xref: /netbsd-src/external/gpl3/gcc.old/dist/gcc/doc/invoke.texi (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
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
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
13Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
141999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
15Free Software Foundation, Inc.
16
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.2 or
19any later version published by the Free Software Foundation; with the
20Invariant Sections being ``GNU General Public License'' and ``Funding
21Free Software'', the Front-Cover texts being (a) (see below), and with
22the Back-Cover Texts being (b) (see below).  A copy of the license is
23included 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
39gcc [@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
47Only the most useful options are listed here; see below for the
48remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
49@c man end
50@c man begin SEEALSO
51gpl(7), gfdl(7), fsf-funding(7),
52cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
53and 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
57For instructions on reporting bugs, see
58@w{@value{BUGURL}}.
59@c man end
60@c man begin AUTHOR
61See the Info entry for @command{gcc}, or
62@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
63for 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
74When you invoke GCC, it normally does preprocessing, compilation,
75assembly and linking.  The ``overall options'' allow you to stop this
76process at an intermediate stage.  For example, the @option{-c} option
77says not to run the linker.  Then the output consists of object files
78output by the assembler.
79
80Other options are passed on to one stage of processing.  Some options
81control the preprocessor and others the compiler itself.  Yet other
82options control the assembler and linker; most of these are not
83documented here, since you rarely need to use any of them.
84
85@cindex C compilation options
86Most of the command line options that you can use with GCC are useful
87for C programs; when an option is only useful with another language
88(usually C++), the explanation says so explicitly.  If the description
89for a particular option does not mention a source language, you can use
90that option with all supported languages.
91
92@cindex C++ compilation options
93@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
94options for compiling C++ programs.
95
96@cindex grouping options
97@cindex options, grouping
98The @command{gcc} program accepts options and file names as operands.  Many
99options have multi-letter names; therefore multiple single-letter options
100may @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
105You can mix options and other arguments.  For the most part, the order
106you use doesn't matter.  Order does matter when you use several
107options of the same kind; for example, if you specify @option{-L} more
108than once, the directories are searched in the order specified.  Also,
109the placement of the @option{-l} option is significant.
110
111Many 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
114these have both positive and negative forms; the negative form of
115@option{-ffoo} would be @option{-fno-foo}.  This manual documents
116only 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
158Here is a summary of all the options, grouped by type.  Explanations are
159in 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}  -combine  -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}}
168
169@item C Language Options
170@xref{C Dialect Options,,Options Controlling C Dialect}.
171@gccoptlist{-ansi  -std=@var{standard}  -fgnu89-inline @gol
172-aux-info @var{filename} @gol
173-fno-asm  -fno-builtin  -fno-builtin-@var{function} @gol
174-fhosted  -ffreestanding -fopenmp -fms-extensions @gol
175-trigraphs  -no-integrated-cpp  -traditional  -traditional-cpp @gol
176-fallow-single-precision  -fcond-mismatch -flax-vector-conversions @gol
177-fsigned-bitfields  -fsigned-char @gol
178-funsigned-bitfields  -funsigned-char}
179
180@item C++ Language Options
181@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
182@gccoptlist{-fabi-version=@var{n}  -fno-access-control  -fcheck-new @gol
183-fconserve-space  -ffriend-injection @gol
184-fno-elide-constructors @gol
185-fno-enforce-eh-specs @gol
186-ffor-scope  -fno-for-scope  -fno-gnu-keywords @gol
187-fno-implicit-templates @gol
188-fno-implicit-inline-templates @gol
189-fno-implement-inlines  -fms-extensions @gol
190-fno-nonansi-builtins  -fno-operator-names @gol
191-fno-optional-diags  -fpermissive @gol
192-fno-pretty-templates @gol
193-frepo  -fno-rtti  -fstats  -ftemplate-depth=@var{n} @gol
194-fno-threadsafe-statics -fuse-cxa-atexit  -fno-weak  -nostdinc++ @gol
195-fno-default-inline  -fvisibility-inlines-hidden @gol
196-fvisibility-ms-compat @gol
197-Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
198-Wnon-virtual-dtor  -Wreorder @gol
199-Weffc++  -Wstrict-null-sentinel @gol
200-Wno-non-template-friend  -Wold-style-cast @gol
201-Woverloaded-virtual  -Wno-pmf-conversions @gol
202-Wsign-promo}
203
204@item Objective-C and Objective-C++ Language Options
205@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
206Objective-C and Objective-C++ Dialects}.
207@gccoptlist{-fconstant-string-class=@var{class-name} @gol
208-fgnu-runtime  -fnext-runtime @gol
209-fno-nil-receivers @gol
210-fobjc-call-cxx-cdtors @gol
211-fobjc-direct-dispatch @gol
212-fobjc-exceptions @gol
213-fobjc-gc @gol
214-freplace-objc-classes @gol
215-fzero-link @gol
216-gen-decls @gol
217-Wassign-intercept @gol
218-Wno-protocol  -Wselector @gol
219-Wstrict-selector-match @gol
220-Wundeclared-selector}
221
222@item Language Independent Options
223@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
224@gccoptlist{-fmessage-length=@var{n}  @gol
225-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}  @gol
226-fdiagnostics-show-option}
227
228@item Warning Options
229@xref{Warning Options,,Options to Request or Suppress Warnings}.
230@gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
231-w  -Wextra  -Wall  -Waddress  -Waggregate-return  -Warray-bounds @gol
232-Wno-attributes -Wno-builtin-macro-redefined @gol
233-Wc++-compat -Wc++0x-compat -Wcast-align  -Wcast-qual  @gol
234-Wchar-subscripts -Wclobbered  -Wcomment @gol
235-Wconversion  -Wcoverage-mismatch  -Wno-deprecated  @gol
236-Wno-deprecated-declarations -Wdisabled-optimization  @gol
237-Wno-div-by-zero -Wempty-body  -Wenum-compare -Wno-endif-labels @gol
238-Werror  -Werror=* @gol
239-Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
240-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
241-Wformat-security  -Wformat-y2k @gol
242-Wframe-larger-than=@var{len} -Wjump-misses-init -Wignored-qualifiers @gol
243-Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
244-Winit-self  -Winline @gol
245-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
246-Winvalid-pch -Wlarger-than=@var{len}  -Wunsafe-loop-optimizations @gol
247-Wlogical-op -Wlong-long @gol
248-Wmain  -Wmissing-braces  -Wmissing-field-initializers @gol
249-Wmissing-format-attribute  -Wmissing-include-dirs @gol
250-Wmissing-noreturn  -Wno-mudflap @gol
251-Wno-multichar  -Wnonnull  -Wno-overflow @gol
252-Woverlength-strings  -Wpacked  -Wpacked-bitfield-compat  -Wpadded @gol
253-Wparentheses  -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
254-Wpointer-arith  -Wno-pointer-to-int-cast @gol
255-Wredundant-decls @gol
256-Wreturn-type  -Wsequence-point  -Wshadow @gol
257-Wsign-compare  -Wsign-conversion  -Wstack-protector @gol
258-Wstrict-aliasing -Wstrict-aliasing=n @gol
259-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
260-Wswitch  -Wswitch-default  -Wswitch-enum -Wsync-nand @gol
261-Wsystem-headers  -Wtrigraphs  -Wtype-limits  -Wundef  -Wuninitialized @gol
262-Wunknown-pragmas  -Wno-pragmas @gol
263-Wunsuffixed-float-constants  -Wunused  -Wunused-function @gol
264-Wunused-label  -Wunused-parameter -Wno-unused-result -Wunused-value  -Wunused-variable @gol
265-Wvariadic-macros -Wvla @gol
266-Wvolatile-register-var  -Wwrite-strings}
267
268@item C and Objective-C-only Warning Options
269@gccoptlist{-Wbad-function-cast  -Wmissing-declarations @gol
270-Wmissing-parameter-type  -Wmissing-prototypes  -Wnested-externs @gol
271-Wold-style-declaration  -Wold-style-definition @gol
272-Wstrict-prototypes  -Wtraditional  -Wtraditional-conversion @gol
273-Wdeclaration-after-statement -Wpointer-sign}
274
275@item Debugging Options
276@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
277@gccoptlist{-d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
278-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
279-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
280-fdump-translation-unit@r{[}-@var{n}@r{]} @gol
281-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
282-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
283-fdump-statistics @gol
284-fdump-tree-all @gol
285-fdump-tree-original@r{[}-@var{n}@r{]}  @gol
286-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
287-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
288-fdump-tree-ch @gol
289-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
290-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
291-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
292-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
293-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
294-fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
295-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
296-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
297-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
298-fdump-tree-nrv -fdump-tree-vect @gol
299-fdump-tree-sink @gol
300-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
301-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
302-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
303-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
304-ftree-vectorizer-verbose=@var{n} @gol
305-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
306-fdump-final-insns=@var{file} @gol
307-fcompare-debug@r{[}=@var{opts}@r{]}  -fcompare-debug-second @gol
308-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
309-feliminate-unused-debug-symbols -femit-class-debug-always @gol
310-fenable-icf-debug @gol
311-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
312-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
313-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
314-ftest-coverage  -ftime-report -fvar-tracking @gol
315-fvar-tracking-assignments  -fvar-tracking-assignments-toggle @gol
316-g  -g@var{level}  -gtoggle  -gcoff  -gdwarf-@var{version} @gol
317-ggdb  -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
318-gvms  -gxcoff  -gxcoff+ @gol
319-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
320-fdebug-prefix-map=@var{old}=@var{new} @gol
321-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
322-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
323-p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
324-print-multi-directory  -print-multi-lib  -print-multi-os-directory @gol
325-print-prog-name=@var{program}  -print-search-dirs  -Q @gol
326-print-sysroot -print-sysroot-headers-suffix @gol
327-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
328
329@item Optimization Options
330@xref{Optimize Options,,Options that Control Optimization}.
331@gccoptlist{
332-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
333-falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
334-fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
335-fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
336-fcheck-data-deps -fconserve-stack -fcprop-registers -fcrossjumping @gol
337-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range @gol
338-fdata-sections -fdce -fdce @gol
339-fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse @gol
340-fearly-inlining -fipa-sra -fexpensive-optimizations -ffast-math @gol
341-ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
342-fforward-propagate -ffunction-sections @gol
343-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol
344-fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
345-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
346-finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta @gol
347-fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
348-fipa-type-escape -fira-algorithm=@var{algorithm} @gol
349-fira-region=@var{region} -fira-coalesce @gol
350-fira-loop-pressure -fno-ira-share-save-slots @gol
351-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
352-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
353-floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol
354-floop-parallelize-all -flto -flto-compression-level -flto-report -fltrans @gol
355-fltrans-output-list -fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
356-fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
357-fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
358-fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
359-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
360-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
361-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
362-fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
363-fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays @gol
364-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
365-fprofile-generate=@var{path} @gol
366-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
367-freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
368-freorder-blocks-and-partition -freorder-functions @gol
369-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
370-frounding-math -fsched2-use-superblocks -fsched-pressure @gol
371-fsched-spec-load -fsched-spec-load-dangerous @gol
372-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
373-fsched-group-heuristic -fsched-critical-path-heuristic @gol
374-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
375-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
376-fschedule-insns -fschedule-insns2 -fsection-anchors @gol
377-fselective-scheduling -fselective-scheduling2 @gol
378-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
379-fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
380-fsplit-wide-types -fstack-protector -fstack-protector-all @gol
381-fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
382-ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
383-ftree-copyrename -ftree-dce @gol
384-ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-im @gol
385-ftree-phiprop -ftree-loop-distribution @gol
386-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
387-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
388-ftree-sink -ftree-sra -ftree-switch-conversion @gol
389-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
390-funit-at-a-time -funroll-all-loops -funroll-loops @gol
391-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
392-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
393-fwhole-program -fwhopr -fwpa -fuse-linker-plugin @gol
394--param @var{name}=@var{value}
395-O  -O0  -O1  -O2  -O3  -Os}
396
397@item Preprocessor Options
398@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
399@gccoptlist{-A@var{question}=@var{answer} @gol
400-A-@var{question}@r{[}=@var{answer}@r{]} @gol
401-C  -dD  -dI  -dM  -dN @gol
402-D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
403-idirafter @var{dir} @gol
404-include @var{file}  -imacros @var{file} @gol
405-iprefix @var{file}  -iwithprefix @var{dir} @gol
406-iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
407-cxx-isystem @var{dir} @gol
408-imultilib @var{dir} -isysroot @var{dir} @gol
409-M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  @gol
410-P  -fworking-directory  -remap @gol
411-trigraphs  -undef  -U@var{macro}  -Wp,@var{option} @gol
412-Xpreprocessor @var{option}}
413
414@item Assembler Option
415@xref{Assembler Options,,Passing Options to the Assembler}.
416@gccoptlist{-Wa,@var{option}  -Xassembler @var{option}}
417
418@item Linker Options
419@xref{Link Options,,Options for Linking}.
420@gccoptlist{@var{object-file-name}  -l@var{library} @gol
421-nostartfiles  -nodefaultlibs  -nostdlib -pie -rdynamic @gol
422-s  -static  -static-libgcc  -static-libstdc++ -shared  @gol
423-shared-libgcc  -symbolic @gol
424-T @var{script}  -Wl,@var{option}  -Xlinker @var{option} @gol
425-u @var{symbol}}
426
427@item Directory Options
428@xref{Directory Options,,Options for Directory Search}.
429@gccoptlist{-B@var{prefix}  -I@var{dir}  -iquote@var{dir}
430-iremap@var{src}:@var{dst}  -L@var{dir}
431-specs=@var{file}  -I- --sysroot=@var{dir}}
432
433@item Target Options
434@c I wrote this xref this way to avoid overfull hbox. -- rms
435@xref{Target Options}.
436@gccoptlist{-V @var{version}  -b @var{machine}}
437
438@item Machine Dependent Options
439@xref{Submodel Options,,Hardware Models and Configurations}.
440@c This list is ordered alphanumerically by subsection name.
441@c Try and put the significant identifier (CPU or system) first,
442@c so users have a clue at guessing where the ones they want will be.
443
444@emph{ARC Options}
445@gccoptlist{-EB  -EL @gol
446-mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
447-mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
448
449@emph{ARM Options}
450@gccoptlist{-mapcs-frame  -mno-apcs-frame @gol
451-mabi=@var{name} @gol
452-mapcs-stack-check  -mno-apcs-stack-check @gol
453-mapcs-float  -mno-apcs-float @gol
454-mapcs-reentrant  -mno-apcs-reentrant @gol
455-msched-prolog  -mno-sched-prolog @gol
456-mlittle-endian  -mbig-endian  -mwords-little-endian @gol
457-mfloat-abi=@var{name}  -msoft-float  -mhard-float  -mfpe @gol
458-mfp16-format=@var{name}
459-mthumb-interwork  -mno-thumb-interwork @gol
460-mcpu=@var{name}  -march=@var{name}  -mfpu=@var{name}  @gol
461-mstructure-size-boundary=@var{n} @gol
462-mabort-on-noreturn @gol
463-mlong-calls  -mno-long-calls @gol
464-msingle-pic-base  -mno-single-pic-base @gol
465-mpic-register=@var{reg} @gol
466-mnop-fun-dllimport @gol
467-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
468-mpoke-function-name @gol
469-mthumb  -marm @gol
470-mtpcs-frame  -mtpcs-leaf-frame @gol
471-mcaller-super-interworking  -mcallee-super-interworking @gol
472-mtp=@var{name} @gol
473-mword-relocations @gol
474-mfix-cortex-m3-ldrd}
475
476@emph{AVR Options}
477@gccoptlist{-mmcu=@var{mcu}  -mno-interrupts @gol
478-mcall-prologues  -mtiny-stack  -mint8}
479
480@emph{Blackfin Options}
481@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
482-msim -momit-leaf-frame-pointer  -mno-omit-leaf-frame-pointer @gol
483-mspecld-anomaly  -mno-specld-anomaly  -mcsync-anomaly  -mno-csync-anomaly @gol
484-mlow-64k -mno-low64k  -mstack-check-l1  -mid-shared-library @gol
485-mno-id-shared-library  -mshared-library-id=@var{n} @gol
486-mleaf-id-shared-library  -mno-leaf-id-shared-library @gol
487-msep-data  -mno-sep-data  -mlong-calls  -mno-long-calls @gol
488-mfast-fp -minline-plt -mmulticore  -mcorea  -mcoreb  -msdram @gol
489-micplb}
490
491@emph{CRIS Options}
492@gccoptlist{-mcpu=@var{cpu}  -march=@var{cpu}  -mtune=@var{cpu} @gol
493-mmax-stack-frame=@var{n}  -melinux-stacksize=@var{n} @gol
494-metrax4  -metrax100  -mpdebug  -mcc-init  -mno-side-effects @gol
495-mstack-align  -mdata-align  -mconst-align @gol
496-m32-bit  -m16-bit  -m8-bit  -mno-prologue-epilogue  -mno-gotplt @gol
497-melf  -maout  -melinux  -mlinux  -sim  -sim2 @gol
498-mmul-bug-workaround  -mno-mul-bug-workaround}
499
500@emph{CRX Options}
501@gccoptlist{-mmac -mpush-args}
502
503@emph{Darwin Options}
504@gccoptlist{-all_load  -allowable_client  -arch  -arch_errors_fatal @gol
505-arch_only  -bind_at_load  -bundle  -bundle_loader @gol
506-client_name  -compatibility_version  -current_version @gol
507-dead_strip @gol
508-dependency-file  -dylib_file  -dylinker_install_name @gol
509-dynamic  -dynamiclib  -exported_symbols_list @gol
510-filelist  -flat_namespace  -force_cpusubtype_ALL @gol
511-force_flat_namespace  -headerpad_max_install_names @gol
512-iframework @gol
513-image_base  -init  -install_name  -keep_private_externs @gol
514-multi_module  -multiply_defined  -multiply_defined_unused @gol
515-noall_load   -no_dead_strip_inits_and_terms @gol
516-nofixprebinding -nomultidefs  -noprebind  -noseglinkedit @gol
517-pagezero_size  -prebind  -prebind_all_twolevel_modules @gol
518-private_bundle  -read_only_relocs  -sectalign @gol
519-sectobjectsymbols  -whyload  -seg1addr @gol
520-sectcreate  -sectobjectsymbols  -sectorder @gol
521-segaddr -segs_read_only_addr -segs_read_write_addr @gol
522-seg_addr_table  -seg_addr_table_filename  -seglinkedit @gol
523-segprot  -segs_read_only_addr  -segs_read_write_addr @gol
524-single_module  -static  -sub_library  -sub_umbrella @gol
525-twolevel_namespace  -umbrella  -undefined @gol
526-unexported_symbols_list  -weak_reference_mismatches @gol
527-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
528-mkernel -mone-byte-bool}
529
530@emph{DEC Alpha Options}
531@gccoptlist{-mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
532-mieee  -mieee-with-inexact  -mieee-conformant @gol
533-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
534-mtrap-precision=@var{mode}  -mbuild-constants @gol
535-mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
536-mbwx  -mmax  -mfix  -mcix @gol
537-mfloat-vax  -mfloat-ieee @gol
538-mexplicit-relocs  -msmall-data  -mlarge-data @gol
539-msmall-text  -mlarge-text @gol
540-mmemory-latency=@var{time}}
541
542@emph{DEC Alpha/VMS Options}
543@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
544
545@emph{FR30 Options}
546@gccoptlist{-msmall-model -mno-lsim}
547
548@emph{FRV Options}
549@gccoptlist{-mgpr-32  -mgpr-64  -mfpr-32  -mfpr-64 @gol
550-mhard-float  -msoft-float @gol
551-malloc-cc  -mfixed-cc  -mdword  -mno-dword @gol
552-mdouble  -mno-double @gol
553-mmedia  -mno-media  -mmuladd  -mno-muladd @gol
554-mfdpic  -minline-plt -mgprel-ro  -multilib-library-pic @gol
555-mlinked-fp  -mlong-calls  -malign-labels @gol
556-mlibrary-pic  -macc-4  -macc-8 @gol
557-mpack  -mno-pack  -mno-eflags  -mcond-move  -mno-cond-move @gol
558-moptimize-membar -mno-optimize-membar @gol
559-mscc  -mno-scc  -mcond-exec  -mno-cond-exec @gol
560-mvliw-branch  -mno-vliw-branch @gol
561-mmulti-cond-exec  -mno-multi-cond-exec  -mnested-cond-exec @gol
562-mno-nested-cond-exec  -mtomcat-stats @gol
563-mTLS -mtls @gol
564-mcpu=@var{cpu}}
565
566@emph{GNU/Linux Options}
567@gccoptlist{-muclibc}
568
569@emph{H8/300 Options}
570@gccoptlist{-mrelax  -mh  -ms  -mn  -mint32  -malign-300}
571
572@emph{HPPA Options}
573@gccoptlist{-march=@var{architecture-type} @gol
574-mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
575-mfast-indirect-calls  -mgas  -mgnu-ld   -mhp-ld @gol
576-mfixed-range=@var{register-range} @gol
577-mjump-in-delay -mlinker-opt -mlong-calls @gol
578-mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
579-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
580-mno-jump-in-delay  -mno-long-load-store @gol
581-mno-portable-runtime  -mno-soft-float @gol
582-mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
583-mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
584-mschedule=@var{cpu-type}  -mspace-regs  -msio  -mwsio @gol
585-munix=@var{unix-std}  -nolibdld  -static  -threads}
586
587@emph{i386 and x86-64 Options}
588@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
589-mfpmath=@var{unit} @gol
590-masm=@var{dialect}  -mno-fancy-math-387 @gol
591-mno-fp-ret-in-387  -msoft-float @gol
592-mno-wide-multiply  -mrtd  -malign-double @gol
593-mpreferred-stack-boundary=@var{num}
594-mincoming-stack-boundary=@var{num}
595-mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip @gol
596-mmmx  -msse  -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
597-maes -mpclmul -mfused-madd @gol
598-msse4a -m3dnow -mpopcnt -mabm -mfma4 -mxop -mlwp @gol
599-mthreads  -mno-align-stringops  -minline-all-stringops @gol
600-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
601-mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
602-m96bit-long-double  -mregparm=@var{num}  -msseregparm @gol
603-mveclibabi=@var{type} -mpc32 -mpc64 -mpc80 -mstackrealign @gol
604-momit-leaf-frame-pointer  -mno-red-zone -mno-tls-direct-seg-refs @gol
605-mcmodel=@var{code-model} -mabi=@var{name} @gol
606-m32  -m64 -mlarge-data-threshold=@var{num} @gol
607-msse2avx}
608
609@emph{i386 and x86-64 Windows Options}
610@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
611-mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
612-fno-set-stack-executable}
613
614@emph{IA-64 Options}
615@gccoptlist{-mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
616-mvolatile-asm-stop  -mregister-names  -msdata -mno-sdata @gol
617-mconstant-gp  -mauto-pic  -mfused-madd @gol
618-minline-float-divide-min-latency @gol
619-minline-float-divide-max-throughput @gol
620-mno-inline-float-divide @gol
621-minline-int-divide-min-latency @gol
622-minline-int-divide-max-throughput  @gol
623-mno-inline-int-divide @gol
624-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
625-mno-inline-sqrt @gol
626-mdwarf2-asm -mearly-stop-bits @gol
627-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
628-mtune=@var{cpu-type} -milp32 -mlp64 @gol
629-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
630-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
631-msched-spec-ldc -msched-spec-control-ldc @gol
632-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
633-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
634-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
635-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
636
637@emph{IA-64/VMS Options}
638@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
639
640@emph{LM32 Options}
641@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
642-msign-extend-enabled -muser-enabled}
643
644@emph{M32R/D Options}
645@gccoptlist{-m32r2 -m32rx -m32r @gol
646-mdebug @gol
647-malign-loops -mno-align-loops @gol
648-missue-rate=@var{number} @gol
649-mbranch-cost=@var{number} @gol
650-mmodel=@var{code-size-model-type} @gol
651-msdata=@var{sdata-type} @gol
652-mno-flush-func -mflush-func=@var{name} @gol
653-mno-flush-trap -mflush-trap=@var{number} @gol
654-G @var{num}}
655
656@emph{M32C Options}
657@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
658
659@emph{M680x0 Options}
660@gccoptlist{-march=@var{arch}  -mcpu=@var{cpu}  -mtune=@var{tune}
661-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
662-m68060  -mcpu32  -m5200  -m5206e  -m528x  -m5307  -m5407 @gol
663-mcfv4e  -mbitfield  -mno-bitfield  -mc68000  -mc68020 @gol
664-mnobitfield  -mrtd  -mno-rtd  -mdiv  -mno-div  -mshort @gol
665-mno-short  -mhard-float  -m68881  -msoft-float  -mpcrel @gol
666-malign-int  -mstrict-align  -msep-data  -mno-sep-data @gol
667-mshared-library-id=n  -mid-shared-library  -mno-id-shared-library @gol
668-mxgot -mno-xgot}
669
670@emph{M68hc1x Options}
671@gccoptlist{-m6811  -m6812  -m68hc11  -m68hc12   -m68hcs12 @gol
672-mauto-incdec  -minmax  -mlong-calls  -mshort @gol
673-msoft-reg-count=@var{count}}
674
675@emph{MCore Options}
676@gccoptlist{-mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
677-mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
678-m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
679-mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
680-mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
681
682@emph{MeP Options}
683@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
684-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
685-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
686-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
687-mtiny=@var{n}}
688
689@emph{MIPS Options}
690@gccoptlist{-EL  -EB  -march=@var{arch}  -mtune=@var{arch} @gol
691-mips1  -mips2  -mips3  -mips4  -mips32  -mips32r2 @gol
692-mips64  -mips64r2 @gol
693-mips16  -mno-mips16  -mflip-mips16 @gol
694-minterlink-mips16  -mno-interlink-mips16 @gol
695-mabi=@var{abi}  -mabicalls  -mno-abicalls @gol
696-mshared  -mno-shared  -mplt  -mno-plt  -mxgot  -mno-xgot @gol
697-mgp32  -mgp64  -mfp32  -mfp64  -mhard-float  -msoft-float @gol
698-msingle-float  -mdouble-float  -mdsp  -mno-dsp  -mdspr2  -mno-dspr2 @gol
699-mfpu=@var{fpu-type} @gol
700-msmartmips  -mno-smartmips @gol
701-mpaired-single  -mno-paired-single  -mdmx  -mno-mdmx @gol
702-mips3d  -mno-mips3d  -mmt  -mno-mt  -mllsc  -mno-llsc @gol
703-mlong64  -mlong32  -msym32  -mno-sym32 @gol
704-G@var{num}  -mlocal-sdata  -mno-local-sdata @gol
705-mextern-sdata  -mno-extern-sdata  -mgpopt  -mno-gopt @gol
706-membedded-data  -mno-embedded-data @gol
707-muninit-const-in-rodata  -mno-uninit-const-in-rodata @gol
708-mcode-readable=@var{setting} @gol
709-msplit-addresses  -mno-split-addresses @gol
710-mexplicit-relocs  -mno-explicit-relocs @gol
711-mcheck-zero-division  -mno-check-zero-division @gol
712-mdivide-traps  -mdivide-breaks @gol
713-mmemcpy  -mno-memcpy  -mlong-calls  -mno-long-calls @gol
714-mmad  -mno-mad  -mfused-madd  -mno-fused-madd  -nocpp @gol
715-mfix-r4000  -mno-fix-r4000  -mfix-r4400  -mno-fix-r4400 @gol
716-mfix-r10000 -mno-fix-r10000  -mfix-vr4120  -mno-fix-vr4120 @gol
717-mfix-vr4130  -mno-fix-vr4130  -mfix-sb1  -mno-fix-sb1 @gol
718-mflush-func=@var{func}  -mno-flush-func @gol
719-mbranch-cost=@var{num}  -mbranch-likely  -mno-branch-likely @gol
720-mfp-exceptions -mno-fp-exceptions @gol
721-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
722-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
723
724@emph{MMIX Options}
725@gccoptlist{-mlibfuncs  -mno-libfuncs  -mepsilon  -mno-epsilon  -mabi=gnu @gol
726-mabi=mmixware  -mzero-extend  -mknuthdiv  -mtoplevel-symbols @gol
727-melf  -mbranch-predict  -mno-branch-predict  -mbase-addresses @gol
728-mno-base-addresses  -msingle-exit  -mno-single-exit}
729
730@emph{MN10300 Options}
731@gccoptlist{-mmult-bug  -mno-mult-bug @gol
732-mam33  -mno-am33 @gol
733-mam33-2  -mno-am33-2 @gol
734-mreturn-pointer-on-d0 @gol
735-mno-crt0  -mrelax}
736
737@emph{PDP-11 Options}
738@gccoptlist{-mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
739-mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
740-mint16  -mno-int32  -mfloat32  -mno-float64 @gol
741-mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
742-mbranch-expensive  -mbranch-cheap @gol
743-msplit  -mno-split  -munix-asm  -mdec-asm}
744
745@emph{picoChip Options}
746@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N}
747-msymbol-as-address -mno-inefficient-warnings}
748
749@emph{PowerPC Options}
750See RS/6000 and PowerPC Options.
751
752@emph{RS/6000 and PowerPC Options}
753@gccoptlist{-mcpu=@var{cpu-type} @gol
754-mtune=@var{cpu-type} @gol
755-mpower  -mno-power  -mpower2  -mno-power2 @gol
756-mpowerpc  -mpowerpc64  -mno-powerpc @gol
757-maltivec  -mno-altivec @gol
758-mpowerpc-gpopt  -mno-powerpc-gpopt @gol
759-mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
760-mmfcrf  -mno-mfcrf  -mpopcntb  -mno-popcntb -mpopcntd -mno-popcntd @gol
761-mfprnd  -mno-fprnd @gol
762-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
763-mnew-mnemonics  -mold-mnemonics @gol
764-mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
765-m64  -m32  -mxl-compat  -mno-xl-compat  -mpe @gol
766-malign-power  -malign-natural @gol
767-msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
768-msingle-float -mdouble-float -msimple-fpu @gol
769-mstring  -mno-string  -mupdate  -mno-update @gol
770-mavoid-indexed-addresses  -mno-avoid-indexed-addresses @gol
771-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
772-mstrict-align  -mno-strict-align  -mrelocatable @gol
773-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
774-mtoc  -mno-toc  -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
775-mdynamic-no-pic  -maltivec -mswdiv @gol
776-mprioritize-restricted-insns=@var{priority} @gol
777-msched-costly-dep=@var{dependence_type} @gol
778-minsert-sched-nops=@var{scheme} @gol
779-mcall-sysv  -mcall-netbsd @gol
780-maix-struct-return  -msvr4-struct-return @gol
781-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
782-misel -mno-isel @gol
783-misel=yes  -misel=no @gol
784-mspe -mno-spe @gol
785-mspe=yes  -mspe=no @gol
786-mpaired @gol
787-mgen-cell-microcode -mwarn-cell-microcode @gol
788-mvrsave -mno-vrsave @gol
789-mmulhw -mno-mulhw @gol
790-mdlmzb -mno-dlmzb @gol
791-mfloat-gprs=yes  -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
792-mprototype  -mno-prototype @gol
793-msim  -mmvme  -mads  -myellowknife  -memb  -msdata @gol
794-msdata=@var{opt}  -mvxworks  -G @var{num}  -pthread}
795
796@emph{RX Options}
797@gccoptlist{-m64bit-doubles  -m32bit-doubles  -fpu  -nofpu@gol
798-mcpu= -patch=@gol
799-mbig-endian-data -mlittle-endian-data @gol
800-msmall-data @gol
801-msim  -mno-sim@gol
802-mas100-syntax -mno-as100-syntax@gol
803-mrelax@gol
804-mmax-constant-size=@gol
805-mint-register=@gol
806-msave-acc-in-interrupts}
807
808@emph{S/390 and zSeries Options}
809@gccoptlist{-mtune=@var{cpu-type}  -march=@var{cpu-type} @gol
810-mhard-float  -msoft-float  -mhard-dfp -mno-hard-dfp @gol
811-mlong-double-64 -mlong-double-128 @gol
812-mbackchain  -mno-backchain -mpacked-stack  -mno-packed-stack @gol
813-msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
814-m64  -m31  -mdebug  -mno-debug  -mesa  -mzarch @gol
815-mtpf-trace -mno-tpf-trace  -mfused-madd  -mno-fused-madd @gol
816-mwarn-framesize  -mwarn-dynamicstack  -mstack-size -mstack-guard}
817
818@emph{Score Options}
819@gccoptlist{-meb -mel @gol
820-mnhwloop @gol
821-muls @gol
822-mmac @gol
823-mscore5 -mscore5u -mscore7 -mscore7d}
824
825@emph{SH Options}
826@gccoptlist{-m1  -m2  -m2e @gol
827-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
828-m3  -m3e @gol
829-m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
830-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
831-m5-64media  -m5-64media-nofpu @gol
832-m5-32media  -m5-32media-nofpu @gol
833-m5-compact  -m5-compact-nofpu @gol
834-mb  -ml  -mdalign  -mrelax @gol
835-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
836-mieee  -mbitops  -misize  -minline-ic_invalidate -mpadstruct  -mspace @gol
837-mprefergot  -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
838-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
839-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
840-minvalid-symbols}
841
842@emph{SPARC Options}
843@gccoptlist{-mcpu=@var{cpu-type} @gol
844-mtune=@var{cpu-type} @gol
845-mcmodel=@var{code-model} @gol
846-m32  -m64  -mapp-regs  -mno-app-regs @gol
847-mfaster-structs  -mno-faster-structs @gol
848-mfpu  -mno-fpu  -mhard-float  -msoft-float @gol
849-mhard-quad-float  -msoft-quad-float @gol
850-mimpure-text  -mno-impure-text  -mlittle-endian @gol
851-mstack-bias  -mno-stack-bias @gol
852-munaligned-doubles  -mno-unaligned-doubles @gol
853-mv8plus  -mno-v8plus  -mvis  -mno-vis
854-threads -pthreads -pthread}
855
856@emph{SPU Options}
857@gccoptlist{-mwarn-reloc -merror-reloc @gol
858-msafe-dma -munsafe-dma @gol
859-mbranch-hints @gol
860-msmall-mem -mlarge-mem -mstdmain @gol
861-mfixed-range=@var{register-range} @gol
862-mea32 -mea64 @gol
863-maddress-space-conversion -mno-address-space-conversion @gol
864-mcache-size=@var{cache-size} @gol
865-matomic-updates -mno-atomic-updates}
866
867@emph{System V Options}
868@gccoptlist{-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
869
870@emph{V850 Options}
871@gccoptlist{-mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
872-mprolog-function  -mno-prolog-function  -mspace @gol
873-mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
874-mapp-regs  -mno-app-regs @gol
875-mdisable-callt  -mno-disable-callt @gol
876-mv850e1 @gol
877-mv850e @gol
878-mv850  -mbig-switch}
879
880@emph{VAX Options}
881@gccoptlist{-mg  -mgnu  -munix}
882
883@emph{VxWorks Options}
884@gccoptlist{-mrtp  -non-static  -Bstatic  -Bdynamic @gol
885-Xbind-lazy  -Xbind-now}
886
887@emph{x86-64 Options}
888See i386 and x86-64 Options.
889
890@emph{Xstormy16 Options}
891@gccoptlist{-msim}
892
893@emph{Xtensa Options}
894@gccoptlist{-mconst16 -mno-const16 @gol
895-mfused-madd  -mno-fused-madd @gol
896-mserialize-volatile  -mno-serialize-volatile @gol
897-mtext-section-literals  -mno-text-section-literals @gol
898-mtarget-align  -mno-target-align @gol
899-mlongcalls  -mno-longcalls}
900
901@emph{zSeries Options}
902See S/390 and zSeries Options.
903
904@item Code Generation Options
905@xref{Code Gen Options,,Options for Code Generation Conventions}.
906@gccoptlist{-fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
907-ffixed-@var{reg}  -fexceptions @gol
908-fnon-call-exceptions  -funwind-tables @gol
909-fasynchronous-unwind-tables @gol
910-finhibit-size-directive  -finstrument-functions @gol
911-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
912-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
913-fno-common  -fno-ident @gol
914-fpcc-struct-return  -fpic  -fPIC -fpie -fPIE @gol
915-fno-jump-tables @gol
916-frecord-gcc-switches @gol
917-freg-struct-return  -fshort-enums @gol
918-fshort-double  -fshort-wchar @gol
919-fverbose-asm  -fpack-struct[=@var{n}]  -fstack-check @gol
920-fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
921-fno-stack-limit  -fargument-alias  -fargument-noalias @gol
922-fargument-noalias-global  -fargument-noalias-anything @gol
923-fleading-underscore  -ftls-model=@var{model} @gol
924-ftrapv  -fwrapv  -fbounds-check @gol
925-fvisibility}
926@end table
927
928@menu
929* Overall Options::     Controlling the kind of output:
930                        an executable, object files, assembler files,
931                        or preprocessed source.
932* C Dialect Options::   Controlling the variant of C language compiled.
933* C++ Dialect Options:: Variations on C++.
934* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
935                        and Objective-C++.
936* Language Independent Options:: Controlling how diagnostics should be
937                        formatted.
938* Warning Options::     How picky should the compiler be?
939* Debugging Options::   Symbol tables, measurements, and debugging dumps.
940* Optimize Options::    How much optimization?
941* Preprocessor Options:: Controlling header files and macro definitions.
942                         Also, getting dependency information for Make.
943* Assembler Options::   Passing options to the assembler.
944* Link Options::        Specifying libraries and so on.
945* Directory Options::   Where to find header files and libraries.
946                        Where to find the compiler executable files.
947* Spec Files::          How to pass switches to sub-processes.
948* Target Options::      Running a cross-compiler, or an old version of GCC.
949@end menu
950
951@node Overall Options
952@section Options Controlling the Kind of Output
953
954Compilation can involve up to four stages: preprocessing, compilation
955proper, assembly and linking, always in that order.  GCC is capable of
956preprocessing and compiling several files either into several
957assembler input files, or into one assembler input file; then each
958assembler input file produces an object file, and linking combines all
959the object files (those newly compiled, and those specified as input)
960into an executable file.
961
962@cindex file name suffix
963For any given input file, the file name suffix determines what kind of
964compilation is done:
965
966@table @gcctabopt
967@item @var{file}.c
968C source code which must be preprocessed.
969
970@item @var{file}.i
971C source code which should not be preprocessed.
972
973@item @var{file}.ii
974C++ source code which should not be preprocessed.
975
976@item @var{file}.m
977Objective-C source code.  Note that you must link with the @file{libobjc}
978library to make an Objective-C program work.
979
980@item @var{file}.mi
981Objective-C source code which should not be preprocessed.
982
983@item @var{file}.mm
984@itemx @var{file}.M
985Objective-C++ source code.  Note that you must link with the @file{libobjc}
986library to make an Objective-C++ program work.  Note that @samp{.M} refers
987to a literal capital M@.
988
989@item @var{file}.mii
990Objective-C++ source code which should not be preprocessed.
991
992@item @var{file}.h
993C, C++, Objective-C or Objective-C++ header file to be turned into a
994precompiled header.
995
996@item @var{file}.cc
997@itemx @var{file}.cp
998@itemx @var{file}.cxx
999@itemx @var{file}.cpp
1000@itemx @var{file}.CPP
1001@itemx @var{file}.c++
1002@itemx @var{file}.C
1003C++ source code which must be preprocessed.  Note that in @samp{.cxx},
1004the last two letters must both be literally @samp{x}.  Likewise,
1005@samp{.C} refers to a literal capital C@.
1006
1007@item @var{file}.mm
1008@itemx @var{file}.M
1009Objective-C++ source code which must be preprocessed.
1010
1011@item @var{file}.mii
1012Objective-C++ source code which should not be preprocessed.
1013
1014@item @var{file}.hh
1015@itemx @var{file}.H
1016@itemx @var{file}.hp
1017@itemx @var{file}.hxx
1018@itemx @var{file}.hpp
1019@itemx @var{file}.HPP
1020@itemx @var{file}.h++
1021@itemx @var{file}.tcc
1022C++ header file to be turned into a precompiled header.
1023
1024@item @var{file}.f
1025@itemx @var{file}.for
1026@itemx @var{file}.ftn
1027Fixed form Fortran source code which should not be preprocessed.
1028
1029@item @var{file}.F
1030@itemx @var{file}.FOR
1031@itemx @var{file}.fpp
1032@itemx @var{file}.FPP
1033@itemx @var{file}.FTN
1034Fixed form Fortran source code which must be preprocessed (with the traditional
1035preprocessor).
1036
1037@item @var{file}.f90
1038@itemx @var{file}.f95
1039@itemx @var{file}.f03
1040@itemx @var{file}.f08
1041Free form Fortran source code which should not be preprocessed.
1042
1043@item @var{file}.F90
1044@itemx @var{file}.F95
1045@itemx @var{file}.F03
1046@itemx @var{file}.F08
1047Free form Fortran source code which must be preprocessed (with the
1048traditional preprocessor).
1049
1050@c FIXME: Descriptions of Java file types.
1051@c @var{file}.java
1052@c @var{file}.class
1053@c @var{file}.zip
1054@c @var{file}.jar
1055
1056@item @var{file}.ads
1057Ada source code file which contains a library unit declaration (a
1058declaration of a package, subprogram, or generic, or a generic
1059instantiation), or a library unit renaming declaration (a package,
1060generic, or subprogram renaming declaration).  Such files are also
1061called @dfn{specs}.
1062
1063@item @var{file}.adb
1064Ada source code file containing a library unit body (a subprogram or
1065package body).  Such files are also called @dfn{bodies}.
1066
1067@c GCC also knows about some suffixes for languages not yet included:
1068@c Pascal:
1069@c @var{file}.p
1070@c @var{file}.pas
1071@c Ratfor:
1072@c @var{file}.r
1073
1074@item @var{file}.s
1075Assembler code.
1076
1077@item @var{file}.S
1078@itemx @var{file}.sx
1079Assembler code which must be preprocessed.
1080
1081@item @var{other}
1082An object file to be fed straight into linking.
1083Any file name with no recognized suffix is treated this way.
1084@end table
1085
1086@opindex x
1087You can specify the input language explicitly with the @option{-x} option:
1088
1089@table @gcctabopt
1090@item -x @var{language}
1091Specify explicitly the @var{language} for the following input files
1092(rather than letting the compiler choose a default based on the file
1093name suffix).  This option applies to all following input files until
1094the next @option{-x} option.  Possible values for @var{language} are:
1095@smallexample
1096c  c-header  c-cpp-output
1097c++  c++-header  c++-cpp-output
1098objective-c  objective-c-header  objective-c-cpp-output
1099objective-c++ objective-c++-header objective-c++-cpp-output
1100assembler  assembler-with-cpp
1101ada
1102f77  f77-cpp-input f95  f95-cpp-input
1103java
1104@end smallexample
1105
1106@item -x none
1107Turn off any specification of a language, so that subsequent files are
1108handled according to their file name suffixes (as they are if @option{-x}
1109has not been used at all).
1110
1111@item -pass-exit-codes
1112@opindex pass-exit-codes
1113Normally the @command{gcc} program will exit with the code of 1 if any
1114phase of the compiler returns a non-success return code.  If you specify
1115@option{-pass-exit-codes}, the @command{gcc} program will instead return with
1116numerically highest error produced by any phase that returned an error
1117indication.  The C, C++, and Fortran frontends return 4, if an internal
1118compiler error is encountered.
1119@end table
1120
1121If you only want some of the stages of compilation, you can use
1122@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1123one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1124@command{gcc} is to stop.  Note that some combinations (for example,
1125@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1126
1127@table @gcctabopt
1128@item -c
1129@opindex c
1130Compile or assemble the source files, but do not link.  The linking
1131stage simply is not done.  The ultimate output is in the form of an
1132object file for each source file.
1133
1134By default, the object file name for a source file is made by replacing
1135the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1136
1137Unrecognized input files, not requiring compilation or assembly, are
1138ignored.
1139
1140@item -S
1141@opindex S
1142Stop after the stage of compilation proper; do not assemble.  The output
1143is in the form of an assembler code file for each non-assembler input
1144file specified.
1145
1146By default, the assembler file name for a source file is made by
1147replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1148
1149Input files that don't require compilation are ignored.
1150
1151@item -E
1152@opindex E
1153Stop after the preprocessing stage; do not run the compiler proper.  The
1154output is in the form of preprocessed source code, which is sent to the
1155standard output.
1156
1157Input files which don't require preprocessing are ignored.
1158
1159@cindex output file option
1160@item -o @var{file}
1161@opindex o
1162Place output in file @var{file}.  This applies regardless to whatever
1163sort of output is being produced, whether it be an executable file,
1164an object file, an assembler file or preprocessed C code.
1165
1166If @option{-o} is not specified, the default is to put an executable
1167file in @file{a.out}, the object file for
1168@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1169assembler file in @file{@var{source}.s}, a precompiled header file in
1170@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1171standard output.
1172
1173@item -v
1174@opindex v
1175Print (on standard error output) the commands executed to run the stages
1176of compilation.  Also print the version number of the compiler driver
1177program and of the preprocessor and the compiler proper.
1178
1179@item -###
1180@opindex ###
1181Like @option{-v} except the commands are not executed and all command
1182arguments are quoted.  This is useful for shell scripts to capture the
1183driver-generated command lines.
1184
1185@item -pipe
1186@opindex pipe
1187Use pipes rather than temporary files for communication between the
1188various stages of compilation.  This fails to work on some systems where
1189the assembler is unable to read from a pipe; but the GNU assembler has
1190no trouble.
1191
1192@item -combine
1193@opindex combine
1194If you are compiling multiple source files, this option tells the driver
1195to pass all the source files to the compiler at once (for those
1196languages for which the compiler can handle this).  This will allow
1197intermodule analysis (IMA) to be performed by the compiler.  Currently the only
1198language for which this is supported is C@.  If you pass source files for
1199multiple languages to the driver, using this option, the driver will invoke
1200the compiler(s) that support IMA once each, passing each compiler all the
1201source files appropriate for it.  For those languages that do not support
1202IMA this option will be ignored, and the compiler will be invoked once for
1203each source file in that language.  If you use this option in conjunction
1204with @option{-save-temps}, the compiler will generate multiple
1205pre-processed files
1206(one for each source file), but only one (combined) @file{.o} or
1207@file{.s} file.
1208
1209@item --help
1210@opindex help
1211Print (on the standard output) a description of the command line options
1212understood by @command{gcc}.  If the @option{-v} option is also specified
1213then @option{--help} will also be passed on to the various processes
1214invoked by @command{gcc}, so that they can display the command line options
1215they accept.  If the @option{-Wextra} option has also been specified
1216(prior to the @option{--help} option), then command line options which
1217have no documentation associated with them will also be displayed.
1218
1219@item --target-help
1220@opindex target-help
1221Print (on the standard output) a description of target-specific command
1222line options for each tool.  For some targets extra target-specific
1223information may also be printed.
1224
1225@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1226Print (on the standard output) a description of the command line
1227options understood by the compiler that fit into all specified classes
1228and qualifiers.  These are the supported classes:
1229
1230@table @asis
1231@item @samp{optimizers}
1232This will display all of the optimization options supported by the
1233compiler.
1234
1235@item @samp{warnings}
1236This will display all of the options controlling warning messages
1237produced by the compiler.
1238
1239@item @samp{target}
1240This will display target-specific options.  Unlike the
1241@option{--target-help} option however, target-specific options of the
1242linker and assembler will not be displayed.  This is because those
1243tools do not currently support the extended @option{--help=} syntax.
1244
1245@item @samp{params}
1246This will display the values recognized by the @option{--param}
1247option.
1248
1249@item @var{language}
1250This will display the options supported for @var{language}, where
1251@var{language} is the name of one of the languages supported in this
1252version of GCC.
1253
1254@item @samp{common}
1255This will display the options that are common to all languages.
1256@end table
1257
1258These are the supported qualifiers:
1259
1260@table @asis
1261@item @samp{undocumented}
1262Display only those options which are undocumented.
1263
1264@item @samp{joined}
1265Display options which take an argument that appears after an equal
1266sign in the same continuous piece of text, such as:
1267@samp{--help=target}.
1268
1269@item @samp{separate}
1270Display options which take an argument that appears as a separate word
1271following the original option, such as: @samp{-o output-file}.
1272@end table
1273
1274Thus for example to display all the undocumented target-specific
1275switches supported by the compiler the following can be used:
1276
1277@smallexample
1278--help=target,undocumented
1279@end smallexample
1280
1281The sense of a qualifier can be inverted by prefixing it with the
1282@samp{^} character, so for example to display all binary warning
1283options (i.e., ones that are either on or off and that do not take an
1284argument), which have a description the following can be used:
1285
1286@smallexample
1287--help=warnings,^joined,^undocumented
1288@end smallexample
1289
1290The argument to @option{--help=} should not consist solely of inverted
1291qualifiers.
1292
1293Combining several classes is possible, although this usually
1294restricts the output by so much that there is nothing to display.  One
1295case where it does work however is when one of the classes is
1296@var{target}.  So for example to display all the target-specific
1297optimization options the following can be used:
1298
1299@smallexample
1300--help=target,optimizers
1301@end smallexample
1302
1303The @option{--help=} option can be repeated on the command line.  Each
1304successive use will display its requested class of options, skipping
1305those that have already been displayed.
1306
1307If the @option{-Q} option appears on the command line before the
1308@option{--help=} option, then the descriptive text displayed by
1309@option{--help=} is changed.  Instead of describing the displayed
1310options, an indication is given as to whether the option is enabled,
1311disabled or set to a specific value (assuming that the compiler
1312knows this at the point where the @option{--help=} option is used).
1313
1314Here is a truncated example from the ARM port of @command{gcc}:
1315
1316@smallexample
1317  % gcc -Q -mabi=2 --help=target -c
1318  The following options are target specific:
1319  -mabi=                                2
1320  -mabort-on-noreturn                   [disabled]
1321  -mapcs                                [disabled]
1322@end smallexample
1323
1324The output is sensitive to the effects of previous command line
1325options, so for example it is possible to find out which optimizations
1326are enabled at @option{-O2} by using:
1327
1328@smallexample
1329-Q -O2 --help=optimizers
1330@end smallexample
1331
1332Alternatively you can discover which binary optimizations are enabled
1333by @option{-O3} by using:
1334
1335@smallexample
1336gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1337gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1338diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1339@end smallexample
1340
1341@item -no-canonical-prefixes
1342@opindex no-canonical-prefixes
1343Do not expand any symbolic links, resolve references to @samp{/../}
1344or @samp{/./}, or make the path absolute when generating a relative
1345prefix.
1346
1347@item --version
1348@opindex version
1349Display the version number and copyrights of the invoked GCC@.
1350
1351@item -wrapper
1352@opindex wrapper
1353Invoke all subcommands under a wrapper program. It takes a single
1354comma separated list as an argument, which will be used to invoke
1355the wrapper:
1356
1357@smallexample
1358gcc -c t.c -wrapper gdb,--args
1359@end smallexample
1360
1361This will invoke all subprograms of gcc under "gdb --args",
1362thus cc1 invocation will be "gdb --args cc1 ...".
1363
1364@item -fplugin=@var{name}.so
1365Load the plugin code in file @var{name}.so, assumed to be a
1366shared object to be dlopen'd by the compiler.  The base name of
1367the shared object file is used to identify the plugin for the
1368purposes of argument parsing (See
1369@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1370Each plugin should define the callback functions specified in the
1371Plugins API.
1372
1373@item -fplugin-arg-@var{name}-@var{key}=@var{value}
1374Define an argument called @var{key} with a value of @var{value}
1375for the plugin called @var{name}.
1376
1377@include @value{srcdir}/../libiberty/at-file.texi
1378@end table
1379
1380@node Invoking G++
1381@section Compiling C++ Programs
1382
1383@cindex suffixes for C++ source
1384@cindex C++ source file suffixes
1385C++ source files conventionally use one of the suffixes @samp{.C},
1386@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1387@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1388@samp{.H}, or (for shared template code) @samp{.tcc}; and
1389preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
1390files with these names and compiles them as C++ programs even if you
1391call the compiler the same way as for compiling C programs (usually
1392with the name @command{gcc}).
1393
1394@findex g++
1395@findex c++
1396However, the use of @command{gcc} does not add the C++ library.
1397@command{g++} is a program that calls GCC and treats @samp{.c},
1398@samp{.h} and @samp{.i} files as C++ source files instead of C source
1399files unless @option{-x} is used, and automatically specifies linking
1400against the C++ library.  This program is also useful when
1401precompiling a C header file with a @samp{.h} extension for use in C++
1402compilations.  On many systems, @command{g++} is also installed with
1403the name @command{c++}.
1404
1405@cindex invoking @command{g++}
1406When you compile C++ programs, you may specify many of the same
1407command-line options that you use for compiling programs in any
1408language; or command-line options meaningful for C and related
1409languages; or options that are meaningful only for C++ programs.
1410@xref{C Dialect Options,,Options Controlling C Dialect}, for
1411explanations of options for languages related to C@.
1412@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1413explanations of options that are meaningful only for C++ programs.
1414
1415@node C Dialect Options
1416@section Options Controlling C Dialect
1417@cindex dialect options
1418@cindex language dialect options
1419@cindex options, dialect
1420
1421The following options control the dialect of C (or languages derived
1422from C, such as C++, Objective-C and Objective-C++) that the compiler
1423accepts:
1424
1425@table @gcctabopt
1426@cindex ANSI support
1427@cindex ISO support
1428@item -ansi
1429@opindex ansi
1430In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
1431equivalent to @samp{-std=c++98}.
1432
1433This turns off certain features of GCC that are incompatible with ISO
1434C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1435such as the @code{asm} and @code{typeof} keywords, and
1436predefined macros such as @code{unix} and @code{vax} that identify the
1437type of system you are using.  It also enables the undesirable and
1438rarely used ISO trigraph feature.  For the C compiler,
1439it disables recognition of C++ style @samp{//} comments as well as
1440the @code{inline} keyword.
1441
1442The alternate keywords @code{__asm__}, @code{__extension__},
1443@code{__inline__} and @code{__typeof__} continue to work despite
1444@option{-ansi}.  You would not want to use them in an ISO C program, of
1445course, but it is useful to put them in header files that might be included
1446in compilations done with @option{-ansi}.  Alternate predefined macros
1447such as @code{__unix__} and @code{__vax__} are also available, with or
1448without @option{-ansi}.
1449
1450The @option{-ansi} option does not cause non-ISO programs to be
1451rejected gratuitously.  For that, @option{-pedantic} is required in
1452addition to @option{-ansi}.  @xref{Warning Options}.
1453
1454The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1455option is used.  Some header files may notice this macro and refrain
1456from declaring certain functions or defining certain macros that the
1457ISO standard doesn't call for; this is to avoid interfering with any
1458programs that might use these names for other things.
1459
1460Functions that would normally be built in but do not have semantics
1461defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1462functions when @option{-ansi} is used.  @xref{Other Builtins,,Other
1463built-in functions provided by GCC}, for details of the functions
1464affected.
1465
1466@item -std=
1467@opindex std
1468Determine the language standard. @xref{Standards,,Language Standards
1469Supported by GCC}, for details of these standard versions.  This option
1470is currently only supported when compiling C or C++.
1471
1472The compiler can accept several base standards, such as @samp{c90} or
1473@samp{c++98}, and GNU dialects of those standards, such as
1474@samp{gnu90} or @samp{gnu++98}.  By specifying a base standard, the
1475compiler will accept all programs following that standard and those
1476using GNU extensions that do not contradict it.  For example,
1477@samp{-std=c90} turns off certain features of GCC that are
1478incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1479keywords, but not other GNU extensions that do not have a meaning in
1480ISO C90, such as omitting the middle term of a @code{?:}
1481expression. On the other hand, by specifying a GNU dialect of a
1482standard, all features the compiler support are enabled, even when
1483those features change the meaning of the base standard and some
1484strict-conforming programs may be rejected.  The particular standard
1485is used by @option{-pedantic} to identify which features are GNU
1486extensions given that version of the standard. For example
1487@samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
1488comments, while @samp{-std=gnu99 -pedantic} would not.
1489
1490A value for this option must be provided; possible values are
1491
1492@table @samp
1493@item c90
1494@itemx c89
1495@itemx iso9899:1990
1496Support all ISO C90 programs (certain GNU extensions that conflict
1497with ISO C90 are disabled). Same as @option{-ansi} for C code.
1498
1499@item iso9899:199409
1500ISO C90 as modified in amendment 1.
1501
1502@item c99
1503@itemx c9x
1504@itemx iso9899:1999
1505@itemx iso9899:199x
1506ISO C99.  Note that this standard is not yet fully supported; see
1507@w{@uref{http://gcc.gnu.org/gcc-4.5/c99status.html}} for more information.  The
1508names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1509
1510@item gnu90
1511@itemx gnu89
1512GNU dialect of ISO C90 (including some C99 features). This
1513is the default for C code.
1514
1515@item gnu99
1516@itemx gnu9x
1517GNU dialect of ISO C99.  When ISO C99 is fully implemented in GCC,
1518this will become the default.  The name @samp{gnu9x} is deprecated.
1519
1520@item c++98
1521The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1522C++ code.
1523
1524@item gnu++98
1525GNU dialect of @option{-std=c++98}.  This is the default for
1526C++ code.
1527
1528@item c++0x
1529The working draft of the upcoming ISO C++0x standard. This option
1530enables experimental features that are likely to be included in
1531C++0x. The working draft is constantly changing, and any feature that is
1532enabled by this flag may be removed from future versions of GCC if it is
1533not part of the C++0x standard.
1534
1535@item gnu++0x
1536GNU dialect of @option{-std=c++0x}. This option enables
1537experimental features that may be removed in future versions of GCC.
1538@end table
1539
1540@item -fgnu89-inline
1541@opindex fgnu89-inline
1542The option @option{-fgnu89-inline} tells GCC to use the traditional
1543GNU semantics for @code{inline} functions when in C99 mode.
1544@xref{Inline,,An Inline Function is As Fast As a Macro}.  This option
1545is accepted and ignored by GCC versions 4.1.3 up to but not including
15464.3.  In GCC versions 4.3 and later it changes the behavior of GCC in
1547C99 mode.  Using this option is roughly equivalent to adding the
1548@code{gnu_inline} function attribute to all inline functions
1549(@pxref{Function Attributes}).
1550
1551The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1552C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1553specifies the default behavior).  This option was first supported in
1554GCC 4.3.  This option is not supported in @option{-std=c90} or
1555@option{-std=gnu90} mode.
1556
1557The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1558@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1559in effect for @code{inline} functions.  @xref{Common Predefined
1560Macros,,,cpp,The C Preprocessor}.
1561
1562@item -aux-info @var{filename}
1563@opindex aux-info
1564Output to the given filename prototyped declarations for all functions
1565declared and/or defined in a translation unit, including those in header
1566files.  This option is silently ignored in any language other than C@.
1567
1568Besides declarations, the file indicates, in comments, the origin of
1569each declaration (source file and line), whether the declaration was
1570implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1571@samp{O} for old, respectively, in the first character after the line
1572number and the colon), and whether it came from a declaration or a
1573definition (@samp{C} or @samp{F}, respectively, in the following
1574character).  In the case of function definitions, a K&R-style list of
1575arguments followed by their declarations is also provided, inside
1576comments, after the declaration.
1577
1578@item -fno-asm
1579@opindex fno-asm
1580Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1581keyword, so that code can use these words as identifiers.  You can use
1582the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1583instead.  @option{-ansi} implies @option{-fno-asm}.
1584
1585In C++, this switch only affects the @code{typeof} keyword, since
1586@code{asm} and @code{inline} are standard keywords.  You may want to
1587use the @option{-fno-gnu-keywords} flag instead, which has the same
1588effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1589switch only affects the @code{asm} and @code{typeof} keywords, since
1590@code{inline} is a standard keyword in ISO C99.
1591
1592@item -fno-builtin
1593@itemx -fno-builtin-@var{function}
1594@opindex fno-builtin
1595@cindex built-in functions
1596Don't recognize built-in functions that do not begin with
1597@samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1598functions provided by GCC}, for details of the functions affected,
1599including those which are not built-in functions when @option{-ansi} or
1600@option{-std} options for strict ISO C conformance are used because they
1601do not have an ISO standard meaning.
1602
1603GCC normally generates special code to handle certain built-in functions
1604more efficiently; for instance, calls to @code{alloca} may become single
1605instructions that adjust the stack directly, and calls to @code{memcpy}
1606may become inline copy loops.  The resulting code is often both smaller
1607and faster, but since the function calls no longer appear as such, you
1608cannot set a breakpoint on those calls, nor can you change the behavior
1609of the functions by linking with a different library.  In addition,
1610when a function is recognized as a built-in function, GCC may use
1611information about that function to warn about problems with calls to
1612that function, or to generate more efficient code, even if the
1613resulting code still contains calls to that function.  For example,
1614warnings are given with @option{-Wformat} for bad calls to
1615@code{printf}, when @code{printf} is built in, and @code{strlen} is
1616known not to modify global memory.
1617
1618With the @option{-fno-builtin-@var{function}} option
1619only the built-in function @var{function} is
1620disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1621function is named that is not built-in in this version of GCC, this
1622option is ignored.  There is no corresponding
1623@option{-fbuiltin-@var{function}} option; if you wish to enable
1624built-in functions selectively when using @option{-fno-builtin} or
1625@option{-ffreestanding}, you may define macros such as:
1626
1627@smallexample
1628#define abs(n)          __builtin_abs ((n))
1629#define strcpy(d, s)    __builtin_strcpy ((d), (s))
1630@end smallexample
1631
1632@item -fhosted
1633@opindex fhosted
1634@cindex hosted environment
1635
1636Assert that compilation takes place in a hosted environment.  This implies
1637@option{-fbuiltin}.  A hosted environment is one in which the
1638entire standard library is available, and in which @code{main} has a return
1639type of @code{int}.  Examples are nearly everything except a kernel.
1640This is equivalent to @option{-fno-freestanding}.
1641
1642@item -ffreestanding
1643@opindex ffreestanding
1644@cindex hosted environment
1645
1646Assert that compilation takes place in a freestanding environment.  This
1647implies @option{-fno-builtin}.  A freestanding environment
1648is one in which the standard library may not exist, and program startup may
1649not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1650This is equivalent to @option{-fno-hosted}.
1651
1652@xref{Standards,,Language Standards Supported by GCC}, for details of
1653freestanding and hosted environments.
1654
1655@item -fopenmp
1656@opindex fopenmp
1657@cindex openmp parallel
1658Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1659@code{!$omp} in Fortran.  When @option{-fopenmp} is specified, the
1660compiler generates parallel code according to the OpenMP Application
1661Program Interface v3.0 @w{@uref{http://www.openmp.org/}}.  This option
1662implies @option{-pthread}, and thus is only supported on targets that
1663have support for @option{-pthread}.
1664
1665@item -fms-extensions
1666@opindex fms-extensions
1667Accept some non-standard constructs used in Microsoft header files.
1668
1669Some cases of unnamed fields in structures and unions are only
1670accepted with this option.  @xref{Unnamed Fields,,Unnamed struct/union
1671fields within structs/unions}, for details.
1672
1673@item -trigraphs
1674@opindex trigraphs
1675Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1676options for strict ISO C conformance) implies @option{-trigraphs}.
1677
1678@item -no-integrated-cpp
1679@opindex no-integrated-cpp
1680Performs a compilation in two passes: preprocessing and compiling.  This
1681option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1682@option{-B} option.  The user supplied compilation step can then add in
1683an additional preprocessing step after normal preprocessing but before
1684compiling.  The default is to use the integrated cpp (internal cpp)
1685
1686The semantics of this option will change if "cc1", "cc1plus", and
1687"cc1obj" are merged.
1688
1689@cindex traditional C language
1690@cindex C language, traditional
1691@item -traditional
1692@itemx -traditional-cpp
1693@opindex traditional-cpp
1694@opindex traditional
1695Formerly, these options caused GCC to attempt to emulate a pre-standard
1696C compiler.  They are now only supported with the @option{-E} switch.
1697The preprocessor continues to support a pre-standard mode.  See the GNU
1698CPP manual for details.
1699
1700@item -fcond-mismatch
1701@opindex fcond-mismatch
1702Allow conditional expressions with mismatched types in the second and
1703third arguments.  The value of such an expression is void.  This option
1704is not supported for C++.
1705
1706@item -flax-vector-conversions
1707@opindex flax-vector-conversions
1708Allow implicit conversions between vectors with differing numbers of
1709elements and/or incompatible element types.  This option should not be
1710used for new code.
1711
1712@item -funsigned-char
1713@opindex funsigned-char
1714Let the type @code{char} be unsigned, like @code{unsigned char}.
1715
1716Each kind of machine has a default for what @code{char} should
1717be.  It is either like @code{unsigned char} by default or like
1718@code{signed char} by default.
1719
1720Ideally, a portable program should always use @code{signed char} or
1721@code{unsigned char} when it depends on the signedness of an object.
1722But many programs have been written to use plain @code{char} and
1723expect it to be signed, or expect it to be unsigned, depending on the
1724machines they were written for.  This option, and its inverse, let you
1725make such a program work with the opposite default.
1726
1727The type @code{char} is always a distinct type from each of
1728@code{signed char} or @code{unsigned char}, even though its behavior
1729is always just like one of those two.
1730
1731@item -fsigned-char
1732@opindex fsigned-char
1733Let the type @code{char} be signed, like @code{signed char}.
1734
1735Note that this is equivalent to @option{-fno-unsigned-char}, which is
1736the negative form of @option{-funsigned-char}.  Likewise, the option
1737@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1738
1739@item -fsigned-bitfields
1740@itemx -funsigned-bitfields
1741@itemx -fno-signed-bitfields
1742@itemx -fno-unsigned-bitfields
1743@opindex fsigned-bitfields
1744@opindex funsigned-bitfields
1745@opindex fno-signed-bitfields
1746@opindex fno-unsigned-bitfields
1747These options control whether a bit-field is signed or unsigned, when the
1748declaration does not use either @code{signed} or @code{unsigned}.  By
1749default, such a bit-field is signed, because this is consistent: the
1750basic integer types such as @code{int} are signed types.
1751@end table
1752
1753@node C++ Dialect Options
1754@section Options Controlling C++ Dialect
1755
1756@cindex compiler options, C++
1757@cindex C++ options, command line
1758@cindex options, C++
1759This section describes the command-line options that are only meaningful
1760for C++ programs; but you can also use most of the GNU compiler options
1761regardless of what language your program is in.  For example, you
1762might compile a file @code{firstClass.C} like this:
1763
1764@smallexample
1765g++ -g -frepo -O -c firstClass.C
1766@end smallexample
1767
1768@noindent
1769In this example, only @option{-frepo} is an option meant
1770only for C++ programs; you can use the other options with any
1771language supported by GCC@.
1772
1773Here is a list of options that are @emph{only} for compiling C++ programs:
1774
1775@table @gcctabopt
1776
1777@item -fabi-version=@var{n}
1778@opindex fabi-version
1779Use version @var{n} of the C++ ABI@.  Version 2 is the version of the
1780C++ ABI that first appeared in G++ 3.4.  Version 1 is the version of
1781the C++ ABI that first appeared in G++ 3.2.  Version 0 will always be
1782the version that conforms most closely to the C++ ABI specification.
1783Therefore, the ABI obtained using version 0 will change as ABI bugs
1784are fixed.
1785
1786The default is version 2.
1787
1788Version 3 corrects an error in mangling a constant address as a
1789template argument.
1790
1791Version 4 implements a standard mangling for vector types.
1792
1793See also @option{-Wabi}.
1794
1795@item -fno-access-control
1796@opindex fno-access-control
1797Turn off all access checking.  This switch is mainly useful for working
1798around bugs in the access control code.
1799
1800@item -fcheck-new
1801@opindex fcheck-new
1802Check that the pointer returned by @code{operator new} is non-null
1803before attempting to modify the storage allocated.  This check is
1804normally unnecessary because the C++ standard specifies that
1805@code{operator new} will only return @code{0} if it is declared
1806@samp{throw()}, in which case the compiler will always check the
1807return value even without this option.  In all other cases, when
1808@code{operator new} has a non-empty exception specification, memory
1809exhaustion is signalled by throwing @code{std::bad_alloc}.  See also
1810@samp{new (nothrow)}.
1811
1812@item -fconserve-space
1813@opindex fconserve-space
1814Put uninitialized or runtime-initialized global variables into the
1815common segment, as C does.  This saves space in the executable at the
1816cost of not diagnosing duplicate definitions.  If you compile with this
1817flag and your program mysteriously crashes after @code{main()} has
1818completed, you may have an object that is being destroyed twice because
1819two definitions were merged.
1820
1821This option is no longer useful on most targets, now that support has
1822been added for putting variables into BSS without making them common.
1823
1824@item -fno-deduce-init-list
1825@opindex fno-deduce-init-list
1826Disable deduction of a template type parameter as
1827std::initializer_list from a brace-enclosed initializer list, i.e.
1828
1829@smallexample
1830template <class T> auto forward(T t) -> decltype (realfn (t))
1831@{
1832  return realfn (t);
1833@}
1834
1835void f()
1836@{
1837  forward(@{1,2@}); // call forward<std::initializer_list<int>>
1838@}
1839@end smallexample
1840
1841This option is present because this deduction is an extension to the
1842current specification in the C++0x working draft, and there was
1843some concern about potential overload resolution problems.
1844
1845@item -ffriend-injection
1846@opindex ffriend-injection
1847Inject friend functions into the enclosing namespace, so that they are
1848visible outside the scope of the class in which they are declared.
1849Friend functions were documented to work this way in the old Annotated
1850C++ Reference Manual, and versions of G++ before 4.1 always worked
1851that way.  However, in ISO C++ a friend function which is not declared
1852in an enclosing scope can only be found using argument dependent
1853lookup.  This option causes friends to be injected as they were in
1854earlier releases.
1855
1856This option is for compatibility, and may be removed in a future
1857release of G++.
1858
1859@item -fno-elide-constructors
1860@opindex fno-elide-constructors
1861The C++ standard allows an implementation to omit creating a temporary
1862which is only used to initialize another object of the same type.
1863Specifying this option disables that optimization, and forces G++ to
1864call the copy constructor in all cases.
1865
1866@item -fno-enforce-eh-specs
1867@opindex fno-enforce-eh-specs
1868Don't generate code to check for violation of exception specifications
1869at runtime.  This option violates the C++ standard, but may be useful
1870for reducing code size in production builds, much like defining
1871@samp{NDEBUG}.  This does not give user code permission to throw
1872exceptions in violation of the exception specifications; the compiler
1873will still optimize based on the specifications, so throwing an
1874unexpected exception will result in undefined behavior.
1875
1876@item -ffor-scope
1877@itemx -fno-for-scope
1878@opindex ffor-scope
1879@opindex fno-for-scope
1880If @option{-ffor-scope} is specified, the scope of variables declared in
1881a @i{for-init-statement} is limited to the @samp{for} loop itself,
1882as specified by the C++ standard.
1883If @option{-fno-for-scope} is specified, the scope of variables declared in
1884a @i{for-init-statement} extends to the end of the enclosing scope,
1885as was the case in old versions of G++, and other (traditional)
1886implementations of C++.
1887
1888The default if neither flag is given to follow the standard,
1889but to allow and give a warning for old-style code that would
1890otherwise be invalid, or have different behavior.
1891
1892@item -fno-gnu-keywords
1893@opindex fno-gnu-keywords
1894Do not recognize @code{typeof} as a keyword, so that code can use this
1895word as an identifier.  You can use the keyword @code{__typeof__} instead.
1896@option{-ansi} implies @option{-fno-gnu-keywords}.
1897
1898@item -fno-implicit-templates
1899@opindex fno-implicit-templates
1900Never emit code for non-inline templates which are instantiated
1901implicitly (i.e.@: by use); only emit code for explicit instantiations.
1902@xref{Template Instantiation}, for more information.
1903
1904@item -fno-implicit-inline-templates
1905@opindex fno-implicit-inline-templates
1906Don't emit code for implicit instantiations of inline templates, either.
1907The default is to handle inlines differently so that compiles with and
1908without optimization will need the same set of explicit instantiations.
1909
1910@item -fno-implement-inlines
1911@opindex fno-implement-inlines
1912To save space, do not emit out-of-line copies of inline functions
1913controlled by @samp{#pragma implementation}.  This will cause linker
1914errors if these functions are not inlined everywhere they are called.
1915
1916@item -fms-extensions
1917@opindex fms-extensions
1918Disable pedantic warnings about constructs used in MFC, such as implicit
1919int and getting a pointer to member function via non-standard syntax.
1920
1921@item -fno-nonansi-builtins
1922@opindex fno-nonansi-builtins
1923Disable built-in declarations of functions that are not mandated by
1924ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1925@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1926
1927@item -fno-operator-names
1928@opindex fno-operator-names
1929Do not treat the operator name keywords @code{and}, @code{bitand},
1930@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1931synonyms as keywords.
1932
1933@item -fno-optional-diags
1934@opindex fno-optional-diags
1935Disable diagnostics that the standard says a compiler does not need to
1936issue.  Currently, the only such diagnostic issued by G++ is the one for
1937a name having multiple meanings within a class.
1938
1939@item -fpermissive
1940@opindex fpermissive
1941Downgrade some diagnostics about nonconformant code from errors to
1942warnings.  Thus, using @option{-fpermissive} will allow some
1943nonconforming code to compile.
1944
1945@item -fno-pretty-templates
1946@opindex fno-pretty-templates
1947When an error message refers to a specialization of a function
1948template, the compiler will normally print the signature of the
1949template followed by the template arguments and any typedefs or
1950typenames in the signature (e.g. @code{void f(T) [with T = int]}
1951rather than @code{void f(int)}) so that it's clear which template is
1952involved.  When an error message refers to a specialization of a class
1953template, the compiler will omit any template arguments which match
1954the default template arguments for that template.  If either of these
1955behaviors make it harder to understand the error message rather than
1956easier, using @option{-fno-pretty-templates} will disable them.
1957
1958@item -frepo
1959@opindex frepo
1960Enable automatic template instantiation at link time.  This option also
1961implies @option{-fno-implicit-templates}.  @xref{Template
1962Instantiation}, for more information.
1963
1964@item -fno-rtti
1965@opindex fno-rtti
1966Disable generation of information about every class with virtual
1967functions for use by the C++ runtime type identification features
1968(@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1969of the language, you can save some space by using this flag.  Note that
1970exception handling uses the same information, but it will generate it as
1971needed. The @samp{dynamic_cast} operator can still be used for casts that
1972do not require runtime type information, i.e.@: casts to @code{void *} or to
1973unambiguous base classes.
1974
1975@item -fstats
1976@opindex fstats
1977Emit statistics about front-end processing at the end of the compilation.
1978This information is generally only useful to the G++ development team.
1979
1980@item -ftemplate-depth=@var{n}
1981@opindex ftemplate-depth
1982Set the maximum instantiation depth for template classes to @var{n}.
1983A limit on the template instantiation depth is needed to detect
1984endless recursions during template class instantiation.  ANSI/ISO C++
1985conforming programs must not rely on a maximum depth greater than 17
1986(changed to 1024 in C++0x).
1987
1988@item -fno-threadsafe-statics
1989@opindex fno-threadsafe-statics
1990Do not emit the extra code to use the routines specified in the C++
1991ABI for thread-safe initialization of local statics.  You can use this
1992option to reduce code size slightly in code that doesn't need to be
1993thread-safe.
1994
1995@item -fuse-cxa-atexit
1996@opindex fuse-cxa-atexit
1997Register destructors for objects with static storage duration with the
1998@code{__cxa_atexit} function rather than the @code{atexit} function.
1999This option is required for fully standards-compliant handling of static
2000destructors, but will only work if your C library supports
2001@code{__cxa_atexit}.
2002
2003@item -fno-use-cxa-get-exception-ptr
2004@opindex fno-use-cxa-get-exception-ptr
2005Don't use the @code{__cxa_get_exception_ptr} runtime routine.  This
2006will cause @code{std::uncaught_exception} to be incorrect, but is necessary
2007if the runtime routine is not available.
2008
2009@item -fvisibility-inlines-hidden
2010@opindex fvisibility-inlines-hidden
2011This switch declares that the user does not attempt to compare
2012pointers to inline methods where the addresses of the two functions
2013were taken in different shared objects.
2014
2015The effect of this is that GCC may, effectively, mark inline methods with
2016@code{__attribute__ ((visibility ("hidden")))} so that they do not
2017appear in the export table of a DSO and do not require a PLT indirection
2018when used within the DSO@.  Enabling this option can have a dramatic effect
2019on load and link times of a DSO as it massively reduces the size of the
2020dynamic export table when the library makes heavy use of templates.
2021
2022The behavior of this switch is not quite the same as marking the
2023methods as hidden directly, because it does not affect static variables
2024local to the function or cause the compiler to deduce that
2025the function is defined in only one shared object.
2026
2027You may mark a method as having a visibility explicitly to negate the
2028effect of the switch for that method.  For example, if you do want to
2029compare pointers to a particular inline method, you might mark it as
2030having default visibility.  Marking the enclosing class with explicit
2031visibility will have no effect.
2032
2033Explicitly instantiated inline methods are unaffected by this option
2034as their linkage might otherwise cross a shared library boundary.
2035@xref{Template Instantiation}.
2036
2037@item -fvisibility-ms-compat
2038@opindex fvisibility-ms-compat
2039This flag attempts to use visibility settings to make GCC's C++
2040linkage model compatible with that of Microsoft Visual Studio.
2041
2042The flag makes these changes to GCC's linkage model:
2043
2044@enumerate
2045@item
2046It sets the default visibility to @code{hidden}, like
2047@option{-fvisibility=hidden}.
2048
2049@item
2050Types, but not their members, are not hidden by default.
2051
2052@item
2053The One Definition Rule is relaxed for types without explicit
2054visibility specifications which are defined in more than one different
2055shared object: those declarations are permitted if they would have
2056been permitted when this option was not used.
2057@end enumerate
2058
2059In new code it is better to use @option{-fvisibility=hidden} and
2060export those classes which are intended to be externally visible.
2061Unfortunately it is possible for code to rely, perhaps accidentally,
2062on the Visual Studio behavior.
2063
2064Among the consequences of these changes are that static data members
2065of the same type with the same name but defined in different shared
2066objects will be different, so changing one will not change the other;
2067and that pointers to function members defined in different shared
2068objects may not compare equal.  When this flag is given, it is a
2069violation of the ODR to define types with the same name differently.
2070
2071@item -fno-weak
2072@opindex fno-weak
2073Do not use weak symbol support, even if it is provided by the linker.
2074By default, G++ will use weak symbols if they are available.  This
2075option exists only for testing, and should not be used by end-users;
2076it will result in inferior code and has no benefits.  This option may
2077be removed in a future release of G++.
2078
2079@item -nostdinc++
2080@opindex nostdinc++
2081Do not search for header files in the standard directories specific to
2082C++, but do still search the other standard directories.  (This option
2083is used when building the C++ library.)
2084@end table
2085
2086In addition, these optimization, warning, and code generation options
2087have meanings only for C++ programs:
2088
2089@table @gcctabopt
2090@item -fno-default-inline
2091@opindex fno-default-inline
2092Do not assume @samp{inline} for functions defined inside a class scope.
2093@xref{Optimize Options,,Options That Control Optimization}.  Note that these
2094functions will have linkage like inline functions; they just won't be
2095inlined by default.
2096
2097@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2098@opindex Wabi
2099@opindex Wno-abi
2100Warn when G++ generates code that is probably not compatible with the
2101vendor-neutral C++ ABI@.  Although an effort has been made to warn about
2102all such cases, there are probably some cases that are not warned about,
2103even though G++ is generating incompatible code.  There may also be
2104cases where warnings are emitted even though the code that is generated
2105will be compatible.
2106
2107You should rewrite your code to avoid these warnings if you are
2108concerned about the fact that code generated by G++ may not be binary
2109compatible with code generated by other compilers.
2110
2111The known incompatibilities in @option{-fabi-version=2} (the default) include:
2112
2113@itemize @bullet
2114
2115@item
2116A template with a non-type template parameter of reference type is
2117mangled incorrectly:
2118@smallexample
2119extern int N;
2120template <int &> struct S @{@};
2121void n (S<N>) @{2@}
2122@end smallexample
2123
2124This is fixed in @option{-fabi-version=3}.
2125
2126@item
2127SIMD vector types declared using @code{__attribute ((vector_size))} are
2128mangled in a non-standard way that does not allow for overloading of
2129functions taking vectors of different sizes.
2130
2131The mangling is changed in @option{-fabi-version=4}.
2132@end itemize
2133
2134The known incompatibilities in @option{-fabi-version=1} include:
2135
2136@itemize @bullet
2137
2138@item
2139Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
2140pack data into the same byte as a base class.  For example:
2141
2142@smallexample
2143struct A @{ virtual void f(); int f1 : 1; @};
2144struct B : public A @{ int f2 : 1; @};
2145@end smallexample
2146
2147@noindent
2148In this case, G++ will place @code{B::f2} into the same byte
2149as@code{A::f1}; other compilers will not.  You can avoid this problem
2150by explicitly padding @code{A} so that its size is a multiple of the
2151byte size on your platform; that will cause G++ and other compilers to
2152layout @code{B} identically.
2153
2154@item
2155Incorrect handling of tail-padding for virtual bases.  G++ does not use
2156tail padding when laying out virtual bases.  For example:
2157
2158@smallexample
2159struct A @{ virtual void f(); char c1; @};
2160struct B @{ B(); char c2; @};
2161struct C : public A, public virtual B @{@};
2162@end smallexample
2163
2164@noindent
2165In this case, G++ will not place @code{B} into the tail-padding for
2166@code{A}; other compilers will.  You can avoid this problem by
2167explicitly padding @code{A} so that its size is a multiple of its
2168alignment (ignoring virtual base classes); that will cause G++ and other
2169compilers to layout @code{C} identically.
2170
2171@item
2172Incorrect handling of bit-fields with declared widths greater than that
2173of their underlying types, when the bit-fields appear in a union.  For
2174example:
2175
2176@smallexample
2177union U @{ int i : 4096; @};
2178@end smallexample
2179
2180@noindent
2181Assuming that an @code{int} does not have 4096 bits, G++ will make the
2182union too small by the number of bits in an @code{int}.
2183
2184@item
2185Empty classes can be placed at incorrect offsets.  For example:
2186
2187@smallexample
2188struct A @{@};
2189
2190struct B @{
2191  A a;
2192  virtual void f ();
2193@};
2194
2195struct C : public B, public A @{@};
2196@end smallexample
2197
2198@noindent
2199G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2200it should be placed at offset zero.  G++ mistakenly believes that the
2201@code{A} data member of @code{B} is already at offset zero.
2202
2203@item
2204Names of template functions whose types involve @code{typename} or
2205template template parameters can be mangled incorrectly.
2206
2207@smallexample
2208template <typename Q>
2209void f(typename Q::X) @{@}
2210
2211template <template <typename> class Q>
2212void f(typename Q<int>::X) @{@}
2213@end smallexample
2214
2215@noindent
2216Instantiations of these templates may be mangled incorrectly.
2217
2218@end itemize
2219
2220It also warns psABI related changes.  The known psABI changes at this
2221point include:
2222
2223@itemize @bullet
2224
2225@item
2226For SYSV/x86-64, when passing union with long double, it is changed to
2227pass in memory as specified in psABI.  For example:
2228
2229@smallexample
2230union U @{
2231  long double ld;
2232  int i;
2233@};
2234@end smallexample
2235
2236@noindent
2237@code{union U} will always be passed in memory.
2238
2239@end itemize
2240
2241@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2242@opindex Wctor-dtor-privacy
2243@opindex Wno-ctor-dtor-privacy
2244Warn when a class seems unusable because all the constructors or
2245destructors in that class are private, and it has neither friends nor
2246public static member functions.
2247
2248@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2249@opindex Wnon-virtual-dtor
2250@opindex Wno-non-virtual-dtor
2251Warn when a class has virtual functions and accessible non-virtual
2252destructor, in which case it would be possible but unsafe to delete
2253an instance of a derived class through a pointer to the base class.
2254This warning is also enabled if -Weffc++ is specified.
2255
2256@item -Wreorder @r{(C++ and Objective-C++ only)}
2257@opindex Wreorder
2258@opindex Wno-reorder
2259@cindex reordering, warning
2260@cindex warning for reordering of member initializers
2261Warn when the order of member initializers given in the code does not
2262match the order in which they must be executed.  For instance:
2263
2264@smallexample
2265struct A @{
2266  int i;
2267  int j;
2268  A(): j (0), i (1) @{ @}
2269@};
2270@end smallexample
2271
2272The compiler will rearrange the member initializers for @samp{i}
2273and @samp{j} to match the declaration order of the members, emitting
2274a warning to that effect.  This warning is enabled by @option{-Wall}.
2275@end table
2276
2277The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2278
2279@table @gcctabopt
2280@item -Weffc++ @r{(C++ and Objective-C++ only)}
2281@opindex Weffc++
2282@opindex Wno-effc++
2283Warn about violations of the following style guidelines from Scott Meyers'
2284@cite{Effective C++} book:
2285
2286@itemize @bullet
2287@item
2288Item 11:  Define a copy constructor and an assignment operator for classes
2289with dynamically allocated memory.
2290
2291@item
2292Item 12:  Prefer initialization to assignment in constructors.
2293
2294@item
2295Item 14:  Make destructors virtual in base classes.
2296
2297@item
2298Item 15:  Have @code{operator=} return a reference to @code{*this}.
2299
2300@item
2301Item 23:  Don't try to return a reference when you must return an object.
2302
2303@end itemize
2304
2305Also warn about violations of the following style guidelines from
2306Scott Meyers' @cite{More Effective C++} book:
2307
2308@itemize @bullet
2309@item
2310Item 6:  Distinguish between prefix and postfix forms of increment and
2311decrement operators.
2312
2313@item
2314Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
2315
2316@end itemize
2317
2318When selecting this option, be aware that the standard library
2319headers do not obey all of these guidelines; use @samp{grep -v}
2320to filter out those warnings.
2321
2322@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2323@opindex Wstrict-null-sentinel
2324@opindex Wno-strict-null-sentinel
2325Warn also about the use of an uncasted @code{NULL} as sentinel.  When
2326compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2327to @code{__null}.  Although it is a null pointer constant not a null pointer,
2328it is guaranteed to be of the same size as a pointer.  But this use is
2329not portable across different compilers.
2330
2331@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2332@opindex Wno-non-template-friend
2333@opindex Wnon-template-friend
2334Disable warnings when non-templatized friend functions are declared
2335within a template.  Since the advent of explicit template specification
2336support in G++, if the name of the friend is an unqualified-id (i.e.,
2337@samp{friend foo(int)}), the C++ language specification demands that the
2338friend declare or define an ordinary, nontemplate function.  (Section
233914.5.3).  Before G++ implemented explicit specification, unqualified-ids
2340could be interpreted as a particular specialization of a templatized
2341function.  Because this non-conforming behavior is no longer the default
2342behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2343check existing code for potential trouble spots and is on by default.
2344This new compiler behavior can be turned off with
2345@option{-Wno-non-template-friend} which keeps the conformant compiler code
2346but disables the helpful warning.
2347
2348@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2349@opindex Wold-style-cast
2350@opindex Wno-old-style-cast
2351Warn if an old-style (C-style) cast to a non-void type is used within
2352a C++ program.  The new-style casts (@samp{dynamic_cast},
2353@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2354less vulnerable to unintended effects and much easier to search for.
2355
2356@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2357@opindex Woverloaded-virtual
2358@opindex Wno-overloaded-virtual
2359@cindex overloaded virtual fn, warning
2360@cindex warning for overloaded virtual fn
2361Warn when a function declaration hides virtual functions from a
2362base class.  For example, in:
2363
2364@smallexample
2365struct A @{
2366  virtual void f();
2367@};
2368
2369struct B: public A @{
2370  void f(int);
2371@};
2372@end smallexample
2373
2374the @code{A} class version of @code{f} is hidden in @code{B}, and code
2375like:
2376
2377@smallexample
2378B* b;
2379b->f();
2380@end smallexample
2381
2382will fail to compile.
2383
2384@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2385@opindex Wno-pmf-conversions
2386@opindex Wpmf-conversions
2387Disable the diagnostic for converting a bound pointer to member function
2388to a plain pointer.
2389
2390@item -Wsign-promo @r{(C++ and Objective-C++ only)}
2391@opindex Wsign-promo
2392@opindex Wno-sign-promo
2393Warn when overload resolution chooses a promotion from unsigned or
2394enumerated type to a signed type, over a conversion to an unsigned type of
2395the same size.  Previous versions of G++ would try to preserve
2396unsignedness, but the standard mandates the current behavior.
2397
2398@smallexample
2399struct A @{
2400  operator int ();
2401  A& operator = (int);
2402@};
2403
2404main ()
2405@{
2406  A a,b;
2407  a = b;
2408@}
2409@end smallexample
2410
2411In this example, G++ will synthesize a default @samp{A& operator =
2412(const A&);}, while cfront will use the user-defined @samp{operator =}.
2413@end table
2414
2415@node Objective-C and Objective-C++ Dialect Options
2416@section Options Controlling Objective-C and Objective-C++ Dialects
2417
2418@cindex compiler options, Objective-C and Objective-C++
2419@cindex Objective-C and Objective-C++ options, command line
2420@cindex options, Objective-C and Objective-C++
2421(NOTE: This manual does not describe the Objective-C and Objective-C++
2422languages themselves.  @xref{Standards,,Language Standards
2423Supported by GCC}, for references.)
2424
2425This section describes the command-line options that are only meaningful
2426for Objective-C and Objective-C++ programs, but you can also use most of
2427the language-independent GNU compiler options.
2428For example, you might compile a file @code{some_class.m} like this:
2429
2430@smallexample
2431gcc -g -fgnu-runtime -O -c some_class.m
2432@end smallexample
2433
2434@noindent
2435In this example, @option{-fgnu-runtime} is an option meant only for
2436Objective-C and Objective-C++ programs; you can use the other options with
2437any language supported by GCC@.
2438
2439Note that since Objective-C is an extension of the C language, Objective-C
2440compilations may also use options specific to the C front-end (e.g.,
2441@option{-Wtraditional}).  Similarly, Objective-C++ compilations may use
2442C++-specific options (e.g., @option{-Wabi}).
2443
2444Here is a list of options that are @emph{only} for compiling Objective-C
2445and Objective-C++ programs:
2446
2447@table @gcctabopt
2448@item -fconstant-string-class=@var{class-name}
2449@opindex fconstant-string-class
2450Use @var{class-name} as the name of the class to instantiate for each
2451literal string specified with the syntax @code{@@"@dots{}"}.  The default
2452class name is @code{NXConstantString} if the GNU runtime is being used, and
2453@code{NSConstantString} if the NeXT runtime is being used (see below).  The
2454@option{-fconstant-cfstrings} option, if also present, will override the
2455@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2456to be laid out as constant CoreFoundation strings.
2457
2458@item -fgnu-runtime
2459@opindex fgnu-runtime
2460Generate object code compatible with the standard GNU Objective-C
2461runtime.  This is the default for most types of systems.
2462
2463@item -fnext-runtime
2464@opindex fnext-runtime
2465Generate output compatible with the NeXT runtime.  This is the default
2466for NeXT-based systems, including Darwin and Mac OS X@.  The macro
2467@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2468used.
2469
2470@item -fno-nil-receivers
2471@opindex fno-nil-receivers
2472Assume that all Objective-C message dispatches (e.g.,
2473@code{[receiver message:arg]}) in this translation unit ensure that the receiver
2474is not @code{nil}.  This allows for more efficient entry points in the runtime
2475to be used.  Currently, this option is only available in conjunction with
2476the NeXT runtime on Mac OS X 10.3 and later.
2477
2478@item -fobjc-call-cxx-cdtors
2479@opindex fobjc-call-cxx-cdtors
2480For each Objective-C class, check if any of its instance variables is a
2481C++ object with a non-trivial default constructor.  If so, synthesize a
2482special @code{- (id) .cxx_construct} instance method that will run
2483non-trivial default constructors on any such instance variables, in order,
2484and then return @code{self}.  Similarly, check if any instance variable
2485is a C++ object with a non-trivial destructor, and if so, synthesize a
2486special @code{- (void) .cxx_destruct} method that will run
2487all such default destructors, in reverse order.
2488
2489The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2490thusly generated will only operate on instance variables declared in the
2491current Objective-C class, and not those inherited from superclasses.  It
2492is the responsibility of the Objective-C runtime to invoke all such methods
2493in an object's inheritance hierarchy.  The @code{- (id) .cxx_construct} methods
2494will be invoked by the runtime immediately after a new object
2495instance is allocated; the @code{- (void) .cxx_destruct} methods will
2496be invoked immediately before the runtime deallocates an object instance.
2497
2498As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2499support for invoking the @code{- (id) .cxx_construct} and
2500@code{- (void) .cxx_destruct} methods.
2501
2502@item -fobjc-direct-dispatch
2503@opindex fobjc-direct-dispatch
2504Allow fast jumps to the message dispatcher.  On Darwin this is
2505accomplished via the comm page.
2506
2507@item -fobjc-exceptions
2508@opindex fobjc-exceptions
2509Enable syntactic support for structured exception handling in Objective-C,
2510similar to what is offered by C++ and Java.  This option is
2511unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2512earlier.
2513
2514@smallexample
2515  @@try @{
2516    @dots{}
2517       @@throw expr;
2518    @dots{}
2519  @}
2520  @@catch (AnObjCClass *exc) @{
2521    @dots{}
2522      @@throw expr;
2523    @dots{}
2524      @@throw;
2525    @dots{}
2526  @}
2527  @@catch (AnotherClass *exc) @{
2528    @dots{}
2529  @}
2530  @@catch (id allOthers) @{
2531    @dots{}
2532  @}
2533  @@finally @{
2534    @dots{}
2535      @@throw expr;
2536    @dots{}
2537  @}
2538@end smallexample
2539
2540The @code{@@throw} statement may appear anywhere in an Objective-C or
2541Objective-C++ program; when used inside of a @code{@@catch} block, the
2542@code{@@throw} may appear without an argument (as shown above), in which case
2543the object caught by the @code{@@catch} will be rethrown.
2544
2545Note that only (pointers to) Objective-C objects may be thrown and
2546caught using this scheme.  When an object is thrown, it will be caught
2547by the nearest @code{@@catch} clause capable of handling objects of that type,
2548analogously to how @code{catch} blocks work in C++ and Java.  A
2549@code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2550any and all Objective-C exceptions not caught by previous @code{@@catch}
2551clauses (if any).
2552
2553The @code{@@finally} clause, if present, will be executed upon exit from the
2554immediately preceding @code{@@try @dots{} @@catch} section.  This will happen
2555regardless of whether any exceptions are thrown, caught or rethrown
2556inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2557of the @code{finally} clause in Java.
2558
2559There are several caveats to using the new exception mechanism:
2560
2561@itemize @bullet
2562@item
2563Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2564idioms provided by the @code{NSException} class, the new
2565exceptions can only be used on Mac OS X 10.3 (Panther) and later
2566systems, due to additional functionality needed in the (NeXT) Objective-C
2567runtime.
2568
2569@item
2570As mentioned above, the new exceptions do not support handling
2571types other than Objective-C objects.   Furthermore, when used from
2572Objective-C++, the Objective-C exception model does not interoperate with C++
2573exceptions at this time.  This means you cannot @code{@@throw} an exception
2574from Objective-C and @code{catch} it in C++, or vice versa
2575(i.e., @code{throw @dots{} @@catch}).
2576@end itemize
2577
2578The @option{-fobjc-exceptions} switch also enables the use of synchronization
2579blocks for thread-safe execution:
2580
2581@smallexample
2582  @@synchronized (ObjCClass *guard) @{
2583    @dots{}
2584  @}
2585@end smallexample
2586
2587Upon entering the @code{@@synchronized} block, a thread of execution shall
2588first check whether a lock has been placed on the corresponding @code{guard}
2589object by another thread.  If it has, the current thread shall wait until
2590the other thread relinquishes its lock.  Once @code{guard} becomes available,
2591the current thread will place its own lock on it, execute the code contained in
2592the @code{@@synchronized} block, and finally relinquish the lock (thereby
2593making @code{guard} available to other threads).
2594
2595Unlike Java, Objective-C does not allow for entire methods to be marked
2596@code{@@synchronized}.  Note that throwing exceptions out of
2597@code{@@synchronized} blocks is allowed, and will cause the guarding object
2598to be unlocked properly.
2599
2600@item -fobjc-gc
2601@opindex fobjc-gc
2602Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2603
2604@item -freplace-objc-classes
2605@opindex freplace-objc-classes
2606Emit a special marker instructing @command{ld(1)} not to statically link in
2607the resulting object file, and allow @command{dyld(1)} to load it in at
2608run time instead.  This is used in conjunction with the Fix-and-Continue
2609debugging mode, where the object file in question may be recompiled and
2610dynamically reloaded in the course of program execution, without the need
2611to restart the program itself.  Currently, Fix-and-Continue functionality
2612is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2613and later.
2614
2615@item -fzero-link
2616@opindex fzero-link
2617When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2618to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2619compile time) with static class references that get initialized at load time,
2620which improves run-time performance.  Specifying the @option{-fzero-link} flag
2621suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2622to be retained.  This is useful in Zero-Link debugging mode, since it allows
2623for individual class implementations to be modified during program execution.
2624
2625@item -gen-decls
2626@opindex gen-decls
2627Dump interface declarations for all classes seen in the source file to a
2628file named @file{@var{sourcename}.decl}.
2629
2630@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2631@opindex Wassign-intercept
2632@opindex Wno-assign-intercept
2633Warn whenever an Objective-C assignment is being intercepted by the
2634garbage collector.
2635
2636@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2637@opindex Wno-protocol
2638@opindex Wprotocol
2639If a class is declared to implement a protocol, a warning is issued for
2640every method in the protocol that is not implemented by the class.  The
2641default behavior is to issue a warning for every method not explicitly
2642implemented in the class, even if a method implementation is inherited
2643from the superclass.  If you use the @option{-Wno-protocol} option, then
2644methods inherited from the superclass are considered to be implemented,
2645and no warning is issued for them.
2646
2647@item -Wselector @r{(Objective-C and Objective-C++ only)}
2648@opindex Wselector
2649@opindex Wno-selector
2650Warn if multiple methods of different types for the same selector are
2651found during compilation.  The check is performed on the list of methods
2652in the final stage of compilation.  Additionally, a check is performed
2653for each selector appearing in a @code{@@selector(@dots{})}
2654expression, and a corresponding method for that selector has been found
2655during compilation.  Because these checks scan the method table only at
2656the end of compilation, these warnings are not produced if the final
2657stage of compilation is not reached, for example because an error is
2658found during compilation, or because the @option{-fsyntax-only} option is
2659being used.
2660
2661@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2662@opindex Wstrict-selector-match
2663@opindex Wno-strict-selector-match
2664Warn if multiple methods with differing argument and/or return types are
2665found for a given selector when attempting to send a message using this
2666selector to a receiver of type @code{id} or @code{Class}.  When this flag
2667is off (which is the default behavior), the compiler will omit such warnings
2668if any differences found are confined to types which share the same size
2669and alignment.
2670
2671@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2672@opindex Wundeclared-selector
2673@opindex Wno-undeclared-selector
2674Warn if a @code{@@selector(@dots{})} expression referring to an
2675undeclared selector is found.  A selector is considered undeclared if no
2676method with that name has been declared before the
2677@code{@@selector(@dots{})} expression, either explicitly in an
2678@code{@@interface} or @code{@@protocol} declaration, or implicitly in
2679an @code{@@implementation} section.  This option always performs its
2680checks as soon as a @code{@@selector(@dots{})} expression is found,
2681while @option{-Wselector} only performs its checks in the final stage of
2682compilation.  This also enforces the coding style convention
2683that methods and selectors must be declared before being used.
2684
2685@item -print-objc-runtime-info
2686@opindex print-objc-runtime-info
2687Generate C header describing the largest structure that is passed by
2688value, if any.
2689
2690@end table
2691
2692@node Language Independent Options
2693@section Options to Control Diagnostic Messages Formatting
2694@cindex options to control diagnostics formatting
2695@cindex diagnostic messages
2696@cindex message formatting
2697
2698Traditionally, diagnostic messages have been formatted irrespective of
2699the output device's aspect (e.g.@: its width, @dots{}).  The options described
2700below can be used to control the diagnostic messages formatting
2701algorithm, e.g.@: how many characters per line, how often source location
2702information should be reported.  Right now, only the C++ front end can
2703honor these options.  However it is expected, in the near future, that
2704the remaining front ends would be able to digest them correctly.
2705
2706@table @gcctabopt
2707@item -fmessage-length=@var{n}
2708@opindex fmessage-length
2709Try to format error messages so that they fit on lines of about @var{n}
2710characters.  The default is 72 characters for @command{g++} and 0 for the rest of
2711the front ends supported by GCC@.  If @var{n} is zero, then no
2712line-wrapping will be done; each error message will appear on a single
2713line.
2714
2715@opindex fdiagnostics-show-location
2716@item -fdiagnostics-show-location=once
2717Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
2718reporter to emit @emph{once} source location information; that is, in
2719case the message is too long to fit on a single physical line and has to
2720be wrapped, the source location won't be emitted (as prefix) again,
2721over and over, in subsequent continuation lines.  This is the default
2722behavior.
2723
2724@item -fdiagnostics-show-location=every-line
2725Only meaningful in line-wrapping mode.  Instructs the diagnostic
2726messages reporter to emit the same source location information (as
2727prefix) for physical lines that result from the process of breaking
2728a message which is too long to fit on a single line.
2729
2730@item -fdiagnostics-show-option
2731@opindex fdiagnostics-show-option
2732This option instructs the diagnostic machinery to add text to each
2733diagnostic emitted, which indicates which command line option directly
2734controls that diagnostic, when such an option is known to the
2735diagnostic machinery.
2736
2737@item -Wcoverage-mismatch
2738@opindex Wcoverage-mismatch
2739Warn if feedback profiles do not match when using the
2740@option{-fprofile-use} option.
2741If a source file was changed between @option{-fprofile-gen} and
2742@option{-fprofile-use}, the files with the profile feedback can fail
2743to match the source file and GCC can not use the profile feedback
2744information.  By default, GCC emits an error message in this case.
2745The option @option{-Wcoverage-mismatch} emits a warning instead of an
2746error.  GCC does not use appropriate feedback profiles, so using this
2747option can result in poorly optimized code.  This option is useful
2748only in the case of very minor changes such as bug fixes to an
2749existing code-base.
2750
2751@end table
2752
2753@node Warning Options
2754@section Options to Request or Suppress Warnings
2755@cindex options to control warnings
2756@cindex warning messages
2757@cindex messages, warning
2758@cindex suppressing warnings
2759
2760Warnings are diagnostic messages that report constructions which
2761are not inherently erroneous but which are risky or suggest there
2762may have been an error.
2763
2764The following language-independent options do not enable specific
2765warnings but control the kinds of diagnostics produced by GCC.
2766
2767@table @gcctabopt
2768@cindex syntax checking
2769@item -fsyntax-only
2770@opindex fsyntax-only
2771Check the code for syntax errors, but don't do anything beyond that.
2772
2773@item -w
2774@opindex w
2775Inhibit all warning messages.
2776
2777@item -Werror
2778@opindex Werror
2779@opindex Wno-error
2780Make all warnings into errors.
2781
2782@item -Werror=
2783@opindex Werror=
2784@opindex Wno-error=
2785Make the specified warning into an error.  The specifier for a warning
2786is appended, for example @option{-Werror=switch} turns the warnings
2787controlled by @option{-Wswitch} into errors.  This switch takes a
2788negative form, to be used to negate @option{-Werror} for specific
2789warnings, for example @option{-Wno-error=switch} makes
2790@option{-Wswitch} warnings not be errors, even when @option{-Werror}
2791is in effect.  You can use the @option{-fdiagnostics-show-option}
2792option to have each controllable warning amended with the option which
2793controls it, to determine what to use with this option.
2794
2795Note that specifying @option{-Werror=}@var{foo} automatically implies
2796@option{-W}@var{foo}.  However, @option{-Wno-error=}@var{foo} does not
2797imply anything.
2798
2799@item -Wfatal-errors
2800@opindex Wfatal-errors
2801@opindex Wno-fatal-errors
2802This option causes the compiler to abort compilation on the first error
2803occurred rather than trying to keep going and printing further error
2804messages.
2805
2806@end table
2807
2808You can request many specific warnings with options beginning
2809@samp{-W}, for example @option{-Wimplicit} to request warnings on
2810implicit declarations.  Each of these specific warning options also
2811has a negative form beginning @samp{-Wno-} to turn off warnings; for
2812example, @option{-Wno-implicit}.  This manual lists only one of the
2813two forms, whichever is not the default.  For further,
2814language-specific options also refer to @ref{C++ Dialect Options} and
2815@ref{Objective-C and Objective-C++ Dialect Options}.
2816
2817@table @gcctabopt
2818@item -pedantic
2819@opindex pedantic
2820Issue all the warnings demanded by strict ISO C and ISO C++;
2821reject all programs that use forbidden extensions, and some other
2822programs that do not follow ISO C and ISO C++.  For ISO C, follows the
2823version of the ISO C standard specified by any @option{-std} option used.
2824
2825Valid ISO C and ISO C++ programs should compile properly with or without
2826this option (though a rare few will require @option{-ansi} or a
2827@option{-std} option specifying the required version of ISO C)@.  However,
2828without this option, certain GNU extensions and traditional C and C++
2829features are supported as well.  With this option, they are rejected.
2830
2831@option{-pedantic} does not cause warning messages for use of the
2832alternate keywords whose names begin and end with @samp{__}.  Pedantic
2833warnings are also disabled in the expression that follows
2834@code{__extension__}.  However, only system header files should use
2835these escape routes; application programs should avoid them.
2836@xref{Alternate Keywords}.
2837
2838Some users try to use @option{-pedantic} to check programs for strict ISO
2839C conformance.  They soon find that it does not do quite what they want:
2840it finds some non-ISO practices, but not all---only those for which
2841ISO C @emph{requires} a diagnostic, and some others for which
2842diagnostics have been added.
2843
2844A feature to report any failure to conform to ISO C might be useful in
2845some instances, but would require considerable additional work and would
2846be quite different from @option{-pedantic}.  We don't have plans to
2847support such a feature in the near future.
2848
2849Where the standard specified with @option{-std} represents a GNU
2850extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
2851corresponding @dfn{base standard}, the version of ISO C on which the GNU
2852extended dialect is based.  Warnings from @option{-pedantic} are given
2853where they are required by the base standard.  (It would not make sense
2854for such warnings to be given only for features not in the specified GNU
2855C dialect, since by definition the GNU dialects of C include all
2856features the compiler supports with the given option, and there would be
2857nothing to warn about.)
2858
2859@item -pedantic-errors
2860@opindex pedantic-errors
2861Like @option{-pedantic}, except that errors are produced rather than
2862warnings.
2863
2864@item -Wall
2865@opindex Wall
2866@opindex Wno-all
2867This enables all the warnings about constructions that some users
2868consider questionable, and that are easy to avoid (or modify to
2869prevent the warning), even in conjunction with macros.  This also
2870enables some language-specific warnings described in @ref{C++ Dialect
2871Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2872
2873@option{-Wall} turns on the following warning flags:
2874
2875@gccoptlist{-Waddress   @gol
2876-Warray-bounds @r{(only with} @option{-O2}@r{)}  @gol
2877-Wc++0x-compat  @gol
2878-Wchar-subscripts  @gol
2879-Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
2880-Wimplicit-int  @gol
2881-Wimplicit-function-declaration  @gol
2882-Wcomment  @gol
2883-Wformat   @gol
2884-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)}  @gol
2885-Wmissing-braces  @gol
2886-Wnonnull  @gol
2887-Wparentheses  @gol
2888-Wpointer-sign  @gol
2889-Wreorder   @gol
2890-Wreturn-type  @gol
2891-Wsequence-point  @gol
2892-Wsign-compare @r{(only in C++)}  @gol
2893-Wstrict-aliasing  @gol
2894-Wstrict-overflow=1  @gol
2895-Wswitch  @gol
2896-Wtrigraphs  @gol
2897-Wuninitialized  @gol
2898-Wunknown-pragmas  @gol
2899-Wunused-function  @gol
2900-Wunused-label     @gol
2901-Wunused-value     @gol
2902-Wunused-variable  @gol
2903-Wvolatile-register-var @gol
2904}
2905
2906Note that some warning flags are not implied by @option{-Wall}.  Some of
2907them warn about constructions that users generally do not consider
2908questionable, but which occasionally you might wish to check for;
2909others warn about constructions that are necessary or hard to avoid in
2910some cases, and there is no simple way to modify the code to suppress
2911the warning. Some of them are enabled by @option{-Wextra} but many of
2912them must be enabled individually.
2913
2914@item -Wextra
2915@opindex W
2916@opindex Wextra
2917@opindex Wno-extra
2918This enables some extra warning flags that are not enabled by
2919@option{-Wall}. (This option used to be called @option{-W}.  The older
2920name is still supported, but the newer name is more descriptive.)
2921
2922@gccoptlist{-Wclobbered  @gol
2923-Wempty-body  @gol
2924-Wignored-qualifiers @gol
2925-Wmissing-field-initializers  @gol
2926-Wmissing-parameter-type @r{(C only)}  @gol
2927-Wold-style-declaration @r{(C only)}  @gol
2928-Woverride-init  @gol
2929-Wsign-compare  @gol
2930-Wtype-limits  @gol
2931-Wuninitialized  @gol
2932-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)}  @gol
2933}
2934
2935The option @option{-Wextra} also prints warning messages for the
2936following cases:
2937
2938@itemize @bullet
2939
2940@item
2941A pointer is compared against integer zero with @samp{<}, @samp{<=},
2942@samp{>}, or @samp{>=}.
2943
2944@item
2945(C++ only) An enumerator and a non-enumerator both appear in a
2946conditional expression.
2947
2948@item
2949(C++ only) Ambiguous virtual bases.
2950
2951@item
2952(C++ only) Subscripting an array which has been declared @samp{register}.
2953
2954@item
2955(C++ only) Taking the address of a variable which has been declared
2956@samp{register}.
2957
2958@item
2959(C++ only) A base class is not initialized in a derived class' copy
2960constructor.
2961
2962@end itemize
2963
2964@item -Wchar-subscripts
2965@opindex Wchar-subscripts
2966@opindex Wno-char-subscripts
2967Warn if an array subscript has type @code{char}.  This is a common cause
2968of error, as programmers often forget that this type is signed on some
2969machines.
2970This warning is enabled by @option{-Wall}.
2971
2972@item -Wcomment
2973@opindex Wcomment
2974@opindex Wno-comment
2975Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2976comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2977This warning is enabled by @option{-Wall}.
2978
2979@item -Wformat
2980@opindex Wformat
2981@opindex Wno-format
2982@opindex ffreestanding
2983@opindex fno-builtin
2984Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2985the arguments supplied have types appropriate to the format string
2986specified, and that the conversions specified in the format string make
2987sense.  This includes standard functions, and others specified by format
2988attributes (@pxref{Function Attributes}), in the @code{printf},
2989@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2990not in the C standard) families (or other target-specific families).
2991Which functions are checked without format attributes having been
2992specified depends on the standard version selected, and such checks of
2993functions without the attribute specified are disabled by
2994@option{-ffreestanding} or @option{-fno-builtin}.
2995
2996The formats are checked against the format features supported by GNU
2997libc version 2.2.  These include all ISO C90 and C99 features, as well
2998as features from the Single Unix Specification and some BSD and GNU
2999extensions.  Other library implementations may not support all these
3000features; GCC does not support warning about features that go beyond a
3001particular library's limitations.  However, if @option{-pedantic} is used
3002with @option{-Wformat}, warnings will be given about format features not
3003in the selected standard version (but not for @code{strfmon} formats,
3004since those are not in any version of the C standard).  @xref{C Dialect
3005Options,,Options Controlling C Dialect}.
3006
3007Since @option{-Wformat} also checks for null format arguments for
3008several functions, @option{-Wformat} also implies @option{-Wnonnull}.
3009
3010@option{-Wformat} is included in @option{-Wall}.  For more control over some
3011aspects of format checking, the options @option{-Wformat-y2k},
3012@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
3013@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
3014@option{-Wformat=2} are available, but are not included in @option{-Wall}.
3015
3016@item -Wformat-y2k
3017@opindex Wformat-y2k
3018@opindex Wno-format-y2k
3019If @option{-Wformat} is specified, also warn about @code{strftime}
3020formats which may yield only a two-digit year.
3021
3022@item -Wno-format-contains-nul
3023@opindex Wno-format-contains-nul
3024@opindex Wformat-contains-nul
3025If @option{-Wformat} is specified, do not warn about format strings that
3026contain NUL bytes.
3027
3028@item -Wno-format-extra-args
3029@opindex Wno-format-extra-args
3030@opindex Wformat-extra-args
3031If @option{-Wformat} is specified, do not warn about excess arguments to a
3032@code{printf} or @code{scanf} format function.  The C standard specifies
3033that such arguments are ignored.
3034
3035Where the unused arguments lie between used arguments that are
3036specified with @samp{$} operand number specifications, normally
3037warnings are still given, since the implementation could not know what
3038type to pass to @code{va_arg} to skip the unused arguments.  However,
3039in the case of @code{scanf} formats, this option will suppress the
3040warning if the unused arguments are all pointers, since the Single
3041Unix Specification says that such unused arguments are allowed.
3042
3043@item -Wno-format-zero-length @r{(C and Objective-C only)}
3044@opindex Wno-format-zero-length
3045@opindex Wformat-zero-length
3046If @option{-Wformat} is specified, do not warn about zero-length formats.
3047The C standard specifies that zero-length formats are allowed.
3048
3049@item -Wformat-nonliteral
3050@opindex Wformat-nonliteral
3051@opindex Wno-format-nonliteral
3052If @option{-Wformat} is specified, also warn if the format string is not a
3053string literal and so cannot be checked, unless the format function
3054takes its format arguments as a @code{va_list}.
3055
3056@item -Wformat-security
3057@opindex Wformat-security
3058@opindex Wno-format-security
3059If @option{-Wformat} is specified, also warn about uses of format
3060functions that represent possible security problems.  At present, this
3061warns about calls to @code{printf} and @code{scanf} functions where the
3062format string is not a string literal and there are no format arguments,
3063as in @code{printf (foo);}.  This may be a security hole if the format
3064string came from untrusted input and contains @samp{%n}.  (This is
3065currently a subset of what @option{-Wformat-nonliteral} warns about, but
3066in future warnings may be added to @option{-Wformat-security} that are not
3067included in @option{-Wformat-nonliteral}.)
3068
3069@item -Wformat=2
3070@opindex Wformat=2
3071@opindex Wno-format=2
3072Enable @option{-Wformat} plus format checks not included in
3073@option{-Wformat}.  Currently equivalent to @samp{-Wformat
3074-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
3075
3076@item -Wnonnull @r{(C and Objective-C only)}
3077@opindex Wnonnull
3078@opindex Wno-nonnull
3079Warn about passing a null pointer for arguments marked as
3080requiring a non-null value by the @code{nonnull} function attribute.
3081
3082@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
3083can be disabled with the @option{-Wno-nonnull} option.
3084
3085@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3086@opindex Winit-self
3087@opindex Wno-init-self
3088Warn about uninitialized variables which are initialized with themselves.
3089Note this option can only be used with the @option{-Wuninitialized} option.
3090
3091For example, GCC will warn about @code{i} being uninitialized in the
3092following snippet only when @option{-Winit-self} has been specified:
3093@smallexample
3094@group
3095int f()
3096@{
3097  int i = i;
3098  return i;
3099@}
3100@end group
3101@end smallexample
3102
3103@item -Wimplicit-int @r{(C and Objective-C only)}
3104@opindex Wimplicit-int
3105@opindex Wno-implicit-int
3106Warn when a declaration does not specify a type.
3107This warning is enabled by @option{-Wall}.
3108
3109@item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3110@opindex Wimplicit-function-declaration
3111@opindex Wno-implicit-function-declaration
3112Give a warning whenever a function is used before being declared. In
3113C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3114enabled by default and it is made into an error by
3115@option{-pedantic-errors}. This warning is also enabled by
3116@option{-Wall}.
3117
3118@item -Wimplicit
3119@opindex Wimplicit
3120@opindex Wno-implicit
3121Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3122This warning is enabled by @option{-Wall}.
3123
3124@item -Wignored-qualifiers @r{(C and C++ only)}
3125@opindex Wignored-qualifiers
3126@opindex Wno-ignored-qualifiers
3127Warn if the return type of a function has a type qualifier
3128such as @code{const}.  For ISO C such a type qualifier has no effect,
3129since the value returned by a function is not an lvalue.
3130For C++, the warning is only emitted for scalar types or @code{void}.
3131ISO C prohibits qualified @code{void} return types on function
3132definitions, so such return types always receive a warning
3133even without this option.
3134
3135This warning is also enabled by @option{-Wextra}.
3136
3137@item -Wmain
3138@opindex Wmain
3139@opindex Wno-main
3140Warn if the type of @samp{main} is suspicious.  @samp{main} should be
3141a function with external linkage, returning int, taking either zero
3142arguments, two, or three arguments of appropriate types.  This warning
3143is enabled by default in C++ and is enabled by either @option{-Wall}
3144or @option{-pedantic}.
3145
3146@item -Wmissing-braces
3147@opindex Wmissing-braces
3148@opindex Wno-missing-braces
3149Warn if an aggregate or union initializer is not fully bracketed.  In
3150the following example, the initializer for @samp{a} is not fully
3151bracketed, but that for @samp{b} is fully bracketed.
3152
3153@smallexample
3154int a[2][2] = @{ 0, 1, 2, 3 @};
3155int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3156@end smallexample
3157
3158This warning is enabled by @option{-Wall}.
3159
3160@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3161@opindex Wmissing-include-dirs
3162@opindex Wno-missing-include-dirs
3163Warn if a user-supplied include directory does not exist.
3164
3165@item -Wparentheses
3166@opindex Wparentheses
3167@opindex Wno-parentheses
3168Warn if parentheses are omitted in certain contexts, such
3169as when there is an assignment in a context where a truth value
3170is expected, or when operators are nested whose precedence people
3171often get confused about.
3172
3173Also warn if a comparison like @samp{x<=y<=z} appears; this is
3174equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3175interpretation from that of ordinary mathematical notation.
3176
3177Also warn about constructions where there may be confusion to which
3178@code{if} statement an @code{else} branch belongs.  Here is an example of
3179such a case:
3180
3181@smallexample
3182@group
3183@{
3184  if (a)
3185    if (b)
3186      foo ();
3187  else
3188    bar ();
3189@}
3190@end group
3191@end smallexample
3192
3193In C/C++, every @code{else} branch belongs to the innermost possible
3194@code{if} statement, which in this example is @code{if (b)}.  This is
3195often not what the programmer expected, as illustrated in the above
3196example by indentation the programmer chose.  When there is the
3197potential for this confusion, GCC will issue a warning when this flag
3198is specified.  To eliminate the warning, add explicit braces around
3199the innermost @code{if} statement so there is no way the @code{else}
3200could belong to the enclosing @code{if}.  The resulting code would
3201look like this:
3202
3203@smallexample
3204@group
3205@{
3206  if (a)
3207    @{
3208      if (b)
3209        foo ();
3210      else
3211        bar ();
3212    @}
3213@}
3214@end group
3215@end smallexample
3216
3217This warning is enabled by @option{-Wall}.
3218
3219@item -Wsequence-point
3220@opindex Wsequence-point
3221@opindex Wno-sequence-point
3222Warn about code that may have undefined semantics because of violations
3223of sequence point rules in the C and C++ standards.
3224
3225The C and C++ standards defines the order in which expressions in a C/C++
3226program are evaluated in terms of @dfn{sequence points}, which represent
3227a partial ordering between the execution of parts of the program: those
3228executed before the sequence point, and those executed after it.  These
3229occur after the evaluation of a full expression (one which is not part
3230of a larger expression), after the evaluation of the first operand of a
3231@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3232function is called (but after the evaluation of its arguments and the
3233expression denoting the called function), and in certain other places.
3234Other than as expressed by the sequence point rules, the order of
3235evaluation of subexpressions of an expression is not specified.  All
3236these rules describe only a partial order rather than a total order,
3237since, for example, if two functions are called within one expression
3238with no sequence point between them, the order in which the functions
3239are called is not specified.  However, the standards committee have
3240ruled that function calls do not overlap.
3241
3242It is not specified when between sequence points modifications to the
3243values of objects take effect.  Programs whose behavior depends on this
3244have undefined behavior; the C and C++ standards specify that ``Between
3245the previous and next sequence point an object shall have its stored
3246value modified at most once by the evaluation of an expression.
3247Furthermore, the prior value shall be read only to determine the value
3248to be stored.''.  If a program breaks these rules, the results on any
3249particular implementation are entirely unpredictable.
3250
3251Examples of code with undefined behavior are @code{a = a++;},
3252@code{a[n] = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases
3253are not diagnosed by this option, and it may give an occasional false
3254positive result, but in general it has been found fairly effective at
3255detecting this sort of problem in programs.
3256
3257The standard is worded confusingly, therefore there is some debate
3258over the precise meaning of the sequence point rules in subtle cases.
3259Links to discussions of the problem, including proposed formal
3260definitions, may be found on the GCC readings page, at
3261@w{@uref{http://gcc.gnu.org/readings.html}}.
3262
3263This warning is enabled by @option{-Wall} for C and C++.
3264
3265@item -Wreturn-type
3266@opindex Wreturn-type
3267@opindex Wno-return-type
3268Warn whenever a function is defined with a return-type that defaults
3269to @code{int}.  Also warn about any @code{return} statement with no
3270return-value in a function whose return-type is not @code{void}
3271(falling off the end of the function body is considered returning
3272without a value), and about a @code{return} statement with an
3273expression in a function whose return-type is @code{void}.
3274
3275For C++, a function without return type always produces a diagnostic
3276message, even when @option{-Wno-return-type} is specified.  The only
3277exceptions are @samp{main} and functions defined in system headers.
3278
3279This warning is enabled by @option{-Wall}.
3280
3281@item -Wswitch
3282@opindex Wswitch
3283@opindex Wno-switch
3284Warn whenever a @code{switch} statement has an index of enumerated type
3285and lacks a @code{case} for one or more of the named codes of that
3286enumeration.  (The presence of a @code{default} label prevents this
3287warning.)  @code{case} labels outside the enumeration range also
3288provoke warnings when this option is used (even if there is a
3289@code{default} label).
3290This warning is enabled by @option{-Wall}.
3291
3292@item -Wswitch-default
3293@opindex Wswitch-default
3294@opindex Wno-switch-default
3295Warn whenever a @code{switch} statement does not have a @code{default}
3296case.
3297
3298@item -Wswitch-enum
3299@opindex Wswitch-enum
3300@opindex Wno-switch-enum
3301Warn whenever a @code{switch} statement has an index of enumerated type
3302and lacks a @code{case} for one or more of the named codes of that
3303enumeration.  @code{case} labels outside the enumeration range also
3304provoke warnings when this option is used.  The only difference
3305between @option{-Wswitch} and this option is that this option gives a
3306warning about an omitted enumeration code even if there is a
3307@code{default} label.
3308
3309@item -Wsync-nand @r{(C and C++ only)}
3310@opindex Wsync-nand
3311@opindex Wno-sync-nand
3312Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3313built-in functions are used.  These functions changed semantics in GCC 4.4.
3314
3315@item -Wtrigraphs
3316@opindex Wtrigraphs
3317@opindex Wno-trigraphs
3318Warn if any trigraphs are encountered that might change the meaning of
3319the program (trigraphs within comments are not warned about).
3320This warning is enabled by @option{-Wall}.
3321
3322@item -Wunused-function
3323@opindex Wunused-function
3324@opindex Wno-unused-function
3325Warn whenever a static function is declared but not defined or a
3326non-inline static function is unused.
3327This warning is enabled by @option{-Wall}.
3328
3329@item -Wunused-label
3330@opindex Wunused-label
3331@opindex Wno-unused-label
3332Warn whenever a label is declared but not used.
3333This warning is enabled by @option{-Wall}.
3334
3335To suppress this warning use the @samp{unused} attribute
3336(@pxref{Variable Attributes}).
3337
3338@item -Wunused-parameter
3339@opindex Wunused-parameter
3340@opindex Wno-unused-parameter
3341Warn whenever a function parameter is unused aside from its declaration.
3342
3343To suppress this warning use the @samp{unused} attribute
3344(@pxref{Variable Attributes}).
3345
3346@item -Wno-unused-result
3347@opindex Wunused-result
3348@opindex Wno-unused-result
3349Do not warn if a caller of a function marked with attribute
3350@code{warn_unused_result} (@pxref{Variable Attributes}) does not use
3351its return value. The default is @option{-Wunused-result}.
3352
3353@item -Wunused-variable
3354@opindex Wunused-variable
3355@opindex Wno-unused-variable
3356Warn whenever a local variable or non-constant static variable is unused
3357aside from its declaration.
3358This warning is enabled by @option{-Wall}.
3359
3360To suppress this warning use the @samp{unused} attribute
3361(@pxref{Variable Attributes}).
3362
3363@item -Wunused-value
3364@opindex Wunused-value
3365@opindex Wno-unused-value
3366Warn whenever a statement computes a result that is explicitly not
3367used. To suppress this warning cast the unused expression to
3368@samp{void}. This includes an expression-statement or the left-hand
3369side of a comma expression that contains no side effects. For example,
3370an expression such as @samp{x[i,j]} will cause a warning, while
3371@samp{x[(void)i,j]} will not.
3372
3373This warning is enabled by @option{-Wall}.
3374
3375@item -Wunused
3376@opindex Wunused
3377@opindex Wno-unused
3378All the above @option{-Wunused} options combined.
3379
3380In order to get a warning about an unused function parameter, you must
3381either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3382@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3383
3384@item -Wuninitialized
3385@opindex Wuninitialized
3386@opindex Wno-uninitialized
3387Warn if an automatic variable is used without first being initialized
3388or if a variable may be clobbered by a @code{setjmp} call. In C++,
3389warn if a non-static reference or non-static @samp{const} member
3390appears in a class without constructors.
3391
3392If you want to warn about code which uses the uninitialized value of the
3393variable in its own initializer, use the @option{-Winit-self} option.
3394
3395These warnings occur for individual uninitialized or clobbered
3396elements of structure, union or array variables as well as for
3397variables which are uninitialized or clobbered as a whole.  They do
3398not occur for variables or elements declared @code{volatile}.  Because
3399these warnings depend on optimization, the exact variables or elements
3400for which there are warnings will depend on the precise optimization
3401options and version of GCC used.
3402
3403Note that there may be no warning about a variable that is used only
3404to compute a value that itself is never used, because such
3405computations may be deleted by data flow analysis before the warnings
3406are printed.
3407
3408These warnings are made optional because GCC is not smart
3409enough to see all the reasons why the code might be correct
3410despite appearing to have an error.  Here is one example of how
3411this can happen:
3412
3413@smallexample
3414@group
3415@{
3416  int x;
3417  switch (y)
3418    @{
3419    case 1: x = 1;
3420      break;
3421    case 2: x = 4;
3422      break;
3423    case 3: x = 5;
3424    @}
3425  foo (x);
3426@}
3427@end group
3428@end smallexample
3429
3430@noindent
3431If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3432always initialized, but GCC doesn't know this.  Here is
3433another common case:
3434
3435@smallexample
3436@{
3437  int save_y;
3438  if (change_y) save_y = y, y = new_y;
3439  @dots{}
3440  if (change_y) y = save_y;
3441@}
3442@end smallexample
3443
3444@noindent
3445This has no bug because @code{save_y} is used only if it is set.
3446
3447@cindex @code{longjmp} warnings
3448This option also warns when a non-volatile automatic variable might be
3449changed by a call to @code{longjmp}.  These warnings as well are possible
3450only in optimizing compilation.
3451
3452The compiler sees only the calls to @code{setjmp}.  It cannot know
3453where @code{longjmp} will be called; in fact, a signal handler could
3454call it at any point in the code.  As a result, you may get a warning
3455even when there is in fact no problem because @code{longjmp} cannot
3456in fact be called at the place which would cause a problem.
3457
3458Some spurious warnings can be avoided if you declare all the functions
3459you use that never return as @code{noreturn}.  @xref{Function
3460Attributes}.
3461
3462This warning is enabled by @option{-Wall} or @option{-Wextra}.
3463
3464@item -Wunknown-pragmas
3465@opindex Wunknown-pragmas
3466@opindex Wno-unknown-pragmas
3467@cindex warning for unknown pragmas
3468@cindex unknown pragmas, warning
3469@cindex pragmas, warning of unknown
3470Warn when a #pragma directive is encountered which is not understood by
3471GCC@.  If this command line option is used, warnings will even be issued
3472for unknown pragmas in system header files.  This is not the case if
3473the warnings were only enabled by the @option{-Wall} command line option.
3474
3475@item -Wno-pragmas
3476@opindex Wno-pragmas
3477@opindex Wpragmas
3478Do not warn about misuses of pragmas, such as incorrect parameters,
3479invalid syntax, or conflicts between pragmas.  See also
3480@samp{-Wunknown-pragmas}.
3481
3482@item -Wstrict-aliasing
3483@opindex Wstrict-aliasing
3484@opindex Wno-strict-aliasing
3485This option is only active when @option{-fstrict-aliasing} is active.
3486It warns about code which might break the strict aliasing rules that the
3487compiler is using for optimization.  The warning does not catch all
3488cases, but does attempt to catch the more common pitfalls.  It is
3489included in @option{-Wall}.
3490It is equivalent to @option{-Wstrict-aliasing=3}
3491
3492@item -Wstrict-aliasing=n
3493@opindex Wstrict-aliasing=n
3494@opindex Wno-strict-aliasing=n
3495This option is only active when @option{-fstrict-aliasing} is active.
3496It warns about code which might break the strict aliasing rules that the
3497compiler is using for optimization.
3498Higher levels correspond to higher accuracy (fewer false positives).
3499Higher levels also correspond to more effort, similar to the way -O works.
3500@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3501with n=3.
3502
3503Level 1: Most aggressive, quick, least accurate.
3504Possibly useful when higher levels
3505do not warn but -fstrict-aliasing still breaks the code, as it has very few
3506false negatives.  However, it has many false positives.
3507Warns for all pointer conversions between possibly incompatible types,
3508even if never dereferenced.  Runs in the frontend only.
3509
3510Level 2: Aggressive, quick, not too precise.
3511May still have many false positives (not as many as level 1 though),
3512and few false negatives (but possibly more than level 1).
3513Unlike level 1, it only warns when an address is taken.  Warns about
3514incomplete types.  Runs in the frontend only.
3515
3516Level 3 (default for @option{-Wstrict-aliasing}):
3517Should have very few false positives and few false
3518negatives.  Slightly slower than levels 1 or 2 when optimization is enabled.
3519Takes care of the common pun+dereference pattern in the frontend:
3520@code{*(int*)&some_float}.
3521If optimization is enabled, it also runs in the backend, where it deals
3522with multiple statement cases using flow-sensitive points-to information.
3523Only warns when the converted pointer is dereferenced.
3524Does not warn about incomplete types.
3525
3526@item -Wstrict-overflow
3527@itemx -Wstrict-overflow=@var{n}
3528@opindex Wstrict-overflow
3529@opindex Wno-strict-overflow
3530This option is only active when @option{-fstrict-overflow} is active.
3531It warns about cases where the compiler optimizes based on the
3532assumption that signed overflow does not occur.  Note that it does not
3533warn about all cases where the code might overflow: it only warns
3534about cases where the compiler implements some optimization.  Thus
3535this warning depends on the optimization level.
3536
3537An optimization which assumes that signed overflow does not occur is
3538perfectly safe if the values of the variables involved are such that
3539overflow never does, in fact, occur.  Therefore this warning can
3540easily give a false positive: a warning about code which is not
3541actually a problem.  To help focus on important issues, several
3542warning levels are defined.  No warnings are issued for the use of
3543undefined signed overflow when estimating how many iterations a loop
3544will require, in particular when determining whether a loop will be
3545executed at all.
3546
3547@table @gcctabopt
3548@item -Wstrict-overflow=1
3549Warn about cases which are both questionable and easy to avoid.  For
3550example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3551compiler will simplify this to @code{1}.  This level of
3552@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3553are not, and must be explicitly requested.
3554
3555@item -Wstrict-overflow=2
3556Also warn about other cases where a comparison is simplified to a
3557constant.  For example: @code{abs (x) >= 0}.  This can only be
3558simplified when @option{-fstrict-overflow} is in effect, because
3559@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3560zero.  @option{-Wstrict-overflow} (with no level) is the same as
3561@option{-Wstrict-overflow=2}.
3562
3563@item -Wstrict-overflow=3
3564Also warn about other cases where a comparison is simplified.  For
3565example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3566
3567@item -Wstrict-overflow=4
3568Also warn about other simplifications not covered by the above cases.
3569For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3570
3571@item -Wstrict-overflow=5
3572Also warn about cases where the compiler reduces the magnitude of a
3573constant involved in a comparison.  For example: @code{x + 2 > y} will
3574be simplified to @code{x + 1 >= y}.  This is reported only at the
3575highest warning level because this simplification applies to many
3576comparisons, so this warning level will give a very large number of
3577false positives.
3578@end table
3579
3580@item -Warray-bounds
3581@opindex Wno-array-bounds
3582@opindex Warray-bounds
3583This option is only active when @option{-ftree-vrp} is active
3584(default for -O2 and above). It warns about subscripts to arrays
3585that are always out of bounds. This warning is enabled by @option{-Wall}.
3586
3587@item -Wno-div-by-zero
3588@opindex Wno-div-by-zero
3589@opindex Wdiv-by-zero
3590Do not warn about compile-time integer division by zero.  Floating point
3591division by zero is not warned about, as it can be a legitimate way of
3592obtaining infinities and NaNs.
3593
3594@item -Wsystem-headers
3595@opindex Wsystem-headers
3596@opindex Wno-system-headers
3597@cindex warnings from system headers
3598@cindex system headers, warnings from
3599Print warning messages for constructs found in system header files.
3600Warnings from system headers are normally suppressed, on the assumption
3601that they usually do not indicate real problems and would only make the
3602compiler output harder to read.  Using this command line option tells
3603GCC to emit warnings from system headers as if they occurred in user
3604code.  However, note that using @option{-Wall} in conjunction with this
3605option will @emph{not} warn about unknown pragmas in system
3606headers---for that, @option{-Wunknown-pragmas} must also be used.
3607
3608@item -Wfloat-equal
3609@opindex Wfloat-equal
3610@opindex Wno-float-equal
3611Warn if floating point values are used in equality comparisons.
3612
3613The idea behind this is that sometimes it is convenient (for the
3614programmer) to consider floating-point values as approximations to
3615infinitely precise real numbers.  If you are doing this, then you need
3616to compute (by analyzing the code, or in some other way) the maximum or
3617likely maximum error that the computation introduces, and allow for it
3618when performing comparisons (and when producing output, but that's a
3619different problem).  In particular, instead of testing for equality, you
3620would check to see whether the two values have ranges that overlap; and
3621this is done with the relational operators, so equality comparisons are
3622probably mistaken.
3623
3624@item -Wtraditional @r{(C and Objective-C only)}
3625@opindex Wtraditional
3626@opindex Wno-traditional
3627Warn about certain constructs that behave differently in traditional and
3628ISO C@.  Also warn about ISO C constructs that have no traditional C
3629equivalent, and/or problematic constructs which should be avoided.
3630
3631@itemize @bullet
3632@item
3633Macro parameters that appear within string literals in the macro body.
3634In traditional C macro replacement takes place within string literals,
3635but does not in ISO C@.
3636
3637@item
3638In traditional C, some preprocessor directives did not exist.
3639Traditional preprocessors would only consider a line to be a directive
3640if the @samp{#} appeared in column 1 on the line.  Therefore
3641@option{-Wtraditional} warns about directives that traditional C
3642understands but would ignore because the @samp{#} does not appear as the
3643first character on the line.  It also suggests you hide directives like
3644@samp{#pragma} not understood by traditional C by indenting them.  Some
3645traditional implementations would not recognize @samp{#elif}, so it
3646suggests avoiding it altogether.
3647
3648@item
3649A function-like macro that appears without arguments.
3650
3651@item
3652The unary plus operator.
3653
3654@item
3655The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3656constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
3657constants.)  Note, these suffixes appear in macros defined in the system
3658headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3659Use of these macros in user code might normally lead to spurious
3660warnings, however GCC's integrated preprocessor has enough context to
3661avoid warning in these cases.
3662
3663@item
3664A function declared external in one block and then used after the end of
3665the block.
3666
3667@item
3668A @code{switch} statement has an operand of type @code{long}.
3669
3670@item
3671A non-@code{static} function declaration follows a @code{static} one.
3672This construct is not accepted by some traditional C compilers.
3673
3674@item
3675The ISO type of an integer constant has a different width or
3676signedness from its traditional type.  This warning is only issued if
3677the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
3678typically represent bit patterns, are not warned about.
3679
3680@item
3681Usage of ISO string concatenation is detected.
3682
3683@item
3684Initialization of automatic aggregates.
3685
3686@item
3687Identifier conflicts with labels.  Traditional C lacks a separate
3688namespace for labels.
3689
3690@item
3691Initialization of unions.  If the initializer is zero, the warning is
3692omitted.  This is done under the assumption that the zero initializer in
3693user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3694initializer warnings and relies on default initialization to zero in the
3695traditional C case.
3696
3697@item
3698Conversions by prototypes between fixed/floating point values and vice
3699versa.  The absence of these prototypes when compiling with traditional
3700C would cause serious problems.  This is a subset of the possible
3701conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3702
3703@item
3704Use of ISO C style function definitions.  This warning intentionally is
3705@emph{not} issued for prototype declarations or variadic functions
3706because these ISO C features will appear in your code when using
3707libiberty's traditional C compatibility macros, @code{PARAMS} and
3708@code{VPARAMS}.  This warning is also bypassed for nested functions
3709because that feature is already a GCC extension and thus not relevant to
3710traditional C compatibility.
3711@end itemize
3712
3713@item -Wtraditional-conversion @r{(C and Objective-C only)}
3714@opindex Wtraditional-conversion
3715@opindex Wno-traditional-conversion
3716Warn if a prototype causes a type conversion that is different from what
3717would happen to the same argument in the absence of a prototype.  This
3718includes conversions of fixed point to floating and vice versa, and
3719conversions changing the width or signedness of a fixed point argument
3720except when the same as the default promotion.
3721
3722@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
3723@opindex Wdeclaration-after-statement
3724@opindex Wno-declaration-after-statement
3725Warn when a declaration is found after a statement in a block.  This
3726construct, known from C++, was introduced with ISO C99 and is by default
3727allowed in GCC@.  It is not supported by ISO C90 and was not supported by
3728GCC versions before GCC 3.0.  @xref{Mixed Declarations}.
3729
3730@item -Wundef
3731@opindex Wundef
3732@opindex Wno-undef
3733Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3734
3735@item -Wno-endif-labels
3736@opindex Wno-endif-labels
3737@opindex Wendif-labels
3738Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3739
3740@item -Wshadow
3741@opindex Wshadow
3742@opindex Wno-shadow
3743Warn whenever a local variable shadows another local variable, parameter or
3744global variable or whenever a built-in function is shadowed.
3745
3746@item -Wlarger-than=@var{len}
3747@opindex Wlarger-than=@var{len}
3748@opindex Wlarger-than-@var{len}
3749Warn whenever an object of larger than @var{len} bytes is defined.
3750
3751@item -Wframe-larger-than=@var{len}
3752@opindex Wframe-larger-than
3753Warn if the size of a function frame is larger than @var{len} bytes.
3754The computation done to determine the stack frame size is approximate
3755and not conservative.
3756The actual requirements may be somewhat greater than @var{len}
3757even if you do not get a warning.  In addition, any space allocated
3758via @code{alloca}, variable-length arrays, or related constructs
3759is not included by the compiler when determining
3760whether or not to issue a warning.
3761
3762@item -Wunsafe-loop-optimizations
3763@opindex Wunsafe-loop-optimizations
3764@opindex Wno-unsafe-loop-optimizations
3765Warn if the loop cannot be optimized because the compiler could not
3766assume anything on the bounds of the loop indices.  With
3767@option{-funsafe-loop-optimizations} warn if the compiler made
3768such assumptions.
3769
3770@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
3771@opindex Wno-pedantic-ms-format
3772@opindex Wpedantic-ms-format
3773Disables the warnings about non-ISO @code{printf} / @code{scanf} format
3774width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
3775depending on the MS runtime, when you are using the options @option{-Wformat}
3776and @option{-pedantic} without gnu-extensions.
3777
3778@item -Wpointer-arith
3779@opindex Wpointer-arith
3780@opindex Wno-pointer-arith
3781Warn about anything that depends on the ``size of'' a function type or
3782of @code{void}.  GNU C assigns these types a size of 1, for
3783convenience in calculations with @code{void *} pointers and pointers
3784to functions.  In C++, warn also when an arithmetic operation involves
3785@code{NULL}.  This warning is also enabled by @option{-pedantic}.
3786
3787@item -Wtype-limits
3788@opindex Wtype-limits
3789@opindex Wno-type-limits
3790Warn if a comparison is always true or always false due to the limited
3791range of the data type, but do not warn for constant expressions.  For
3792example, warn if an unsigned variable is compared against zero with
3793@samp{<} or @samp{>=}.  This warning is also enabled by
3794@option{-Wextra}.
3795
3796@item -Wbad-function-cast @r{(C and Objective-C only)}
3797@opindex Wbad-function-cast
3798@opindex Wno-bad-function-cast
3799Warn whenever a function call is cast to a non-matching type.
3800For example, warn if @code{int malloc()} is cast to @code{anything *}.
3801
3802@item -Wc++-compat @r{(C and Objective-C only)}
3803Warn about ISO C constructs that are outside of the common subset of
3804ISO C and ISO C++, e.g.@: request for implicit conversion from
3805@code{void *} to a pointer to non-@code{void} type.
3806
3807@item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3808Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3809ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
3810in ISO C++ 200x.  This warning is enabled by @option{-Wall}.
3811
3812@item -Wcast-qual
3813@opindex Wcast-qual
3814@opindex Wno-cast-qual
3815Warn whenever a pointer is cast so as to remove a type qualifier from
3816the target type.  For example, warn if a @code{const char *} is cast
3817to an ordinary @code{char *}.
3818
3819Also warn when making a cast which introduces a type qualifier in an
3820unsafe way.  For example, casting @code{char **} to @code{const char **}
3821is unsafe, as in this example:
3822
3823@smallexample
3824  /* p is char ** value.  */
3825  const char **q = (const char **) p;
3826  /* Assignment of readonly string to const char * is OK.  */
3827  *q = "string";
3828  /* Now char** pointer points to read-only memory.  */
3829  **p = 'b';
3830@end smallexample
3831
3832@item -Wcast-align
3833@opindex Wcast-align
3834@opindex Wno-cast-align
3835Warn whenever a pointer is cast such that the required alignment of the
3836target is increased.  For example, warn if a @code{char *} is cast to
3837an @code{int *} on machines where integers can only be accessed at
3838two- or four-byte boundaries.
3839
3840@item -Wwrite-strings
3841@opindex Wwrite-strings
3842@opindex Wno-write-strings
3843When compiling C, give string constants the type @code{const
3844char[@var{length}]} so that copying the address of one into a
3845non-@code{const} @code{char *} pointer will get a warning.  These
3846warnings will help you find at compile time code that can try to write
3847into a string constant, but only if you have been very careful about
3848using @code{const} in declarations and prototypes.  Otherwise, it will
3849just be a nuisance. This is why we did not make @option{-Wall} request
3850these warnings.
3851
3852When compiling C++, warn about the deprecated conversion from string
3853literals to @code{char *}.  This warning is enabled by default for C++
3854programs.
3855
3856@item -Wclobbered
3857@opindex Wclobbered
3858@opindex Wno-clobbered
3859Warn for variables that might be changed by @samp{longjmp} or
3860@samp{vfork}.  This warning is also enabled by @option{-Wextra}.
3861
3862@item -Wconversion
3863@opindex Wconversion
3864@opindex Wno-conversion
3865Warn for implicit conversions that may alter a value. This includes
3866conversions between real and integer, like @code{abs (x)} when
3867@code{x} is @code{double}; conversions between signed and unsigned,
3868like @code{unsigned ui = -1}; and conversions to smaller types, like
3869@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3870((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3871changed by the conversion like in @code{abs (2.0)}.  Warnings about
3872conversions between signed and unsigned integers can be disabled by
3873using @option{-Wno-sign-conversion}.
3874
3875For C++, also warn for confusing overload resolution for user-defined
3876conversions; and conversions that will never use a type conversion
3877operator: conversions to @code{void}, the same type, a base class or a
3878reference to them. Warnings about conversions between signed and
3879unsigned integers are disabled by default in C++ unless
3880@option{-Wsign-conversion} is explicitly enabled.
3881
3882@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
3883@opindex Wconversion-null
3884@opindex Wno-conversion-null
3885Do not warn for conversions between @code{NULL} and non-pointer
3886types. @option{-Wconversion-null} is enabled by default.
3887
3888@item -Wempty-body
3889@opindex Wempty-body
3890@opindex Wno-empty-body
3891Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
3892while} statement.  This warning is also enabled by @option{-Wextra}.
3893
3894@item -Wenum-compare
3895@opindex Wenum-compare
3896@opindex Wno-enum-compare
3897Warn about a comparison between values of different enum types. In C++
3898this warning is enabled by default.  In C this warning is enabled by
3899@option{-Wall}.
3900
3901@item -Wjump-misses-init @r{(C, Objective-C only)}
3902@opindex Wjump-misses-init
3903@opindex Wno-jump-misses-init
3904Warn if a @code{goto} statement or a @code{switch} statement jumps
3905forward across the initialization of a variable, or jumps backward to a
3906label after the variable has been initialized.  This only warns about
3907variables which are initialized when they are declared.  This warning is
3908only supported for C and Objective C; in C++ this sort of branch is an
3909error in any case.
3910
3911@option{-Wjump-misses-init} is included in @option{-Wc++-compat}.  It
3912can be disabled with the @option{-Wno-jump-misses-init} option.
3913
3914@item -Wsign-compare
3915@opindex Wsign-compare
3916@opindex Wno-sign-compare
3917@cindex warning for comparison of signed and unsigned values
3918@cindex comparison of signed and unsigned values, warning
3919@cindex signed and unsigned values, comparison warning
3920Warn when a comparison between signed and unsigned values could produce
3921an incorrect result when the signed value is converted to unsigned.
3922This warning is also enabled by @option{-Wextra}; to get the other warnings
3923of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3924
3925@item -Wsign-conversion
3926@opindex Wsign-conversion
3927@opindex Wno-sign-conversion
3928Warn for implicit conversions that may change the sign of an integer
3929value, like assigning a signed integer expression to an unsigned
3930integer variable. An explicit cast silences the warning. In C, this
3931option is enabled also by @option{-Wconversion}.
3932
3933@item -Waddress
3934@opindex Waddress
3935@opindex Wno-address
3936Warn about suspicious uses of memory addresses. These include using
3937the address of a function in a conditional expression, such as
3938@code{void func(void); if (func)}, and comparisons against the memory
3939address of a string literal, such as @code{if (x == "abc")}.  Such
3940uses typically indicate a programmer error: the address of a function
3941always evaluates to true, so their use in a conditional usually
3942indicate that the programmer forgot the parentheses in a function
3943call; and comparisons against string literals result in unspecified
3944behavior and are not portable in C, so they usually indicate that the
3945programmer intended to use @code{strcmp}.  This warning is enabled by
3946@option{-Wall}.
3947
3948@item -Wlogical-op
3949@opindex Wlogical-op
3950@opindex Wno-logical-op
3951Warn about suspicious uses of logical operators in expressions.
3952This includes using logical operators in contexts where a
3953bit-wise operator is likely to be expected.
3954
3955@item -Waggregate-return
3956@opindex Waggregate-return
3957@opindex Wno-aggregate-return
3958Warn if any functions that return structures or unions are defined or
3959called.  (In languages where you can return an array, this also elicits
3960a warning.)
3961
3962@item -Wno-attributes
3963@opindex Wno-attributes
3964@opindex Wattributes
3965Do not warn if an unexpected @code{__attribute__} is used, such as
3966unrecognized attributes, function attributes applied to variables,
3967etc.  This will not stop errors for incorrect use of supported
3968attributes.
3969
3970@item -Wno-builtin-macro-redefined
3971@opindex Wno-builtin-macro-redefined
3972@opindex Wbuiltin-macro-redefined
3973Do not warn if certain built-in macros are redefined.  This suppresses
3974warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
3975@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
3976
3977@item -Wstrict-prototypes @r{(C and Objective-C only)}
3978@opindex Wstrict-prototypes
3979@opindex Wno-strict-prototypes
3980Warn if a function is declared or defined without specifying the
3981argument types.  (An old-style function definition is permitted without
3982a warning if preceded by a declaration which specifies the argument
3983types.)
3984
3985@item -Wold-style-declaration @r{(C and Objective-C only)}
3986@opindex Wold-style-declaration
3987@opindex Wno-old-style-declaration
3988Warn for obsolescent usages, according to the C Standard, in a
3989declaration. For example, warn if storage-class specifiers like
3990@code{static} are not the first things in a declaration.  This warning
3991is also enabled by @option{-Wextra}.
3992
3993@item -Wold-style-definition @r{(C and Objective-C only)}
3994@opindex Wold-style-definition
3995@opindex Wno-old-style-definition
3996Warn if an old-style function definition is used.  A warning is given
3997even if there is a previous prototype.
3998
3999@item -Wmissing-parameter-type @r{(C and Objective-C only)}
4000@opindex Wmissing-parameter-type
4001@opindex Wno-missing-parameter-type
4002A function parameter is declared without a type specifier in K&R-style
4003functions:
4004
4005@smallexample
4006void foo(bar) @{ @}
4007@end smallexample
4008
4009This warning is also enabled by @option{-Wextra}.
4010
4011@item -Wmissing-prototypes @r{(C and Objective-C only)}
4012@opindex Wmissing-prototypes
4013@opindex Wno-missing-prototypes
4014Warn if a global function is defined without a previous prototype
4015declaration.  This warning is issued even if the definition itself
4016provides a prototype.  The aim is to detect global functions that fail
4017to be declared in header files.
4018
4019@item -Wmissing-declarations
4020@opindex Wmissing-declarations
4021@opindex Wno-missing-declarations
4022Warn if a global function is defined without a previous declaration.
4023Do so even if the definition itself provides a prototype.
4024Use this option to detect global functions that are not declared in
4025header files.  In C++, no warnings are issued for function templates,
4026or for inline functions, or for functions in anonymous namespaces.
4027
4028@item -Wmissing-field-initializers
4029@opindex Wmissing-field-initializers
4030@opindex Wno-missing-field-initializers
4031@opindex W
4032@opindex Wextra
4033@opindex Wno-extra
4034Warn if a structure's initializer has some fields missing.  For
4035example, the following code would cause such a warning, because
4036@code{x.h} is implicitly zero:
4037
4038@smallexample
4039struct s @{ int f, g, h; @};
4040struct s x = @{ 3, 4 @};
4041@end smallexample
4042
4043This option does not warn about designated initializers, so the following
4044modification would not trigger a warning:
4045
4046@smallexample
4047struct s @{ int f, g, h; @};
4048struct s x = @{ .f = 3, .g = 4 @};
4049@end smallexample
4050
4051This warning is included in @option{-Wextra}.  To get other @option{-Wextra}
4052warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
4053
4054@item -Wmissing-noreturn
4055@opindex Wmissing-noreturn
4056@opindex Wno-missing-noreturn
4057Warn about functions which might be candidates for attribute @code{noreturn}.
4058Note these are only possible candidates, not absolute ones.  Care should
4059be taken to manually verify functions actually do not ever return before
4060adding the @code{noreturn} attribute, otherwise subtle code generation
4061bugs could be introduced.  You will not get a warning for @code{main} in
4062hosted C environments.
4063
4064@item -Wmissing-format-attribute
4065@opindex Wmissing-format-attribute
4066@opindex Wno-missing-format-attribute
4067@opindex Wformat
4068@opindex Wno-format
4069Warn about function pointers which might be candidates for @code{format}
4070attributes.  Note these are only possible candidates, not absolute ones.
4071GCC will guess that function pointers with @code{format} attributes that
4072are used in assignment, initialization, parameter passing or return
4073statements should have a corresponding @code{format} attribute in the
4074resulting type.  I.e.@: the left-hand side of the assignment or
4075initialization, the type of the parameter variable, or the return type
4076of the containing function respectively should also have a @code{format}
4077attribute to avoid the warning.
4078
4079GCC will also warn about function definitions which might be
4080candidates for @code{format} attributes.  Again, these are only
4081possible candidates.  GCC will guess that @code{format} attributes
4082might be appropriate for any function that calls a function like
4083@code{vprintf} or @code{vscanf}, but this might not always be the
4084case, and some functions for which @code{format} attributes are
4085appropriate may not be detected.
4086
4087@item -Wno-multichar
4088@opindex Wno-multichar
4089@opindex Wmultichar
4090Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4091Usually they indicate a typo in the user's code, as they have
4092implementation-defined values, and should not be used in portable code.
4093
4094@item -Wnormalized=<none|id|nfc|nfkc>
4095@opindex Wnormalized=
4096@cindex NFC
4097@cindex NFKC
4098@cindex character set, input normalization
4099In ISO C and ISO C++, two identifiers are different if they are
4100different sequences of characters.  However, sometimes when characters
4101outside the basic ASCII character set are used, you can have two
4102different character sequences that look the same.  To avoid confusion,
4103the ISO 10646 standard sets out some @dfn{normalization rules} which
4104when applied ensure that two sequences that look the same are turned into
4105the same sequence.  GCC can warn you if you are using identifiers which
4106have not been normalized; this option controls that warning.
4107
4108There are four levels of warning that GCC supports.  The default is
4109@option{-Wnormalized=nfc}, which warns about any identifier which is
4110not in the ISO 10646 ``C'' normalized form, @dfn{NFC}.  NFC is the
4111recommended form for most uses.
4112
4113Unfortunately, there are some characters which ISO C and ISO C++ allow
4114in identifiers that when turned into NFC aren't allowable as
4115identifiers.  That is, there's no way to use these symbols in portable
4116ISO C or C++ and have all your identifiers in NFC@.
4117@option{-Wnormalized=id} suppresses the warning for these characters.
4118It is hoped that future versions of the standards involved will correct
4119this, which is why this option is not the default.
4120
4121You can switch the warning off for all characters by writing
4122@option{-Wnormalized=none}.  You would only want to do this if you
4123were using some other normalization scheme (like ``D''), because
4124otherwise you can easily create bugs that are literally impossible to see.
4125
4126Some characters in ISO 10646 have distinct meanings but look identical
4127in some fonts or display methodologies, especially once formatting has
4128been applied.  For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4129LETTER N'', will display just like a regular @code{n} which has been
4130placed in a superscript.  ISO 10646 defines the @dfn{NFKC}
4131normalization scheme to convert all these into a standard form as
4132well, and GCC will warn if your code is not in NFKC if you use
4133@option{-Wnormalized=nfkc}.  This warning is comparable to warning
4134about every identifier that contains the letter O because it might be
4135confused with the digit 0, and so is not the default, but may be
4136useful as a local coding convention if the programming environment is
4137unable to be fixed to display these characters distinctly.
4138
4139@item -Wno-deprecated
4140@opindex Wno-deprecated
4141@opindex Wdeprecated
4142Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
4143
4144@item -Wno-deprecated-declarations
4145@opindex Wno-deprecated-declarations
4146@opindex Wdeprecated-declarations
4147Do not warn about uses of functions (@pxref{Function Attributes}),
4148variables (@pxref{Variable Attributes}), and types (@pxref{Type
4149Attributes}) marked as deprecated by using the @code{deprecated}
4150attribute.
4151
4152@item -Wno-overflow
4153@opindex Wno-overflow
4154@opindex Woverflow
4155Do not warn about compile-time overflow in constant expressions.
4156
4157@item -Woverride-init @r{(C and Objective-C only)}
4158@opindex Woverride-init
4159@opindex Wno-override-init
4160@opindex W
4161@opindex Wextra
4162@opindex Wno-extra
4163Warn if an initialized field without side effects is overridden when
4164using designated initializers (@pxref{Designated Inits, , Designated
4165Initializers}).
4166
4167This warning is included in @option{-Wextra}.  To get other
4168@option{-Wextra} warnings without this one, use @samp{-Wextra
4169-Wno-override-init}.
4170
4171@item -Wpacked
4172@opindex Wpacked
4173@opindex Wno-packed
4174Warn if a structure is given the packed attribute, but the packed
4175attribute has no effect on the layout or size of the structure.
4176Such structures may be mis-aligned for little benefit.  For
4177instance, in this code, the variable @code{f.x} in @code{struct bar}
4178will be misaligned even though @code{struct bar} does not itself
4179have the packed attribute:
4180
4181@smallexample
4182@group
4183struct foo @{
4184  int x;
4185  char a, b, c, d;
4186@} __attribute__((packed));
4187struct bar @{
4188  char z;
4189  struct foo f;
4190@};
4191@end group
4192@end smallexample
4193
4194@item -Wpacked-bitfield-compat
4195@opindex Wpacked-bitfield-compat
4196@opindex Wno-packed-bitfield-compat
4197The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4198on bit-fields of type @code{char}.  This has been fixed in GCC 4.4 but
4199the change can lead to differences in the structure layout.  GCC
4200informs you when the offset of such a field has changed in GCC 4.4.
4201For example there is no longer a 4-bit padding between field @code{a}
4202and @code{b} in this structure:
4203
4204@smallexample
4205struct foo
4206@{
4207  char a:4;
4208  char b:8;
4209@} __attribute__ ((packed));
4210@end smallexample
4211
4212This warning is enabled by default.  Use
4213@option{-Wno-packed-bitfield-compat} to disable this warning.
4214
4215@item -Wpadded
4216@opindex Wpadded
4217@opindex Wno-padded
4218Warn if padding is included in a structure, either to align an element
4219of the structure or to align the whole structure.  Sometimes when this
4220happens it is possible to rearrange the fields of the structure to
4221reduce the padding and so make the structure smaller.
4222
4223@item -Wredundant-decls
4224@opindex Wredundant-decls
4225@opindex Wno-redundant-decls
4226Warn if anything is declared more than once in the same scope, even in
4227cases where multiple declaration is valid and changes nothing.
4228
4229@item -Wnested-externs @r{(C and Objective-C only)}
4230@opindex Wnested-externs
4231@opindex Wno-nested-externs
4232Warn if an @code{extern} declaration is encountered within a function.
4233
4234@item -Winline
4235@opindex Winline
4236@opindex Wno-inline
4237Warn if a function can not be inlined and it was declared as inline.
4238Even with this option, the compiler will not warn about failures to
4239inline functions declared in system headers.
4240
4241The compiler uses a variety of heuristics to determine whether or not
4242to inline a function.  For example, the compiler takes into account
4243the size of the function being inlined and the amount of inlining
4244that has already been done in the current function.  Therefore,
4245seemingly insignificant changes in the source program can cause the
4246warnings produced by @option{-Winline} to appear or disappear.
4247
4248@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4249@opindex Wno-invalid-offsetof
4250@opindex Winvalid-offsetof
4251Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4252type.  According to the 1998 ISO C++ standard, applying @samp{offsetof}
4253to a non-POD type is undefined.  In existing C++ implementations,
4254however, @samp{offsetof} typically gives meaningful results even when
4255applied to certain kinds of non-POD types. (Such as a simple
4256@samp{struct} that fails to be a POD type only by virtue of having a
4257constructor.)  This flag is for users who are aware that they are
4258writing nonportable code and who have deliberately chosen to ignore the
4259warning about it.
4260
4261The restrictions on @samp{offsetof} may be relaxed in a future version
4262of the C++ standard.
4263
4264@item -Wno-int-to-pointer-cast @r{(C and Objective-C only)}
4265@opindex Wno-int-to-pointer-cast
4266@opindex Wint-to-pointer-cast
4267Suppress warnings from casts to pointer type of an integer of a
4268different size.
4269
4270@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4271@opindex Wno-pointer-to-int-cast
4272@opindex Wpointer-to-int-cast
4273Suppress warnings from casts from a pointer to an integer type of a
4274different size.
4275
4276@item -Winvalid-pch
4277@opindex Winvalid-pch
4278@opindex Wno-invalid-pch
4279Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4280the search path but can't be used.
4281
4282@item -Wlong-long
4283@opindex Wlong-long
4284@opindex Wno-long-long
4285Warn if @samp{long long} type is used.  This is enabled by either
4286@option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4287modes.  To inhibit the warning messages, use @option{-Wno-long-long}.
4288
4289@item -Wvariadic-macros
4290@opindex Wvariadic-macros
4291@opindex Wno-variadic-macros
4292Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4293alternate syntax when in pedantic ISO C99 mode.  This is default.
4294To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4295
4296@item -Wvla
4297@opindex Wvla
4298@opindex Wno-vla
4299Warn if variable length array is used in the code.
4300@option{-Wno-vla} will prevent the @option{-pedantic} warning of
4301the variable length array.
4302
4303@item -Wvolatile-register-var
4304@opindex Wvolatile-register-var
4305@opindex Wno-volatile-register-var
4306Warn if a register variable is declared volatile.  The volatile
4307modifier does not inhibit all optimizations that may eliminate reads
4308and/or writes to register variables.  This warning is enabled by
4309@option{-Wall}.
4310
4311@item -Wdisabled-optimization
4312@opindex Wdisabled-optimization
4313@opindex Wno-disabled-optimization
4314Warn if a requested optimization pass is disabled.  This warning does
4315not generally indicate that there is anything wrong with your code; it
4316merely indicates that GCC's optimizers were unable to handle the code
4317effectively.  Often, the problem is that your code is too big or too
4318complex; GCC will refuse to optimize programs when the optimization
4319itself is likely to take inordinate amounts of time.
4320
4321@item -Wpointer-sign @r{(C and Objective-C only)}
4322@opindex Wpointer-sign
4323@opindex Wno-pointer-sign
4324Warn for pointer argument passing or assignment with different signedness.
4325This option is only supported for C and Objective-C@.  It is implied by
4326@option{-Wall} and by @option{-pedantic}, which can be disabled with
4327@option{-Wno-pointer-sign}.
4328
4329@item -Wstack-protector
4330@opindex Wstack-protector
4331@opindex Wno-stack-protector
4332This option is only active when @option{-fstack-protector} is active.  It
4333warns about functions that will not be protected against stack smashing.
4334
4335@item -Wno-mudflap
4336@opindex Wno-mudflap
4337Suppress warnings about constructs that cannot be instrumented by
4338@option{-fmudflap}.
4339
4340@item -Woverlength-strings
4341@opindex Woverlength-strings
4342@opindex Wno-overlength-strings
4343Warn about string constants which are longer than the ``minimum
4344maximum'' length specified in the C standard.  Modern compilers
4345generally allow string constants which are much longer than the
4346standard's minimum limit, but very portable programs should avoid
4347using longer strings.
4348
4349The limit applies @emph{after} string constant concatenation, and does
4350not count the trailing NUL@.  In C90, the limit was 509 characters; in
4351C99, it was raised to 4095.  C++98 does not specify a normative
4352minimum maximum, so we do not diagnose overlength strings in C++@.
4353
4354This option is implied by @option{-pedantic}, and can be disabled with
4355@option{-Wno-overlength-strings}.
4356
4357@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
4358@opindex Wunsuffixed-float-constants
4359
4360GCC will issue a warning for any floating constant that does not have
4361a suffix.  When used together with @option{-Wsystem-headers} it will
4362warn about such constants in system header files.  This can be useful
4363when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4364from the decimal floating-point extension to C99.
4365@end table
4366
4367@node Debugging Options
4368@section Options for Debugging Your Program or GCC
4369@cindex options, debugging
4370@cindex debugging information options
4371
4372GCC has various special options that are used for debugging
4373either your program or GCC:
4374
4375@table @gcctabopt
4376@item -g
4377@opindex g
4378Produce debugging information in the operating system's native format
4379(stabs, COFF, XCOFF, or DWARF 2)@.  GDB can work with this debugging
4380information.
4381
4382On most systems that use stabs format, @option{-g} enables use of extra
4383debugging information that only GDB can use; this extra information
4384makes debugging work better in GDB but will probably make other debuggers
4385crash or
4386refuse to read the program.  If you want to control for certain whether
4387to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
4388@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
4389
4390GCC allows you to use @option{-g} with
4391@option{-O}.  The shortcuts taken by optimized code may occasionally
4392produce surprising results: some variables you declared may not exist
4393at all; flow of control may briefly move where you did not expect it;
4394some statements may not be executed because they compute constant
4395results or their values were already at hand; some statements may
4396execute in different places because they were moved out of loops.
4397
4398Nevertheless it proves possible to debug optimized output.  This makes
4399it reasonable to use the optimizer for programs that might have bugs.
4400
4401The following options are useful when GCC is generated with the
4402capability for more than one debugging format.
4403
4404@item -ggdb
4405@opindex ggdb
4406Produce debugging information for use by GDB@.  This means to use the
4407most expressive format available (DWARF 2, stabs, or the native format
4408if neither of those are supported), including GDB extensions if at all
4409possible.
4410
4411@item -gstabs
4412@opindex gstabs
4413Produce debugging information in stabs format (if that is supported),
4414without GDB extensions.  This is the format used by DBX on most BSD
4415systems.  On MIPS, Alpha and System V Release 4 systems this option
4416produces stabs debugging output which is not understood by DBX or SDB@.
4417On System V Release 4 systems this option requires the GNU assembler.
4418
4419@item -feliminate-unused-debug-symbols
4420@opindex feliminate-unused-debug-symbols
4421Produce debugging information in stabs format (if that is supported),
4422for only symbols that are actually used.
4423
4424@item -femit-class-debug-always
4425Instead of emitting debugging information for a C++ class in only one
4426object file, emit it in all object files using the class.  This option
4427should be used only with debuggers that are unable to handle the way GCC
4428normally emits debugging information for classes because using this
4429option will increase the size of debugging information by as much as a
4430factor of two.
4431
4432@item -gstabs+
4433@opindex gstabs+
4434Produce debugging information in stabs format (if that is supported),
4435using GNU extensions understood only by the GNU debugger (GDB)@.  The
4436use of these extensions is likely to make other debuggers crash or
4437refuse to read the program.
4438
4439@item -gcoff
4440@opindex gcoff
4441Produce debugging information in COFF format (if that is supported).
4442This is the format used by SDB on most System V systems prior to
4443System V Release 4.
4444
4445@item -gxcoff
4446@opindex gxcoff
4447Produce debugging information in XCOFF format (if that is supported).
4448This is the format used by the DBX debugger on IBM RS/6000 systems.
4449
4450@item -gxcoff+
4451@opindex gxcoff+
4452Produce debugging information in XCOFF format (if that is supported),
4453using GNU extensions understood only by the GNU debugger (GDB)@.  The
4454use of these extensions is likely to make other debuggers crash or
4455refuse to read the program, and may cause assemblers other than the GNU
4456assembler (GAS) to fail with an error.
4457
4458@item -gdwarf-@var{version}
4459@opindex gdwarf-@var{version}
4460Produce debugging information in DWARF format (if that is
4461supported).  This is the format used by DBX on IRIX 6.  The value
4462of @var{version} may be either 2, 3 or 4; the default version is 2.
4463
4464Note that with DWARF version 2 some ports require, and will always
4465use, some non-conflicting DWARF 3 extensions in the unwind tables.
4466
4467Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
4468for maximum benefit.
4469
4470@item -gstrict-dwarf
4471@opindex gstrict-dwarf
4472Disallow using extensions of later DWARF standard version than selected
4473with @option{-gdwarf-@var{version}}.  On most targets using non-conflicting
4474DWARF extensions from later standard versions is allowed.
4475
4476@item -gno-strict-dwarf
4477@opindex gno-strict-dwarf
4478Allow using extensions of later DWARF standard version than selected with
4479@option{-gdwarf-@var{version}}.
4480
4481@item -gvms
4482@opindex gvms
4483Produce debugging information in VMS debug format (if that is
4484supported).  This is the format used by DEBUG on VMS systems.
4485
4486@item -g@var{level}
4487@itemx -ggdb@var{level}
4488@itemx -gstabs@var{level}
4489@itemx -gcoff@var{level}
4490@itemx -gxcoff@var{level}
4491@itemx -gvms@var{level}
4492Request debugging information and also use @var{level} to specify how
4493much information.  The default level is 2.
4494
4495Level 0 produces no debug information at all.  Thus, @option{-g0} negates
4496@option{-g}.
4497
4498Level 1 produces minimal information, enough for making backtraces in
4499parts of the program that you don't plan to debug.  This includes
4500descriptions of functions and external variables, but no information
4501about local variables and no line numbers.
4502
4503Level 3 includes extra information, such as all the macro definitions
4504present in the program.  Some debuggers support macro expansion when
4505you use @option{-g3}.
4506
4507@option{-gdwarf-2} does not accept a concatenated debug level, because
4508GCC used to support an option @option{-gdwarf} that meant to generate
4509debug information in version 1 of the DWARF format (which is very
4510different from version 2), and it would have been too confusing.  That
4511debug format is long obsolete, but the option cannot be changed now.
4512Instead use an additional @option{-g@var{level}} option to change the
4513debug level for DWARF.
4514
4515@item -gtoggle
4516@opindex gtoggle
4517Turn off generation of debug info, if leaving out this option would have
4518generated it, or turn it on at level 2 otherwise.  The position of this
4519argument in the command line does not matter, it takes effect after all
4520other options are processed, and it does so only once, no matter how
4521many times it is given.  This is mainly intended to be used with
4522@option{-fcompare-debug}.
4523
4524@item -fdump-final-insns@r{[}=@var{file}@r{]}
4525@opindex fdump-final-insns
4526Dump the final internal representation (RTL) to @var{file}.  If the
4527optional argument is omitted (or if @var{file} is @code{.}), the name
4528of the dump file will be determined by appending @code{.gkd} to the
4529compilation output file name.
4530
4531@item -fcompare-debug@r{[}=@var{opts}@r{]}
4532@opindex fcompare-debug
4533@opindex fno-compare-debug
4534If no error occurs during compilation, run the compiler a second time,
4535adding @var{opts} and @option{-fcompare-debug-second} to the arguments
4536passed to the second compilation.  Dump the final internal
4537representation in both compilations, and print an error if they differ.
4538
4539If the equal sign is omitted, the default @option{-gtoggle} is used.
4540
4541The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
4542and nonzero, implicitly enables @option{-fcompare-debug}.  If
4543@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
4544then it is used for @var{opts}, otherwise the default @option{-gtoggle}
4545is used.
4546
4547@option{-fcompare-debug=}, with the equal sign but without @var{opts},
4548is equivalent to @option{-fno-compare-debug}, which disables the dumping
4549of the final representation and the second compilation, preventing even
4550@env{GCC_COMPARE_DEBUG} from taking effect.
4551
4552To verify full coverage during @option{-fcompare-debug} testing, set
4553@env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
4554which GCC will reject as an invalid option in any actual compilation
4555(rather than preprocessing, assembly or linking).  To get just a
4556warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
4557not overridden} will do.
4558
4559@item -fcompare-debug-second
4560@opindex fcompare-debug-second
4561This option is implicitly passed to the compiler for the second
4562compilation requested by @option{-fcompare-debug}, along with options to
4563silence warnings, and omitting other options that would cause
4564side-effect compiler outputs to files or to the standard output.  Dump
4565files and preserved temporary files are renamed so as to contain the
4566@code{.gk} additional extension during the second compilation, to avoid
4567overwriting those generated by the first.
4568
4569When this option is passed to the compiler driver, it causes the
4570@emph{first} compilation to be skipped, which makes it useful for little
4571other than debugging the compiler proper.
4572
4573@item -feliminate-dwarf2-dups
4574@opindex feliminate-dwarf2-dups
4575Compress DWARF2 debugging information by eliminating duplicated
4576information about each symbol.  This option only makes sense when
4577generating DWARF2 debugging information with @option{-gdwarf-2}.
4578
4579@item -femit-struct-debug-baseonly
4580Emit debug information for struct-like types
4581only when the base name of the compilation source file
4582matches the base name of file in which the struct was defined.
4583
4584This option substantially reduces the size of debugging information,
4585but at significant potential loss in type information to the debugger.
4586See @option{-femit-struct-debug-reduced} for a less aggressive option.
4587See @option{-femit-struct-debug-detailed} for more detailed control.
4588
4589This option works only with DWARF 2.
4590
4591@item -femit-struct-debug-reduced
4592Emit debug information for struct-like types
4593only when the base name of the compilation source file
4594matches the base name of file in which the type was defined,
4595unless the struct is a template or defined in a system header.
4596
4597This option significantly reduces the size of debugging information,
4598with some potential loss in type information to the debugger.
4599See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4600See @option{-femit-struct-debug-detailed} for more detailed control.
4601
4602This option works only with DWARF 2.
4603
4604@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4605Specify the struct-like types
4606for which the compiler will generate debug information.
4607The intent is to reduce duplicate struct debug information
4608between different object files within the same program.
4609
4610This option is a detailed version of
4611@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4612which will serve for most needs.
4613
4614A specification has the syntax
4615[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4616
4617The optional first word limits the specification to
4618structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4619A struct type is used directly when it is the type of a variable, member.
4620Indirect uses arise through pointers to structs.
4621That is, when use of an incomplete struct would be legal, the use is indirect.
4622An example is
4623@samp{struct one direct; struct two * indirect;}.
4624
4625The optional second word limits the specification to
4626ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4627Generic structs are a bit complicated to explain.
4628For C++, these are non-explicit specializations of template classes,
4629or non-template classes within the above.
4630Other programming languages have generics,
4631but @samp{-femit-struct-debug-detailed} does not yet implement them.
4632
4633The third word specifies the source files for those
4634structs for which the compiler will emit debug information.
4635The values @samp{none} and @samp{any} have the normal meaning.
4636The value @samp{base} means that
4637the base of name of the file in which the type declaration appears
4638must match the base of the name of the main compilation file.
4639In practice, this means that
4640types declared in @file{foo.c} and @file{foo.h} will have debug information,
4641but types declared in other header will not.
4642The value @samp{sys} means those types satisfying @samp{base}
4643or declared in system or compiler headers.
4644
4645You may need to experiment to determine the best settings for your application.
4646
4647The default is @samp{-femit-struct-debug-detailed=all}.
4648
4649This option works only with DWARF 2.
4650
4651@item -fenable-icf-debug
4652@opindex fenable-icf-debug
4653Generate additional debug information to support identical code folding (ICF).
4654This option only works with DWARF version 2 or higher.
4655
4656@item -fno-merge-debug-strings
4657@opindex fmerge-debug-strings
4658@opindex fno-merge-debug-strings
4659Direct the linker to not merge together strings in the debugging
4660information which are identical in different object files.  Merging is
4661not supported by all assemblers or linkers.  Merging decreases the size
4662of the debug information in the output file at the cost of increasing
4663link processing time.  Merging is enabled by default.
4664
4665@item -fdebug-prefix-map=@var{old}=@var{new}
4666@opindex fdebug-prefix-map
4667When compiling files in directory @file{@var{old}}, record debugging
4668information describing them as in @file{@var{new}} instead.
4669
4670@item -fno-dwarf2-cfi-asm
4671@opindex fdwarf2-cfi-asm
4672@opindex fno-dwarf2-cfi-asm
4673Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
4674instead of using GAS @code{.cfi_*} directives.
4675
4676@cindex @command{prof}
4677@item -p
4678@opindex p
4679Generate extra code to write profile information suitable for the
4680analysis program @command{prof}.  You must use this option when compiling
4681the source files you want data about, and you must also use it when
4682linking.
4683
4684@cindex @command{gprof}
4685@item -pg
4686@opindex pg
4687Generate extra code to write profile information suitable for the
4688analysis program @command{gprof}.  You must use this option when compiling
4689the source files you want data about, and you must also use it when
4690linking.
4691
4692@item -Q
4693@opindex Q
4694Makes the compiler print out each function name as it is compiled, and
4695print some statistics about each pass when it finishes.
4696
4697@item -ftime-report
4698@opindex ftime-report
4699Makes the compiler print some statistics about the time consumed by each
4700pass when it finishes.
4701
4702@item -fmem-report
4703@opindex fmem-report
4704Makes the compiler print some statistics about permanent memory
4705allocation when it finishes.
4706
4707@item -fpre-ipa-mem-report
4708@opindex fpre-ipa-mem-report
4709@item -fpost-ipa-mem-report
4710@opindex fpost-ipa-mem-report
4711Makes the compiler print some statistics about permanent memory
4712allocation before or after interprocedural optimization.
4713
4714@item -fprofile-arcs
4715@opindex fprofile-arcs
4716Add code so that program flow @dfn{arcs} are instrumented.  During
4717execution the program records how many times each branch and call is
4718executed and how many times it is taken or returns.  When the compiled
4719program exits it saves this data to a file called
4720@file{@var{auxname}.gcda} for each source file.  The data may be used for
4721profile-directed optimizations (@option{-fbranch-probabilities}), or for
4722test coverage analysis (@option{-ftest-coverage}).  Each object file's
4723@var{auxname} is generated from the name of the output file, if
4724explicitly specified and it is not the final executable, otherwise it is
4725the basename of the source file.  In both cases any suffix is removed
4726(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
4727@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
4728@xref{Cross-profiling}.
4729
4730@cindex @command{gcov}
4731@item --coverage
4732@opindex coverage
4733
4734This option is used to compile and link code instrumented for coverage
4735analysis.  The option is a synonym for @option{-fprofile-arcs}
4736@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4737linking).  See the documentation for those options for more details.
4738
4739@itemize
4740
4741@item
4742Compile the source files with @option{-fprofile-arcs} plus optimization
4743and code generation options.  For test coverage analysis, use the
4744additional @option{-ftest-coverage} option.  You do not need to profile
4745every source file in a program.
4746
4747@item
4748Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4749(the latter implies the former).
4750
4751@item
4752Run the program on a representative workload to generate the arc profile
4753information.  This may be repeated any number of times.  You can run
4754concurrent instances of your program, and provided that the file system
4755supports locking, the data files will be correctly updated.  Also
4756@code{fork} calls are detected and correctly handled (double counting
4757will not happen).
4758
4759@item
4760For profile-directed optimizations, compile the source files again with
4761the same optimization and code generation options plus
4762@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
4763Control Optimization}).
4764
4765@item
4766For test coverage analysis, use @command{gcov} to produce human readable
4767information from the @file{.gcno} and @file{.gcda} files.  Refer to the
4768@command{gcov} documentation for further information.
4769
4770@end itemize
4771
4772With @option{-fprofile-arcs}, for each function of your program GCC
4773creates a program flow graph, then finds a spanning tree for the graph.
4774Only arcs that are not on the spanning tree have to be instrumented: the
4775compiler adds code to count the number of times that these arcs are
4776executed.  When an arc is the only exit or only entrance to a block, the
4777instrumentation code can be added to the block; otherwise, a new basic
4778block must be created to hold the instrumentation code.
4779
4780@need 2000
4781@item -ftest-coverage
4782@opindex ftest-coverage
4783Produce a notes file that the @command{gcov} code-coverage utility
4784(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
4785show program coverage.  Each source file's note file is called
4786@file{@var{auxname}.gcno}.  Refer to the @option{-fprofile-arcs} option
4787above for a description of @var{auxname} and instructions on how to
4788generate test coverage data.  Coverage data will match the source files
4789more closely, if you do not optimize.
4790
4791@item -fdbg-cnt-list
4792@opindex fdbg-cnt-list
4793Print the name and the counter upperbound for all debug counters.
4794
4795@item -fdbg-cnt=@var{counter-value-list}
4796@opindex fdbg-cnt
4797Set the internal debug counter upperbound. @var{counter-value-list}
4798is a comma-separated list of @var{name}:@var{value} pairs
4799which sets the upperbound of each debug counter @var{name} to @var{value}.
4800All debug counters have the initial upperbound of @var{UINT_MAX},
4801thus dbg_cnt() returns true always unless the upperbound is set by this option.
4802e.g. With -fdbg-cnt=dce:10,tail_call:0
4803dbg_cnt(dce) will return true only for first 10 invocations
4804and dbg_cnt(tail_call) will return false always.
4805
4806@item -d@var{letters}
4807@itemx -fdump-rtl-@var{pass}
4808@opindex d
4809Says to make debugging dumps during compilation at times specified by
4810@var{letters}.  This is used for debugging the RTL-based passes of the
4811compiler.  The file names for most of the dumps are made by appending
4812a pass number and a word to the @var{dumpname}, and the files are
4813created in the directory of the output file.  @var{dumpname} is
4814generated from the name of the output file, if explicitly specified
4815and it is not an executable, otherwise it is the basename of the
4816source file. These switches may have different effects when
4817@option{-E} is used for preprocessing.
4818
4819Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
4820@option{-d} option @var{letters}.  Here are the possible
4821letters for use in @var{pass} and @var{letters}, and their meanings:
4822
4823@table @gcctabopt
4824
4825@item -fdump-rtl-alignments
4826@opindex fdump-rtl-alignments
4827Dump after branch alignments have been computed.
4828
4829@item -fdump-rtl-asmcons
4830@opindex fdump-rtl-asmcons
4831Dump after fixing rtl statements that have unsatisfied in/out constraints.
4832
4833@item -fdump-rtl-auto_inc_dec
4834@opindex fdump-rtl-auto_inc_dec
4835Dump after auto-inc-dec discovery.  This pass is only run on
4836architectures that have auto inc or auto dec instructions.
4837
4838@item -fdump-rtl-barriers
4839@opindex fdump-rtl-barriers
4840Dump after cleaning up the barrier instructions.
4841
4842@item -fdump-rtl-bbpart
4843@opindex fdump-rtl-bbpart
4844Dump after partitioning hot and cold basic blocks.
4845
4846@item -fdump-rtl-bbro
4847@opindex fdump-rtl-bbro
4848Dump after block reordering.
4849
4850@item -fdump-rtl-btl1
4851@itemx -fdump-rtl-btl2
4852@opindex fdump-rtl-btl2
4853@opindex fdump-rtl-btl2
4854@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
4855after the two branch
4856target load optimization passes.
4857
4858@item -fdump-rtl-bypass
4859@opindex fdump-rtl-bypass
4860Dump after jump bypassing and control flow optimizations.
4861
4862@item -fdump-rtl-combine
4863@opindex fdump-rtl-combine
4864Dump after the RTL instruction combination pass.
4865
4866@item -fdump-rtl-compgotos
4867@opindex fdump-rtl-compgotos
4868Dump after duplicating the computed gotos.
4869
4870@item -fdump-rtl-ce1
4871@itemx -fdump-rtl-ce2
4872@itemx -fdump-rtl-ce3
4873@opindex fdump-rtl-ce1
4874@opindex fdump-rtl-ce2
4875@opindex fdump-rtl-ce3
4876@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
4877@option{-fdump-rtl-ce3} enable dumping after the three
4878if conversion passes.
4879
4880@itemx -fdump-rtl-cprop_hardreg
4881@opindex fdump-rtl-cprop_hardreg
4882Dump after hard register copy propagation.
4883
4884@itemx -fdump-rtl-csa
4885@opindex fdump-rtl-csa
4886Dump after combining stack adjustments.
4887
4888@item -fdump-rtl-cse1
4889@itemx -fdump-rtl-cse2
4890@opindex fdump-rtl-cse1
4891@opindex fdump-rtl-cse2
4892@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
4893the two common sub-expression elimination passes.
4894
4895@itemx -fdump-rtl-dce
4896@opindex fdump-rtl-dce
4897Dump after the standalone dead code elimination passes.
4898
4899@itemx -fdump-rtl-dbr
4900@opindex fdump-rtl-dbr
4901Dump after delayed branch scheduling.
4902
4903@item -fdump-rtl-dce1
4904@itemx -fdump-rtl-dce2
4905@opindex fdump-rtl-dce1
4906@opindex fdump-rtl-dce2
4907@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
4908the two dead store elimination passes.
4909
4910@item -fdump-rtl-eh
4911@opindex fdump-rtl-eh
4912Dump after finalization of EH handling code.
4913
4914@item -fdump-rtl-eh_ranges
4915@opindex fdump-rtl-eh_ranges
4916Dump after conversion of EH handling range regions.
4917
4918@item -fdump-rtl-expand
4919@opindex fdump-rtl-expand
4920Dump after RTL generation.
4921
4922@item -fdump-rtl-fwprop1
4923@itemx -fdump-rtl-fwprop2
4924@opindex fdump-rtl-fwprop1
4925@opindex fdump-rtl-fwprop2
4926@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
4927dumping after the two forward propagation passes.
4928
4929@item -fdump-rtl-gcse1
4930@itemx -fdump-rtl-gcse2
4931@opindex fdump-rtl-gcse1
4932@opindex fdump-rtl-gcse2
4933@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
4934after global common subexpression elimination.
4935
4936@item -fdump-rtl-init-regs
4937@opindex fdump-rtl-init-regs
4938Dump after the initialization of the registers.
4939
4940@item -fdump-rtl-initvals
4941@opindex fdump-rtl-initvals
4942Dump after the computation of the initial value sets.
4943
4944@itemx -fdump-rtl-into_cfglayout
4945@opindex fdump-rtl-into_cfglayout
4946Dump after converting to cfglayout mode.
4947
4948@item -fdump-rtl-ira
4949@opindex fdump-rtl-ira
4950Dump after iterated register allocation.
4951
4952@item -fdump-rtl-jump
4953@opindex fdump-rtl-jump
4954Dump after the second jump optimization.
4955
4956@item -fdump-rtl-loop2
4957@opindex fdump-rtl-loop2
4958@option{-fdump-rtl-loop2} enables dumping after the rtl
4959loop optimization passes.
4960
4961@item -fdump-rtl-mach
4962@opindex fdump-rtl-mach
4963Dump after performing the machine dependent reorganization pass, if that
4964pass exists.
4965
4966@item -fdump-rtl-mode_sw
4967@opindex fdump-rtl-mode_sw
4968Dump after removing redundant mode switches.
4969
4970@item -fdump-rtl-rnreg
4971@opindex fdump-rtl-rnreg
4972Dump after register renumbering.
4973
4974@itemx -fdump-rtl-outof_cfglayout
4975@opindex fdump-rtl-outof_cfglayout
4976Dump after converting from cfglayout mode.
4977
4978@item -fdump-rtl-peephole2
4979@opindex fdump-rtl-peephole2
4980Dump after the peephole pass.
4981
4982@item -fdump-rtl-postreload
4983@opindex fdump-rtl-postreload
4984Dump after post-reload optimizations.
4985
4986@itemx -fdump-rtl-pro_and_epilogue
4987@opindex fdump-rtl-pro_and_epilogue
4988Dump after generating the function pro and epilogues.
4989
4990@item -fdump-rtl-regmove
4991@opindex fdump-rtl-regmove
4992Dump after the register move pass.
4993
4994@item -fdump-rtl-sched1
4995@itemx -fdump-rtl-sched2
4996@opindex fdump-rtl-sched1
4997@opindex fdump-rtl-sched2
4998@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
4999after the basic block scheduling passes.
5000
5001@item -fdump-rtl-see
5002@opindex fdump-rtl-see
5003Dump after sign extension elimination.
5004
5005@item -fdump-rtl-seqabstr
5006@opindex fdump-rtl-seqabstr
5007Dump after common sequence discovery.
5008
5009@item -fdump-rtl-shorten
5010@opindex fdump-rtl-shorten
5011Dump after shortening branches.
5012
5013@item -fdump-rtl-sibling
5014@opindex fdump-rtl-sibling
5015Dump after sibling call optimizations.
5016
5017@item -fdump-rtl-split1
5018@itemx -fdump-rtl-split2
5019@itemx -fdump-rtl-split3
5020@itemx -fdump-rtl-split4
5021@itemx -fdump-rtl-split5
5022@opindex fdump-rtl-split1
5023@opindex fdump-rtl-split2
5024@opindex fdump-rtl-split3
5025@opindex fdump-rtl-split4
5026@opindex fdump-rtl-split5
5027@option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
5028@option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
5029@option{-fdump-rtl-split5} enable dumping after five rounds of
5030instruction splitting.
5031
5032@item -fdump-rtl-sms
5033@opindex fdump-rtl-sms
5034Dump after modulo scheduling.  This pass is only run on some
5035architectures.
5036
5037@item -fdump-rtl-stack
5038@opindex fdump-rtl-stack
5039Dump after conversion from GCC's "flat register file" registers to the
5040x87's stack-like registers.  This pass is only run on x86 variants.
5041
5042@item -fdump-rtl-subreg1
5043@itemx -fdump-rtl-subreg2
5044@opindex fdump-rtl-subreg1
5045@opindex fdump-rtl-subreg2
5046@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
5047the two subreg expansion passes.
5048
5049@item -fdump-rtl-unshare
5050@opindex fdump-rtl-unshare
5051Dump after all rtl has been unshared.
5052
5053@item -fdump-rtl-vartrack
5054@opindex fdump-rtl-vartrack
5055Dump after variable tracking.
5056
5057@item -fdump-rtl-vregs
5058@opindex fdump-rtl-vregs
5059Dump after converting virtual registers to hard registers.
5060
5061@item -fdump-rtl-web
5062@opindex fdump-rtl-web
5063Dump after live range splitting.
5064
5065@item -fdump-rtl-regclass
5066@itemx -fdump-rtl-subregs_of_mode_init
5067@itemx -fdump-rtl-subregs_of_mode_finish
5068@itemx -fdump-rtl-dfinit
5069@itemx -fdump-rtl-dfinish
5070@opindex fdump-rtl-regclass
5071@opindex fdump-rtl-subregs_of_mode_init
5072@opindex fdump-rtl-subregs_of_mode_finish
5073@opindex fdump-rtl-dfinit
5074@opindex fdump-rtl-dfinish
5075These dumps are defined but always produce empty files.
5076
5077@item -fdump-rtl-all
5078@opindex fdump-rtl-all
5079Produce all the dumps listed above.
5080
5081@item -dA
5082@opindex dA
5083Annotate the assembler output with miscellaneous debugging information.
5084
5085@item -dD
5086@opindex dD
5087Dump all macro definitions, at the end of preprocessing, in addition to
5088normal output.
5089
5090@item -dH
5091@opindex dH
5092Produce a core dump whenever an error occurs.
5093
5094@item -dm
5095@opindex dm
5096Print statistics on memory usage, at the end of the run, to
5097standard error.
5098
5099@item -dp
5100@opindex dp
5101Annotate the assembler output with a comment indicating which
5102pattern and alternative was used.  The length of each instruction is
5103also printed.
5104
5105@item -dP
5106@opindex dP
5107Dump the RTL in the assembler output as a comment before each instruction.
5108Also turns on @option{-dp} annotation.
5109
5110@item -dv
5111@opindex dv
5112For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5113dump a representation of the control flow graph suitable for viewing with VCG
5114to @file{@var{file}.@var{pass}.vcg}.
5115
5116@item -dx
5117@opindex dx
5118Just generate RTL for a function instead of compiling it.  Usually used
5119with @option{-fdump-rtl-expand}.
5120
5121@item -dy
5122@opindex dy
5123Dump debugging information during parsing, to standard error.
5124@end table
5125
5126@item -fdump-noaddr
5127@opindex fdump-noaddr
5128When doing debugging dumps, suppress address output.  This makes it more
5129feasible to use diff on debugging dumps for compiler invocations with
5130different compiler binaries and/or different
5131text / bss / data / heap / stack / dso start locations.
5132
5133@item -fdump-unnumbered
5134@opindex fdump-unnumbered
5135When doing debugging dumps, suppress instruction numbers and address output.
5136This makes it more feasible to use diff on debugging dumps for compiler
5137invocations with different options, in particular with and without
5138@option{-g}.
5139
5140@item -fdump-unnumbered-links
5141@opindex fdump-unnumbered-links
5142When doing debugging dumps (see @option{-d} option above), suppress
5143instruction numbers for the links to the previous and next instructions
5144in a sequence.
5145
5146@item -fdump-translation-unit @r{(C++ only)}
5147@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
5148@opindex fdump-translation-unit
5149Dump a representation of the tree structure for the entire translation
5150unit to a file.  The file name is made by appending @file{.tu} to the
5151source file name, and the file is created in the same directory as the
5152output file.  If the @samp{-@var{options}} form is used, @var{options}
5153controls the details of the dump as described for the
5154@option{-fdump-tree} options.
5155
5156@item -fdump-class-hierarchy @r{(C++ only)}
5157@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
5158@opindex fdump-class-hierarchy
5159Dump a representation of each class's hierarchy and virtual function
5160table layout to a file.  The file name is made by appending
5161@file{.class} to the source file name, and the file is created in the
5162same directory as the output file.  If the @samp{-@var{options}} form
5163is used, @var{options} controls the details of the dump as described
5164for the @option{-fdump-tree} options.
5165
5166@item -fdump-ipa-@var{switch}
5167@opindex fdump-ipa
5168Control the dumping at various stages of inter-procedural analysis
5169language tree to a file.  The file name is generated by appending a
5170switch specific suffix to the source file name, and the file is created
5171in the same directory as the output file.  The following dumps are
5172possible:
5173
5174@table @samp
5175@item all
5176Enables all inter-procedural analysis dumps.
5177
5178@item cgraph
5179Dumps information about call-graph optimization, unused function removal,
5180and inlining decisions.
5181
5182@item inline
5183Dump after function inlining.
5184
5185@end table
5186
5187@item -fdump-statistics-@var{option}
5188@opindex fdump-statistics
5189Enable and control dumping of pass statistics in a separate file.  The
5190file name is generated by appending a suffix ending in
5191@samp{.statistics} to the source file name, and the file is created in
5192the same directory as the output file.  If the @samp{-@var{option}}
5193form is used, @samp{-stats} will cause counters to be summed over the
5194whole compilation unit while @samp{-details} will dump every event as
5195the passes generate them.  The default with no option is to sum
5196counters for each function compiled.
5197
5198@item -fdump-tree-@var{switch}
5199@itemx -fdump-tree-@var{switch}-@var{options}
5200@opindex fdump-tree
5201Control the dumping at various stages of processing the intermediate
5202language tree to a file.  The file name is generated by appending a
5203switch specific suffix to the source file name, and the file is
5204created in the same directory as the output file.  If the
5205@samp{-@var{options}} form is used, @var{options} is a list of
5206@samp{-} separated options that control the details of the dump.  Not
5207all options are applicable to all dumps, those which are not
5208meaningful will be ignored.  The following options are available
5209
5210@table @samp
5211@item address
5212Print the address of each node.  Usually this is not meaningful as it
5213changes according to the environment and source file.  Its primary use
5214is for tying up a dump file with a debug environment.
5215@item asmname
5216If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5217in the dump instead of @code{DECL_NAME}.  Its primary use is ease of
5218use working backward from mangled names in the assembly file.
5219@item slim
5220Inhibit dumping of members of a scope or body of a function merely
5221because that scope has been reached.  Only dump such items when they
5222are directly reachable by some other path.  When dumping pretty-printed
5223trees, this option inhibits dumping the bodies of control structures.
5224@item raw
5225Print a raw representation of the tree.  By default, trees are
5226pretty-printed into a C-like representation.
5227@item details
5228Enable more detailed dumps (not honored by every dump option).
5229@item stats
5230Enable dumping various statistics about the pass (not honored by every dump
5231option).
5232@item blocks
5233Enable showing basic block boundaries (disabled in raw dumps).
5234@item vops
5235Enable showing virtual operands for every statement.
5236@item lineno
5237Enable showing line numbers for statements.
5238@item uid
5239Enable showing the unique ID (@code{DECL_UID}) for each variable.
5240@item verbose
5241Enable showing the tree dump for each statement.
5242@item eh
5243Enable showing the EH region number holding each statement.
5244@item all
5245Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5246and @option{lineno}.
5247@end table
5248
5249The following tree dumps are possible:
5250@table @samp
5251
5252@item original
5253@opindex fdump-tree-original
5254Dump before any tree based optimization, to @file{@var{file}.original}.
5255
5256@item optimized
5257@opindex fdump-tree-optimized
5258Dump after all tree based optimization, to @file{@var{file}.optimized}.
5259
5260@item gimple
5261@opindex fdump-tree-gimple
5262Dump each function before and after the gimplification pass to a file.  The
5263file name is made by appending @file{.gimple} to the source file name.
5264
5265@item cfg
5266@opindex fdump-tree-cfg
5267Dump the control flow graph of each function to a file.  The file name is
5268made by appending @file{.cfg} to the source file name.
5269
5270@item vcg
5271@opindex fdump-tree-vcg
5272Dump the control flow graph of each function to a file in VCG format.  The
5273file name is made by appending @file{.vcg} to the source file name.  Note
5274that if the file contains more than one function, the generated file cannot
5275be used directly by VCG@.  You will need to cut and paste each function's
5276graph into its own separate file first.
5277
5278@item ch
5279@opindex fdump-tree-ch
5280Dump each function after copying loop headers.  The file name is made by
5281appending @file{.ch} to the source file name.
5282
5283@item ssa
5284@opindex fdump-tree-ssa
5285Dump SSA related information to a file.  The file name is made by appending
5286@file{.ssa} to the source file name.
5287
5288@item alias
5289@opindex fdump-tree-alias
5290Dump aliasing information for each function.  The file name is made by
5291appending @file{.alias} to the source file name.
5292
5293@item ccp
5294@opindex fdump-tree-ccp
5295Dump each function after CCP@.  The file name is made by appending
5296@file{.ccp} to the source file name.
5297
5298@item storeccp
5299@opindex fdump-tree-storeccp
5300Dump each function after STORE-CCP@.  The file name is made by appending
5301@file{.storeccp} to the source file name.
5302
5303@item pre
5304@opindex fdump-tree-pre
5305Dump trees after partial redundancy elimination.  The file name is made
5306by appending @file{.pre} to the source file name.
5307
5308@item fre
5309@opindex fdump-tree-fre
5310Dump trees after full redundancy elimination.  The file name is made
5311by appending @file{.fre} to the source file name.
5312
5313@item copyprop
5314@opindex fdump-tree-copyprop
5315Dump trees after copy propagation.  The file name is made
5316by appending @file{.copyprop} to the source file name.
5317
5318@item store_copyprop
5319@opindex fdump-tree-store_copyprop
5320Dump trees after store copy-propagation.  The file name is made
5321by appending @file{.store_copyprop} to the source file name.
5322
5323@item dce
5324@opindex fdump-tree-dce
5325Dump each function after dead code elimination.  The file name is made by
5326appending @file{.dce} to the source file name.
5327
5328@item mudflap
5329@opindex fdump-tree-mudflap
5330Dump each function after adding mudflap instrumentation.  The file name is
5331made by appending @file{.mudflap} to the source file name.
5332
5333@item sra
5334@opindex fdump-tree-sra
5335Dump each function after performing scalar replacement of aggregates.  The
5336file name is made by appending @file{.sra} to the source file name.
5337
5338@item sink
5339@opindex fdump-tree-sink
5340Dump each function after performing code sinking.  The file name is made
5341by appending @file{.sink} to the source file name.
5342
5343@item dom
5344@opindex fdump-tree-dom
5345Dump each function after applying dominator tree optimizations.  The file
5346name is made by appending @file{.dom} to the source file name.
5347
5348@item dse
5349@opindex fdump-tree-dse
5350Dump each function after applying dead store elimination.  The file
5351name is made by appending @file{.dse} to the source file name.
5352
5353@item phiopt
5354@opindex fdump-tree-phiopt
5355Dump each function after optimizing PHI nodes into straightline code.  The file
5356name is made by appending @file{.phiopt} to the source file name.
5357
5358@item forwprop
5359@opindex fdump-tree-forwprop
5360Dump each function after forward propagating single use variables.  The file
5361name is made by appending @file{.forwprop} to the source file name.
5362
5363@item copyrename
5364@opindex fdump-tree-copyrename
5365Dump each function after applying the copy rename optimization.  The file
5366name is made by appending @file{.copyrename} to the source file name.
5367
5368@item nrv
5369@opindex fdump-tree-nrv
5370Dump each function after applying the named return value optimization on
5371generic trees.  The file name is made by appending @file{.nrv} to the source
5372file name.
5373
5374@item vect
5375@opindex fdump-tree-vect
5376Dump each function after applying vectorization of loops.  The file name is
5377made by appending @file{.vect} to the source file name.
5378
5379@item slp
5380@opindex fdump-tree-slp
5381Dump each function after applying vectorization of basic blocks.  The file name
5382is made by appending @file{.slp} to the source file name.
5383
5384@item vrp
5385@opindex fdump-tree-vrp
5386Dump each function after Value Range Propagation (VRP).  The file name
5387is made by appending @file{.vrp} to the source file name.
5388
5389@item all
5390@opindex fdump-tree-all
5391Enable all the available tree dumps with the flags provided in this option.
5392@end table
5393
5394@item -ftree-vectorizer-verbose=@var{n}
5395@opindex ftree-vectorizer-verbose
5396This option controls the amount of debugging output the vectorizer prints.
5397This information is written to standard error, unless
5398@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
5399in which case it is output to the usual dump listing file, @file{.vect}.
5400For @var{n}=0 no diagnostic information is reported.
5401If @var{n}=1 the vectorizer reports each loop that got vectorized,
5402and the total number of loops that got vectorized.
5403If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
5404the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
5405inner-most, single-bb, single-entry/exit loops.  This is the same verbosity
5406level that @option{-fdump-tree-vect-stats} uses.
5407Higher verbosity levels mean either more information dumped for each
5408reported loop, or same amount of information reported for more loops:
5409if @var{n}=3, vectorizer cost model information is reported.
5410If @var{n}=4, alignment related information is added to the reports.
5411If @var{n}=5, data-references related information (e.g.@: memory dependences,
5412memory access-patterns) is added to the reports.
5413If @var{n}=6, the vectorizer reports also non-vectorized inner-most loops
5414that did not pass the first analysis phase (i.e., may not be countable, or
5415may have complicated control-flow).
5416If @var{n}=7, the vectorizer reports also non-vectorized nested loops.
5417If @var{n}=8, SLP related information is added to the reports.
5418For @var{n}=9, all the information the vectorizer generates during its
5419analysis and transformation is reported.  This is the same verbosity level
5420that @option{-fdump-tree-vect-details} uses.
5421
5422@item -frandom-seed=@var{string}
5423@opindex frandom-seed
5424This option provides a seed that GCC uses when it would otherwise use
5425random numbers.  It is used to generate certain symbol names
5426that have to be different in every compiled file.  It is also used to
5427place unique stamps in coverage data files and the object files that
5428produce them.  You can use the @option{-frandom-seed} option to produce
5429reproducibly identical object files.
5430
5431The @var{string} should be different for every file you compile.
5432
5433@item -fsched-verbose=@var{n}
5434@opindex fsched-verbose
5435On targets that use instruction scheduling, this option controls the
5436amount of debugging output the scheduler prints.  This information is
5437written to standard error, unless @option{-fdump-rtl-sched1} or
5438@option{-fdump-rtl-sched2} is specified, in which case it is output
5439to the usual dump listing file, @file{.sched1} or @file{.sched2}
5440respectively.  However for @var{n} greater than nine, the output is
5441always printed to standard error.
5442
5443For @var{n} greater than zero, @option{-fsched-verbose} outputs the
5444same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
5445For @var{n} greater than one, it also output basic block probabilities,
5446detailed ready list information and unit/insn info.  For @var{n} greater
5447than two, it includes RTL at abort point, control-flow and regions info.
5448And for @var{n} over four, @option{-fsched-verbose} also includes
5449dependence info.
5450
5451@item -save-temps
5452@itemx -save-temps=cwd
5453@opindex save-temps
5454Store the usual ``temporary'' intermediate files permanently; place them
5455in the current directory and name them based on the source file.  Thus,
5456compiling @file{foo.c} with @samp{-c -save-temps} would produce files
5457@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
5458preprocessed @file{foo.i} output file even though the compiler now
5459normally uses an integrated preprocessor.
5460
5461When used in combination with the @option{-x} command line option,
5462@option{-save-temps} is sensible enough to avoid over writing an
5463input source file with the same extension as an intermediate file.
5464The corresponding intermediate file may be obtained by renaming the
5465source file before using @option{-save-temps}.
5466
5467If you invoke GCC in parallel, compiling several different source
5468files that share a common base name in different subdirectories or the
5469same source file compiled for multiple output destinations, it is
5470likely that the different parallel compilers will interfere with each
5471other, and overwrite the temporary files.  For instance:
5472
5473@smallexample
5474gcc -save-temps -o outdir1/foo.o indir1/foo.c&
5475gcc -save-temps -o outdir2/foo.o indir2/foo.c&
5476@end smallexample
5477
5478may result in @file{foo.i} and @file{foo.o} being written to
5479simultaneously by both compilers.
5480
5481@item -save-temps=obj
5482@opindex save-temps=obj
5483Store the usual ``temporary'' intermediate files permanently.  If the
5484@option{-o} option is used, the temporary files are based on the
5485object file.  If the @option{-o} option is not used, the
5486@option{-save-temps=obj} switch behaves like @option{-save-temps}.
5487
5488For example:
5489
5490@smallexample
5491gcc -save-temps=obj -c foo.c
5492gcc -save-temps=obj -c bar.c -o dir/xbar.o
5493gcc -save-temps=obj foobar.c -o dir2/yfoobar
5494@end smallexample
5495
5496would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
5497@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
5498@file{dir2/yfoobar.o}.
5499
5500@item -time@r{[}=@var{file}@r{]}
5501@opindex time
5502Report the CPU time taken by each subprocess in the compilation
5503sequence.  For C source files, this is the compiler proper and assembler
5504(plus the linker if linking is done).
5505
5506Without the specification of an output file, the output looks like this:
5507
5508@smallexample
5509# cc1 0.12 0.01
5510# as 0.00 0.01
5511@end smallexample
5512
5513The first number on each line is the ``user time'', that is time spent
5514executing the program itself.  The second number is ``system time'',
5515time spent executing operating system routines on behalf of the program.
5516Both numbers are in seconds.
5517
5518With the specification of an output file, the output is appended to the
5519named file, and it looks like this:
5520
5521@smallexample
55220.12 0.01 cc1 @var{options}
55230.00 0.01 as @var{options}
5524@end smallexample
5525
5526The ``user time'' and the ``system time'' are moved before the program
5527name, and the options passed to the program are displayed, so that one
5528can later tell what file was being compiled, and with which options.
5529
5530@item -fvar-tracking
5531@opindex fvar-tracking
5532Run variable tracking pass.  It computes where variables are stored at each
5533position in code.  Better debugging information is then generated
5534(if the debugging information format supports this information).
5535
5536It is enabled by default when compiling with optimization (@option{-Os},
5537@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
5538the debug info format supports it.
5539
5540@item -fvar-tracking-assignments
5541@opindex fvar-tracking-assignments
5542@opindex fno-var-tracking-assignments
5543Annotate assignments to user variables early in the compilation and
5544attempt to carry the annotations over throughout the compilation all the
5545way to the end, in an attempt to improve debug information while
5546optimizing.  Use of @option{-gdwarf-4} is recommended along with it.
5547
5548It can be enabled even if var-tracking is disabled, in which case
5549annotations will be created and maintained, but discarded at the end.
5550
5551@item -fvar-tracking-assignments-toggle
5552@opindex fvar-tracking-assignments-toggle
5553@opindex fno-var-tracking-assignments-toggle
5554Toggle @option{-fvar-tracking-assignments}, in the same way that
5555@option{-gtoggle} toggles @option{-g}.
5556
5557@item -print-file-name=@var{library}
5558@opindex print-file-name
5559Print the full absolute name of the library file @var{library} that
5560would be used when linking---and don't do anything else.  With this
5561option, GCC does not compile or link anything; it just prints the
5562file name.
5563
5564@item -print-multi-directory
5565@opindex print-multi-directory
5566Print the directory name corresponding to the multilib selected by any
5567other switches present in the command line.  This directory is supposed
5568to exist in @env{GCC_EXEC_PREFIX}.
5569
5570@item -print-multi-lib
5571@opindex print-multi-lib
5572Print the mapping from multilib directory names to compiler switches
5573that enable them.  The directory name is separated from the switches by
5574@samp{;}, and each switch starts with an @samp{@@} instead of the
5575@samp{-}, without spaces between multiple switches.  This is supposed to
5576ease shell-processing.
5577
5578@item -print-multi-os-directory
5579@opindex print-multi-os-directory
5580Print the path to OS libraries for the selected
5581multilib, relative to some @file{lib} subdirectory.  If OS libraries are
5582present in the @file{lib} subdirectory and no multilibs are used, this is
5583usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
5584sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
5585@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
5586subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
5587
5588@item -print-prog-name=@var{program}
5589@opindex print-prog-name
5590Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
5591
5592@item -print-libgcc-file-name
5593@opindex print-libgcc-file-name
5594Same as @option{-print-file-name=libgcc.a}.
5595
5596This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
5597but you do want to link with @file{libgcc.a}.  You can do
5598
5599@smallexample
5600gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
5601@end smallexample
5602
5603@item -print-search-dirs
5604@opindex print-search-dirs
5605Print the name of the configured installation directory and a list of
5606program and library directories @command{gcc} will search---and don't do anything else.
5607
5608This is useful when @command{gcc} prints the error message
5609@samp{installation problem, cannot exec cpp0: No such file or directory}.
5610To resolve this you either need to put @file{cpp0} and the other compiler
5611components where @command{gcc} expects to find them, or you can set the environment
5612variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
5613Don't forget the trailing @samp{/}.
5614@xref{Environment Variables}.
5615
5616@item -print-sysroot
5617@opindex print-sysroot
5618Print the target sysroot directory that will be used during
5619compilation.  This is the target sysroot specified either at configure
5620time or using the @option{--sysroot} option, possibly with an extra
5621suffix that depends on compilation options.  If no target sysroot is
5622specified, the option prints nothing.
5623
5624@item -print-sysroot-headers-suffix
5625@opindex print-sysroot-headers-suffix
5626Print the suffix added to the target sysroot when searching for
5627headers, or give an error if the compiler is not configured with such
5628a suffix---and don't do anything else.
5629
5630@item -dumpmachine
5631@opindex dumpmachine
5632Print the compiler's target machine (for example,
5633@samp{i686-pc-linux-gnu})---and don't do anything else.
5634
5635@item -dumpversion
5636@opindex dumpversion
5637Print the compiler version (for example, @samp{3.0})---and don't do
5638anything else.
5639
5640@item -dumpspecs
5641@opindex dumpspecs
5642Print the compiler's built-in specs---and don't do anything else.  (This
5643is used when GCC itself is being built.)  @xref{Spec Files}.
5644
5645@item -feliminate-unused-debug-types
5646@opindex feliminate-unused-debug-types
5647Normally, when producing DWARF2 output, GCC will emit debugging
5648information for all types declared in a compilation
5649unit, regardless of whether or not they are actually used
5650in that compilation unit.  Sometimes this is useful, such as
5651if, in the debugger, you want to cast a value to a type that is
5652not actually used in your program (but is declared).  More often,
5653however, this results in a significant amount of wasted space.
5654With this option, GCC will avoid producing debug symbol output
5655for types that are nowhere used in the source file being compiled.
5656@end table
5657
5658@node Optimize Options
5659@section Options That Control Optimization
5660@cindex optimize options
5661@cindex options, optimization
5662
5663These options control various sorts of optimizations.
5664
5665Without any optimization option, the compiler's goal is to reduce the
5666cost of compilation and to make debugging produce the expected
5667results.  Statements are independent: if you stop the program with a
5668breakpoint between statements, you can then assign a new value to any
5669variable or change the program counter to any other statement in the
5670function and get exactly the results you would expect from the source
5671code.
5672
5673Turning on optimization flags makes the compiler attempt to improve
5674the performance and/or code size at the expense of compilation time
5675and possibly the ability to debug the program.
5676
5677The compiler performs optimization based on the knowledge it has of the
5678program.  Compiling multiple files at once to a single output file mode allows
5679the compiler to use information gained from all of the files when compiling
5680each of them.
5681
5682Not all optimizations are controlled directly by a flag.  Only
5683optimizations that have a flag are listed in this section.
5684
5685Most optimizations are only enabled if an @option{-O} level is set on
5686the command line.  Otherwise they are disabled, even if individual
5687optimization flags are specified.
5688
5689Depending on the target and how GCC was configured, a slightly different
5690set of optimizations may be enabled at each @option{-O} level than
5691those listed here.  You can invoke GCC with @samp{-Q --help=optimizers}
5692to find out the exact set of optimizations that are enabled at each level.
5693@xref{Overall Options}, for examples.
5694
5695@table @gcctabopt
5696@item -O
5697@itemx -O1
5698@opindex O
5699@opindex O1
5700Optimize.  Optimizing compilation takes somewhat more time, and a lot
5701more memory for a large function.
5702
5703With @option{-O}, the compiler tries to reduce code size and execution
5704time, without performing any optimizations that take a great deal of
5705compilation time.
5706
5707@option{-O} turns on the following optimization flags:
5708@gccoptlist{
5709-fauto-inc-dec @gol
5710-fcprop-registers @gol
5711-fdce @gol
5712-fdefer-pop @gol
5713-fdelayed-branch @gol
5714-fdse @gol
5715-fguess-branch-probability @gol
5716-fif-conversion2 @gol
5717-fif-conversion @gol
5718-fipa-pure-const @gol
5719-fipa-reference @gol
5720-fmerge-constants
5721-fsplit-wide-types @gol
5722-ftree-builtin-call-dce @gol
5723-ftree-ccp @gol
5724-ftree-ch @gol
5725-ftree-copyrename @gol
5726-ftree-dce @gol
5727-ftree-dominator-opts @gol
5728-ftree-dse @gol
5729-ftree-forwprop @gol
5730-ftree-fre @gol
5731-ftree-phiprop @gol
5732-ftree-sra @gol
5733-ftree-pta @gol
5734-ftree-ter @gol
5735-funit-at-a-time}
5736
5737@option{-O} also turns on @option{-fomit-frame-pointer} on machines
5738where doing so does not interfere with debugging.
5739
5740@item -O2
5741@opindex O2
5742Optimize even more.  GCC performs nearly all supported optimizations
5743that do not involve a space-speed tradeoff.
5744As compared to @option{-O}, this option increases both compilation time
5745and the performance of the generated code.
5746
5747@option{-O2} turns on all optimization flags specified by @option{-O}.  It
5748also turns on the following optimization flags:
5749@gccoptlist{-fthread-jumps @gol
5750-falign-functions  -falign-jumps @gol
5751-falign-loops  -falign-labels @gol
5752-fcaller-saves @gol
5753-fcrossjumping @gol
5754-fcse-follow-jumps  -fcse-skip-blocks @gol
5755-fdelete-null-pointer-checks @gol
5756-fexpensive-optimizations @gol
5757-fgcse  -fgcse-lm  @gol
5758-finline-small-functions @gol
5759-findirect-inlining @gol
5760-fipa-sra @gol
5761-foptimize-sibling-calls @gol
5762-fpeephole2 @gol
5763-fregmove @gol
5764-freorder-blocks  -freorder-functions @gol
5765-frerun-cse-after-loop  @gol
5766-fsched-interblock  -fsched-spec @gol
5767-fschedule-insns  -fschedule-insns2 @gol
5768-fstrict-aliasing -fstrict-overflow @gol
5769-ftree-switch-conversion @gol
5770-ftree-pre @gol
5771-ftree-vrp}
5772
5773Please note the warning under @option{-fgcse} about
5774invoking @option{-O2} on programs that use computed gotos.
5775
5776@item -O3
5777@opindex O3
5778Optimize yet more.  @option{-O3} turns on all optimizations specified
5779by @option{-O2} and also turns on the @option{-finline-functions},
5780@option{-funswitch-loops}, @option{-fpredictive-commoning},
5781@option{-fgcse-after-reload}, @option{-ftree-vectorize} and
5782@option{-fipa-cp-clone} options.
5783
5784@item -O0
5785@opindex O0
5786Reduce compilation time and make debugging produce the expected
5787results.  This is the default.
5788
5789@item -Os
5790@opindex Os
5791Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
5792do not typically increase code size.  It also performs further
5793optimizations designed to reduce code size.
5794
5795@option{-Os} disables the following optimization flags:
5796@gccoptlist{-falign-functions  -falign-jumps  -falign-loops @gol
5797-falign-labels  -freorder-blocks  -freorder-blocks-and-partition @gol
5798-fprefetch-loop-arrays  -ftree-vect-loop-version}
5799
5800If you use multiple @option{-O} options, with or without level numbers,
5801the last such option is the one that is effective.
5802@end table
5803
5804Options of the form @option{-f@var{flag}} specify machine-independent
5805flags.  Most flags have both positive and negative forms; the negative
5806form of @option{-ffoo} would be @option{-fno-foo}.  In the table
5807below, only one of the forms is listed---the one you typically will
5808use.  You can figure out the other form by either removing @samp{no-}
5809or adding it.
5810
5811The following options control specific optimizations.  They are either
5812activated by @option{-O} options or are related to ones that are.  You
5813can use the following flags in the rare cases when ``fine-tuning'' of
5814optimizations to be performed is desired.
5815
5816@table @gcctabopt
5817@item -fno-default-inline
5818@opindex fno-default-inline
5819Do not make member functions inline by default merely because they are
5820defined inside the class scope (C++ only).  Otherwise, when you specify
5821@w{@option{-O}}, member functions defined inside class scope are compiled
5822inline by default; i.e., you don't need to add @samp{inline} in front of
5823the member function name.
5824
5825@item -fno-defer-pop
5826@opindex fno-defer-pop
5827Always pop the arguments to each function call as soon as that function
5828returns.  For machines which must pop arguments after a function call,
5829the compiler normally lets arguments accumulate on the stack for several
5830function calls and pops them all at once.
5831
5832Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5833
5834@item -fforward-propagate
5835@opindex fforward-propagate
5836Perform a forward propagation pass on RTL@.  The pass tries to combine two
5837instructions and checks if the result can be simplified.  If loop unrolling
5838is active, two passes are performed and the second is scheduled after
5839loop unrolling.
5840
5841This option is enabled by default at optimization levels @option{-O},
5842@option{-O2}, @option{-O3}, @option{-Os}.
5843
5844@item -fomit-frame-pointer
5845@opindex fomit-frame-pointer
5846Don't keep the frame pointer in a register for functions that
5847don't need one.  This avoids the instructions to save, set up and
5848restore frame pointers; it also makes an extra register available
5849in many functions.  @strong{It also makes debugging impossible on
5850some machines.}
5851
5852On some machines, such as the VAX, this flag has no effect, because
5853the standard calling sequence automatically handles the frame pointer
5854and nothing is saved by pretending it doesn't exist.  The
5855machine-description macro @code{FRAME_POINTER_REQUIRED} controls
5856whether a target machine supports this flag.  @xref{Registers,,Register
5857Usage, gccint, GNU Compiler Collection (GCC) Internals}.
5858
5859Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5860
5861@item -foptimize-sibling-calls
5862@opindex foptimize-sibling-calls
5863Optimize sibling and tail recursive calls.
5864
5865Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5866
5867@item -fno-inline
5868@opindex fno-inline
5869Don't pay attention to the @code{inline} keyword.  Normally this option
5870is used to keep the compiler from expanding any functions inline.
5871Note that if you are not optimizing, no functions can be expanded inline.
5872
5873@item -finline-small-functions
5874@opindex finline-small-functions
5875Integrate functions into their callers when their body is smaller than expected
5876function call code (so overall size of program gets smaller).  The compiler
5877heuristically decides which functions are simple enough to be worth integrating
5878in this way.
5879
5880Enabled at level @option{-O2}.
5881
5882@item -findirect-inlining
5883@opindex findirect-inlining
5884Inline also indirect calls that are discovered to be known at compile
5885time thanks to previous inlining.  This option has any effect only
5886when inlining itself is turned on by the @option{-finline-functions}
5887or @option{-finline-small-functions} options.
5888
5889Enabled at level @option{-O2}.
5890
5891@item -finline-functions
5892@opindex finline-functions
5893Integrate all simple functions into their callers.  The compiler
5894heuristically decides which functions are simple enough to be worth
5895integrating in this way.
5896
5897If all calls to a given function are integrated, and the function is
5898declared @code{static}, then the function is normally not output as
5899assembler code in its own right.
5900
5901Enabled at level @option{-O3}.
5902
5903@item -finline-functions-called-once
5904@opindex finline-functions-called-once
5905Consider all @code{static} functions called once for inlining into their
5906caller even if they are not marked @code{inline}.  If a call to a given
5907function is integrated, then the function is not output as assembler code
5908in its own right.
5909
5910Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
5911
5912@item -fearly-inlining
5913@opindex fearly-inlining
5914Inline functions marked by @code{always_inline} and functions whose body seems
5915smaller than the function call overhead early before doing
5916@option{-fprofile-generate} instrumentation and real inlining pass.  Doing so
5917makes profiling significantly cheaper and usually inlining faster on programs
5918having large chains of nested wrapper functions.
5919
5920Enabled by default.
5921
5922@item -fipa-sra
5923@opindex fipa-sra
5924Perform interprocedural scalar replacement of aggregates, removal of
5925unused parameters and replacement of parameters passed by reference
5926by parameters passed by value.
5927
5928Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
5929
5930@item -finline-limit=@var{n}
5931@opindex finline-limit
5932By default, GCC limits the size of functions that can be inlined.  This flag
5933allows coarse control of this limit.  @var{n} is the size of functions that
5934can be inlined in number of pseudo instructions.
5935
5936Inlining is actually controlled by a number of parameters, which may be
5937specified individually by using @option{--param @var{name}=@var{value}}.
5938The @option{-finline-limit=@var{n}} option sets some of these parameters
5939as follows:
5940
5941@table @gcctabopt
5942@item max-inline-insns-single
5943is set to @var{n}/2.
5944@item max-inline-insns-auto
5945is set to @var{n}/2.
5946@end table
5947
5948See below for a documentation of the individual
5949parameters controlling inlining and for the defaults of these parameters.
5950
5951@emph{Note:} there may be no value to @option{-finline-limit} that results
5952in default behavior.
5953
5954@emph{Note:} pseudo instruction represents, in this particular context, an
5955abstract measurement of function's size.  In no way does it represent a count
5956of assembly instructions and as such its exact meaning might change from one
5957release to an another.
5958
5959@item -fkeep-inline-functions
5960@opindex fkeep-inline-functions
5961In C, emit @code{static} functions that are declared @code{inline}
5962into the object file, even if the function has been inlined into all
5963of its callers.  This switch does not affect functions using the
5964@code{extern inline} extension in GNU C90@.  In C++, emit any and all
5965inline functions into the object file.
5966
5967@item -fkeep-static-consts
5968@opindex fkeep-static-consts
5969Emit variables declared @code{static const} when optimization isn't turned
5970on, even if the variables aren't referenced.
5971
5972GCC enables this option by default.  If you want to force the compiler to
5973check if the variable was referenced, regardless of whether or not
5974optimization is turned on, use the @option{-fno-keep-static-consts} option.
5975
5976@item -fmerge-constants
5977@opindex fmerge-constants
5978Attempt to merge identical constants (string constants and floating point
5979constants) across compilation units.
5980
5981This option is the default for optimized compilation if the assembler and
5982linker support it.  Use @option{-fno-merge-constants} to inhibit this
5983behavior.
5984
5985Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5986
5987@item -fmerge-all-constants
5988@opindex fmerge-all-constants
5989Attempt to merge identical constants and identical variables.
5990
5991This option implies @option{-fmerge-constants}.  In addition to
5992@option{-fmerge-constants} this considers e.g.@: even constant initialized
5993arrays or initialized constant variables with integral or floating point
5994types.  Languages like C or C++ require each variable, including multiple
5995instances of the same variable in recursive calls, to have distinct locations,
5996so using this option will result in non-conforming
5997behavior.
5998
5999@item -fmodulo-sched
6000@opindex fmodulo-sched
6001Perform swing modulo scheduling immediately before the first scheduling
6002pass.  This pass looks at innermost loops and reorders their
6003instructions by overlapping different iterations.
6004
6005@item -fmodulo-sched-allow-regmoves
6006@opindex fmodulo-sched-allow-regmoves
6007Perform more aggressive SMS based modulo scheduling with register moves
6008allowed.  By setting this flag certain anti-dependences edges will be
6009deleted which will trigger the generation of reg-moves based on the
6010life-range analysis.  This option is effective only with
6011@option{-fmodulo-sched} enabled.
6012
6013@item -fno-branch-count-reg
6014@opindex fno-branch-count-reg
6015Do not use ``decrement and branch'' instructions on a count register,
6016but instead generate a sequence of instructions that decrement a
6017register, compare it against zero, then branch based upon the result.
6018This option is only meaningful on architectures that support such
6019instructions, which include x86, PowerPC, IA-64 and S/390.
6020
6021The default is @option{-fbranch-count-reg}.
6022
6023@item -fno-function-cse
6024@opindex fno-function-cse
6025Do not put function addresses in registers; make each instruction that
6026calls a constant function contain the function's address explicitly.
6027
6028This option results in less efficient code, but some strange hacks
6029that alter the assembler output may be confused by the optimizations
6030performed when this option is not used.
6031
6032The default is @option{-ffunction-cse}
6033
6034@item -fno-zero-initialized-in-bss
6035@opindex fno-zero-initialized-in-bss
6036If the target supports a BSS section, GCC by default puts variables that
6037are initialized to zero into BSS@.  This can save space in the resulting
6038code.
6039
6040This option turns off this behavior because some programs explicitly
6041rely on variables going to the data section.  E.g., so that the
6042resulting executable can find the beginning of that section and/or make
6043assumptions based on that.
6044
6045The default is @option{-fzero-initialized-in-bss}.
6046
6047@item -fmudflap -fmudflapth -fmudflapir
6048@opindex fmudflap
6049@opindex fmudflapth
6050@opindex fmudflapir
6051@cindex bounds checking
6052@cindex mudflap
6053For front-ends that support it (C and C++), instrument all risky
6054pointer/array dereferencing operations, some standard library
6055string/heap functions, and some other associated constructs with
6056range/validity tests.  Modules so instrumented should be immune to
6057buffer overflows, invalid heap use, and some other classes of C/C++
6058programming errors.  The instrumentation relies on a separate runtime
6059library (@file{libmudflap}), which will be linked into a program if
6060@option{-fmudflap} is given at link time.  Run-time behavior of the
6061instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
6062environment variable.  See @code{env MUDFLAP_OPTIONS=-help a.out}
6063for its options.
6064
6065Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
6066link if your program is multi-threaded.  Use @option{-fmudflapir}, in
6067addition to @option{-fmudflap} or @option{-fmudflapth}, if
6068instrumentation should ignore pointer reads.  This produces less
6069instrumentation (and therefore faster execution) and still provides
6070some protection against outright memory corrupting writes, but allows
6071erroneously read data to propagate within a program.
6072
6073@item -fthread-jumps
6074@opindex fthread-jumps
6075Perform optimizations where we check to see if a jump branches to a
6076location where another comparison subsumed by the first is found.  If
6077so, the first branch is redirected to either the destination of the
6078second branch or a point immediately following it, depending on whether
6079the condition is known to be true or false.
6080
6081Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6082
6083@item -fsplit-wide-types
6084@opindex fsplit-wide-types
6085When using a type that occupies multiple registers, such as @code{long
6086long} on a 32-bit system, split the registers apart and allocate them
6087independently.  This normally generates better code for those types,
6088but may make debugging more difficult.
6089
6090Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6091@option{-Os}.
6092
6093@item -fcse-follow-jumps
6094@opindex fcse-follow-jumps
6095In common subexpression elimination (CSE), scan through jump instructions
6096when the target of the jump is not reached by any other path.  For
6097example, when CSE encounters an @code{if} statement with an
6098@code{else} clause, CSE will follow the jump when the condition
6099tested is false.
6100
6101Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6102
6103@item -fcse-skip-blocks
6104@opindex fcse-skip-blocks
6105This is similar to @option{-fcse-follow-jumps}, but causes CSE to
6106follow jumps which conditionally skip over blocks.  When CSE
6107encounters a simple @code{if} statement with no else clause,
6108@option{-fcse-skip-blocks} causes CSE to follow the jump around the
6109body of the @code{if}.
6110
6111Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6112
6113@item -frerun-cse-after-loop
6114@opindex frerun-cse-after-loop
6115Re-run common subexpression elimination after loop optimizations has been
6116performed.
6117
6118Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6119
6120@item -fgcse
6121@opindex fgcse
6122Perform a global common subexpression elimination pass.
6123This pass also performs global constant and copy propagation.
6124
6125@emph{Note:} When compiling a program using computed gotos, a GCC
6126extension, you may get better runtime performance if you disable
6127the global common subexpression elimination pass by adding
6128@option{-fno-gcse} to the command line.
6129
6130Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6131
6132@item -fgcse-lm
6133@opindex fgcse-lm
6134When @option{-fgcse-lm} is enabled, global common subexpression elimination will
6135attempt to move loads which are only killed by stores into themselves.  This
6136allows a loop containing a load/store sequence to be changed to a load outside
6137the loop, and a copy/store within the loop.
6138
6139Enabled by default when gcse is enabled.
6140
6141@item -fgcse-sm
6142@opindex fgcse-sm
6143When @option{-fgcse-sm} is enabled, a store motion pass is run after
6144global common subexpression elimination.  This pass will attempt to move
6145stores out of loops.  When used in conjunction with @option{-fgcse-lm},
6146loops containing a load/store sequence can be changed to a load before
6147the loop and a store after the loop.
6148
6149Not enabled at any optimization level.
6150
6151@item -fgcse-las
6152@opindex fgcse-las
6153When @option{-fgcse-las} is enabled, the global common subexpression
6154elimination pass eliminates redundant loads that come after stores to the
6155same memory location (both partial and full redundancies).
6156
6157Not enabled at any optimization level.
6158
6159@item -fgcse-after-reload
6160@opindex fgcse-after-reload
6161When @option{-fgcse-after-reload} is enabled, a redundant load elimination
6162pass is performed after reload.  The purpose of this pass is to cleanup
6163redundant spilling.
6164
6165@item -funsafe-loop-optimizations
6166@opindex funsafe-loop-optimizations
6167If given, the loop optimizer will assume that loop indices do not
6168overflow, and that the loops with nontrivial exit condition are not
6169infinite.  This enables a wider range of loop optimizations even if
6170the loop optimizer itself cannot prove that these assumptions are valid.
6171Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
6172if it finds this kind of loop.
6173
6174@item -fcrossjumping
6175@opindex fcrossjumping
6176Perform cross-jumping transformation.  This transformation unifies equivalent code and save code size.  The
6177resulting code may or may not perform better than without cross-jumping.
6178
6179Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6180
6181@item -fauto-inc-dec
6182@opindex fauto-inc-dec
6183Combine increments or decrements of addresses with memory accesses.
6184This pass is always skipped on architectures that do not have
6185instructions to support this.  Enabled by default at @option{-O} and
6186higher on architectures that support this.
6187
6188@item -fdce
6189@opindex fdce
6190Perform dead code elimination (DCE) on RTL@.
6191Enabled by default at @option{-O} and higher.
6192
6193@item -fdse
6194@opindex fdse
6195Perform dead store elimination (DSE) on RTL@.
6196Enabled by default at @option{-O} and higher.
6197
6198@item -fif-conversion
6199@opindex fif-conversion
6200Attempt to transform conditional jumps into branch-less equivalents.  This
6201include use of conditional moves, min, max, set flags and abs instructions, and
6202some tricks doable by standard arithmetics.  The use of conditional execution
6203on chips where it is available is controlled by @code{if-conversion2}.
6204
6205Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6206
6207@item -fif-conversion2
6208@opindex fif-conversion2
6209Use conditional execution (where available) to transform conditional jumps into
6210branch-less equivalents.
6211
6212Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6213
6214@item -fdelete-null-pointer-checks
6215@opindex fdelete-null-pointer-checks
6216Assume that programs cannot safely dereference null pointers, and that
6217no code or data element resides there.  This enables simple constant
6218folding optimizations at all optimization levels.  In addition, other
6219optimization passes in GCC use this flag to control global dataflow
6220analyses that eliminate useless checks for null pointers; these assume
6221that if a pointer is checked after it has already been dereferenced,
6222it cannot be null.
6223
6224Note however that in some environments this assumption is not true.
6225Use @option{-fno-delete-null-pointer-checks} to disable this optimization
6226for programs which depend on that behavior.
6227
6228Some targets, especially embedded ones, disable this option at all levels.
6229Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
6230@option{-O2}, @option{-O3}, @option{-Os}.  Passes that use the information
6231are enabled independently at different optimization levels.
6232
6233@item -fexpensive-optimizations
6234@opindex fexpensive-optimizations
6235Perform a number of minor optimizations that are relatively expensive.
6236
6237Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6238
6239@item -foptimize-register-move
6240@itemx -fregmove
6241@opindex foptimize-register-move
6242@opindex fregmove
6243Attempt to reassign register numbers in move instructions and as
6244operands of other simple instructions in order to maximize the amount of
6245register tying.  This is especially helpful on machines with two-operand
6246instructions.
6247
6248Note @option{-fregmove} and @option{-foptimize-register-move} are the same
6249optimization.
6250
6251Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6252
6253@item -fira-algorithm=@var{algorithm}
6254Use specified coloring algorithm for the integrated register
6255allocator.  The @var{algorithm} argument should be @code{priority} or
6256@code{CB}.  The first algorithm specifies Chow's priority coloring,
6257the second one specifies Chaitin-Briggs coloring.  The second
6258algorithm can be unimplemented for some architectures.  If it is
6259implemented, it is the default because Chaitin-Briggs coloring as a
6260rule generates a better code.
6261
6262@item -fira-region=@var{region}
6263Use specified regions for the integrated register allocator.  The
6264@var{region} argument should be one of @code{all}, @code{mixed}, or
6265@code{one}.  The first value means using all loops as register
6266allocation regions, the second value which is the default means using
6267all loops except for loops with small register pressure as the
6268regions, and third one means using all function as a single region.
6269The first value can give best result for machines with small size and
6270irregular register set, the third one results in faster and generates
6271decent code and the smallest size code, and the default value usually
6272give the best results in most cases and for most architectures.
6273
6274@item -fira-coalesce
6275@opindex fira-coalesce
6276Do optimistic register coalescing.  This option might be profitable for
6277architectures with big regular register files.
6278
6279@item -fira-loop-pressure
6280@opindex fira-loop-pressure
6281Use IRA to evaluate register pressure in loops for decision to move
6282loop invariants.  Usage of this option usually results in generation
6283of faster and smaller code on machines with big register files (>= 32
6284registers) but it can slow compiler down.
6285
6286This option is enabled at level @option{-O3} for some targets.
6287
6288@item -fno-ira-share-save-slots
6289@opindex fno-ira-share-save-slots
6290Switch off sharing stack slots used for saving call used hard
6291registers living through a call.  Each hard register will get a
6292separate stack slot and as a result function stack frame will be
6293bigger.
6294
6295@item -fno-ira-share-spill-slots
6296@opindex fno-ira-share-spill-slots
6297Switch off sharing stack slots allocated for pseudo-registers.  Each
6298pseudo-register which did not get a hard register will get a separate
6299stack slot and as a result function stack frame will be bigger.
6300
6301@item -fira-verbose=@var{n}
6302@opindex fira-verbose
6303Set up how verbose dump file for the integrated register allocator
6304will be.  Default value is 5.  If the value is greater or equal to 10,
6305the dump file will be stderr as if the value were @var{n} minus 10.
6306
6307@item -fdelayed-branch
6308@opindex fdelayed-branch
6309If supported for the target machine, attempt to reorder instructions
6310to exploit instruction slots available after delayed branch
6311instructions.
6312
6313Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6314
6315@item -fschedule-insns
6316@opindex fschedule-insns
6317If supported for the target machine, attempt to reorder instructions to
6318eliminate execution stalls due to required data being unavailable.  This
6319helps machines that have slow floating point or memory load instructions
6320by allowing other instructions to be issued until the result of the load
6321or floating point instruction is required.
6322
6323Enabled at levels @option{-O2}, @option{-O3}.
6324
6325@item -fschedule-insns2
6326@opindex fschedule-insns2
6327Similar to @option{-fschedule-insns}, but requests an additional pass of
6328instruction scheduling after register allocation has been done.  This is
6329especially useful on machines with a relatively small number of
6330registers and where memory load instructions take more than one cycle.
6331
6332Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6333
6334@item -fno-sched-interblock
6335@opindex fno-sched-interblock
6336Don't schedule instructions across basic blocks.  This is normally
6337enabled by default when scheduling before register allocation, i.e.@:
6338with @option{-fschedule-insns} or at @option{-O2} or higher.
6339
6340@item -fno-sched-spec
6341@opindex fno-sched-spec
6342Don't allow speculative motion of non-load instructions.  This is normally
6343enabled by default when scheduling before register allocation, i.e.@:
6344with @option{-fschedule-insns} or at @option{-O2} or higher.
6345
6346@item -fsched-pressure
6347@opindex fsched-pressure
6348Enable register pressure sensitive insn scheduling before the register
6349allocation.  This only makes sense when scheduling before register
6350allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
6351@option{-O2} or higher.  Usage of this option can improve the
6352generated code and decrease its size by preventing register pressure
6353increase above the number of available hard registers and as a
6354consequence register spills in the register allocation.
6355
6356@item -fsched-spec-load
6357@opindex fsched-spec-load
6358Allow speculative motion of some load instructions.  This only makes
6359sense when scheduling before register allocation, i.e.@: with
6360@option{-fschedule-insns} or at @option{-O2} or higher.
6361
6362@item -fsched-spec-load-dangerous
6363@opindex fsched-spec-load-dangerous
6364Allow speculative motion of more load instructions.  This only makes
6365sense when scheduling before register allocation, i.e.@: with
6366@option{-fschedule-insns} or at @option{-O2} or higher.
6367
6368@item -fsched-stalled-insns
6369@itemx -fsched-stalled-insns=@var{n}
6370@opindex fsched-stalled-insns
6371Define how many insns (if any) can be moved prematurely from the queue
6372of stalled insns into the ready list, during the second scheduling pass.
6373@option{-fno-sched-stalled-insns} means that no insns will be moved
6374prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6375on how many queued insns can be moved prematurely.
6376@option{-fsched-stalled-insns} without a value is equivalent to
6377@option{-fsched-stalled-insns=1}.
6378
6379@item -fsched-stalled-insns-dep
6380@itemx -fsched-stalled-insns-dep=@var{n}
6381@opindex fsched-stalled-insns-dep
6382Define how many insn groups (cycles) will be examined for a dependency
6383on a stalled insn that is candidate for premature removal from the queue
6384of stalled insns.  This has an effect only during the second scheduling pass,
6385and only if @option{-fsched-stalled-insns} is used.
6386@option{-fno-sched-stalled-insns-dep} is equivalent to
6387@option{-fsched-stalled-insns-dep=0}.
6388@option{-fsched-stalled-insns-dep} without a value is equivalent to
6389@option{-fsched-stalled-insns-dep=1}.
6390
6391@item -fsched2-use-superblocks
6392@opindex fsched2-use-superblocks
6393When scheduling after register allocation, do use superblock scheduling
6394algorithm.  Superblock scheduling allows motion across basic block boundaries
6395resulting on faster schedules.  This option is experimental, as not all machine
6396descriptions used by GCC model the CPU closely enough to avoid unreliable
6397results from the algorithm.
6398
6399This only makes sense when scheduling after register allocation, i.e.@: with
6400@option{-fschedule-insns2} or at @option{-O2} or higher.
6401
6402@item -fsched-group-heuristic
6403@opindex fsched-group-heuristic
6404Enable the group heuristic in the scheduler.  This heuristic favors
6405the instruction that belongs to a schedule group.  This is enabled
6406by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6407or @option{-fschedule-insns2} or at @option{-O2} or higher.
6408
6409@item -fsched-critical-path-heuristic
6410@opindex fsched-critical-path-heuristic
6411Enable the critical-path heuristic in the scheduler.  This heuristic favors
6412instructions on the critical path.  This is enabled by default when
6413scheduling is enabled, i.e.@: with @option{-fschedule-insns}
6414or @option{-fschedule-insns2} or at @option{-O2} or higher.
6415
6416@item -fsched-spec-insn-heuristic
6417@opindex fsched-spec-insn-heuristic
6418Enable the speculative instruction heuristic in the scheduler.  This
6419heuristic favors speculative instructions with greater dependency weakness.
6420This is enabled by default when scheduling is enabled, i.e.@:
6421with @option{-fschedule-insns} or @option{-fschedule-insns2}
6422or at @option{-O2} or higher.
6423
6424@item -fsched-rank-heuristic
6425@opindex fsched-rank-heuristic
6426Enable the rank heuristic in the scheduler.  This heuristic favors
6427the instruction belonging to a basic block with greater size or frequency.
6428This is enabled by default when scheduling is enabled, i.e.@:
6429with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6430at @option{-O2} or higher.
6431
6432@item -fsched-last-insn-heuristic
6433@opindex fsched-last-insn-heuristic
6434Enable the last-instruction heuristic in the scheduler.  This heuristic
6435favors the instruction that is less dependent on the last instruction
6436scheduled.  This is enabled by default when scheduling is enabled,
6437i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6438at @option{-O2} or higher.
6439
6440@item -fsched-dep-count-heuristic
6441@opindex fsched-dep-count-heuristic
6442Enable the dependent-count heuristic in the scheduler.  This heuristic
6443favors the instruction that has more instructions depending on it.
6444This is enabled by default when scheduling is enabled, i.e.@:
6445with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6446at @option{-O2} or higher.
6447
6448@item -freschedule-modulo-scheduled-loops
6449@opindex freschedule-modulo-scheduled-loops
6450The modulo scheduling comes before the traditional scheduling, if a loop
6451was modulo scheduled we may want to prevent the later scheduling passes
6452from changing its schedule, we use this option to control that.
6453
6454@item -fselective-scheduling
6455@opindex fselective-scheduling
6456Schedule instructions using selective scheduling algorithm.  Selective
6457scheduling runs instead of the first scheduler pass.
6458
6459@item -fselective-scheduling2
6460@opindex fselective-scheduling2
6461Schedule instructions using selective scheduling algorithm.  Selective
6462scheduling runs instead of the second scheduler pass.
6463
6464@item -fsel-sched-pipelining
6465@opindex fsel-sched-pipelining
6466Enable software pipelining of innermost loops during selective scheduling.
6467This option has no effect until one of @option{-fselective-scheduling} or
6468@option{-fselective-scheduling2} is turned on.
6469
6470@item -fsel-sched-pipelining-outer-loops
6471@opindex fsel-sched-pipelining-outer-loops
6472When pipelining loops during selective scheduling, also pipeline outer loops.
6473This option has no effect until @option{-fsel-sched-pipelining} is turned on.
6474
6475@item -fcaller-saves
6476@opindex fcaller-saves
6477Enable values to be allocated in registers that will be clobbered by
6478function calls, by emitting extra instructions to save and restore the
6479registers around such calls.  Such allocation is done only when it
6480seems to result in better code than would otherwise be produced.
6481
6482This option is always enabled by default on certain machines, usually
6483those which have no call-preserved registers to use instead.
6484
6485Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6486
6487@item -fconserve-stack
6488@opindex fconserve-stack
6489Attempt to minimize stack usage.  The compiler will attempt to use less
6490stack space, even if that makes the program slower.  This option
6491implies setting the @option{large-stack-frame} parameter to 100
6492and the @option{large-stack-frame-growth} parameter to 400.
6493
6494@item -ftree-reassoc
6495@opindex ftree-reassoc
6496Perform reassociation on trees.  This flag is enabled by default
6497at @option{-O} and higher.
6498
6499@item -ftree-pre
6500@opindex ftree-pre
6501Perform partial redundancy elimination (PRE) on trees.  This flag is
6502enabled by default at @option{-O2} and @option{-O3}.
6503
6504@item -ftree-forwprop
6505@opindex ftree-forwprop
6506Perform forward propagation on trees.  This flag is enabled by default
6507at @option{-O} and higher.
6508
6509@item -ftree-fre
6510@opindex ftree-fre
6511Perform full redundancy elimination (FRE) on trees.  The difference
6512between FRE and PRE is that FRE only considers expressions
6513that are computed on all paths leading to the redundant computation.
6514This analysis is faster than PRE, though it exposes fewer redundancies.
6515This flag is enabled by default at @option{-O} and higher.
6516
6517@item -ftree-phiprop
6518@opindex ftree-phiprop
6519Perform hoisting of loads from conditional pointers on trees.  This
6520pass is enabled by default at @option{-O} and higher.
6521
6522@item -ftree-copy-prop
6523@opindex ftree-copy-prop
6524Perform copy propagation on trees.  This pass eliminates unnecessary
6525copy operations.  This flag is enabled by default at @option{-O} and
6526higher.
6527
6528@item -fipa-pure-const
6529@opindex fipa-pure-const
6530Discover which functions are pure or constant.
6531Enabled by default at @option{-O} and higher.
6532
6533@item -fipa-reference
6534@opindex fipa-reference
6535Discover which static variables do not escape cannot escape the
6536compilation unit.
6537Enabled by default at @option{-O} and higher.
6538
6539@item -fipa-struct-reorg
6540@opindex fipa-struct-reorg
6541Perform structure reorganization optimization, that change C-like structures
6542layout in order to better utilize spatial locality.  This transformation is
6543effective for programs containing arrays of structures.  Available in two
6544compilation modes: profile-based (enabled with @option{-fprofile-generate})
6545or static (which uses built-in heuristics).  Require @option{-fipa-type-escape}
6546to provide the safety of this transformation.  It works only in whole program
6547mode, so it requires @option{-fwhole-program} and @option{-combine} to be
6548enabled.  Structures considered @samp{cold} by this transformation are not
6549affected (see @option{--param struct-reorg-cold-struct-ratio=@var{value}}).
6550
6551With this flag, the program debug info reflects a new structure layout.
6552
6553@item -fipa-pta
6554@opindex fipa-pta
6555Perform interprocedural pointer analysis.  This option is experimental
6556and does not affect generated code.
6557
6558@item -fipa-cp
6559@opindex fipa-cp
6560Perform interprocedural constant propagation.
6561This optimization analyzes the program to determine when values passed
6562to functions are constants and then optimizes accordingly.
6563This optimization can substantially increase performance
6564if the application has constants passed to functions.
6565This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
6566
6567@item -fipa-cp-clone
6568@opindex fipa-cp-clone
6569Perform function cloning to make interprocedural constant propagation stronger.
6570When enabled, interprocedural constant propagation will perform function cloning
6571when externally visible function can be called with constant arguments.
6572Because this optimization can create multiple copies of functions,
6573it may significantly increase code size
6574(see @option{--param ipcp-unit-growth=@var{value}}).
6575This flag is enabled by default at @option{-O3}.
6576
6577@item -fipa-matrix-reorg
6578@opindex fipa-matrix-reorg
6579Perform matrix flattening and transposing.
6580Matrix flattening tries to replace an @math{m}-dimensional matrix
6581with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
6582This reduces the level of indirection needed for accessing the elements
6583of the matrix. The second optimization is matrix transposing that
6584attempts to change the order of the matrix's dimensions in order to
6585improve cache locality.
6586Both optimizations need the @option{-fwhole-program} flag.
6587Transposing is enabled only if profiling information is available.
6588
6589@item -ftree-sink
6590@opindex ftree-sink
6591Perform forward store motion  on trees.  This flag is
6592enabled by default at @option{-O} and higher.
6593
6594@item -ftree-ccp
6595@opindex ftree-ccp
6596Perform sparse conditional constant propagation (CCP) on trees.  This
6597pass only operates on local scalar variables and is enabled by default
6598at @option{-O} and higher.
6599
6600@item -ftree-switch-conversion
6601Perform conversion of simple initializations in a switch to
6602initializations from a scalar array.  This flag is enabled by default
6603at @option{-O2} and higher.
6604
6605@item -ftree-dce
6606@opindex ftree-dce
6607Perform dead code elimination (DCE) on trees.  This flag is enabled by
6608default at @option{-O} and higher.
6609
6610@item -ftree-builtin-call-dce
6611@opindex ftree-builtin-call-dce
6612Perform conditional dead code elimination (DCE) for calls to builtin functions
6613that may set @code{errno} but are otherwise side-effect free.  This flag is
6614enabled by default at @option{-O2} and higher if @option{-Os} is not also
6615specified.
6616
6617@item -ftree-dominator-opts
6618@opindex ftree-dominator-opts
6619Perform a variety of simple scalar cleanups (constant/copy
6620propagation, redundancy elimination, range propagation and expression
6621simplification) based on a dominator tree traversal.  This also
6622performs jump threading (to reduce jumps to jumps). This flag is
6623enabled by default at @option{-O} and higher.
6624
6625@item -ftree-dse
6626@opindex ftree-dse
6627Perform dead store elimination (DSE) on trees.  A dead store is a store into
6628a memory location which will later be overwritten by another store without
6629any intervening loads.  In this case the earlier store can be deleted.  This
6630flag is enabled by default at @option{-O} and higher.
6631
6632@item -ftree-ch
6633@opindex ftree-ch
6634Perform loop header copying on trees.  This is beneficial since it increases
6635effectiveness of code motion optimizations.  It also saves one jump.  This flag
6636is enabled by default at @option{-O} and higher.  It is not enabled
6637for @option{-Os}, since it usually increases code size.
6638
6639@item -ftree-loop-optimize
6640@opindex ftree-loop-optimize
6641Perform loop optimizations on trees.  This flag is enabled by default
6642at @option{-O} and higher.
6643
6644@item -ftree-loop-linear
6645@opindex ftree-loop-linear
6646Perform linear loop transformations on tree.  This flag can improve cache
6647performance and allow further loop optimizations to take place.
6648
6649@item -floop-interchange
6650Perform loop interchange transformations on loops.  Interchanging two
6651nested loops switches the inner and outer loops.  For example, given a
6652loop like:
6653@smallexample
6654DO J = 1, M
6655  DO I = 1, N
6656    A(J, I) = A(J, I) * C
6657  ENDDO
6658ENDDO
6659@end smallexample
6660loop interchange will transform the loop as if the user had written:
6661@smallexample
6662DO I = 1, N
6663  DO J = 1, M
6664    A(J, I) = A(J, I) * C
6665  ENDDO
6666ENDDO
6667@end smallexample
6668which can be beneficial when @code{N} is larger than the caches,
6669because in Fortran, the elements of an array are stored in memory
6670contiguously by column, and the original loop iterates over rows,
6671potentially creating at each access a cache miss.  This optimization
6672applies to all the languages supported by GCC and is not limited to
6673Fortran.  To use this code transformation, GCC has to be configured
6674with @option{--with-ppl} and @option{--with-cloog} to enable the
6675Graphite loop transformation infrastructure.
6676
6677@item -floop-strip-mine
6678Perform loop strip mining transformations on loops.  Strip mining
6679splits a loop into two nested loops.  The outer loop has strides
6680equal to the strip size and the inner loop has strides of the
6681original loop within a strip.  The strip length can be changed
6682using the @option{loop-block-tile-size} parameter.  For example,
6683given a loop like:
6684@smallexample
6685DO I = 1, N
6686  A(I) = A(I) + C
6687ENDDO
6688@end smallexample
6689loop strip mining will transform the loop as if the user had written:
6690@smallexample
6691DO II = 1, N, 51
6692  DO I = II, min (II + 50, N)
6693    A(I) = A(I) + C
6694  ENDDO
6695ENDDO
6696@end smallexample
6697This optimization applies to all the languages supported by GCC and is
6698not limited to Fortran.  To use this code transformation, GCC has to
6699be configured with @option{--with-ppl} and @option{--with-cloog} to
6700enable the Graphite loop transformation infrastructure.
6701
6702@item -floop-block
6703Perform loop blocking transformations on loops.  Blocking strip mines
6704each loop in the loop nest such that the memory accesses of the
6705element loops fit inside caches.  The strip length can be changed
6706using the @option{loop-block-tile-size} parameter.  For example, given
6707a loop like:
6708@smallexample
6709DO I = 1, N
6710  DO J = 1, M
6711    A(J, I) = B(I) + C(J)
6712  ENDDO
6713ENDDO
6714@end smallexample
6715loop blocking will transform the loop as if the user had written:
6716@smallexample
6717DO II = 1, N, 51
6718  DO JJ = 1, M, 51
6719    DO I = II, min (II + 50, N)
6720      DO J = JJ, min (JJ + 50, M)
6721        A(J, I) = B(I) + C(J)
6722      ENDDO
6723    ENDDO
6724  ENDDO
6725ENDDO
6726@end smallexample
6727which can be beneficial when @code{M} is larger than the caches,
6728because the innermost loop will iterate over a smaller amount of data
6729that can be kept in the caches.  This optimization applies to all the
6730languages supported by GCC and is not limited to Fortran.  To use this
6731code transformation, GCC has to be configured with @option{--with-ppl}
6732and @option{--with-cloog} to enable the Graphite loop transformation
6733infrastructure.
6734
6735@item -fgraphite-identity
6736@opindex fgraphite-identity
6737Enable the identity transformation for graphite.  For every SCoP we generate
6738the polyhedral representation and transform it back to gimple.  Using
6739@option{-fgraphite-identity} we can check the costs or benefits of the
6740GIMPLE -> GRAPHITE -> GIMPLE transformation.  Some minimal optimizations
6741are also performed by the code generator CLooG, like index splitting and
6742dead code elimination in loops.
6743
6744@item -floop-parallelize-all
6745Use the Graphite data dependence analysis to identify loops that can
6746be parallelized.  Parallelize all the loops that can be analyzed to
6747not contain loop carried dependences without checking that it is
6748profitable to parallelize the loops.
6749
6750@item -fcheck-data-deps
6751@opindex fcheck-data-deps
6752Compare the results of several data dependence analyzers.  This option
6753is used for debugging the data dependence analyzers.
6754
6755@item -ftree-loop-distribution
6756Perform loop distribution.  This flag can improve cache performance on
6757big loop bodies and allow further loop optimizations, like
6758parallelization or vectorization, to take place.  For example, the loop
6759@smallexample
6760DO I = 1, N
6761  A(I) = B(I) + C
6762  D(I) = E(I) * F
6763ENDDO
6764@end smallexample
6765is transformed to
6766@smallexample
6767DO I = 1, N
6768   A(I) = B(I) + C
6769ENDDO
6770DO I = 1, N
6771   D(I) = E(I) * F
6772ENDDO
6773@end smallexample
6774
6775@item -ftree-loop-im
6776@opindex ftree-loop-im
6777Perform loop invariant motion on trees.  This pass moves only invariants that
6778would be hard to handle at RTL level (function calls, operations that expand to
6779nontrivial sequences of insns).  With @option{-funswitch-loops} it also moves
6780operands of conditions that are invariant out of the loop, so that we can use
6781just trivial invariantness analysis in loop unswitching.  The pass also includes
6782store motion.
6783
6784@item -ftree-loop-ivcanon
6785@opindex ftree-loop-ivcanon
6786Create a canonical counter for number of iterations in the loop for that
6787determining number of iterations requires complicated analysis.  Later
6788optimizations then may determine the number easily.  Useful especially
6789in connection with unrolling.
6790
6791@item -fivopts
6792@opindex fivopts
6793Perform induction variable optimizations (strength reduction, induction
6794variable merging and induction variable elimination) on trees.
6795
6796@item -ftree-parallelize-loops=n
6797@opindex ftree-parallelize-loops
6798Parallelize loops, i.e., split their iteration space to run in n threads.
6799This is only possible for loops whose iterations are independent
6800and can be arbitrarily reordered.  The optimization is only
6801profitable on multiprocessor machines, for loops that are CPU-intensive,
6802rather than constrained e.g.@: by memory bandwidth.  This option
6803implies @option{-pthread}, and thus is only supported on targets
6804that have support for @option{-pthread}.
6805
6806@item -ftree-pta
6807@opindex ftree-pta
6808Perform function-local points-to analysis on trees.  This flag is
6809enabled by default at @option{-O} and higher.
6810
6811@item -ftree-sra
6812@opindex ftree-sra
6813Perform scalar replacement of aggregates.  This pass replaces structure
6814references with scalars to prevent committing structures to memory too
6815early.  This flag is enabled by default at @option{-O} and higher.
6816
6817@item -ftree-copyrename
6818@opindex ftree-copyrename
6819Perform copy renaming on trees.  This pass attempts to rename compiler
6820temporaries to other variables at copy locations, usually resulting in
6821variable names which more closely resemble the original variables.  This flag
6822is enabled by default at @option{-O} and higher.
6823
6824@item -ftree-ter
6825@opindex ftree-ter
6826Perform temporary expression replacement during the SSA->normal phase.  Single
6827use/single def temporaries are replaced at their use location with their
6828defining expression.  This results in non-GIMPLE code, but gives the expanders
6829much more complex trees to work on resulting in better RTL generation.  This is
6830enabled by default at @option{-O} and higher.
6831
6832@item -ftree-vectorize
6833@opindex ftree-vectorize
6834Perform loop vectorization on trees. This flag is enabled by default at
6835@option{-O3}.
6836
6837@item -ftree-slp-vectorize
6838@opindex ftree-slp-vectorize
6839Perform basic block vectorization on trees. This flag is enabled by default at
6840@option{-O3} and when @option{-ftree-vectorize} is enabled.
6841
6842@item -ftree-vect-loop-version
6843@opindex ftree-vect-loop-version
6844Perform loop versioning when doing loop vectorization on trees.  When a loop
6845appears to be vectorizable except that data alignment or data dependence cannot
6846be determined at compile time then vectorized and non-vectorized versions of
6847the loop are generated along with runtime checks for alignment or dependence
6848to control which version is executed.  This option is enabled by default
6849except at level @option{-Os} where it is disabled.
6850
6851@item -fvect-cost-model
6852@opindex fvect-cost-model
6853Enable cost model for vectorization.
6854
6855@item -ftree-vrp
6856@opindex ftree-vrp
6857Perform Value Range Propagation on trees.  This is similar to the
6858constant propagation pass, but instead of values, ranges of values are
6859propagated.  This allows the optimizers to remove unnecessary range
6860checks like array bound checks and null pointer checks.  This is
6861enabled by default at @option{-O2} and higher.  Null pointer check
6862elimination is only done if @option{-fdelete-null-pointer-checks} is
6863enabled.
6864
6865@item -ftracer
6866@opindex ftracer
6867Perform tail duplication to enlarge superblock size.  This transformation
6868simplifies the control flow of the function allowing other optimizations to do
6869better job.
6870
6871@item -funroll-loops
6872@opindex funroll-loops
6873Unroll loops whose number of iterations can be determined at compile
6874time or upon entry to the loop.  @option{-funroll-loops} implies
6875@option{-frerun-cse-after-loop}.  This option makes code larger,
6876and may or may not make it run faster.
6877
6878@item -funroll-all-loops
6879@opindex funroll-all-loops
6880Unroll all loops, even if their number of iterations is uncertain when
6881the loop is entered.  This usually makes programs run more slowly.
6882@option{-funroll-all-loops} implies the same options as
6883@option{-funroll-loops},
6884
6885@item -fsplit-ivs-in-unroller
6886@opindex fsplit-ivs-in-unroller
6887Enables expressing of values of induction variables in later iterations
6888of the unrolled loop using the value in the first iteration.  This breaks
6889long dependency chains, thus improving efficiency of the scheduling passes.
6890
6891Combination of @option{-fweb} and CSE is often sufficient to obtain the
6892same effect.  However in cases the loop body is more complicated than
6893a single basic block, this is not reliable.  It also does not work at all
6894on some of the architectures due to restrictions in the CSE pass.
6895
6896This optimization is enabled by default.
6897
6898@item -fvariable-expansion-in-unroller
6899@opindex fvariable-expansion-in-unroller
6900With this option, the compiler will create multiple copies of some
6901local variables when unrolling a loop which can result in superior code.
6902
6903@item -fpredictive-commoning
6904@opindex fpredictive-commoning
6905Perform predictive commoning optimization, i.e., reusing computations
6906(especially memory loads and stores) performed in previous
6907iterations of loops.
6908
6909This option is enabled at level @option{-O3}.
6910
6911@item -fprefetch-loop-arrays
6912@opindex fprefetch-loop-arrays
6913If supported by the target machine, generate instructions to prefetch
6914memory to improve the performance of loops that access large arrays.
6915
6916This option may generate better or worse code; results are highly
6917dependent on the structure of loops within the source code.
6918
6919Disabled at level @option{-Os}.
6920
6921@item -fno-peephole
6922@itemx -fno-peephole2
6923@opindex fno-peephole
6924@opindex fno-peephole2
6925Disable any machine-specific peephole optimizations.  The difference
6926between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6927are implemented in the compiler; some targets use one, some use the
6928other, a few use both.
6929
6930@option{-fpeephole} is enabled by default.
6931@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6932
6933@item -fno-guess-branch-probability
6934@opindex fno-guess-branch-probability
6935Do not guess branch probabilities using heuristics.
6936
6937GCC will use heuristics to guess branch probabilities if they are
6938not provided by profiling feedback (@option{-fprofile-arcs}).  These
6939heuristics are based on the control flow graph.  If some branch probabilities
6940are specified by @samp{__builtin_expect}, then the heuristics will be
6941used to guess branch probabilities for the rest of the control flow graph,
6942taking the @samp{__builtin_expect} info into account.  The interactions
6943between the heuristics and @samp{__builtin_expect} can be complex, and in
6944some cases, it may be useful to disable the heuristics so that the effects
6945of @samp{__builtin_expect} are easier to understand.
6946
6947The default is @option{-fguess-branch-probability} at levels
6948@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6949
6950@item -freorder-blocks
6951@opindex freorder-blocks
6952Reorder basic blocks in the compiled function in order to reduce number of
6953taken branches and improve code locality.
6954
6955Enabled at levels @option{-O2}, @option{-O3}.
6956
6957@item -freorder-blocks-and-partition
6958@opindex freorder-blocks-and-partition
6959In addition to reordering basic blocks in the compiled function, in order
6960to reduce number of taken branches, partitions hot and cold basic blocks
6961into separate sections of the assembly and .o files, to improve
6962paging and cache locality performance.
6963
6964This optimization is automatically turned off in the presence of
6965exception handling, for linkonce sections, for functions with a user-defined
6966section attribute and on any architecture that does not support named
6967sections.
6968
6969@item -freorder-functions
6970@opindex freorder-functions
6971Reorder functions in the object file in order to
6972improve code locality.  This is implemented by using special
6973subsections @code{.text.hot} for most frequently executed functions and
6974@code{.text.unlikely} for unlikely executed functions.  Reordering is done by
6975the linker so object file format must support named sections and linker must
6976place them in a reasonable way.
6977
6978Also profile feedback must be available in to make this option effective.  See
6979@option{-fprofile-arcs} for details.
6980
6981Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6982
6983@item -fstrict-aliasing
6984@opindex fstrict-aliasing
6985Allow the compiler to assume the strictest aliasing rules applicable to
6986the language being compiled.  For C (and C++), this activates
6987optimizations based on the type of expressions.  In particular, an
6988object of one type is assumed never to reside at the same address as an
6989object of a different type, unless the types are almost the same.  For
6990example, an @code{unsigned int} can alias an @code{int}, but not a
6991@code{void*} or a @code{double}.  A character type may alias any other
6992type.
6993
6994@anchor{Type-punning}Pay special attention to code like this:
6995@smallexample
6996union a_union @{
6997  int i;
6998  double d;
6999@};
7000
7001int f() @{
7002  union a_union t;
7003  t.d = 3.0;
7004  return t.i;
7005@}
7006@end smallexample
7007The practice of reading from a different union member than the one most
7008recently written to (called ``type-punning'') is common.  Even with
7009@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
7010is accessed through the union type.  So, the code above will work as
7011expected.  @xref{Structures unions enumerations and bit-fields
7012implementation}.  However, this code might not:
7013@smallexample
7014int f() @{
7015  union a_union t;
7016  int* ip;
7017  t.d = 3.0;
7018  ip = &t.i;
7019  return *ip;
7020@}
7021@end smallexample
7022
7023Similarly, access by taking the address, casting the resulting pointer
7024and dereferencing the result has undefined behavior, even if the cast
7025uses a union type, e.g.:
7026@smallexample
7027int f() @{
7028  double d = 3.0;
7029  return ((union a_union *) &d)->i;
7030@}
7031@end smallexample
7032
7033The @option{-fstrict-aliasing} option is enabled at levels
7034@option{-O2}, @option{-O3}, @option{-Os}.
7035
7036@item -fstrict-overflow
7037@opindex fstrict-overflow
7038Allow the compiler to assume strict signed overflow rules, depending
7039on the language being compiled.  For C (and C++) this means that
7040overflow when doing arithmetic with signed numbers is undefined, which
7041means that the compiler may assume that it will not happen.  This
7042permits various optimizations.  For example, the compiler will assume
7043that an expression like @code{i + 10 > i} will always be true for
7044signed @code{i}.  This assumption is only valid if signed overflow is
7045undefined, as the expression is false if @code{i + 10} overflows when
7046using twos complement arithmetic.  When this option is in effect any
7047attempt to determine whether an operation on signed numbers will
7048overflow must be written carefully to not actually involve overflow.
7049
7050This option also allows the compiler to assume strict pointer
7051semantics: given a pointer to an object, if adding an offset to that
7052pointer does not produce a pointer to the same object, the addition is
7053undefined.  This permits the compiler to conclude that @code{p + u >
7054p} is always true for a pointer @code{p} and unsigned integer
7055@code{u}.  This assumption is only valid because pointer wraparound is
7056undefined, as the expression is false if @code{p + u} overflows using
7057twos complement arithmetic.
7058
7059See also the @option{-fwrapv} option.  Using @option{-fwrapv} means
7060that integer signed overflow is fully defined: it wraps.  When
7061@option{-fwrapv} is used, there is no difference between
7062@option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7063integers.  With @option{-fwrapv} certain types of overflow are
7064permitted.  For example, if the compiler gets an overflow when doing
7065arithmetic on constants, the overflowed value can still be used with
7066@option{-fwrapv}, but not otherwise.
7067
7068The @option{-fstrict-overflow} option is enabled at levels
7069@option{-O2}, @option{-O3}, @option{-Os}.
7070
7071@item -falign-functions
7072@itemx -falign-functions=@var{n}
7073@opindex falign-functions
7074Align the start of functions to the next power-of-two greater than
7075@var{n}, skipping up to @var{n} bytes.  For instance,
7076@option{-falign-functions=32} aligns functions to the next 32-byte
7077boundary, but @option{-falign-functions=24} would align to the next
707832-byte boundary only if this can be done by skipping 23 bytes or less.
7079
7080@option{-fno-align-functions} and @option{-falign-functions=1} are
7081equivalent and mean that functions will not be aligned.
7082
7083Some assemblers only support this flag when @var{n} is a power of two;
7084in that case, it is rounded up.
7085
7086If @var{n} is not specified or is zero, use a machine-dependent default.
7087
7088Enabled at levels @option{-O2}, @option{-O3}.
7089
7090@item -falign-labels
7091@itemx -falign-labels=@var{n}
7092@opindex falign-labels
7093Align all branch targets to a power-of-two boundary, skipping up to
7094@var{n} bytes like @option{-falign-functions}.  This option can easily
7095make code slower, because it must insert dummy operations for when the
7096branch target is reached in the usual flow of the code.
7097
7098@option{-fno-align-labels} and @option{-falign-labels=1} are
7099equivalent and mean that labels will not be aligned.
7100
7101If @option{-falign-loops} or @option{-falign-jumps} are applicable and
7102are greater than this value, then their values are used instead.
7103
7104If @var{n} is not specified or is zero, use a machine-dependent default
7105which is very likely to be @samp{1}, meaning no alignment.
7106
7107Enabled at levels @option{-O2}, @option{-O3}.
7108
7109@item -falign-loops
7110@itemx -falign-loops=@var{n}
7111@opindex falign-loops
7112Align loops to a power-of-two boundary, skipping up to @var{n} bytes
7113like @option{-falign-functions}.  The hope is that the loop will be
7114executed many times, which will make up for any execution of the dummy
7115operations.
7116
7117@option{-fno-align-loops} and @option{-falign-loops=1} are
7118equivalent and mean that loops will not be aligned.
7119
7120If @var{n} is not specified or is zero, use a machine-dependent default.
7121
7122Enabled at levels @option{-O2}, @option{-O3}.
7123
7124@item -falign-jumps
7125@itemx -falign-jumps=@var{n}
7126@opindex falign-jumps
7127Align branch targets to a power-of-two boundary, for branch targets
7128where the targets can only be reached by jumping, skipping up to @var{n}
7129bytes like @option{-falign-functions}.  In this case, no dummy operations
7130need be executed.
7131
7132@option{-fno-align-jumps} and @option{-falign-jumps=1} are
7133equivalent and mean that loops will not be aligned.
7134
7135If @var{n} is not specified or is zero, use a machine-dependent default.
7136
7137Enabled at levels @option{-O2}, @option{-O3}.
7138
7139@item -funit-at-a-time
7140@opindex funit-at-a-time
7141This option is left for compatibility reasons. @option{-funit-at-a-time}
7142has no effect, while @option{-fno-unit-at-a-time} implies
7143@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7144
7145Enabled by default.
7146
7147@item -fno-toplevel-reorder
7148@opindex fno-toplevel-reorder
7149Do not reorder top-level functions, variables, and @code{asm}
7150statements.  Output them in the same order that they appear in the
7151input file.  When this option is used, unreferenced static variables
7152will not be removed.  This option is intended to support existing code
7153which relies on a particular ordering.  For new code, it is better to
7154use attributes.
7155
7156Enabled at level @option{-O0}.  When disabled explicitly, it also imply
7157@option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
7158targets.
7159
7160@item -fweb
7161@opindex fweb
7162Constructs webs as commonly used for register allocation purposes and assign
7163each web individual pseudo register.  This allows the register allocation pass
7164to operate on pseudos directly, but also strengthens several other optimization
7165passes, such as CSE, loop optimizer and trivial dead code remover.  It can,
7166however, make debugging impossible, since variables will no longer stay in a
7167``home register''.
7168
7169Enabled by default with @option{-funroll-loops}.
7170
7171@item -fwhole-program
7172@opindex fwhole-program
7173Assume that the current compilation unit represents the whole program being
7174compiled.  All public functions and variables with the exception of @code{main}
7175and those merged by attribute @code{externally_visible} become static functions
7176and in effect are optimized more aggressively by interprocedural optimizers.
7177While this option is equivalent to proper use of the @code{static} keyword for
7178programs consisting of a single file, in combination with option
7179@option{-combine}, @option{-flto} or @option{-fwhopr} this flag can be used to
7180compile many smaller scale programs since the functions and variables become
7181local for the whole combined compilation unit, not for the single source file
7182itself.
7183
7184This option implies @option{-fwhole-file} for Fortran programs.
7185
7186@item -flto
7187@opindex flto
7188This option runs the standard link-time optimizer.  When invoked
7189with source code, it generates GIMPLE (one of GCC's internal
7190representations) and writes it to special ELF sections in the object
7191file.  When the object files are linked together, all the function
7192bodies are read from these ELF sections and instantiated as if they
7193had been part of the same translation unit.
7194
7195To use the link-timer optimizer, @option{-flto} needs to be specified at
7196compile time and during the final link.  For example,
7197
7198@smallexample
7199gcc -c -O2 -flto foo.c
7200gcc -c -O2 -flto bar.c
7201gcc -o myprog -flto -O2 foo.o bar.o
7202@end smallexample
7203
7204The first two invocations to GCC will save a bytecode representation
7205of GIMPLE into special ELF sections inside @file{foo.o} and
7206@file{bar.o}.  The final invocation will read the GIMPLE bytecode from
7207@file{foo.o} and @file{bar.o}, merge the two files into a single
7208internal image, and compile the result as usual.  Since both
7209@file{foo.o} and @file{bar.o} are merged into a single image, this
7210causes all the inter-procedural analyses and optimizations in GCC to
7211work across the two files as if they were a single one.  This means,
7212for example, that the inliner will be able to inline functions in
7213@file{bar.o} into functions in @file{foo.o} and vice-versa.
7214
7215Another (simpler) way to enable link-time optimization is,
7216
7217@smallexample
7218gcc -o myprog -flto -O2 foo.c bar.c
7219@end smallexample
7220
7221The above will generate bytecode for @file{foo.c} and @file{bar.c},
7222merge them together into a single GIMPLE representation and optimize
7223them as usual to produce @file{myprog}.
7224
7225The only important thing to keep in mind is that to enable link-time
7226optimizations the @option{-flto} flag needs to be passed to both the
7227compile and the link commands.
7228
7229Note that when a file is compiled with @option{-flto}, the generated
7230object file will be larger than a regular object file because it will
7231contain GIMPLE bytecodes and the usual final code.  This means that
7232object files with LTO information can be linked as a normal object
7233file.  So, in the previous example, if the final link is done with
7234
7235@smallexample
7236gcc -o myprog foo.o bar.o
7237@end smallexample
7238
7239The only difference will be that no inter-procedural optimizations
7240will be applied to produce @file{myprog}.  The two object files
7241@file{foo.o} and @file{bar.o} will be simply sent to the regular
7242linker.
7243
7244Additionally, the optimization flags used to compile individual files
7245are not necessarily related to those used at link-time.  For instance,
7246
7247@smallexample
7248gcc -c -O0 -flto foo.c
7249gcc -c -O0 -flto bar.c
7250gcc -o myprog -flto -O3 foo.o bar.o
7251@end smallexample
7252
7253This will produce individual object files with unoptimized assembler
7254code, but the resulting binary @file{myprog} will be optimized at
7255@option{-O3}.  Now, if the final binary is generated without
7256@option{-flto}, then @file{myprog} will not be optimized.
7257
7258When producing the final binary with @option{-flto}, GCC will only
7259apply link-time optimizations to those files that contain bytecode.
7260Therefore, you can mix and match object files and libraries with
7261GIMPLE bytecodes and final object code.  GCC will automatically select
7262which files to optimize in LTO mode and which files to link without
7263further processing.
7264
7265There are some code generation flags that GCC will preserve when
7266generating bytecodes, as they need to be used during the final link
7267stage.  Currently, the following options are saved into the GIMPLE
7268bytecode files: @option{-fPIC}, @option{-fcommon} and all the
7269@option{-m} target flags.
7270
7271At link time, these options are read-in and reapplied.  Note that the
7272current implementation makes no attempt at recognizing conflicting
7273values for these options.  If two or more files have a conflicting
7274value (e.g., one file is compiled with @option{-fPIC} and another
7275isn't), the compiler will simply use the last value read from the
7276bytecode files.  It is recommended, then, that all the files
7277participating in the same link be compiled with the same options.
7278
7279Another feature of LTO is that it is possible to apply interprocedural
7280optimizations on files written in different languages.  This requires
7281some support in the language front end.  Currently, the C, C++ and
7282Fortran front ends are capable of emitting GIMPLE bytecodes, so
7283something like this should work
7284
7285@smallexample
7286gcc -c -flto foo.c
7287g++ -c -flto bar.cc
7288gfortran -c -flto baz.f90
7289g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
7290@end smallexample
7291
7292Notice that the final link is done with @command{g++} to get the C++
7293runtime libraries and @option{-lgfortran} is added to get the Fortran
7294runtime libraries.  In general, when mixing languages in LTO mode, you
7295should use the same link command used when mixing languages in a
7296regular (non-LTO) compilation.  This means that if your build process
7297was mixing languages before, all you need to add is @option{-flto} to
7298all the compile and link commands.
7299
7300If LTO encounters objects with C linkage declared with incompatible
7301types in separate translation units to be linked together (undefined
7302behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
7303issued.  The behavior is still undefined at runtime.
7304
7305If object files containing GIMPLE bytecode are stored in a library
7306archive, say @file{libfoo.a}, it is possible to extract and use them
7307in an LTO link if you are using @command{gold} as the linker (which,
7308in turn requires GCC to be configured with @option{--enable-gold}).
7309To enable this feature, use the flag @option{-fuse-linker-plugin} at
7310link-time:
7311
7312@smallexample
7313gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
7314@end smallexample
7315
7316With the linker plugin enabled, @command{gold} will extract the needed
7317GIMPLE files from @file{libfoo.a} and pass them on to the running GCC
7318to make them part of the aggregated GIMPLE image to be optimized.
7319
7320If you are not using @command{gold} and/or do not specify
7321@option{-fuse-linker-plugin} then the objects inside @file{libfoo.a}
7322will be extracted and linked as usual, but they will not participate
7323in the LTO optimization process.
7324
7325Link time optimizations do not require the presence of the whole
7326program to operate.  If the program does not require any symbols to
7327be exported, it is possible to combine @option{-flto} and
7328@option{-fwhopr} with @option{-fwhole-program} to allow the
7329interprocedural optimizers to use more aggressive assumptions which
7330may lead to improved optimization opportunities.
7331
7332Regarding portability: the current implementation of LTO makes no
7333attempt at generating bytecode that can be ported between different
7334types of hosts.  The bytecode files are versioned and there is a
7335strict version check, so bytecode files generated in one version of
7336GCC will not work with an older/newer version of GCC.
7337
7338Link time optimization does not play well with generating debugging
7339information.  Combining @option{-flto} or @option{-fwhopr} with
7340@option{-g} is experimental.
7341
7342This option is disabled by default.
7343
7344@item -fwhopr
7345@opindex fwhopr
7346This option is identical in functionality to @option{-flto} but it
7347differs in how the final link stage is executed.  Instead of loading
7348all the function bodies in memory, the callgraph is analyzed and
7349optimization decisions are made (whole program analysis or WPA). Once
7350optimization decisions are made, the callgraph is partitioned and the
7351different sections are compiled separately (local transformations or
7352LTRANS)@.  This process allows optimizations on very large programs
7353that otherwise would not fit in memory.  This option enables
7354@option{-fwpa} and @option{-fltrans} automatically.
7355
7356Disabled by default.
7357
7358This option is experimental.
7359
7360@item -fwpa
7361@opindex fwpa
7362This is an internal option used by GCC when compiling with
7363@option{-fwhopr}.  You should never need to use it.
7364
7365This option runs the link-time optimizer in the whole-program-analysis
7366(WPA) mode, which reads in summary information from all inputs and
7367performs a whole-program analysis based on summary information only.
7368It generates object files for subsequent runs of the link-time
7369optimizer where individual object files are optimized using both
7370summary information from the WPA mode and the actual function bodies.
7371It then drives the LTRANS phase.
7372
7373Disabled by default.
7374
7375@item -fltrans
7376@opindex fltrans
7377This is an internal option used by GCC when compiling with
7378@option{-fwhopr}.  You should never need to use it.
7379
7380This option runs the link-time optimizer in the local-transformation (LTRANS)
7381mode, which reads in output from a previous run of the LTO in WPA mode.
7382In the LTRANS mode, LTO optimizes an object and produces the final assembly.
7383
7384Disabled by default.
7385
7386@item -fltrans-output-list=@var{file}
7387@opindex fltrans-output-list
7388This is an internal option used by GCC when compiling with
7389@option{-fwhopr}.  You should never need to use it.
7390
7391This option specifies a file to which the names of LTRANS output files are
7392written.  This option is only meaningful in conjunction with @option{-fwpa}.
7393
7394Disabled by default.
7395
7396@item -flto-compression-level=@var{n}
7397This option specifies the level of compression used for intermediate
7398language written to LTO object files, and is only meaningful in
7399conjunction with LTO mode (@option{-fwhopr}, @option{-flto}).  Valid
7400values are 0 (no compression) to 9 (maximum compression).  Values
7401outside this range are clamped to either 0 or 9.  If the option is not
7402given, a default balanced compression setting is used.
7403
7404@item -flto-report
7405Prints a report with internal details on the workings of the link-time
7406optimizer.  The contents of this report vary from version to version,
7407it is meant to be useful to GCC developers when processing object
7408files in LTO mode (via @option{-fwhopr} or @option{-flto}).
7409
7410Disabled by default.
7411
7412@item -fuse-linker-plugin
7413Enables the extraction of objects with GIMPLE bytecode information
7414from library archives.  This option relies on features available only
7415in @command{gold}, so to use this you must configure GCC with
7416@option{--enable-gold}.  See @option{-flto} for a description on the
7417effect of this flag and how to use it.
7418
7419Disabled by default.
7420
7421@item -fcprop-registers
7422@opindex fcprop-registers
7423After register allocation and post-register allocation instruction splitting,
7424we perform a copy-propagation pass to try to reduce scheduling dependencies
7425and occasionally eliminate the copy.
7426
7427Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7428
7429@item -fprofile-correction
7430@opindex fprofile-correction
7431Profiles collected using an instrumented binary for multi-threaded programs may
7432be inconsistent due to missed counter updates. When this option is specified,
7433GCC will use heuristics to correct or smooth out such inconsistencies. By
7434default, GCC will emit an error message when an inconsistent profile is detected.
7435
7436@item -fprofile-dir=@var{path}
7437@opindex fprofile-dir
7438
7439Set the directory to search the profile data files in to @var{path}.
7440This option affects only the profile data generated by
7441@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
7442and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
7443and its related options.
7444By default, GCC will use the current directory as @var{path}
7445thus the profile data file will appear in the same directory as the object file.
7446
7447@item -fprofile-generate
7448@itemx -fprofile-generate=@var{path}
7449@opindex fprofile-generate
7450
7451Enable options usually used for instrumenting application to produce
7452profile useful for later recompilation with profile feedback based
7453optimization.  You must use @option{-fprofile-generate} both when
7454compiling and when linking your program.
7455
7456The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
7457
7458If @var{path} is specified, GCC will look at the @var{path} to find
7459the profile feedback data files. See @option{-fprofile-dir}.
7460
7461@item -fprofile-use
7462@itemx -fprofile-use=@var{path}
7463@opindex fprofile-use
7464Enable profile feedback directed optimizations, and optimizations
7465generally profitable only with profile feedback available.
7466
7467The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
7468@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
7469
7470By default, GCC emits an error message if the feedback profiles do not
7471match the source code.  This error can be turned into a warning by using
7472@option{-Wcoverage-mismatch}.  Note this may result in poorly optimized
7473code.
7474
7475If @var{path} is specified, GCC will look at the @var{path} to find
7476the profile feedback data files. See @option{-fprofile-dir}.
7477@end table
7478
7479The following options control compiler behavior regarding floating
7480point arithmetic.  These options trade off between speed and
7481correctness.  All must be specifically enabled.
7482
7483@table @gcctabopt
7484@item -ffloat-store
7485@opindex ffloat-store
7486Do not store floating point variables in registers, and inhibit other
7487options that might change whether a floating point value is taken from a
7488register or memory.
7489
7490@cindex floating point precision
7491This option prevents undesirable excess precision on machines such as
7492the 68000 where the floating registers (of the 68881) keep more
7493precision than a @code{double} is supposed to have.  Similarly for the
7494x86 architecture.  For most programs, the excess precision does only
7495good, but a few programs rely on the precise definition of IEEE floating
7496point.  Use @option{-ffloat-store} for such programs, after modifying
7497them to store all pertinent intermediate computations into variables.
7498
7499@item -fexcess-precision=@var{style}
7500@opindex fexcess-precision
7501This option allows further control over excess precision on machines
7502where floating-point registers have more precision than the IEEE
7503@code{float} and @code{double} types and the processor does not
7504support operations rounding to those types.  By default,
7505@option{-fexcess-precision=fast} is in effect; this means that
7506operations are carried out in the precision of the registers and that
7507it is unpredictable when rounding to the types specified in the source
7508code takes place.  When compiling C, if
7509@option{-fexcess-precision=standard} is specified then excess
7510precision will follow the rules specified in ISO C99; in particular,
7511both casts and assignments cause values to be rounded to their
7512semantic types (whereas @option{-ffloat-store} only affects
7513assignments).  This option is enabled by default for C if a strict
7514conformance option such as @option{-std=c99} is used.
7515
7516@opindex mfpmath
7517@option{-fexcess-precision=standard} is not implemented for languages
7518other than C, and has no effect if
7519@option{-funsafe-math-optimizations} or @option{-ffast-math} is
7520specified.  On the x86, it also has no effect if @option{-mfpmath=sse}
7521or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
7522semantics apply without excess precision, and in the latter, rounding
7523is unpredictable.
7524
7525@item -ffast-math
7526@opindex ffast-math
7527Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
7528@option{-ffinite-math-only}, @option{-fno-rounding-math},
7529@option{-fno-signaling-nans} and @option{-fcx-limited-range}.
7530
7531This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
7532
7533This option is not turned on by any @option{-O} option since
7534it can result in incorrect output for programs which depend on
7535an exact implementation of IEEE or ISO rules/specifications for
7536math functions. It may, however, yield faster code for programs
7537that do not require the guarantees of these specifications.
7538
7539@item -fno-math-errno
7540@opindex fno-math-errno
7541Do not set ERRNO after calling math functions that are executed
7542with a single instruction, e.g., sqrt.  A program that relies on
7543IEEE exceptions for math error handling may want to use this flag
7544for speed while maintaining IEEE arithmetic compatibility.
7545
7546This option is not turned on by any @option{-O} option since
7547it can result in incorrect output for programs which depend on
7548an exact implementation of IEEE or ISO rules/specifications for
7549math functions. It may, however, yield faster code for programs
7550that do not require the guarantees of these specifications.
7551
7552The default is @option{-fmath-errno}.
7553
7554On Darwin systems, the math library never sets @code{errno}.  There is
7555therefore no reason for the compiler to consider the possibility that
7556it might, and @option{-fno-math-errno} is the default.
7557
7558@item -funsafe-math-optimizations
7559@opindex funsafe-math-optimizations
7560
7561Allow optimizations for floating-point arithmetic that (a) assume
7562that arguments and results are valid and (b) may violate IEEE or
7563ANSI standards.  When used at link-time, it may include libraries
7564or startup files that change the default FPU control word or other
7565similar optimizations.
7566
7567This option is not turned on by any @option{-O} option since
7568it can result in incorrect output for programs which depend on
7569an exact implementation of IEEE or ISO rules/specifications for
7570math functions. It may, however, yield faster code for programs
7571that do not require the guarantees of these specifications.
7572Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
7573@option{-fassociative-math} and @option{-freciprocal-math}.
7574
7575The default is @option{-fno-unsafe-math-optimizations}.
7576
7577@item -fassociative-math
7578@opindex fassociative-math
7579
7580Allow re-association of operands in series of floating-point operations.
7581This violates the ISO C and C++ language standard by possibly changing
7582computation result.  NOTE: re-ordering may change the sign of zero as
7583well as ignore NaNs and inhibit or create underflow or overflow (and
7584thus cannot be used on a code which relies on rounding behavior like
7585@code{(x + 2**52) - 2**52)}.  May also reorder floating-point comparisons
7586and thus may not be used when ordered comparisons are required.
7587This option requires that both @option{-fno-signed-zeros} and
7588@option{-fno-trapping-math} be in effect.  Moreover, it doesn't make
7589much sense with @option{-frounding-math}. For Fortran the option
7590is automatically enabled when both @option{-fno-signed-zeros} and
7591@option{-fno-trapping-math} are in effect.
7592
7593The default is @option{-fno-associative-math}.
7594
7595@item -freciprocal-math
7596@opindex freciprocal-math
7597
7598Allow the reciprocal of a value to be used instead of dividing by
7599the value if this enables optimizations.  For example @code{x / y}
7600can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
7601is subject to common subexpression elimination.  Note that this loses
7602precision and increases the number of flops operating on the value.
7603
7604The default is @option{-fno-reciprocal-math}.
7605
7606@item -ffinite-math-only
7607@opindex ffinite-math-only
7608Allow optimizations for floating-point arithmetic that assume
7609that arguments and results are not NaNs or +-Infs.
7610
7611This option is not turned on by any @option{-O} option since
7612it can result in incorrect output for programs which depend on
7613an exact implementation of IEEE or ISO rules/specifications for
7614math functions. It may, however, yield faster code for programs
7615that do not require the guarantees of these specifications.
7616
7617The default is @option{-fno-finite-math-only}.
7618
7619@item -fno-signed-zeros
7620@opindex fno-signed-zeros
7621Allow optimizations for floating point arithmetic that ignore the
7622signedness of zero.  IEEE arithmetic specifies the behavior of
7623distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
7624of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
7625This option implies that the sign of a zero result isn't significant.
7626
7627The default is @option{-fsigned-zeros}.
7628
7629@item -fno-trapping-math
7630@opindex fno-trapping-math
7631Compile code assuming that floating-point operations cannot generate
7632user-visible traps.  These traps include division by zero, overflow,
7633underflow, inexact result and invalid operation.  This option requires
7634that @option{-fno-signaling-nans} be in effect.  Setting this option may
7635allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
7636
7637This option should never be turned on by any @option{-O} option since
7638it can result in incorrect output for programs which depend on
7639an exact implementation of IEEE or ISO rules/specifications for
7640math functions.
7641
7642The default is @option{-ftrapping-math}.
7643
7644@item -frounding-math
7645@opindex frounding-math
7646Disable transformations and optimizations that assume default floating
7647point rounding behavior.  This is round-to-zero for all floating point
7648to integer conversions, and round-to-nearest for all other arithmetic
7649truncations.  This option should be specified for programs that change
7650the FP rounding mode dynamically, or that may be executed with a
7651non-default rounding mode.  This option disables constant folding of
7652floating point expressions at compile-time (which may be affected by
7653rounding mode) and arithmetic transformations that are unsafe in the
7654presence of sign-dependent rounding modes.
7655
7656The default is @option{-fno-rounding-math}.
7657
7658This option is experimental and does not currently guarantee to
7659disable all GCC optimizations that are affected by rounding mode.
7660Future versions of GCC may provide finer control of this setting
7661using C99's @code{FENV_ACCESS} pragma.  This command line option
7662will be used to specify the default state for @code{FENV_ACCESS}.
7663
7664@item -fsignaling-nans
7665@opindex fsignaling-nans
7666Compile code assuming that IEEE signaling NaNs may generate user-visible
7667traps during floating-point operations.  Setting this option disables
7668optimizations that may change the number of exceptions visible with
7669signaling NaNs.  This option implies @option{-ftrapping-math}.
7670
7671This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
7672be defined.
7673
7674The default is @option{-fno-signaling-nans}.
7675
7676This option is experimental and does not currently guarantee to
7677disable all GCC optimizations that affect signaling NaN behavior.
7678
7679@item -fsingle-precision-constant
7680@opindex fsingle-precision-constant
7681Treat floating point constant as single precision constant instead of
7682implicitly converting it to double precision constant.
7683
7684@item -fcx-limited-range
7685@opindex fcx-limited-range
7686When enabled, this option states that a range reduction step is not
7687needed when performing complex division.  Also, there is no checking
7688whether the result of a complex multiplication or division is @code{NaN
7689+ I*NaN}, with an attempt to rescue the situation in that case.  The
7690default is @option{-fno-cx-limited-range}, but is enabled by
7691@option{-ffast-math}.
7692
7693This option controls the default setting of the ISO C99
7694@code{CX_LIMITED_RANGE} pragma.  Nevertheless, the option applies to
7695all languages.
7696
7697@item -fcx-fortran-rules
7698@opindex fcx-fortran-rules
7699Complex multiplication and division follow Fortran rules.  Range
7700reduction is done as part of complex division, but there is no checking
7701whether the result of a complex multiplication or division is @code{NaN
7702+ I*NaN}, with an attempt to rescue the situation in that case.
7703
7704The default is @option{-fno-cx-fortran-rules}.
7705
7706@end table
7707
7708The following options control optimizations that may improve
7709performance, but are not enabled by any @option{-O} options.  This
7710section includes experimental options that may produce broken code.
7711
7712@table @gcctabopt
7713@item -fbranch-probabilities
7714@opindex fbranch-probabilities
7715After running a program compiled with @option{-fprofile-arcs}
7716(@pxref{Debugging Options,, Options for Debugging Your Program or
7717@command{gcc}}), you can compile it a second time using
7718@option{-fbranch-probabilities}, to improve optimizations based on
7719the number of times each branch was taken.  When the program
7720compiled with @option{-fprofile-arcs} exits it saves arc execution
7721counts to a file called @file{@var{sourcename}.gcda} for each source
7722file.  The information in this data file is very dependent on the
7723structure of the generated code, so you must use the same source code
7724and the same optimization options for both compilations.
7725
7726With @option{-fbranch-probabilities}, GCC puts a
7727@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
7728These can be used to improve optimization.  Currently, they are only
7729used in one place: in @file{reorg.c}, instead of guessing which path a
7730branch is mostly to take, the @samp{REG_BR_PROB} values are used to
7731exactly determine which path is taken more often.
7732
7733@item -fprofile-values
7734@opindex fprofile-values
7735If combined with @option{-fprofile-arcs}, it adds code so that some
7736data about values of expressions in the program is gathered.
7737
7738With @option{-fbranch-probabilities}, it reads back the data gathered
7739from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
7740notes to instructions for their later usage in optimizations.
7741
7742Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
7743
7744@item -fvpt
7745@opindex fvpt
7746If combined with @option{-fprofile-arcs}, it instructs the compiler to add
7747a code to gather information about values of expressions.
7748
7749With @option{-fbranch-probabilities}, it reads back the data gathered
7750and actually performs the optimizations based on them.
7751Currently the optimizations include specialization of division operation
7752using the knowledge about the value of the denominator.
7753
7754@item -frename-registers
7755@opindex frename-registers
7756Attempt to avoid false dependencies in scheduled code by making use
7757of registers left over after register allocation.  This optimization
7758will most benefit processors with lots of registers.  Depending on the
7759debug information format adopted by the target, however, it can
7760make debugging impossible, since variables will no longer stay in
7761a ``home register''.
7762
7763Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
7764
7765@item -ftracer
7766@opindex ftracer
7767Perform tail duplication to enlarge superblock size.  This transformation
7768simplifies the control flow of the function allowing other optimizations to do
7769better job.
7770
7771Enabled with @option{-fprofile-use}.
7772
7773@item -funroll-loops
7774@opindex funroll-loops
7775Unroll loops whose number of iterations can be determined at compile time or
7776upon entry to the loop.  @option{-funroll-loops} implies
7777@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
7778It also turns on complete loop peeling (i.e.@: complete removal of loops with
7779small constant number of iterations).  This option makes code larger, and may
7780or may not make it run faster.
7781
7782Enabled with @option{-fprofile-use}.
7783
7784@item -funroll-all-loops
7785@opindex funroll-all-loops
7786Unroll all loops, even if their number of iterations is uncertain when
7787the loop is entered.  This usually makes programs run more slowly.
7788@option{-funroll-all-loops} implies the same options as
7789@option{-funroll-loops}.
7790
7791@item -fpeel-loops
7792@opindex fpeel-loops
7793Peels the loops for that there is enough information that they do not
7794roll much (from profile feedback).  It also turns on complete loop peeling
7795(i.e.@: complete removal of loops with small constant number of iterations).
7796
7797Enabled with @option{-fprofile-use}.
7798
7799@item -fmove-loop-invariants
7800@opindex fmove-loop-invariants
7801Enables the loop invariant motion pass in the RTL loop optimizer.  Enabled
7802at level @option{-O1}
7803
7804@item -funswitch-loops
7805@opindex funswitch-loops
7806Move branches with loop invariant conditions out of the loop, with duplicates
7807of the loop on both branches (modified according to result of the condition).
7808
7809@item -ffunction-sections
7810@itemx -fdata-sections
7811@opindex ffunction-sections
7812@opindex fdata-sections
7813Place each function or data item into its own section in the output
7814file if the target supports arbitrary sections.  The name of the
7815function or the name of the data item determines the section's name
7816in the output file.
7817
7818Use these options on systems where the linker can perform optimizations
7819to improve locality of reference in the instruction space.  Most systems
7820using the ELF object format and SPARC processors running Solaris 2 have
7821linkers with such optimizations.  AIX may have these optimizations in
7822the future.
7823
7824Only use these options when there are significant benefits from doing
7825so.  When you specify these options, the assembler and linker will
7826create larger object and executable files and will also be slower.
7827You will not be able to use @code{gprof} on all systems if you
7828specify this option and you may have problems with debugging if
7829you specify both this option and @option{-g}.
7830
7831@item -fbranch-target-load-optimize
7832@opindex fbranch-target-load-optimize
7833Perform branch target register load optimization before prologue / epilogue
7834threading.
7835The use of target registers can typically be exposed only during reload,
7836thus hoisting loads out of loops and doing inter-block scheduling needs
7837a separate optimization pass.
7838
7839@item -fbranch-target-load-optimize2
7840@opindex fbranch-target-load-optimize2
7841Perform branch target register load optimization after prologue / epilogue
7842threading.
7843
7844@item -fbtr-bb-exclusive
7845@opindex fbtr-bb-exclusive
7846When performing branch target register load optimization, don't reuse
7847branch target registers in within any basic block.
7848
7849@item -fstack-protector
7850@opindex fstack-protector
7851Emit extra code to check for buffer overflows, such as stack smashing
7852attacks.  This is done by adding a guard variable to functions with
7853vulnerable objects.  This includes functions that call alloca, and
7854functions with buffers larger than 8 bytes.  The guards are initialized
7855when a function is entered and then checked when the function exits.
7856If a guard check fails, an error message is printed and the program exits.
7857
7858@item -fstack-protector-all
7859@opindex fstack-protector-all
7860Like @option{-fstack-protector} except that all functions are protected.
7861
7862@item -fsection-anchors
7863@opindex fsection-anchors
7864Try to reduce the number of symbolic address calculations by using
7865shared ``anchor'' symbols to address nearby objects.  This transformation
7866can help to reduce the number of GOT entries and GOT accesses on some
7867targets.
7868
7869For example, the implementation of the following function @code{foo}:
7870
7871@smallexample
7872static int a, b, c;
7873int foo (void) @{ return a + b + c; @}
7874@end smallexample
7875
7876would usually calculate the addresses of all three variables, but if you
7877compile it with @option{-fsection-anchors}, it will access the variables
7878from a common anchor point instead.  The effect is similar to the
7879following pseudocode (which isn't valid C):
7880
7881@smallexample
7882int foo (void)
7883@{
7884  register int *xr = &x;
7885  return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
7886@}
7887@end smallexample
7888
7889Not all targets support this option.
7890
7891@item --param @var{name}=@var{value}
7892@opindex param
7893In some places, GCC uses various constants to control the amount of
7894optimization that is done.  For example, GCC will not inline functions
7895that contain more that a certain number of instructions.  You can
7896control some of these constants on the command-line using the
7897@option{--param} option.
7898
7899The names of specific parameters, and the meaning of the values, are
7900tied to the internals of the compiler, and are subject to change
7901without notice in future releases.
7902
7903In each case, the @var{value} is an integer.  The allowable choices for
7904@var{name} are given in the following table:
7905
7906@table @gcctabopt
7907@item struct-reorg-cold-struct-ratio
7908The threshold ratio (as a percentage) between a structure frequency
7909and the frequency of the hottest structure in the program.  This parameter
7910is used by struct-reorg optimization enabled by @option{-fipa-struct-reorg}.
7911We say that if the ratio of a structure frequency, calculated by profiling,
7912to the hottest structure frequency in the program is less than this
7913parameter, then structure reorganization is not applied to this structure.
7914The default is 10.
7915
7916@item predictable-branch-outcome
7917When branch is predicted to be taken with probability lower than this threshold
7918(in percent), then it is considered well predictable. The default is 10.
7919
7920@item max-crossjump-edges
7921The maximum number of incoming edges to consider for crossjumping.
7922The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
7923the number of edges incoming to each block.  Increasing values mean
7924more aggressive optimization, making the compile time increase with
7925probably small improvement in executable size.
7926
7927@item min-crossjump-insns
7928The minimum number of instructions which must be matched at the end
7929of two blocks before crossjumping will be performed on them.  This
7930value is ignored in the case where all instructions in the block being
7931crossjumped from are matched.  The default value is 5.
7932
7933@item max-grow-copy-bb-insns
7934The maximum code size expansion factor when copying basic blocks
7935instead of jumping.  The expansion is relative to a jump instruction.
7936The default value is 8.
7937
7938@item max-goto-duplication-insns
7939The maximum number of instructions to duplicate to a block that jumps
7940to a computed goto.  To avoid @math{O(N^2)} behavior in a number of
7941passes, GCC factors computed gotos early in the compilation process,
7942and unfactors them as late as possible.  Only computed jumps at the
7943end of a basic blocks with no more than max-goto-duplication-insns are
7944unfactored.  The default value is 8.
7945
7946@item max-delay-slot-insn-search
7947The maximum number of instructions to consider when looking for an
7948instruction to fill a delay slot.  If more than this arbitrary number of
7949instructions is searched, the time savings from filling the delay slot
7950will be minimal so stop searching.  Increasing values mean more
7951aggressive optimization, making the compile time increase with probably
7952small improvement in executable run time.
7953
7954@item max-delay-slot-live-search
7955When trying to fill delay slots, the maximum number of instructions to
7956consider when searching for a block with valid live register
7957information.  Increasing this arbitrarily chosen value means more
7958aggressive optimization, increasing the compile time.  This parameter
7959should be removed when the delay slot code is rewritten to maintain the
7960control-flow graph.
7961
7962@item max-gcse-memory
7963The approximate maximum amount of memory that will be allocated in
7964order to perform the global common subexpression elimination
7965optimization.  If more memory than specified is required, the
7966optimization will not be done.
7967
7968@item max-pending-list-length
7969The maximum number of pending dependencies scheduling will allow
7970before flushing the current state and starting over.  Large functions
7971with few branches or calls can create excessively large lists which
7972needlessly consume memory and resources.
7973
7974@item max-inline-insns-single
7975Several parameters control the tree inliner used in gcc.
7976This number sets the maximum number of instructions (counted in GCC's
7977internal representation) in a single function that the tree inliner
7978will consider for inlining.  This only affects functions declared
7979inline and methods implemented in a class declaration (C++).
7980The default value is 300.
7981
7982@item max-inline-insns-auto
7983When you use @option{-finline-functions} (included in @option{-O3}),
7984a lot of functions that would otherwise not be considered for inlining
7985by the compiler will be investigated.  To those functions, a different
7986(more restrictive) limit compared to functions declared inline can
7987be applied.
7988The default value is 50.
7989
7990@item large-function-insns
7991The limit specifying really large functions.  For functions larger than this
7992limit after inlining, inlining is constrained by
7993@option{--param large-function-growth}.  This parameter is useful primarily
7994to avoid extreme compilation time caused by non-linear algorithms used by the
7995backend.
7996The default value is 2700.
7997
7998@item large-function-growth
7999Specifies maximal growth of large function caused by inlining in percents.
8000The default value is 100 which limits large function growth to 2.0 times
8001the original size.
8002
8003@item large-unit-insns
8004The limit specifying large translation unit.  Growth caused by inlining of
8005units larger than this limit is limited by @option{--param inline-unit-growth}.
8006For small units this might be too tight (consider unit consisting of function A
8007that is inline and B that just calls A three time.  If B is small relative to
8008A, the growth of unit is 300\% and yet such inlining is very sane.  For very
8009large units consisting of small inlineable functions however the overall unit
8010growth limit is needed to avoid exponential explosion of code size.  Thus for
8011smaller units, the size is increased to @option{--param large-unit-insns}
8012before applying @option{--param inline-unit-growth}.  The default is 10000
8013
8014@item inline-unit-growth
8015Specifies maximal overall growth of the compilation unit caused by inlining.
8016The default value is 30 which limits unit growth to 1.3 times the original
8017size.
8018
8019@item ipcp-unit-growth
8020Specifies maximal overall growth of the compilation unit caused by
8021interprocedural constant propagation.  The default value is 10 which limits
8022unit growth to 1.1 times the original size.
8023
8024@item large-stack-frame
8025The limit specifying large stack frames.  While inlining the algorithm is trying
8026to not grow past this limit too much.  Default value is 256 bytes.
8027
8028@item large-stack-frame-growth
8029Specifies maximal growth of large stack frames caused by inlining in percents.
8030The default value is 1000 which limits large stack frame growth to 11 times
8031the original size.
8032
8033@item max-inline-insns-recursive
8034@itemx max-inline-insns-recursive-auto
8035Specifies maximum number of instructions out-of-line copy of self recursive inline
8036function can grow into by performing recursive inlining.
8037
8038For functions declared inline @option{--param max-inline-insns-recursive} is
8039taken into account.  For function not declared inline, recursive inlining
8040happens only when @option{-finline-functions} (included in @option{-O3}) is
8041enabled and @option{--param max-inline-insns-recursive-auto} is used.  The
8042default value is 450.
8043
8044@item max-inline-recursive-depth
8045@itemx max-inline-recursive-depth-auto
8046Specifies maximum recursion depth used by the recursive inlining.
8047
8048For functions declared inline @option{--param max-inline-recursive-depth} is
8049taken into account.  For function not declared inline, recursive inlining
8050happens only when @option{-finline-functions} (included in @option{-O3}) is
8051enabled and @option{--param max-inline-recursive-depth-auto} is used.  The
8052default value is 8.
8053
8054@item min-inline-recursive-probability
8055Recursive inlining is profitable only for function having deep recursion
8056in average and can hurt for function having little recursion depth by
8057increasing the prologue size or complexity of function body to other
8058optimizers.
8059
8060When profile feedback is available (see @option{-fprofile-generate}) the actual
8061recursion depth can be guessed from probability that function will recurse via
8062given call expression.  This parameter limits inlining only to call expression
8063whose probability exceeds given threshold (in percents).  The default value is
806410.
8065
8066@item early-inlining-insns
8067Specify growth that early inliner can make.  In effect it increases amount of
8068inlining for code having large abstraction penalty.  The default value is 8.
8069
8070@item max-early-inliner-iterations
8071@itemx max-early-inliner-iterations
8072Limit of iterations of early inliner.  This basically bounds number of nested
8073indirect calls early inliner can resolve.  Deeper chains are still handled by
8074late inlining.
8075
8076@item min-vect-loop-bound
8077The minimum number of iterations under which a loop will not get vectorized
8078when @option{-ftree-vectorize} is used.  The number of iterations after
8079vectorization needs to be greater than the value specified by this option
8080to allow vectorization.  The default value is 0.
8081
8082@item max-unrolled-insns
8083The maximum number of instructions that a loop should have if that loop
8084is unrolled, and if the loop is unrolled, it determines how many times
8085the loop code is unrolled.
8086
8087@item max-average-unrolled-insns
8088The maximum number of instructions biased by probabilities of their execution
8089that a loop should have if that loop is unrolled, and if the loop is unrolled,
8090it determines how many times the loop code is unrolled.
8091
8092@item max-unroll-times
8093The maximum number of unrollings of a single loop.
8094
8095@item max-peeled-insns
8096The maximum number of instructions that a loop should have if that loop
8097is peeled, and if the loop is peeled, it determines how many times
8098the loop code is peeled.
8099
8100@item max-peel-times
8101The maximum number of peelings of a single loop.
8102
8103@item max-completely-peeled-insns
8104The maximum number of insns of a completely peeled loop.
8105
8106@item max-completely-peel-times
8107The maximum number of iterations of a loop to be suitable for complete peeling.
8108
8109@item max-completely-peel-loop-nest-depth
8110The maximum depth of a loop nest suitable for complete peeling.
8111
8112@item max-unswitch-insns
8113The maximum number of insns of an unswitched loop.
8114
8115@item max-unswitch-level
8116The maximum number of branches unswitched in a single loop.
8117
8118@item lim-expensive
8119The minimum cost of an expensive expression in the loop invariant motion.
8120
8121@item iv-consider-all-candidates-bound
8122Bound on number of candidates for induction variables below that
8123all candidates are considered for each use in induction variable
8124optimizations.  Only the most relevant candidates are considered
8125if there are more candidates, to avoid quadratic time complexity.
8126
8127@item iv-max-considered-uses
8128The induction variable optimizations give up on loops that contain more
8129induction variable uses.
8130
8131@item iv-always-prune-cand-set-bound
8132If number of candidates in the set is smaller than this value,
8133we always try to remove unnecessary ivs from the set during its
8134optimization when a new iv is added to the set.
8135
8136@item scev-max-expr-size
8137Bound on size of expressions used in the scalar evolutions analyzer.
8138Large expressions slow the analyzer.
8139
8140@item omega-max-vars
8141The maximum number of variables in an Omega constraint system.
8142The default value is 128.
8143
8144@item omega-max-geqs
8145The maximum number of inequalities in an Omega constraint system.
8146The default value is 256.
8147
8148@item omega-max-eqs
8149The maximum number of equalities in an Omega constraint system.
8150The default value is 128.
8151
8152@item omega-max-wild-cards
8153The maximum number of wildcard variables that the Omega solver will
8154be able to insert.  The default value is 18.
8155
8156@item omega-hash-table-size
8157The size of the hash table in the Omega solver.  The default value is
8158550.
8159
8160@item omega-max-keys
8161The maximal number of keys used by the Omega solver.  The default
8162value is 500.
8163
8164@item omega-eliminate-redundant-constraints
8165When set to 1, use expensive methods to eliminate all redundant
8166constraints.  The default value is 0.
8167
8168@item vect-max-version-for-alignment-checks
8169The maximum number of runtime checks that can be performed when
8170doing loop versioning for alignment in the vectorizer.  See option
8171ftree-vect-loop-version for more information.
8172
8173@item vect-max-version-for-alias-checks
8174The maximum number of runtime checks that can be performed when
8175doing loop versioning for alias in the vectorizer.  See option
8176ftree-vect-loop-version for more information.
8177
8178@item max-iterations-to-track
8179
8180The maximum number of iterations of a loop the brute force algorithm
8181for analysis of # of iterations of the loop tries to evaluate.
8182
8183@item hot-bb-count-fraction
8184Select fraction of the maximal count of repetitions of basic block in program
8185given basic block needs to have to be considered hot.
8186
8187@item hot-bb-frequency-fraction
8188Select fraction of the maximal frequency of executions of basic block in
8189function given basic block needs to have to be considered hot
8190
8191@item max-predicted-iterations
8192The maximum number of loop iterations we predict statically.  This is useful
8193in cases where function contain single loop with known bound and other loop
8194with unknown.  We predict the known number of iterations correctly, while
8195the unknown number of iterations average to roughly 10.  This means that the
8196loop without bounds would appear artificially cold relative to the other one.
8197
8198@item align-threshold
8199
8200Select fraction of the maximal frequency of executions of basic block in
8201function given basic block will get aligned.
8202
8203@item align-loop-iterations
8204
8205A loop expected to iterate at lest the selected number of iterations will get
8206aligned.
8207
8208@item tracer-dynamic-coverage
8209@itemx tracer-dynamic-coverage-feedback
8210
8211This value is used to limit superblock formation once the given percentage of
8212executed instructions is covered.  This limits unnecessary code size
8213expansion.
8214
8215The @option{tracer-dynamic-coverage-feedback} is used only when profile
8216feedback is available.  The real profiles (as opposed to statically estimated
8217ones) are much less balanced allowing the threshold to be larger value.
8218
8219@item tracer-max-code-growth
8220Stop tail duplication once code growth has reached given percentage.  This is
8221rather hokey argument, as most of the duplicates will be eliminated later in
8222cross jumping, so it may be set to much higher values than is the desired code
8223growth.
8224
8225@item tracer-min-branch-ratio
8226
8227Stop reverse growth when the reverse probability of best edge is less than this
8228threshold (in percent).
8229
8230@item tracer-min-branch-ratio
8231@itemx tracer-min-branch-ratio-feedback
8232
8233Stop forward growth if the best edge do have probability lower than this
8234threshold.
8235
8236Similarly to @option{tracer-dynamic-coverage} two values are present, one for
8237compilation for profile feedback and one for compilation without.  The value
8238for compilation with profile feedback needs to be more conservative (higher) in
8239order to make tracer effective.
8240
8241@item max-cse-path-length
8242
8243Maximum number of basic blocks on path that cse considers.  The default is 10.
8244
8245@item max-cse-insns
8246The maximum instructions CSE process before flushing. The default is 1000.
8247
8248@item ggc-min-expand
8249
8250GCC uses a garbage collector to manage its own memory allocation.  This
8251parameter specifies the minimum percentage by which the garbage
8252collector's heap should be allowed to expand between collections.
8253Tuning this may improve compilation speed; it has no effect on code
8254generation.
8255
8256The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
8257RAM >= 1GB@.  If @code{getrlimit} is available, the notion of "RAM" is
8258the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}.  If
8259GCC is not able to calculate RAM on a particular platform, the lower
8260bound of 30% is used.  Setting this parameter and
8261@option{ggc-min-heapsize} to zero causes a full collection to occur at
8262every opportunity.  This is extremely slow, but can be useful for
8263debugging.
8264
8265@item ggc-min-heapsize
8266
8267Minimum size of the garbage collector's heap before it begins bothering
8268to collect garbage.  The first collection occurs after the heap expands
8269by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}.  Again,
8270tuning this may improve compilation speed, and has no effect on code
8271generation.
8272
8273The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
8274tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
8275with a lower bound of 4096 (four megabytes) and an upper bound of
8276131072 (128 megabytes).  If GCC is not able to calculate RAM on a
8277particular platform, the lower bound is used.  Setting this parameter
8278very large effectively disables garbage collection.  Setting this
8279parameter and @option{ggc-min-expand} to zero causes a full collection
8280to occur at every opportunity.
8281
8282@item max-reload-search-insns
8283The maximum number of instruction reload should look backward for equivalent
8284register.  Increasing values mean more aggressive optimization, making the
8285compile time increase with probably slightly better performance.  The default
8286value is 100.
8287
8288@item max-cselib-memory-locations
8289The maximum number of memory locations cselib should take into account.
8290Increasing values mean more aggressive optimization, making the compile time
8291increase with probably slightly better performance.  The default value is 500.
8292
8293@item reorder-blocks-duplicate
8294@itemx reorder-blocks-duplicate-feedback
8295
8296Used by basic block reordering pass to decide whether to use unconditional
8297branch or duplicate the code on its destination.  Code is duplicated when its
8298estimated size is smaller than this value multiplied by the estimated size of
8299unconditional jump in the hot spots of the program.
8300
8301The @option{reorder-block-duplicate-feedback} is used only when profile
8302feedback is available and may be set to higher values than
8303@option{reorder-block-duplicate} since information about the hot spots is more
8304accurate.
8305
8306@item max-sched-ready-insns
8307The maximum number of instructions ready to be issued the scheduler should
8308consider at any given time during the first scheduling pass.  Increasing
8309values mean more thorough searches, making the compilation time increase
8310with probably little benefit.  The default value is 100.
8311
8312@item max-sched-region-blocks
8313The maximum number of blocks in a region to be considered for
8314interblock scheduling.  The default value is 10.
8315
8316@item max-pipeline-region-blocks
8317The maximum number of blocks in a region to be considered for
8318pipelining in the selective scheduler.  The default value is 15.
8319
8320@item max-sched-region-insns
8321The maximum number of insns in a region to be considered for
8322interblock scheduling.  The default value is 100.
8323
8324@item max-pipeline-region-insns
8325The maximum number of insns in a region to be considered for
8326pipelining in the selective scheduler.  The default value is 200.
8327
8328@item min-spec-prob
8329The minimum probability (in percents) of reaching a source block
8330for interblock speculative scheduling.  The default value is 40.
8331
8332@item max-sched-extend-regions-iters
8333The maximum number of iterations through CFG to extend regions.
83340 - disable region extension,
8335N - do at most N iterations.
8336The default value is 0.
8337
8338@item max-sched-insn-conflict-delay
8339The maximum conflict delay for an insn to be considered for speculative motion.
8340The default value is 3.
8341
8342@item sched-spec-prob-cutoff
8343The minimal probability of speculation success (in percents), so that
8344speculative insn will be scheduled.
8345The default value is 40.
8346
8347@item sched-mem-true-dep-cost
8348Minimal distance (in CPU cycles) between store and load targeting same
8349memory locations.  The default value is 1.
8350
8351@item selsched-max-lookahead
8352The maximum size of the lookahead window of selective scheduling.  It is a
8353depth of search for available instructions.
8354The default value is 50.
8355
8356@item selsched-max-sched-times
8357The maximum number of times that an instruction will be scheduled during
8358selective scheduling.  This is the limit on the number of iterations
8359through which the instruction may be pipelined.  The default value is 2.
8360
8361@item selsched-max-insns-to-rename
8362The maximum number of best instructions in the ready list that are considered
8363for renaming in the selective scheduler.  The default value is 2.
8364
8365@item max-last-value-rtl
8366The maximum size measured as number of RTLs that can be recorded in an expression
8367in combiner for a pseudo register as last known value of that register.  The default
8368is 10000.
8369
8370@item integer-share-limit
8371Small integer constants can use a shared data structure, reducing the
8372compiler's memory usage and increasing its speed.  This sets the maximum
8373value of a shared integer constant.  The default value is 256.
8374
8375@item min-virtual-mappings
8376Specifies the minimum number of virtual mappings in the incremental
8377SSA updater that should be registered to trigger the virtual mappings
8378heuristic defined by virtual-mappings-ratio.  The default value is
8379100.
8380
8381@item virtual-mappings-ratio
8382If the number of virtual mappings is virtual-mappings-ratio bigger
8383than the number of virtual symbols to be updated, then the incremental
8384SSA updater switches to a full update for those symbols.  The default
8385ratio is 3.
8386
8387@item ssp-buffer-size
8388The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
8389protection when @option{-fstack-protection} is used.
8390
8391@item max-jump-thread-duplication-stmts
8392Maximum number of statements allowed in a block that needs to be
8393duplicated when threading jumps.
8394
8395@item max-fields-for-field-sensitive
8396Maximum number of fields in a structure we will treat in
8397a field sensitive manner during pointer analysis.  The default is zero
8398for -O0, and -O1 and 100 for -Os, -O2, and -O3.
8399
8400@item prefetch-latency
8401Estimate on average number of instructions that are executed before
8402prefetch finishes.  The distance we prefetch ahead is proportional
8403to this constant.  Increasing this number may also lead to less
8404streams being prefetched (see @option{simultaneous-prefetches}).
8405
8406@item simultaneous-prefetches
8407Maximum number of prefetches that can run at the same time.
8408
8409@item l1-cache-line-size
8410The size of cache line in L1 cache, in bytes.
8411
8412@item l1-cache-size
8413The size of L1 cache, in kilobytes.
8414
8415@item l2-cache-size
8416The size of L2 cache, in kilobytes.
8417
8418@item min-insn-to-prefetch-ratio
8419The minimum ratio between the number of instructions and the
8420number of prefetches to enable prefetching in a loop with an
8421unknown trip count.
8422
8423@item prefetch-min-insn-to-mem-ratio
8424The minimum ratio between the number of instructions and the
8425number of memory references to enable prefetching in a loop.
8426
8427@item use-canonical-types
8428Whether the compiler should use the ``canonical'' type system.  By
8429default, this should always be 1, which uses a more efficient internal
8430mechanism for comparing types in C++ and Objective-C++.  However, if
8431bugs in the canonical type system are causing compilation failures,
8432set this value to 0 to disable canonical types.
8433
8434@item switch-conversion-max-branch-ratio
8435Switch initialization conversion will refuse to create arrays that are
8436bigger than @option{switch-conversion-max-branch-ratio} times the number of
8437branches in the switch.
8438
8439@item max-partial-antic-length
8440Maximum length of the partial antic set computed during the tree
8441partial redundancy elimination optimization (@option{-ftree-pre}) when
8442optimizing at @option{-O3} and above.  For some sorts of source code
8443the enhanced partial redundancy elimination optimization can run away,
8444consuming all of the memory available on the host machine.  This
8445parameter sets a limit on the length of the sets that are computed,
8446which prevents the runaway behavior.  Setting a value of 0 for
8447this parameter will allow an unlimited set length.
8448
8449@item sccvn-max-scc-size
8450Maximum size of a strongly connected component (SCC) during SCCVN
8451processing.  If this limit is hit, SCCVN processing for the whole
8452function will not be done and optimizations depending on it will
8453be disabled.  The default maximum SCC size is 10000.
8454
8455@item ira-max-loops-num
8456IRA uses a regional register allocation by default.  If a function
8457contains loops more than number given by the parameter, only at most
8458given number of the most frequently executed loops will form regions
8459for the regional register allocation.  The default value of the
8460parameter is 100.
8461
8462@item ira-max-conflict-table-size
8463Although IRA uses a sophisticated algorithm of compression conflict
8464table, the table can be still big for huge functions.  If the conflict
8465table for a function could be more than size in MB given by the
8466parameter, the conflict table is not built and faster, simpler, and
8467lower quality register allocation algorithm will be used.  The
8468algorithm do not use pseudo-register conflicts.  The default value of
8469the parameter is 2000.
8470
8471@item ira-loop-reserved-regs
8472IRA can be used to evaluate more accurate register pressure in loops
8473for decision to move loop invariants (see @option{-O3}).  The number
8474of available registers reserved for some other purposes is described
8475by this parameter.  The default value of the parameter is 2 which is
8476minimal number of registers needed for execution of typical
8477instruction.  This value is the best found from numerous experiments.
8478
8479@item loop-invariant-max-bbs-in-loop
8480Loop invariant motion can be very expensive, both in compile time and
8481in amount of needed compile time memory, with very large loops.  Loops
8482with more basic blocks than this parameter won't have loop invariant
8483motion optimization performed on them.  The default value of the
8484parameter is 1000 for -O1 and 10000 for -O2 and above.
8485
8486@item max-vartrack-size
8487Sets a maximum number of hash table slots to use during variable
8488tracking dataflow analysis of any function.  If this limit is exceeded
8489with variable tracking at assignments enabled, analysis for that
8490function is retried without it, after removing all debug insns from
8491the function.  If the limit is exceeded even without debug insns, var
8492tracking analysis is completely disabled for the function.  Setting
8493the parameter to zero makes it unlimited.
8494
8495@item min-nondebug-insn-uid
8496Use uids starting at this parameter for nondebug insns.  The range below
8497the parameter is reserved exclusively for debug insns created by
8498@option{-fvar-tracking-assignments}, but debug insns may get
8499(non-overlapping) uids above it if the reserved range is exhausted.
8500
8501@item ipa-sra-ptr-growth-factor
8502IPA-SRA will replace a pointer to an aggregate with one or more new
8503parameters only when their cumulative size is less or equal to
8504@option{ipa-sra-ptr-growth-factor} times the size of the original
8505pointer parameter.
8506
8507@item graphite-max-nb-scop-params
8508To avoid exponential effects in the Graphite loop transforms, the
8509number of parameters in a Static Control Part (SCoP) is bounded.  The
8510default value is 10 parameters.  A variable whose value is unknown at
8511compile time and defined outside a SCoP is a parameter of the SCoP.
8512
8513@item graphite-max-bbs-per-function
8514To avoid exponential effects in the detection of SCoPs, the size of
8515the functions analyzed by Graphite is bounded.  The default value is
8516100 basic blocks.
8517
8518@item loop-block-tile-size
8519Loop blocking or strip mining transforms, enabled with
8520@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
8521loop in the loop nest by a given number of iterations.  The strip
8522length can be changed using the @option{loop-block-tile-size}
8523parameter.  The default value is 51 iterations.
8524
8525@end table
8526@end table
8527
8528@node Preprocessor Options
8529@section Options Controlling the Preprocessor
8530@cindex preprocessor options
8531@cindex options, preprocessor
8532
8533These options control the C preprocessor, which is run on each C source
8534file before actual compilation.
8535
8536If you use the @option{-E} option, nothing is done except preprocessing.
8537Some of these options make sense only together with @option{-E} because
8538they cause the preprocessor output to be unsuitable for actual
8539compilation.
8540
8541@table @gcctabopt
8542@item -Wp,@var{option}
8543@opindex Wp
8544You can use @option{-Wp,@var{option}} to bypass the compiler driver
8545and pass @var{option} directly through to the preprocessor.  If
8546@var{option} contains commas, it is split into multiple options at the
8547commas.  However, many options are modified, translated or interpreted
8548by the compiler driver before being passed to the preprocessor, and
8549@option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
8550interface is undocumented and subject to change, so whenever possible
8551you should avoid using @option{-Wp} and let the driver handle the
8552options instead.
8553
8554@item -Xpreprocessor @var{option}
8555@opindex Xpreprocessor
8556Pass @var{option} as an option to the preprocessor.  You can use this to
8557supply system-specific preprocessor options which GCC does not know how to
8558recognize.
8559
8560If you want to pass an option that takes an argument, you must use
8561@option{-Xpreprocessor} twice, once for the option and once for the argument.
8562@end table
8563
8564@include cppopts.texi
8565
8566@node Assembler Options
8567@section Passing Options to the Assembler
8568
8569@c prevent bad page break with this line
8570You can pass options to the assembler.
8571
8572@table @gcctabopt
8573@item -Wa,@var{option}
8574@opindex Wa
8575Pass @var{option} as an option to the assembler.  If @var{option}
8576contains commas, it is split into multiple options at the commas.
8577
8578@item -Xassembler @var{option}
8579@opindex Xassembler
8580Pass @var{option} as an option to the assembler.  You can use this to
8581supply system-specific assembler options which GCC does not know how to
8582recognize.
8583
8584If you want to pass an option that takes an argument, you must use
8585@option{-Xassembler} twice, once for the option and once for the argument.
8586
8587@end table
8588
8589@node Link Options
8590@section Options for Linking
8591@cindex link options
8592@cindex options, linking
8593
8594These options come into play when the compiler links object files into
8595an executable output file.  They are meaningless if the compiler is
8596not doing a link step.
8597
8598@table @gcctabopt
8599@cindex file names
8600@item @var{object-file-name}
8601A file name that does not end in a special recognized suffix is
8602considered to name an object file or library.  (Object files are
8603distinguished from libraries by the linker according to the file
8604contents.)  If linking is done, these object files are used as input
8605to the linker.
8606
8607@item -c
8608@itemx -S
8609@itemx -E
8610@opindex c
8611@opindex S
8612@opindex E
8613If any of these options is used, then the linker is not run, and
8614object file names should not be used as arguments.  @xref{Overall
8615Options}.
8616
8617@cindex Libraries
8618@item -l@var{library}
8619@itemx -l @var{library}
8620@opindex l
8621Search the library named @var{library} when linking.  (The second
8622alternative with the library as a separate argument is only for
8623POSIX compliance and is not recommended.)
8624
8625It makes a difference where in the command you write this option; the
8626linker searches and processes libraries and object files in the order they
8627are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
8628after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
8629to functions in @samp{z}, those functions may not be loaded.
8630
8631The linker searches a standard list of directories for the library,
8632which is actually a file named @file{lib@var{library}.a}.  The linker
8633then uses this file as if it had been specified precisely by name.
8634
8635The directories searched include several standard system directories
8636plus any that you specify with @option{-L}.
8637
8638Normally the files found this way are library files---archive files
8639whose members are object files.  The linker handles an archive file by
8640scanning through it for members which define symbols that have so far
8641been referenced but not defined.  But if the file that is found is an
8642ordinary object file, it is linked in the usual fashion.  The only
8643difference between using an @option{-l} option and specifying a file name
8644is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
8645and searches several directories.
8646
8647@item -lobjc
8648@opindex lobjc
8649You need this special case of the @option{-l} option in order to
8650link an Objective-C or Objective-C++ program.
8651
8652@item -nostartfiles
8653@opindex nostartfiles
8654Do not use the standard system startup files when linking.
8655The standard system libraries are used normally, unless @option{-nostdlib}
8656or @option{-nodefaultlibs} is used.
8657
8658@item -nodefaultlibs
8659@opindex nodefaultlibs
8660Do not use the standard system libraries when linking.
8661Only the libraries you specify will be passed to the linker, options
8662specifying linkage of the system libraries, such as @code{-static-libgcc}
8663or @code{-shared-libgcc}, will be ignored.
8664The standard startup files are used normally, unless @option{-nostartfiles}
8665is used.  The compiler may generate calls to @code{memcmp},
8666@code{memset}, @code{memcpy} and @code{memmove}.
8667These entries are usually resolved by entries in
8668libc.  These entry points should be supplied through some other
8669mechanism when this option is specified.
8670
8671@item -nostdlib
8672@opindex nostdlib
8673Do not use the standard system startup files or libraries when linking.
8674No startup files and only the libraries you specify will be passed to
8675the linker, options specifying linkage of the system libraries, such as
8676@code{-static-libgcc} or @code{-shared-libgcc}, will be ignored.
8677The compiler may generate calls to @code{memcmp}, @code{memset},
8678@code{memcpy} and @code{memmove}.
8679These entries are usually resolved by entries in
8680libc.  These entry points should be supplied through some other
8681mechanism when this option is specified.
8682
8683@cindex @option{-lgcc}, use with @option{-nostdlib}
8684@cindex @option{-nostdlib} and unresolved references
8685@cindex unresolved references and @option{-nostdlib}
8686@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
8687@cindex @option{-nodefaultlibs} and unresolved references
8688@cindex unresolved references and @option{-nodefaultlibs}
8689One of the standard libraries bypassed by @option{-nostdlib} and
8690@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
8691that GCC uses to overcome shortcomings of particular machines, or special
8692needs for some languages.
8693(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
8694Collection (GCC) Internals},
8695for more discussion of @file{libgcc.a}.)
8696In most cases, you need @file{libgcc.a} even when you want to avoid
8697other standard libraries.  In other words, when you specify @option{-nostdlib}
8698or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
8699This ensures that you have no unresolved references to internal GCC
8700library subroutines.  (For example, @samp{__main}, used to ensure C++
8701constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
8702GNU Compiler Collection (GCC) Internals}.)
8703
8704@item -pie
8705@opindex pie
8706Produce a position independent executable on targets which support it.
8707For predictable results, you must also specify the same set of options
8708that were used to generate code (@option{-fpie}, @option{-fPIE},
8709or model suboptions) when you specify this option.
8710
8711@item -rdynamic
8712@opindex rdynamic
8713Pass the flag @option{-export-dynamic} to the ELF linker, on targets
8714that support it. This instructs the linker to add all symbols, not
8715only used ones, to the dynamic symbol table. This option is needed
8716for some uses of @code{dlopen} or to allow obtaining backtraces
8717from within a program.
8718
8719@item -s
8720@opindex s
8721Remove all symbol table and relocation information from the executable.
8722
8723@item -static
8724@opindex static
8725On systems that support dynamic linking, this prevents linking with the shared
8726libraries.  On other systems, this option has no effect.
8727
8728@item -shared
8729@opindex shared
8730Produce a shared object which can then be linked with other objects to
8731form an executable.  Not all systems support this option.  For predictable
8732results, you must also specify the same set of options that were used to
8733generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
8734when you specify this option.@footnote{On some systems, @samp{gcc -shared}
8735needs to build supplementary stub code for constructors to work.  On
8736multi-libbed systems, @samp{gcc -shared} must select the correct support
8737libraries to link against.  Failing to supply the correct flags may lead
8738to subtle defects.  Supplying them in cases where they are not necessary
8739is innocuous.}
8740
8741@item -shared-libgcc
8742@itemx -static-libgcc
8743@opindex shared-libgcc
8744@opindex static-libgcc
8745On systems that provide @file{libgcc} as a shared library, these options
8746force the use of either the shared or static version respectively.
8747If no shared version of @file{libgcc} was built when the compiler was
8748configured, these options have no effect.
8749
8750There are several situations in which an application should use the
8751shared @file{libgcc} instead of the static version.  The most common
8752of these is when the application wishes to throw and catch exceptions
8753across different shared libraries.  In that case, each of the libraries
8754as well as the application itself should use the shared @file{libgcc}.
8755
8756Therefore, the G++ and GCJ drivers automatically add
8757@option{-shared-libgcc} whenever you build a shared library or a main
8758executable, because C++ and Java programs typically use exceptions, so
8759this is the right thing to do.
8760
8761If, instead, you use the GCC driver to create shared libraries, you may
8762find that they will not always be linked with the shared @file{libgcc}.
8763If GCC finds, at its configuration time, that you have a non-GNU linker
8764or a GNU linker that does not support option @option{--eh-frame-hdr},
8765it will link the shared version of @file{libgcc} into shared libraries
8766by default.  Otherwise, it will take advantage of the linker and optimize
8767away the linking with the shared version of @file{libgcc}, linking with
8768the static version of libgcc by default.  This allows exceptions to
8769propagate through such shared libraries, without incurring relocation
8770costs at library load time.
8771
8772However, if a library or main executable is supposed to throw or catch
8773exceptions, you must link it using the G++ or GCJ driver, as appropriate
8774for the languages used in the program, or using the option
8775@option{-shared-libgcc}, such that it is linked with the shared
8776@file{libgcc}.
8777
8778@item -static-libstdc++
8779When the @command{g++} program is used to link a C++ program, it will
8780normally automatically link against @option{libstdc++}.  If
8781@file{libstdc++} is available as a shared library, and the
8782@option{-static} option is not used, then this will link against the
8783shared version of @file{libstdc++}.  That is normally fine.  However, it
8784is sometimes useful to freeze the version of @file{libstdc++} used by
8785the program without going all the way to a fully static link.  The
8786@option{-static-libstdc++} option directs the @command{g++} driver to
8787link @file{libstdc++} statically, without necessarily linking other
8788libraries statically.
8789
8790@item -symbolic
8791@opindex symbolic
8792Bind references to global symbols when building a shared object.  Warn
8793about any unresolved references (unless overridden by the link editor
8794option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
8795this option.
8796
8797@item -T @var{script}
8798@opindex T
8799@cindex linker script
8800Use @var{script} as the linker script.  This option is supported by most
8801systems using the GNU linker.  On some targets, such as bare-board
8802targets without an operating system, the @option{-T} option may be required
8803when linking to avoid references to undefined symbols.
8804
8805@item -Xlinker @var{option}
8806@opindex Xlinker
8807Pass @var{option} as an option to the linker.  You can use this to
8808supply system-specific linker options which GCC does not know how to
8809recognize.
8810
8811If you want to pass an option that takes a separate argument, you must use
8812@option{-Xlinker} twice, once for the option and once for the argument.
8813For example, to pass @option{-assert definitions}, you must write
8814@samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
8815@option{-Xlinker "-assert definitions"}, because this passes the entire
8816string as a single argument, which is not what the linker expects.
8817
8818When using the GNU linker, it is usually more convenient to pass
8819arguments to linker options using the @option{@var{option}=@var{value}}
8820syntax than as separate arguments.  For example, you can specify
8821@samp{-Xlinker -Map=output.map} rather than
8822@samp{-Xlinker -Map -Xlinker output.map}.  Other linkers may not support
8823this syntax for command-line options.
8824
8825@item -Wl,@var{option}
8826@opindex Wl
8827Pass @var{option} as an option to the linker.  If @var{option} contains
8828commas, it is split into multiple options at the commas.  You can use this
8829syntax to pass an argument to the option.
8830For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
8831linker.  When using the GNU linker, you can also get the same effect with
8832@samp{-Wl,-Map=output.map}.
8833
8834@item -u @var{symbol}
8835@opindex u
8836Pretend the symbol @var{symbol} is undefined, to force linking of
8837library modules to define it.  You can use @option{-u} multiple times with
8838different symbols to force loading of additional library modules.
8839@end table
8840
8841@node Directory Options
8842@section Options for Directory Search
8843@cindex directory options
8844@cindex options, directory search
8845@cindex search path
8846
8847These options specify directories to search for header files, for
8848libraries and for parts of the compiler:
8849
8850@table @gcctabopt
8851@item -I@var{dir}
8852@opindex I
8853Add the directory @var{dir} to the head of the list of directories to be
8854searched for header files.  This can be used to override a system header
8855file, substituting your own version, since these directories are
8856searched before the system header file directories.  However, you should
8857not use this option to add directories that contain vendor-supplied
8858system header files (use @option{-isystem} for that).  If you use more than
8859one @option{-I} option, the directories are scanned in left-to-right
8860order; the standard system directories come after.
8861
8862If a standard system include directory, or a directory specified with
8863@option{-isystem}, is also specified with @option{-I}, the @option{-I}
8864option will be ignored.  The directory will still be searched but as a
8865system directory at its normal position in the system include chain.
8866This is to ensure that GCC's procedure to fix buggy system headers and
8867the ordering for the include_next directive are not inadvertently changed.
8868If you really need to change the search order for system directories,
8869use the @option{-nostdinc} and/or @option{-isystem} options.
8870
8871@item -iquote@var{dir}
8872@opindex iquote
8873Add the directory @var{dir} to the head of the list of directories to
8874be searched for header files only for the case of @samp{#include
8875"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
8876otherwise just like @option{-I}.
8877
8878@item -iremap @var{src}:@var{dst}
8879@opindex iremap
8880Replace the prefix @var{src} in __FILE__ with @var{dst} at expansion time.
8881This option can be specified more than once.  Processing stops at the first
8882match.
8883
8884@item -L@var{dir}
8885@opindex L
8886Add directory @var{dir} to the list of directories to be searched
8887for @option{-l}.
8888
8889@item -B@var{prefix}
8890@opindex B
8891This option specifies where to find the executables, libraries,
8892include files, and data files of the compiler itself.
8893
8894The compiler driver program runs one or more of the subprograms
8895@file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
8896@var{prefix} as a prefix for each program it tries to run, both with and
8897without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
8898
8899For each subprogram to be run, the compiler driver first tries the
8900@option{-B} prefix, if any.  If that name is not found, or if @option{-B}
8901was not specified, the driver tries two standard prefixes, which are
8902@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}.  If neither of
8903those results in a file name that is found, the unmodified program
8904name is searched for using the directories specified in your
8905@env{PATH} environment variable.
8906
8907The compiler will check to see if the path provided by the @option{-B}
8908refers to a directory, and if necessary it will add a directory
8909separator character at the end of the path.
8910
8911@option{-B} prefixes that effectively specify directory names also apply
8912to libraries in the linker, because the compiler translates these
8913options into @option{-L} options for the linker.  They also apply to
8914includes files in the preprocessor, because the compiler translates these
8915options into @option{-isystem} options for the preprocessor.  In this case,
8916the compiler appends @samp{include} to the prefix.
8917
8918The run-time support file @file{libgcc.a} can also be searched for using
8919the @option{-B} prefix, if needed.  If it is not found there, the two
8920standard prefixes above are tried, and that is all.  The file is left
8921out of the link if it is not found by those means.
8922
8923Another way to specify a prefix much like the @option{-B} prefix is to use
8924the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
8925Variables}.
8926
8927As a special kludge, if the path provided by @option{-B} is
8928@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
89299, then it will be replaced by @file{[dir/]include}.  This is to help
8930with boot-strapping the compiler.
8931
8932@item -specs=@var{file}
8933@opindex specs
8934Process @var{file} after the compiler reads in the standard @file{specs}
8935file, in order to override the defaults that the @file{gcc} driver
8936program uses when determining what switches to pass to @file{cc1},
8937@file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
8938@option{-specs=@var{file}} can be specified on the command line, and they
8939are processed in order, from left to right.
8940
8941@item --sysroot=@var{dir}
8942@opindex sysroot
8943Use @var{dir} as the logical root directory for headers and libraries.
8944For example, if the compiler would normally search for headers in
8945@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
8946search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
8947
8948If you use both this option and the @option{-isysroot} option, then
8949the @option{--sysroot} option will apply to libraries, but the
8950@option{-isysroot} option will apply to header files.
8951
8952The GNU linker (beginning with version 2.16) has the necessary support
8953for this option.  If your linker does not support this option, the
8954header file aspect of @option{--sysroot} will still work, but the
8955library aspect will not.
8956
8957@item -I-
8958@opindex I-
8959This option has been deprecated.  Please use @option{-iquote} instead for
8960@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
8961Any directories you specify with @option{-I} options before the @option{-I-}
8962option are searched only for the case of @samp{#include "@var{file}"};
8963they are not searched for @samp{#include <@var{file}>}.
8964
8965If additional directories are specified with @option{-I} options after
8966the @option{-I-}, these directories are searched for all @samp{#include}
8967directives.  (Ordinarily @emph{all} @option{-I} directories are used
8968this way.)
8969
8970In addition, the @option{-I-} option inhibits the use of the current
8971directory (where the current input file came from) as the first search
8972directory for @samp{#include "@var{file}"}.  There is no way to
8973override this effect of @option{-I-}.  With @option{-I.} you can specify
8974searching the directory which was current when the compiler was
8975invoked.  That is not exactly the same as what the preprocessor does
8976by default, but it is often satisfactory.
8977
8978@option{-I-} does not inhibit the use of the standard system directories
8979for header files.  Thus, @option{-I-} and @option{-nostdinc} are
8980independent.
8981@end table
8982
8983@c man end
8984
8985@node Spec Files
8986@section Specifying subprocesses and the switches to pass to them
8987@cindex Spec Files
8988
8989@command{gcc} is a driver program.  It performs its job by invoking a
8990sequence of other programs to do the work of compiling, assembling and
8991linking.  GCC interprets its command-line parameters and uses these to
8992deduce which programs it should invoke, and which command-line options
8993it ought to place on their command lines.  This behavior is controlled
8994by @dfn{spec strings}.  In most cases there is one spec string for each
8995program that GCC can invoke, but a few programs have multiple spec
8996strings to control their behavior.  The spec strings built into GCC can
8997be overridden by using the @option{-specs=} command-line switch to specify
8998a spec file.
8999
9000@dfn{Spec files} are plaintext files that are used to construct spec
9001strings.  They consist of a sequence of directives separated by blank
9002lines.  The type of directive is determined by the first non-whitespace
9003character on the line and it can be one of the following:
9004
9005@table @code
9006@item %@var{command}
9007Issues a @var{command} to the spec file processor.  The commands that can
9008appear here are:
9009
9010@table @code
9011@item %include <@var{file}>
9012@cindex %include
9013Search for @var{file} and insert its text at the current point in the
9014specs file.
9015
9016@item %include_noerr <@var{file}>
9017@cindex %include_noerr
9018Just like @samp{%include}, but do not generate an error message if the include
9019file cannot be found.
9020
9021@item %rename @var{old_name} @var{new_name}
9022@cindex %rename
9023Rename the spec string @var{old_name} to @var{new_name}.
9024
9025@end table
9026
9027@item *[@var{spec_name}]:
9028This tells the compiler to create, override or delete the named spec
9029string.  All lines after this directive up to the next directive or
9030blank line are considered to be the text for the spec string.  If this
9031results in an empty string then the spec will be deleted.  (Or, if the
9032spec did not exist, then nothing will happened.)  Otherwise, if the spec
9033does not currently exist a new spec will be created.  If the spec does
9034exist then its contents will be overridden by the text of this
9035directive, unless the first character of that text is the @samp{+}
9036character, in which case the text will be appended to the spec.
9037
9038@item [@var{suffix}]:
9039Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
9040and up to the next directive or blank line are considered to make up the
9041spec string for the indicated suffix.  When the compiler encounters an
9042input file with the named suffix, it will processes the spec string in
9043order to work out how to compile that file.  For example:
9044
9045@smallexample
9046.ZZ:
9047z-compile -input %i
9048@end smallexample
9049
9050This says that any input file whose name ends in @samp{.ZZ} should be
9051passed to the program @samp{z-compile}, which should be invoked with the
9052command-line switch @option{-input} and with the result of performing the
9053@samp{%i} substitution.  (See below.)
9054
9055As an alternative to providing a spec string, the text that follows a
9056suffix directive can be one of the following:
9057
9058@table @code
9059@item @@@var{language}
9060This says that the suffix is an alias for a known @var{language}.  This is
9061similar to using the @option{-x} command-line switch to GCC to specify a
9062language explicitly.  For example:
9063
9064@smallexample
9065.ZZ:
9066@@c++
9067@end smallexample
9068
9069Says that .ZZ files are, in fact, C++ source files.
9070
9071@item #@var{name}
9072This causes an error messages saying:
9073
9074@smallexample
9075@var{name} compiler not installed on this system.
9076@end smallexample
9077@end table
9078
9079GCC already has an extensive list of suffixes built into it.
9080This directive will add an entry to the end of the list of suffixes, but
9081since the list is searched from the end backwards, it is effectively
9082possible to override earlier entries using this technique.
9083
9084@end table
9085
9086GCC has the following spec strings built into it.  Spec files can
9087override these strings or create their own.  Note that individual
9088targets can also add their own spec strings to this list.
9089
9090@smallexample
9091asm          Options to pass to the assembler
9092asm_final    Options to pass to the assembler post-processor
9093cpp          Options to pass to the C preprocessor
9094cc1          Options to pass to the C compiler
9095cc1plus      Options to pass to the C++ compiler
9096endfile      Object files to include at the end of the link
9097link         Options to pass to the linker
9098lib          Libraries to include on the command line to the linker
9099libgcc       Decides which GCC support library to pass to the linker
9100linker       Sets the name of the linker
9101predefines   Defines to be passed to the C preprocessor
9102signed_char  Defines to pass to CPP to say whether @code{char} is signed
9103             by default
9104startfile    Object files to include at the start of the link
9105@end smallexample
9106
9107Here is a small example of a spec file:
9108
9109@smallexample
9110%rename lib                 old_lib
9111
9112*lib:
9113--start-group -lgcc -lc -leval1 --end-group %(old_lib)
9114@end smallexample
9115
9116This example renames the spec called @samp{lib} to @samp{old_lib} and
9117then overrides the previous definition of @samp{lib} with a new one.
9118The new definition adds in some extra command-line options before
9119including the text of the old definition.
9120
9121@dfn{Spec strings} are a list of command-line options to be passed to their
9122corresponding program.  In addition, the spec strings can contain
9123@samp{%}-prefixed sequences to substitute variable text or to
9124conditionally insert text into the command line.  Using these constructs
9125it is possible to generate quite complex command lines.
9126
9127Here is a table of all defined @samp{%}-sequences for spec
9128strings.  Note that spaces are not generated automatically around the
9129results of expanding these sequences.  Therefore you can concatenate them
9130together or combine them with constant text in a single argument.
9131
9132@table @code
9133@item %%
9134Substitute one @samp{%} into the program name or argument.
9135
9136@item %i
9137Substitute the name of the input file being processed.
9138
9139@item %b
9140Substitute the basename of the input file being processed.
9141This is the substring up to (and not including) the last period
9142and not including the directory.
9143
9144@item %B
9145This is the same as @samp{%b}, but include the file suffix (text after
9146the last period).
9147
9148@item %d
9149Marks the argument containing or following the @samp{%d} as a
9150temporary file name, so that that file will be deleted if GCC exits
9151successfully.  Unlike @samp{%g}, this contributes no text to the
9152argument.
9153
9154@item %g@var{suffix}
9155Substitute a file name that has suffix @var{suffix} and is chosen
9156once per compilation, and mark the argument in the same way as
9157@samp{%d}.  To reduce exposure to denial-of-service attacks, the file
9158name is now chosen in a way that is hard to predict even when previously
9159chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
9160might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
9161the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
9162treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
9163was simply substituted with a file name chosen once per compilation,
9164without regard to any appended suffix (which was therefore treated
9165just like ordinary text), making such attacks more likely to succeed.
9166
9167@item %u@var{suffix}
9168Like @samp{%g}, but generates a new temporary file name even if
9169@samp{%u@var{suffix}} was already seen.
9170
9171@item %U@var{suffix}
9172Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
9173new one if there is no such last file name.  In the absence of any
9174@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
9175the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
9176would involve the generation of two distinct file names, one
9177for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
9178simply substituted with a file name chosen for the previous @samp{%u},
9179without regard to any appended suffix.
9180
9181@item %j@var{suffix}
9182Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
9183writable, and if save-temps is off; otherwise, substitute the name
9184of a temporary file, just like @samp{%u}.  This temporary file is not
9185meant for communication between processes, but rather as a junk
9186disposal mechanism.
9187
9188@item %|@var{suffix}
9189@itemx %m@var{suffix}
9190Like @samp{%g}, except if @option{-pipe} is in effect.  In that case
9191@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
9192all.  These are the two most common ways to instruct a program that it
9193should read from standard input or write to standard output.  If you
9194need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
9195construct: see for example @file{f/lang-specs.h}.
9196
9197@item %.@var{SUFFIX}
9198Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
9199when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
9200terminated by the next space or %.
9201
9202@item %w
9203Marks the argument containing or following the @samp{%w} as the
9204designated output file of this compilation.  This puts the argument
9205into the sequence of arguments that @samp{%o} will substitute later.
9206
9207@item %o
9208Substitutes the names of all the output files, with spaces
9209automatically placed around them.  You should write spaces
9210around the @samp{%o} as well or the results are undefined.
9211@samp{%o} is for use in the specs for running the linker.
9212Input files whose names have no recognized suffix are not compiled
9213at all, but they are included among the output files, so they will
9214be linked.
9215
9216@item %O
9217Substitutes the suffix for object files.  Note that this is
9218handled specially when it immediately follows @samp{%g, %u, or %U},
9219because of the need for those to form complete file names.  The
9220handling is such that @samp{%O} is treated exactly as if it had already
9221been substituted, except that @samp{%g, %u, and %U} do not currently
9222support additional @var{suffix} characters following @samp{%O} as they would
9223following, for example, @samp{.o}.
9224
9225@item %p
9226Substitutes the standard macro predefinitions for the
9227current target machine.  Use this when running @code{cpp}.
9228
9229@item %P
9230Like @samp{%p}, but puts @samp{__} before and after the name of each
9231predefined macro, except for macros that start with @samp{__} or with
9232@samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
9233C@.
9234
9235@item %I
9236Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
9237@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
9238@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
9239and @option{-imultilib} as necessary.
9240
9241@item %s
9242Current argument is the name of a library or startup file of some sort.
9243Search for that file in a standard list of directories and substitute
9244the full name found.  The current working directory is included in the
9245list of directories scanned.
9246
9247@item %T
9248Current argument is the name of a linker script.  Search for that file
9249in the current list of directories to scan for libraries. If the file
9250is located insert a @option{--script} option into the command line
9251followed by the full path name found.  If the file is not found then
9252generate an error message.  Note: the current working directory is not
9253searched.
9254
9255@item %e@var{str}
9256Print @var{str} as an error message.  @var{str} is terminated by a newline.
9257Use this when inconsistent options are detected.
9258
9259@item %(@var{name})
9260Substitute the contents of spec string @var{name} at this point.
9261
9262@item %[@var{name}]
9263Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
9264
9265@item %x@{@var{option}@}
9266Accumulate an option for @samp{%X}.
9267
9268@item %X
9269Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
9270spec string.
9271
9272@item %Y
9273Output the accumulated assembler options specified by @option{-Wa}.
9274
9275@item %Z
9276Output the accumulated preprocessor options specified by @option{-Wp}.
9277
9278@item %a
9279Process the @code{asm} spec.  This is used to compute the
9280switches to be passed to the assembler.
9281
9282@item %A
9283Process the @code{asm_final} spec.  This is a spec string for
9284passing switches to an assembler post-processor, if such a program is
9285needed.
9286
9287@item %l
9288Process the @code{link} spec.  This is the spec for computing the
9289command line passed to the linker.  Typically it will make use of the
9290@samp{%L %G %S %D and %E} sequences.
9291
9292@item %D
9293Dump out a @option{-L} option for each directory that GCC believes might
9294contain startup files.  If the target supports multilibs then the
9295current multilib directory will be prepended to each of these paths.
9296
9297@item %L
9298Process the @code{lib} spec.  This is a spec string for deciding which
9299libraries should be included on the command line to the linker.
9300
9301@item %G
9302Process the @code{libgcc} spec.  This is a spec string for deciding
9303which GCC support library should be included on the command line to the linker.
9304
9305@item %S
9306Process the @code{startfile} spec.  This is a spec for deciding which
9307object files should be the first ones passed to the linker.  Typically
9308this might be a file named @file{crt0.o}.
9309
9310@item %E
9311Process the @code{endfile} spec.  This is a spec string that specifies
9312the last object files that will be passed to the linker.
9313
9314@item %C
9315Process the @code{cpp} spec.  This is used to construct the arguments
9316to be passed to the C preprocessor.
9317
9318@item %1
9319Process the @code{cc1} spec.  This is used to construct the options to be
9320passed to the actual C compiler (@samp{cc1}).
9321
9322@item %2
9323Process the @code{cc1plus} spec.  This is used to construct the options to be
9324passed to the actual C++ compiler (@samp{cc1plus}).
9325
9326@item %*
9327Substitute the variable part of a matched option.  See below.
9328Note that each comma in the substituted string is replaced by
9329a single space.
9330
9331@item %<@code{S}
9332Remove all occurrences of @code{-S} from the command line.  Note---this
9333command is position dependent.  @samp{%} commands in the spec string
9334before this one will see @code{-S}, @samp{%} commands in the spec string
9335after this one will not.
9336
9337@item %:@var{function}(@var{args})
9338Call the named function @var{function}, passing it @var{args}.
9339@var{args} is first processed as a nested spec string, then split
9340into an argument vector in the usual fashion.  The function returns
9341a string which is processed as if it had appeared literally as part
9342of the current spec.
9343
9344The following built-in spec functions are provided:
9345
9346@table @code
9347@item @code{getenv}
9348The @code{getenv} spec function takes two arguments: an environment
9349variable name and a string.  If the environment variable is not
9350defined, a fatal error is issued.  Otherwise, the return value is the
9351value of the environment variable concatenated with the string.  For
9352example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
9353
9354@smallexample
9355%:getenv(TOPDIR /include)
9356@end smallexample
9357
9358expands to @file{/path/to/top/include}.
9359
9360@item @code{if-exists}
9361The @code{if-exists} spec function takes one argument, an absolute
9362pathname to a file.  If the file exists, @code{if-exists} returns the
9363pathname.  Here is a small example of its usage:
9364
9365@smallexample
9366*startfile:
9367crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
9368@end smallexample
9369
9370@item @code{if-exists-else}
9371The @code{if-exists-else} spec function is similar to the @code{if-exists}
9372spec function, except that it takes two arguments.  The first argument is
9373an absolute pathname to a file.  If the file exists, @code{if-exists-else}
9374returns the pathname.  If it does not exist, it returns the second argument.
9375This way, @code{if-exists-else} can be used to select one file or another,
9376based on the existence of the first.  Here is a small example of its usage:
9377
9378@smallexample
9379*startfile:
9380crt0%O%s %:if-exists(crti%O%s) \
9381%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
9382@end smallexample
9383
9384@item @code{replace-outfile}
9385The @code{replace-outfile} spec function takes two arguments.  It looks for the
9386first argument in the outfiles array and replaces it with the second argument.  Here
9387is a small example of its usage:
9388
9389@smallexample
9390%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
9391@end smallexample
9392
9393@item @code{print-asm-header}
9394The @code{print-asm-header} function takes no arguments and simply
9395prints a banner like:
9396
9397@smallexample
9398Assembler options
9399=================
9400
9401Use "-Wa,OPTION" to pass "OPTION" to the assembler.
9402@end smallexample
9403
9404It is used to separate compiler options from assembler options
9405in the @option{--target-help} output.
9406@end table
9407
9408@item %@{@code{S}@}
9409Substitutes the @code{-S} switch, if that switch was given to GCC@.
9410If that switch was not specified, this substitutes nothing.  Note that
9411the leading dash is omitted when specifying this option, and it is
9412automatically inserted if the substitution is performed.  Thus the spec
9413string @samp{%@{foo@}} would match the command-line option @option{-foo}
9414and would output the command line option @option{-foo}.
9415
9416@item %W@{@code{S}@}
9417Like %@{@code{S}@} but mark last argument supplied within as a file to be
9418deleted on failure.
9419
9420@item %@{@code{S}*@}
9421Substitutes all the switches specified to GCC whose names start
9422with @code{-S}, but which also take an argument.  This is used for
9423switches like @option{-o}, @option{-D}, @option{-I}, etc.
9424GCC considers @option{-o foo} as being
9425one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
9426text, including the space.  Thus two arguments would be generated.
9427
9428@item %@{@code{S}*&@code{T}*@}
9429Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
9430(the order of @code{S} and @code{T} in the spec is not significant).
9431There can be any number of ampersand-separated variables; for each the
9432wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
9433
9434@item %@{@code{S}:@code{X}@}
9435Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
9436
9437@item %@{!@code{S}:@code{X}@}
9438Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
9439
9440@item %@{@code{S}*:@code{X}@}
9441Substitutes @code{X} if one or more switches whose names start with
9442@code{-S} are specified to GCC@.  Normally @code{X} is substituted only
9443once, no matter how many such switches appeared.  However, if @code{%*}
9444appears somewhere in @code{X}, then @code{X} will be substituted once
9445for each matching switch, with the @code{%*} replaced by the part of
9446that switch that matched the @code{*}.
9447
9448@item %@{.@code{S}:@code{X}@}
9449Substitutes @code{X}, if processing a file with suffix @code{S}.
9450
9451@item %@{!.@code{S}:@code{X}@}
9452Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
9453
9454@item %@{,@code{S}:@code{X}@}
9455Substitutes @code{X}, if processing a file for language @code{S}.
9456
9457@item %@{!,@code{S}:@code{X}@}
9458Substitutes @code{X}, if not processing a file for language @code{S}.
9459
9460@item %@{@code{S}|@code{P}:@code{X}@}
9461Substitutes @code{X} if either @code{-S} or @code{-P} was given to
9462GCC@.  This may be combined with @samp{!}, @samp{.}, @samp{,}, and
9463@code{*} sequences as well, although they have a stronger binding than
9464the @samp{|}.  If @code{%*} appears in @code{X}, all of the
9465alternatives must be starred, and only the first matching alternative
9466is substituted.
9467
9468For example, a spec string like this:
9469
9470@smallexample
9471%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
9472@end smallexample
9473
9474will output the following command-line options from the following input
9475command-line options:
9476
9477@smallexample
9478fred.c        -foo -baz
9479jim.d         -bar -boggle
9480-d fred.c     -foo -baz -boggle
9481-d jim.d      -bar -baz -boggle
9482@end smallexample
9483
9484@item %@{S:X; T:Y; :D@}
9485
9486If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
9487given to GCC, substitutes @code{Y}; else substitutes @code{D}.  There can
9488be as many clauses as you need.  This may be combined with @code{.},
9489@code{,}, @code{!}, @code{|}, and @code{*} as needed.
9490
9491
9492@end table
9493
9494The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
9495construct may contain other nested @samp{%} constructs or spaces, or
9496even newlines.  They are processed as usual, as described above.
9497Trailing white space in @code{X} is ignored.  White space may also
9498appear anywhere on the left side of the colon in these constructs,
9499except between @code{.} or @code{*} and the corresponding word.
9500
9501The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
9502handled specifically in these constructs.  If another value of
9503@option{-O} or the negated form of a @option{-f}, @option{-m}, or
9504@option{-W} switch is found later in the command line, the earlier
9505switch value is ignored, except with @{@code{S}*@} where @code{S} is
9506just one letter, which passes all matching options.
9507
9508The character @samp{|} at the beginning of the predicate text is used to
9509indicate that a command should be piped to the following command, but
9510only if @option{-pipe} is specified.
9511
9512It is built into GCC which switches take arguments and which do not.
9513(You might think it would be useful to generalize this to allow each
9514compiler's spec to say which switches take arguments.  But this cannot
9515be done in a consistent fashion.  GCC cannot even decide which input
9516files have been specified without knowing which switches take arguments,
9517and it must know which input files to compile in order to tell which
9518compilers to run).
9519
9520GCC also knows implicitly that arguments starting in @option{-l} are to be
9521treated as compiler output files, and passed to the linker in their
9522proper position among the other output files.
9523
9524@c man begin OPTIONS
9525
9526@node Target Options
9527@section Specifying Target Machine and Compiler Version
9528@cindex target options
9529@cindex cross compiling
9530@cindex specifying machine version
9531@cindex specifying compiler version and target machine
9532@cindex compiler version, specifying
9533@cindex target machine, specifying
9534
9535The usual way to run GCC is to run the executable called @file{gcc}, or
9536@file{<machine>-gcc} when cross-compiling, or
9537@file{<machine>-gcc-<version>} to run a version other than the one that
9538was installed last.  Sometimes this is inconvenient, so GCC provides
9539options that will switch to another cross-compiler or version.
9540
9541@table @gcctabopt
9542@item -b @var{machine}
9543@opindex b
9544The argument @var{machine} specifies the target machine for compilation.
9545
9546The value to use for @var{machine} is the same as was specified as the
9547machine type when configuring GCC as a cross-compiler.  For
9548example, if a cross-compiler was configured with @samp{configure
9549arm-elf}, meaning to compile for an arm processor with elf binaries,
9550then you would specify @option{-b arm-elf} to run that cross compiler.
9551Because there are other options beginning with @option{-b}, the
9552configuration must contain a hyphen, or @option{-b} alone should be one
9553argument followed by the configuration in the next argument.
9554
9555@item -V @var{version}
9556@opindex V
9557The argument @var{version} specifies which version of GCC to run.
9558This is useful when multiple versions are installed.  For example,
9559@var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
9560@end table
9561
9562The @option{-V} and @option{-b} options work by running the
9563@file{<machine>-gcc-<version>} executable, so there's no real reason to
9564use them if you can just run that directly.
9565
9566@node Submodel Options
9567@section Hardware Models and Configurations
9568@cindex submodel options
9569@cindex specifying hardware config
9570@cindex hardware models and configurations, specifying
9571@cindex machine dependent options
9572
9573Earlier we discussed the standard option @option{-b} which chooses among
9574different installed compilers for completely different target
9575machines, such as VAX vs.@: 68000 vs.@: 80386.
9576
9577In addition, each of these target machine types can have its own
9578special options, starting with @samp{-m}, to choose among various
9579hardware models or configurations---for example, 68010 vs 68020,
9580floating coprocessor or none.  A single installed version of the
9581compiler can compile for any model or configuration, according to the
9582options specified.
9583
9584Some configurations of the compiler also support additional special
9585options, usually for compatibility with other compilers on the same
9586platform.
9587
9588@c This list is ordered alphanumerically by subsection name.
9589@c It should be the same order and spelling as these options are listed
9590@c in Machine Dependent Options
9591
9592@menu
9593* ARC Options::
9594* ARM Options::
9595* AVR Options::
9596* Blackfin Options::
9597* CRIS Options::
9598* CRX Options::
9599* Darwin Options::
9600* DEC Alpha Options::
9601* DEC Alpha/VMS Options::
9602* FR30 Options::
9603* FRV Options::
9604* GNU/Linux Options::
9605* H8/300 Options::
9606* HPPA Options::
9607* i386 and x86-64 Options::
9608* i386 and x86-64 Windows Options::
9609* IA-64 Options::
9610* IA-64/VMS Options::
9611* LM32 Options::
9612* M32C Options::
9613* M32R/D Options::
9614* M680x0 Options::
9615* M68hc1x Options::
9616* MCore Options::
9617* MeP Options::
9618* MIPS Options::
9619* MMIX Options::
9620* MN10300 Options::
9621* PDP-11 Options::
9622* picoChip Options::
9623* PowerPC Options::
9624* RS/6000 and PowerPC Options::
9625* RX Options::
9626* S/390 and zSeries Options::
9627* Score Options::
9628* SH Options::
9629* SPARC Options::
9630* SPU Options::
9631* System V Options::
9632* V850 Options::
9633* VAX Options::
9634* VxWorks Options::
9635* x86-64 Options::
9636* Xstormy16 Options::
9637* Xtensa Options::
9638* zSeries Options::
9639@end menu
9640
9641@node ARC Options
9642@subsection ARC Options
9643@cindex ARC Options
9644
9645These options are defined for ARC implementations:
9646
9647@table @gcctabopt
9648@item -EL
9649@opindex EL
9650Compile code for little endian mode.  This is the default.
9651
9652@item -EB
9653@opindex EB
9654Compile code for big endian mode.
9655
9656@item -mmangle-cpu
9657@opindex mmangle-cpu
9658Prepend the name of the CPU to all public symbol names.
9659In multiple-processor systems, there are many ARC variants with different
9660instruction and register set characteristics.  This flag prevents code
9661compiled for one CPU to be linked with code compiled for another.
9662No facility exists for handling variants that are ``almost identical''.
9663This is an all or nothing option.
9664
9665@item -mcpu=@var{cpu}
9666@opindex mcpu
9667Compile code for ARC variant @var{cpu}.
9668Which variants are supported depend on the configuration.
9669All variants support @option{-mcpu=base}, this is the default.
9670
9671@item -mtext=@var{text-section}
9672@itemx -mdata=@var{data-section}
9673@itemx -mrodata=@var{readonly-data-section}
9674@opindex mtext
9675@opindex mdata
9676@opindex mrodata
9677Put functions, data, and readonly data in @var{text-section},
9678@var{data-section}, and @var{readonly-data-section} respectively
9679by default.  This can be overridden with the @code{section} attribute.
9680@xref{Variable Attributes}.
9681
9682@item -mfix-cortex-m3-ldrd
9683@opindex mfix-cortex-m3-ldrd
9684Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
9685with overlapping destination and base registers are used.  This option avoids
9686generating these instructions.  This option is enabled by default when
9687@option{-mcpu=cortex-m3} is specified.
9688
9689@end table
9690
9691@node ARM Options
9692@subsection ARM Options
9693@cindex ARM options
9694
9695These @samp{-m} options are defined for Advanced RISC Machines (ARM)
9696architectures:
9697
9698@table @gcctabopt
9699@item -mabi=@var{name}
9700@opindex mabi
9701Generate code for the specified ABI@.  Permissible values are: @samp{apcs-gnu},
9702@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
9703
9704@item -mapcs-frame
9705@opindex mapcs-frame
9706Generate a stack frame that is compliant with the ARM Procedure Call
9707Standard for all functions, even if this is not strictly necessary for
9708correct execution of the code.  Specifying @option{-fomit-frame-pointer}
9709with this option will cause the stack frames not to be generated for
9710leaf functions.  The default is @option{-mno-apcs-frame}.
9711
9712@item -mapcs
9713@opindex mapcs
9714This is a synonym for @option{-mapcs-frame}.
9715
9716@ignore
9717@c not currently implemented
9718@item -mapcs-stack-check
9719@opindex mapcs-stack-check
9720Generate code to check the amount of stack space available upon entry to
9721every function (that actually uses some stack space).  If there is
9722insufficient space available then either the function
9723@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
9724called, depending upon the amount of stack space required.  The run time
9725system is required to provide these functions.  The default is
9726@option{-mno-apcs-stack-check}, since this produces smaller code.
9727
9728@c not currently implemented
9729@item -mapcs-float
9730@opindex mapcs-float
9731Pass floating point arguments using the float point registers.  This is
9732one of the variants of the APCS@.  This option is recommended if the
9733target hardware has a floating point unit or if a lot of floating point
9734arithmetic is going to be performed by the code.  The default is
9735@option{-mno-apcs-float}, since integer only code is slightly increased in
9736size if @option{-mapcs-float} is used.
9737
9738@c not currently implemented
9739@item -mapcs-reentrant
9740@opindex mapcs-reentrant
9741Generate reentrant, position independent code.  The default is
9742@option{-mno-apcs-reentrant}.
9743@end ignore
9744
9745@item -mthumb-interwork
9746@opindex mthumb-interwork
9747Generate code which supports calling between the ARM and Thumb
9748instruction sets.  Without this option the two instruction sets cannot
9749be reliably used inside one program.  The default is
9750@option{-mno-thumb-interwork}, since slightly larger code is generated
9751when @option{-mthumb-interwork} is specified.
9752
9753@item -mno-sched-prolog
9754@opindex mno-sched-prolog
9755Prevent the reordering of instructions in the function prolog, or the
9756merging of those instruction with the instructions in the function's
9757body.  This means that all functions will start with a recognizable set
9758of instructions (or in fact one of a choice from a small set of
9759different function prologues), and this information can be used to
9760locate the start if functions inside an executable piece of code.  The
9761default is @option{-msched-prolog}.
9762
9763@item -mfloat-abi=@var{name}
9764@opindex mfloat-abi
9765Specifies which floating-point ABI to use.  Permissible values
9766are: @samp{soft}, @samp{softfp} and @samp{hard}.
9767
9768Specifying @samp{soft} causes GCC to generate output containing
9769library calls for floating-point operations.
9770@samp{softfp} allows the generation of code using hardware floating-point
9771instructions, but still uses the soft-float calling conventions.
9772@samp{hard} allows generation of floating-point instructions
9773and uses FPU-specific calling conventions.
9774
9775The default depends on the specific target configuration.  Note that
9776the hard-float and soft-float ABIs are not link-compatible; you must
9777compile your entire program with the same ABI, and link with a
9778compatible set of libraries.
9779
9780@item -mhard-float
9781@opindex mhard-float
9782Equivalent to @option{-mfloat-abi=hard}.
9783
9784@item -msoft-float
9785@opindex msoft-float
9786Equivalent to @option{-mfloat-abi=soft}.
9787
9788@item -mlittle-endian
9789@opindex mlittle-endian
9790Generate code for a processor running in little-endian mode.  This is
9791the default for all standard configurations.
9792
9793@item -mbig-endian
9794@opindex mbig-endian
9795Generate code for a processor running in big-endian mode; the default is
9796to compile code for a little-endian processor.
9797
9798@item -mwords-little-endian
9799@opindex mwords-little-endian
9800This option only applies when generating code for big-endian processors.
9801Generate code for a little-endian word order but a big-endian byte
9802order.  That is, a byte order of the form @samp{32107654}.  Note: this
9803option should only be used if you require compatibility with code for
9804big-endian ARM processors generated by versions of the compiler prior to
98052.8.
9806
9807@item -mcpu=@var{name}
9808@opindex mcpu
9809This specifies the name of the target ARM processor.  GCC uses this name
9810to determine what kind of instructions it can emit when generating
9811assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
9812@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
9813@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
9814@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
9815@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
9816@samp{arm720},
9817@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
9818@samp{arm710t}, @samp{arm720t}, @samp{arm740t},
9819@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
9820@samp{strongarm1110},
9821@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
9822@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
9823@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
9824@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
9825@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
9826@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
9827@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
9828@samp{cortex-a5}, @samp{cortex-a8}, @samp{cortex-a9},
9829@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m3},
9830@samp{cortex-m1},
9831@samp{cortex-m0},
9832@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
9833
9834@item -mtune=@var{name}
9835@opindex mtune
9836This option is very similar to the @option{-mcpu=} option, except that
9837instead of specifying the actual target processor type, and hence
9838restricting which instructions can be used, it specifies that GCC should
9839tune the performance of the code as if the target were of the type
9840specified in this option, but still choosing the instructions that it
9841will generate based on the CPU specified by a @option{-mcpu=} option.
9842For some ARM implementations better performance can be obtained by using
9843this option.
9844
9845@item -march=@var{name}
9846@opindex march
9847This specifies the name of the target ARM architecture.  GCC uses this
9848name to determine what kind of instructions it can emit when generating
9849assembly code.  This option can be used in conjunction with or instead
9850of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
9851@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
9852@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
9853@samp{armv6}, @samp{armv6j},
9854@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
9855@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
9856@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
9857
9858@item -mfpu=@var{name}
9859@itemx -mfpe=@var{number}
9860@itemx -mfp=@var{number}
9861@opindex mfpu
9862@opindex mfpe
9863@opindex mfp
9864This specifies what floating point hardware (or hardware emulation) is
9865available on the target.  Permissible names are: @samp{fpa}, @samp{fpe2},
9866@samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-fp16},
9867@samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, @samp{vfpv3xd-fp16},
9868@samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, @samp{vfpv4-d16},
9869@samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
9870@option{-mfp} and @option{-mfpe} are synonyms for
9871@option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions
9872of GCC@.
9873
9874If @option{-msoft-float} is specified this specifies the format of
9875floating point values.
9876
9877@item -mfp16-format=@var{name}
9878@opindex mfp16-format
9879Specify the format of the @code{__fp16} half-precision floating-point type.
9880Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
9881the default is @samp{none}, in which case the @code{__fp16} type is not
9882defined.  @xref{Half-Precision}, for more information.
9883
9884@item -mstructure-size-boundary=@var{n}
9885@opindex mstructure-size-boundary
9886The size of all structures and unions will be rounded up to a multiple
9887of the number of bits set by this option.  Permissible values are 8, 32
9888and 64.  The default value varies for different toolchains.  For the COFF
9889targeted toolchain the default value is 8.  A value of 64 is only allowed
9890if the underlying ABI supports it.
9891
9892Specifying the larger number can produce faster, more efficient code, but
9893can also increase the size of the program.  Different values are potentially
9894incompatible.  Code compiled with one value cannot necessarily expect to
9895work with code or libraries compiled with another value, if they exchange
9896information using structures or unions.
9897
9898@item -mabort-on-noreturn
9899@opindex mabort-on-noreturn
9900Generate a call to the function @code{abort} at the end of a
9901@code{noreturn} function.  It will be executed if the function tries to
9902return.
9903
9904@item -mlong-calls
9905@itemx -mno-long-calls
9906@opindex mlong-calls
9907@opindex mno-long-calls
9908Tells the compiler to perform function calls by first loading the
9909address of the function into a register and then performing a subroutine
9910call on this register.  This switch is needed if the target function
9911will lie outside of the 64 megabyte addressing range of the offset based
9912version of subroutine call instruction.
9913
9914Even if this switch is enabled, not all function calls will be turned
9915into long calls.  The heuristic is that static functions, functions
9916which have the @samp{short-call} attribute, functions that are inside
9917the scope of a @samp{#pragma no_long_calls} directive and functions whose
9918definitions have already been compiled within the current compilation
9919unit, will not be turned into long calls.  The exception to this rule is
9920that weak function definitions, functions with the @samp{long-call}
9921attribute or the @samp{section} attribute, and functions that are within
9922the scope of a @samp{#pragma long_calls} directive, will always be
9923turned into long calls.
9924
9925This feature is not enabled by default.  Specifying
9926@option{-mno-long-calls} will restore the default behavior, as will
9927placing the function calls within the scope of a @samp{#pragma
9928long_calls_off} directive.  Note these switches have no effect on how
9929the compiler generates code to handle function calls via function
9930pointers.
9931
9932@item -msingle-pic-base
9933@opindex msingle-pic-base
9934Treat the register used for PIC addressing as read-only, rather than
9935loading it in the prologue for each function.  The run-time system is
9936responsible for initializing this register with an appropriate value
9937before execution begins.
9938
9939@item -mpic-register=@var{reg}
9940@opindex mpic-register
9941Specify the register to be used for PIC addressing.  The default is R10
9942unless stack-checking is enabled, when R9 is used.
9943
9944@item -mcirrus-fix-invalid-insns
9945@opindex mcirrus-fix-invalid-insns
9946@opindex mno-cirrus-fix-invalid-insns
9947Insert NOPs into the instruction stream to in order to work around
9948problems with invalid Maverick instruction combinations.  This option
9949is only valid if the @option{-mcpu=ep9312} option has been used to
9950enable generation of instructions for the Cirrus Maverick floating
9951point co-processor.  This option is not enabled by default, since the
9952problem is only present in older Maverick implementations.  The default
9953can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
9954switch.
9955
9956@item -mpoke-function-name
9957@opindex mpoke-function-name
9958Write the name of each function into the text section, directly
9959preceding the function prologue.  The generated code is similar to this:
9960
9961@smallexample
9962     t0
9963         .ascii "arm_poke_function_name", 0
9964         .align
9965     t1
9966         .word 0xff000000 + (t1 - t0)
9967     arm_poke_function_name
9968         mov     ip, sp
9969         stmfd   sp!, @{fp, ip, lr, pc@}
9970         sub     fp, ip, #4
9971@end smallexample
9972
9973When performing a stack backtrace, code can inspect the value of
9974@code{pc} stored at @code{fp + 0}.  If the trace function then looks at
9975location @code{pc - 12} and the top 8 bits are set, then we know that
9976there is a function name embedded immediately preceding this location
9977and has length @code{((pc[-3]) & 0xff000000)}.
9978
9979@item -mthumb
9980@opindex mthumb
9981Generate code for the Thumb instruction set.  The default is to
9982use the 32-bit ARM instruction set.
9983This option automatically enables either 16-bit Thumb-1 or
9984mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
9985and @option{-march=@var{name}} options.  This option is not passed to the
9986assembler. If you want to force assembler files to be interpreted as Thumb code,
9987either add a @samp{.thumb} directive to the source or pass the @option{-mthumb}
9988option directly to the assembler by prefixing it with @option{-Wa}.
9989
9990@item -mtpcs-frame
9991@opindex mtpcs-frame
9992Generate a stack frame that is compliant with the Thumb Procedure Call
9993Standard for all non-leaf functions.  (A leaf function is one that does
9994not call any other functions.)  The default is @option{-mno-tpcs-frame}.
9995
9996@item -mtpcs-leaf-frame
9997@opindex mtpcs-leaf-frame
9998Generate a stack frame that is compliant with the Thumb Procedure Call
9999Standard for all leaf functions.  (A leaf function is one that does
10000not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
10001
10002@item -mcallee-super-interworking
10003@opindex mcallee-super-interworking
10004Gives all externally visible functions in the file being compiled an ARM
10005instruction set header which switches to Thumb mode before executing the
10006rest of the function.  This allows these functions to be called from
10007non-interworking code.  This option is not valid in AAPCS configurations
10008because interworking is enabled by default.
10009
10010@item -mcaller-super-interworking
10011@opindex mcaller-super-interworking
10012Allows calls via function pointers (including virtual functions) to
10013execute correctly regardless of whether the target code has been
10014compiled for interworking or not.  There is a small overhead in the cost
10015of executing a function pointer if this option is enabled.  This option
10016is not valid in AAPCS configurations because interworking is enabled
10017by default.
10018
10019@item -mtp=@var{name}
10020@opindex mtp
10021Specify the access model for the thread local storage pointer.  The valid
10022models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
10023@option{cp15}, which fetches the thread pointer from @code{cp15} directly
10024(supported in the arm6k architecture), and @option{auto}, which uses the
10025best available method for the selected processor.  The default setting is
10026@option{auto}.
10027
10028@item -mword-relocations
10029@opindex mword-relocations
10030Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
10031This is enabled by default on targets (uClinux, SymbianOS) where the runtime
10032loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
10033is specified.
10034
10035@end table
10036
10037@node AVR Options
10038@subsection AVR Options
10039@cindex AVR Options
10040
10041These options are defined for AVR implementations:
10042
10043@table @gcctabopt
10044@item -mmcu=@var{mcu}
10045@opindex mmcu
10046Specify ATMEL AVR instruction set or MCU type.
10047
10048Instruction set avr1 is for the minimal AVR core, not supported by the C
10049compiler, only for assembler programs (MCU types: at90s1200, attiny10,
10050attiny11, attiny12, attiny15, attiny28).
10051
10052Instruction set avr2 (default) is for the classic AVR core with up to
100538K program memory space (MCU types: at90s2313, at90s2323, attiny22,
10054at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
10055at90c8534, at90s8535).
10056
10057Instruction set avr3 is for the classic AVR core with up to 128K program
10058memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
10059
10060Instruction set avr4 is for the enhanced AVR core with up to 8K program
10061memory space (MCU types: atmega8, atmega83, atmega85).
10062
10063Instruction set avr5 is for the enhanced AVR core with up to 128K program
10064memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
10065atmega64, atmega128, at43usb355, at94k).
10066
10067@item -mno-interrupts
10068@opindex mno-interrupts
10069Generated code is not compatible with hardware interrupts.
10070Code size will be smaller.
10071
10072@item -mcall-prologues
10073@opindex mcall-prologues
10074Functions prologues/epilogues expanded as call to appropriate
10075subroutines.  Code size will be smaller.
10076
10077@item -mtiny-stack
10078@opindex mtiny-stack
10079Change only the low 8 bits of the stack pointer.
10080
10081@item -mint8
10082@opindex mint8
10083Assume int to be 8 bit integer.  This affects the sizes of all types: A
10084char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
10085and long long will be 4 bytes.  Please note that this option does not
10086comply to the C standards, but it will provide you with smaller code
10087size.
10088@end table
10089
10090@node Blackfin Options
10091@subsection Blackfin Options
10092@cindex Blackfin Options
10093
10094@table @gcctabopt
10095@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
10096@opindex mcpu=
10097Specifies the name of the target Blackfin processor.  Currently, @var{cpu}
10098can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
10099@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
10100@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
10101@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
10102@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
10103@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
10104@samp{bf561}.
10105The optional @var{sirevision} specifies the silicon revision of the target
10106Blackfin processor.  Any workarounds available for the targeted silicon revision
10107will be enabled.  If @var{sirevision} is @samp{none}, no workarounds are enabled.
10108If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
10109will be enabled.  The @code{__SILICON_REVISION__} macro is defined to two
10110hexadecimal digits representing the major and minor numbers in the silicon
10111revision.  If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
10112is not defined.  If @var{sirevision} is @samp{any}, the
10113@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
10114If this optional @var{sirevision} is not used, GCC assumes the latest known
10115silicon revision of the targeted Blackfin processor.
10116
10117Support for @samp{bf561} is incomplete.  For @samp{bf561},
10118Only the processor macro is defined.
10119Without this option, @samp{bf532} is used as the processor by default.
10120The corresponding predefined processor macros for @var{cpu} is to
10121be defined.  And for @samp{bfin-elf} toolchain, this causes the hardware BSP
10122provided by libgloss to be linked in if @option{-msim} is not given.
10123
10124@item -msim
10125@opindex msim
10126Specifies that the program will be run on the simulator.  This causes
10127the simulator BSP provided by libgloss to be linked in.  This option
10128has effect only for @samp{bfin-elf} toolchain.
10129Certain other options, such as @option{-mid-shared-library} and
10130@option{-mfdpic}, imply @option{-msim}.
10131
10132@item -momit-leaf-frame-pointer
10133@opindex momit-leaf-frame-pointer
10134Don't keep the frame pointer in a register for leaf functions.  This
10135avoids the instructions to save, set up and restore frame pointers and
10136makes an extra register available in leaf functions.  The option
10137@option{-fomit-frame-pointer} removes the frame pointer for all functions
10138which might make debugging harder.
10139
10140@item -mspecld-anomaly
10141@opindex mspecld-anomaly
10142When enabled, the compiler will ensure that the generated code does not
10143contain speculative loads after jump instructions. If this option is used,
10144@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
10145
10146@item -mno-specld-anomaly
10147@opindex mno-specld-anomaly
10148Don't generate extra code to prevent speculative loads from occurring.
10149
10150@item -mcsync-anomaly
10151@opindex mcsync-anomaly
10152When enabled, the compiler will ensure that the generated code does not
10153contain CSYNC or SSYNC instructions too soon after conditional branches.
10154If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
10155
10156@item -mno-csync-anomaly
10157@opindex mno-csync-anomaly
10158Don't generate extra code to prevent CSYNC or SSYNC instructions from
10159occurring too soon after a conditional branch.
10160
10161@item -mlow-64k
10162@opindex mlow-64k
10163When enabled, the compiler is free to take advantage of the knowledge that
10164the entire program fits into the low 64k of memory.
10165
10166@item -mno-low-64k
10167@opindex mno-low-64k
10168Assume that the program is arbitrarily large.  This is the default.
10169
10170@item -mstack-check-l1
10171@opindex mstack-check-l1
10172Do stack checking using information placed into L1 scratchpad memory by the
10173uClinux kernel.
10174
10175@item -mid-shared-library
10176@opindex mid-shared-library
10177Generate code that supports shared libraries via the library ID method.
10178This allows for execute in place and shared libraries in an environment
10179without virtual memory management.  This option implies @option{-fPIC}.
10180With a @samp{bfin-elf} target, this option implies @option{-msim}.
10181
10182@item -mno-id-shared-library
10183@opindex mno-id-shared-library
10184Generate code that doesn't assume ID based shared libraries are being used.
10185This is the default.
10186
10187@item -mleaf-id-shared-library
10188@opindex mleaf-id-shared-library
10189Generate code that supports shared libraries via the library ID method,
10190but assumes that this library or executable won't link against any other
10191ID shared libraries.  That allows the compiler to use faster code for jumps
10192and calls.
10193
10194@item -mno-leaf-id-shared-library
10195@opindex mno-leaf-id-shared-library
10196Do not assume that the code being compiled won't link against any ID shared
10197libraries.  Slower code will be generated for jump and call insns.
10198
10199@item -mshared-library-id=n
10200@opindex mshared-library-id
10201Specified the identification number of the ID based shared library being
10202compiled.  Specifying a value of 0 will generate more compact code, specifying
10203other values will force the allocation of that number to the current
10204library but is no more space or time efficient than omitting this option.
10205
10206@item -msep-data
10207@opindex msep-data
10208Generate code that allows the data segment to be located in a different
10209area of memory from the text segment.  This allows for execute in place in
10210an environment without virtual memory management by eliminating relocations
10211against the text section.
10212
10213@item -mno-sep-data
10214@opindex mno-sep-data
10215Generate code that assumes that the data segment follows the text segment.
10216This is the default.
10217
10218@item -mlong-calls
10219@itemx -mno-long-calls
10220@opindex mlong-calls
10221@opindex mno-long-calls
10222Tells the compiler to perform function calls by first loading the
10223address of the function into a register and then performing a subroutine
10224call on this register.  This switch is needed if the target function
10225will lie outside of the 24 bit addressing range of the offset based
10226version of subroutine call instruction.
10227
10228This feature is not enabled by default.  Specifying
10229@option{-mno-long-calls} will restore the default behavior.  Note these
10230switches have no effect on how the compiler generates code to handle
10231function calls via function pointers.
10232
10233@item -mfast-fp
10234@opindex mfast-fp
10235Link with the fast floating-point library. This library relaxes some of
10236the IEEE floating-point standard's rules for checking inputs against
10237Not-a-Number (NAN), in the interest of performance.
10238
10239@item -minline-plt
10240@opindex minline-plt
10241Enable inlining of PLT entries in function calls to functions that are
10242not known to bind locally.  It has no effect without @option{-mfdpic}.
10243
10244@item -mmulticore
10245@opindex mmulticore
10246Build standalone application for multicore Blackfin processor. Proper
10247start files and link scripts will be used to support multicore.
10248This option defines @code{__BFIN_MULTICORE}. It can only be used with
10249@option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
10250@option{-mcorea} or @option{-mcoreb}. If it's used without
10251@option{-mcorea} or @option{-mcoreb}, single application/dual core
10252programming model is used. In this model, the main function of Core B
10253should be named as coreb_main. If it's used with @option{-mcorea} or
10254@option{-mcoreb}, one application per core programming model is used.
10255If this option is not used, single core application programming
10256model is used.
10257
10258@item -mcorea
10259@opindex mcorea
10260Build standalone application for Core A of BF561 when using
10261one application per core programming model. Proper start files
10262and link scripts will be used to support Core A. This option
10263defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
10264
10265@item -mcoreb
10266@opindex mcoreb
10267Build standalone application for Core B of BF561 when using
10268one application per core programming model. Proper start files
10269and link scripts will be used to support Core B. This option
10270defines @code{__BFIN_COREB}. When this option is used, coreb_main
10271should be used instead of main. It must be used with
10272@option{-mmulticore}.
10273
10274@item -msdram
10275@opindex msdram
10276Build standalone application for SDRAM. Proper start files and
10277link scripts will be used to put the application into SDRAM.
10278Loader should initialize SDRAM before loading the application
10279into SDRAM. This option defines @code{__BFIN_SDRAM}.
10280
10281@item -micplb
10282@opindex micplb
10283Assume that ICPLBs are enabled at runtime.  This has an effect on certain
10284anomaly workarounds.  For Linux targets, the default is to assume ICPLBs
10285are enabled; for standalone applications the default is off.
10286@end table
10287
10288@node CRIS Options
10289@subsection CRIS Options
10290@cindex CRIS Options
10291
10292These options are defined specifically for the CRIS ports.
10293
10294@table @gcctabopt
10295@item -march=@var{architecture-type}
10296@itemx -mcpu=@var{architecture-type}
10297@opindex march
10298@opindex mcpu
10299Generate code for the specified architecture.  The choices for
10300@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
10301respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
10302Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10303@samp{v10}.
10304
10305@item -mtune=@var{architecture-type}
10306@opindex mtune
10307Tune to @var{architecture-type} everything applicable about the generated
10308code, except for the ABI and the set of available instructions.  The
10309choices for @var{architecture-type} are the same as for
10310@option{-march=@var{architecture-type}}.
10311
10312@item -mmax-stack-frame=@var{n}
10313@opindex mmax-stack-frame
10314Warn when the stack frame of a function exceeds @var{n} bytes.
10315
10316@item -metrax4
10317@itemx -metrax100
10318@opindex metrax4
10319@opindex metrax100
10320The options @option{-metrax4} and @option{-metrax100} are synonyms for
10321@option{-march=v3} and @option{-march=v8} respectively.
10322
10323@item -mmul-bug-workaround
10324@itemx -mno-mul-bug-workaround
10325@opindex mmul-bug-workaround
10326@opindex mno-mul-bug-workaround
10327Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
10328models where it applies.  This option is active by default.
10329
10330@item -mpdebug
10331@opindex mpdebug
10332Enable CRIS-specific verbose debug-related information in the assembly
10333code.  This option also has the effect to turn off the @samp{#NO_APP}
10334formatted-code indicator to the assembler at the beginning of the
10335assembly file.
10336
10337@item -mcc-init
10338@opindex mcc-init
10339Do not use condition-code results from previous instruction; always emit
10340compare and test instructions before use of condition codes.
10341
10342@item -mno-side-effects
10343@opindex mno-side-effects
10344Do not emit instructions with side-effects in addressing modes other than
10345post-increment.
10346
10347@item -mstack-align
10348@itemx -mno-stack-align
10349@itemx -mdata-align
10350@itemx -mno-data-align
10351@itemx -mconst-align
10352@itemx -mno-const-align
10353@opindex mstack-align
10354@opindex mno-stack-align
10355@opindex mdata-align
10356@opindex mno-data-align
10357@opindex mconst-align
10358@opindex mno-const-align
10359These options (no-options) arranges (eliminate arrangements) for the
10360stack-frame, individual data and constants to be aligned for the maximum
10361single data access size for the chosen CPU model.  The default is to
10362arrange for 32-bit alignment.  ABI details such as structure layout are
10363not affected by these options.
10364
10365@item -m32-bit
10366@itemx -m16-bit
10367@itemx -m8-bit
10368@opindex m32-bit
10369@opindex m16-bit
10370@opindex m8-bit
10371Similar to the stack- data- and const-align options above, these options
10372arrange for stack-frame, writable data and constants to all be 32-bit,
1037316-bit or 8-bit aligned.  The default is 32-bit alignment.
10374
10375@item -mno-prologue-epilogue
10376@itemx -mprologue-epilogue
10377@opindex mno-prologue-epilogue
10378@opindex mprologue-epilogue
10379With @option{-mno-prologue-epilogue}, the normal function prologue and
10380epilogue that sets up the stack-frame are omitted and no return
10381instructions or return sequences are generated in the code.  Use this
10382option only together with visual inspection of the compiled code: no
10383warnings or errors are generated when call-saved registers must be saved,
10384or storage for local variable needs to be allocated.
10385
10386@item -mno-gotplt
10387@itemx -mgotplt
10388@opindex mno-gotplt
10389@opindex mgotplt
10390With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10391instruction sequences that load addresses for functions from the PLT part
10392of the GOT rather than (traditional on other architectures) calls to the
10393PLT@.  The default is @option{-mgotplt}.
10394
10395@item -melf
10396@opindex melf
10397Legacy no-op option only recognized with the cris-axis-elf and
10398cris-axis-linux-gnu targets.
10399
10400@item -mlinux
10401@opindex mlinux
10402Legacy no-op option only recognized with the cris-axis-linux-gnu target.
10403
10404@item -sim
10405@opindex sim
10406This option, recognized for the cris-axis-elf arranges
10407to link with input-output functions from a simulator library.  Code,
10408initialized data and zero-initialized data are allocated consecutively.
10409
10410@item -sim2
10411@opindex sim2
10412Like @option{-sim}, but pass linker options to locate initialized data at
104130x40000000 and zero-initialized data at 0x80000000.
10414@end table
10415
10416@node CRX Options
10417@subsection CRX Options
10418@cindex CRX Options
10419
10420These options are defined specifically for the CRX ports.
10421
10422@table @gcctabopt
10423
10424@item -mmac
10425@opindex mmac
10426Enable the use of multiply-accumulate instructions. Disabled by default.
10427
10428@item -mpush-args
10429@opindex mpush-args
10430Push instructions will be used to pass outgoing arguments when functions
10431are called. Enabled by default.
10432@end table
10433
10434@node Darwin Options
10435@subsection Darwin Options
10436@cindex Darwin options
10437
10438These options are defined for all architectures running the Darwin operating
10439system.
10440
10441FSF GCC on Darwin does not create ``fat'' object files; it will create
10442an object file for the single architecture that it was built to
10443target.  Apple's GCC on Darwin does create ``fat'' files if multiple
10444@option{-arch} options are used; it does so by running the compiler or
10445linker multiple times and joining the results together with
10446@file{lipo}.
10447
10448The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
10449@samp{i686}) is determined by the flags that specify the ISA
10450that GCC is targetting, like @option{-mcpu} or @option{-march}.  The
10451@option{-force_cpusubtype_ALL} option can be used to override this.
10452
10453The Darwin tools vary in their behavior when presented with an ISA
10454mismatch.  The assembler, @file{as}, will only permit instructions to
10455be used that are valid for the subtype of the file it is generating,
10456so you cannot put 64-bit instructions in a @samp{ppc750} object file.
10457The linker for shared libraries, @file{/usr/bin/libtool}, will fail
10458and print an error if asked to create a shared library with a less
10459restrictive subtype than its input files (for instance, trying to put
10460a @samp{ppc970} object file in a @samp{ppc7400} library).  The linker
10461for executables, @file{ld}, will quietly give the executable the most
10462restrictive subtype of any of its input files.
10463
10464@table @gcctabopt
10465@item -F@var{dir}
10466@opindex F
10467Add the framework directory @var{dir} to the head of the list of
10468directories to be searched for header files.  These directories are
10469interleaved with those specified by @option{-I} options and are
10470scanned in a left-to-right order.
10471
10472A framework directory is a directory with frameworks in it.  A
10473framework is a directory with a @samp{"Headers"} and/or
10474@samp{"PrivateHeaders"} directory contained directly in it that ends
10475in @samp{".framework"}.  The name of a framework is the name of this
10476directory excluding the @samp{".framework"}.  Headers associated with
10477the framework are found in one of those two directories, with
10478@samp{"Headers"} being searched first.  A subframework is a framework
10479directory that is in a framework's @samp{"Frameworks"} directory.
10480Includes of subframework headers can only appear in a header of a
10481framework that contains the subframework, or in a sibling subframework
10482header.  Two subframeworks are siblings if they occur in the same
10483framework.  A subframework should not have the same name as a
10484framework, a warning will be issued if this is violated.  Currently a
10485subframework cannot have subframeworks, in the future, the mechanism
10486may be extended to support this.  The standard frameworks can be found
10487in @samp{"/System/Library/Frameworks"} and
10488@samp{"/Library/Frameworks"}.  An example include looks like
10489@code{#include <Framework/header.h>}, where @samp{Framework} denotes
10490the name of the framework and header.h is found in the
10491@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
10492
10493@item -iframework@var{dir}
10494@opindex iframework
10495Like @option{-F} except the directory is a treated as a system
10496directory.  The main difference between this @option{-iframework} and
10497@option{-F} is that with @option{-iframework} the compiler does not
10498warn about constructs contained within header files found via
10499@var{dir}.  This option is valid only for the C family of languages.
10500
10501@item -gused
10502@opindex gused
10503Emit debugging information for symbols that are used.  For STABS
10504debugging format, this enables @option{-feliminate-unused-debug-symbols}.
10505This is by default ON@.
10506
10507@item -gfull
10508@opindex gfull
10509Emit debugging information for all symbols and types.
10510
10511@item -mmacosx-version-min=@var{version}
10512The earliest version of MacOS X that this executable will run on
10513is @var{version}.  Typical values of @var{version} include @code{10.1},
10514@code{10.2}, and @code{10.3.9}.
10515
10516If the compiler was built to use the system's headers by default,
10517then the default for this option is the system version on which the
10518compiler is running, otherwise the default is to make choices which
10519are compatible with as many systems and code bases as possible.
10520
10521@item -mkernel
10522@opindex mkernel
10523Enable kernel development mode.  The @option{-mkernel} option sets
10524@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
10525@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
10526@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
10527applicable.  This mode also sets @option{-mno-altivec},
10528@option{-msoft-float}, @option{-fno-builtin} and
10529@option{-mlong-branch} for PowerPC targets.
10530
10531@item -mone-byte-bool
10532@opindex mone-byte-bool
10533Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
10534By default @samp{sizeof(bool)} is @samp{4} when compiling for
10535Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
10536option has no effect on x86.
10537
10538@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
10539to generate code that is not binary compatible with code generated
10540without that switch.  Using this switch may require recompiling all
10541other modules in a program, including system libraries.  Use this
10542switch to conform to a non-default data model.
10543
10544@item -mfix-and-continue
10545@itemx -ffix-and-continue
10546@itemx -findirect-data
10547@opindex mfix-and-continue
10548@opindex ffix-and-continue
10549@opindex findirect-data
10550Generate code suitable for fast turn around development.  Needed to
10551enable gdb to dynamically load @code{.o} files into already running
10552programs.  @option{-findirect-data} and @option{-ffix-and-continue}
10553are provided for backwards compatibility.
10554
10555@item -all_load
10556@opindex all_load
10557Loads all members of static archive libraries.
10558See man ld(1) for more information.
10559
10560@item -arch_errors_fatal
10561@opindex arch_errors_fatal
10562Cause the errors having to do with files that have the wrong architecture
10563to be fatal.
10564
10565@item -bind_at_load
10566@opindex bind_at_load
10567Causes the output file to be marked such that the dynamic linker will
10568bind all undefined references when the file is loaded or launched.
10569
10570@item -bundle
10571@opindex bundle
10572Produce a Mach-o bundle format file.
10573See man ld(1) for more information.
10574
10575@item -bundle_loader @var{executable}
10576@opindex bundle_loader
10577This option specifies the @var{executable} that will be loading the build
10578output file being linked.  See man ld(1) for more information.
10579
10580@item -dynamiclib
10581@opindex dynamiclib
10582When passed this option, GCC will produce a dynamic library instead of
10583an executable when linking, using the Darwin @file{libtool} command.
10584
10585@item -force_cpusubtype_ALL
10586@opindex force_cpusubtype_ALL
10587This causes GCC's output file to have the @var{ALL} subtype, instead of
10588one controlled by the @option{-mcpu} or @option{-march} option.
10589
10590@item -allowable_client  @var{client_name}
10591@itemx -client_name
10592@itemx -compatibility_version
10593@itemx -current_version
10594@itemx -dead_strip
10595@itemx -dependency-file
10596@itemx -dylib_file
10597@itemx -dylinker_install_name
10598@itemx -dynamic
10599@itemx -exported_symbols_list
10600@itemx -filelist
10601@itemx -flat_namespace
10602@itemx -force_flat_namespace
10603@itemx -headerpad_max_install_names
10604@itemx -image_base
10605@itemx -init
10606@itemx -install_name
10607@itemx -keep_private_externs
10608@itemx -multi_module
10609@itemx -multiply_defined
10610@itemx -multiply_defined_unused
10611@itemx -noall_load
10612@itemx -no_dead_strip_inits_and_terms
10613@itemx -nofixprebinding
10614@itemx -nomultidefs
10615@itemx -noprebind
10616@itemx -noseglinkedit
10617@itemx -pagezero_size
10618@itemx -prebind
10619@itemx -prebind_all_twolevel_modules
10620@itemx -private_bundle
10621@itemx -read_only_relocs
10622@itemx -sectalign
10623@itemx -sectobjectsymbols
10624@itemx -whyload
10625@itemx -seg1addr
10626@itemx -sectcreate
10627@itemx -sectobjectsymbols
10628@itemx -sectorder
10629@itemx -segaddr
10630@itemx -segs_read_only_addr
10631@itemx -segs_read_write_addr
10632@itemx -seg_addr_table
10633@itemx -seg_addr_table_filename
10634@itemx -seglinkedit
10635@itemx -segprot
10636@itemx -segs_read_only_addr
10637@itemx -segs_read_write_addr
10638@itemx -single_module
10639@itemx -static
10640@itemx -sub_library
10641@itemx -sub_umbrella
10642@itemx -twolevel_namespace
10643@itemx -umbrella
10644@itemx -undefined
10645@itemx -unexported_symbols_list
10646@itemx -weak_reference_mismatches
10647@itemx -whatsloaded
10648@opindex allowable_client
10649@opindex client_name
10650@opindex compatibility_version
10651@opindex current_version
10652@opindex dead_strip
10653@opindex dependency-file
10654@opindex dylib_file
10655@opindex dylinker_install_name
10656@opindex dynamic
10657@opindex exported_symbols_list
10658@opindex filelist
10659@opindex flat_namespace
10660@opindex force_flat_namespace
10661@opindex headerpad_max_install_names
10662@opindex image_base
10663@opindex init
10664@opindex install_name
10665@opindex keep_private_externs
10666@opindex multi_module
10667@opindex multiply_defined
10668@opindex multiply_defined_unused
10669@opindex noall_load
10670@opindex no_dead_strip_inits_and_terms
10671@opindex nofixprebinding
10672@opindex nomultidefs
10673@opindex noprebind
10674@opindex noseglinkedit
10675@opindex pagezero_size
10676@opindex prebind
10677@opindex prebind_all_twolevel_modules
10678@opindex private_bundle
10679@opindex read_only_relocs
10680@opindex sectalign
10681@opindex sectobjectsymbols
10682@opindex whyload
10683@opindex seg1addr
10684@opindex sectcreate
10685@opindex sectobjectsymbols
10686@opindex sectorder
10687@opindex segaddr
10688@opindex segs_read_only_addr
10689@opindex segs_read_write_addr
10690@opindex seg_addr_table
10691@opindex seg_addr_table_filename
10692@opindex seglinkedit
10693@opindex segprot
10694@opindex segs_read_only_addr
10695@opindex segs_read_write_addr
10696@opindex single_module
10697@opindex static
10698@opindex sub_library
10699@opindex sub_umbrella
10700@opindex twolevel_namespace
10701@opindex umbrella
10702@opindex undefined
10703@opindex unexported_symbols_list
10704@opindex weak_reference_mismatches
10705@opindex whatsloaded
10706These options are passed to the Darwin linker.  The Darwin linker man page
10707describes them in detail.
10708@end table
10709
10710@node DEC Alpha Options
10711@subsection DEC Alpha Options
10712
10713These @samp{-m} options are defined for the DEC Alpha implementations:
10714
10715@table @gcctabopt
10716@item -mno-soft-float
10717@itemx -msoft-float
10718@opindex mno-soft-float
10719@opindex msoft-float
10720Use (do not use) the hardware floating-point instructions for
10721floating-point operations.  When @option{-msoft-float} is specified,
10722functions in @file{libgcc.a} will be used to perform floating-point
10723operations.  Unless they are replaced by routines that emulate the
10724floating-point operations, or compiled in such a way as to call such
10725emulations routines, these routines will issue floating-point
10726operations.   If you are compiling for an Alpha without floating-point
10727operations, you must ensure that the library is built so as not to call
10728them.
10729
10730Note that Alpha implementations without floating-point operations are
10731required to have floating-point registers.
10732
10733@item -mfp-reg
10734@itemx -mno-fp-regs
10735@opindex mfp-reg
10736@opindex mno-fp-regs
10737Generate code that uses (does not use) the floating-point register set.
10738@option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
10739register set is not used, floating point operands are passed in integer
10740registers as if they were integers and floating-point results are passed
10741in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
10742so any function with a floating-point argument or return value called by code
10743compiled with @option{-mno-fp-regs} must also be compiled with that
10744option.
10745
10746A typical use of this option is building a kernel that does not use,
10747and hence need not save and restore, any floating-point registers.
10748
10749@item -mieee
10750@opindex mieee
10751The Alpha architecture implements floating-point hardware optimized for
10752maximum performance.  It is mostly compliant with the IEEE floating
10753point standard.  However, for full compliance, software assistance is
10754required.  This option generates code fully IEEE compliant code
10755@emph{except} that the @var{inexact-flag} is not maintained (see below).
10756If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
10757defined during compilation.  The resulting code is less efficient but is
10758able to correctly support denormalized numbers and exceptional IEEE
10759values such as not-a-number and plus/minus infinity.  Other Alpha
10760compilers call this option @option{-ieee_with_no_inexact}.
10761
10762@item -mieee-with-inexact
10763@opindex mieee-with-inexact
10764This is like @option{-mieee} except the generated code also maintains
10765the IEEE @var{inexact-flag}.  Turning on this option causes the
10766generated code to implement fully-compliant IEEE math.  In addition to
10767@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
10768macro.  On some Alpha implementations the resulting code may execute
10769significantly slower than the code generated by default.  Since there is
10770very little code that depends on the @var{inexact-flag}, you should
10771normally not specify this option.  Other Alpha compilers call this
10772option @option{-ieee_with_inexact}.
10773
10774@item -mfp-trap-mode=@var{trap-mode}
10775@opindex mfp-trap-mode
10776This option controls what floating-point related traps are enabled.
10777Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
10778The trap mode can be set to one of four values:
10779
10780@table @samp
10781@item n
10782This is the default (normal) setting.  The only traps that are enabled
10783are the ones that cannot be disabled in software (e.g., division by zero
10784trap).
10785
10786@item u
10787In addition to the traps enabled by @samp{n}, underflow traps are enabled
10788as well.
10789
10790@item su
10791Like @samp{u}, but the instructions are marked to be safe for software
10792completion (see Alpha architecture manual for details).
10793
10794@item sui
10795Like @samp{su}, but inexact traps are enabled as well.
10796@end table
10797
10798@item -mfp-rounding-mode=@var{rounding-mode}
10799@opindex mfp-rounding-mode
10800Selects the IEEE rounding mode.  Other Alpha compilers call this option
10801@option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
10802of:
10803
10804@table @samp
10805@item n
10806Normal IEEE rounding mode.  Floating point numbers are rounded towards
10807the nearest machine number or towards the even machine number in case
10808of a tie.
10809
10810@item m
10811Round towards minus infinity.
10812
10813@item c
10814Chopped rounding mode.  Floating point numbers are rounded towards zero.
10815
10816@item d
10817Dynamic rounding mode.  A field in the floating point control register
10818(@var{fpcr}, see Alpha architecture reference manual) controls the
10819rounding mode in effect.  The C library initializes this register for
10820rounding towards plus infinity.  Thus, unless your program modifies the
10821@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
10822@end table
10823
10824@item -mtrap-precision=@var{trap-precision}
10825@opindex mtrap-precision
10826In the Alpha architecture, floating point traps are imprecise.  This
10827means without software assistance it is impossible to recover from a
10828floating trap and program execution normally needs to be terminated.
10829GCC can generate code that can assist operating system trap handlers
10830in determining the exact location that caused a floating point trap.
10831Depending on the requirements of an application, different levels of
10832precisions can be selected:
10833
10834@table @samp
10835@item p
10836Program precision.  This option is the default and means a trap handler
10837can only identify which program caused a floating point exception.
10838
10839@item f
10840Function precision.  The trap handler can determine the function that
10841caused a floating point exception.
10842
10843@item i
10844Instruction precision.  The trap handler can determine the exact
10845instruction that caused a floating point exception.
10846@end table
10847
10848Other Alpha compilers provide the equivalent options called
10849@option{-scope_safe} and @option{-resumption_safe}.
10850
10851@item -mieee-conformant
10852@opindex mieee-conformant
10853This option marks the generated code as IEEE conformant.  You must not
10854use this option unless you also specify @option{-mtrap-precision=i} and either
10855@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
10856is to emit the line @samp{.eflag 48} in the function prologue of the
10857generated assembly file.  Under DEC Unix, this has the effect that
10858IEEE-conformant math library routines will be linked in.
10859
10860@item -mbuild-constants
10861@opindex mbuild-constants
10862Normally GCC examines a 32- or 64-bit integer constant to
10863see if it can construct it from smaller constants in two or three
10864instructions.  If it cannot, it will output the constant as a literal and
10865generate code to load it from the data segment at runtime.
10866
10867Use this option to require GCC to construct @emph{all} integer constants
10868using code, even if it takes more instructions (the maximum is six).
10869
10870You would typically use this option to build a shared library dynamic
10871loader.  Itself a shared library, it must relocate itself in memory
10872before it can find the variables and constants in its own data segment.
10873
10874@item -malpha-as
10875@itemx -mgas
10876@opindex malpha-as
10877@opindex mgas
10878Select whether to generate code to be assembled by the vendor-supplied
10879assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
10880
10881@item -mbwx
10882@itemx -mno-bwx
10883@itemx -mcix
10884@itemx -mno-cix
10885@itemx -mfix
10886@itemx -mno-fix
10887@itemx -mmax
10888@itemx -mno-max
10889@opindex mbwx
10890@opindex mno-bwx
10891@opindex mcix
10892@opindex mno-cix
10893@opindex mfix
10894@opindex mno-fix
10895@opindex mmax
10896@opindex mno-max
10897Indicate whether GCC should generate code to use the optional BWX,
10898CIX, FIX and MAX instruction sets.  The default is to use the instruction
10899sets supported by the CPU type specified via @option{-mcpu=} option or that
10900of the CPU on which GCC was built if none was specified.
10901
10902@item -mfloat-vax
10903@itemx -mfloat-ieee
10904@opindex mfloat-vax
10905@opindex mfloat-ieee
10906Generate code that uses (does not use) VAX F and G floating point
10907arithmetic instead of IEEE single and double precision.
10908
10909@item -mexplicit-relocs
10910@itemx -mno-explicit-relocs
10911@opindex mexplicit-relocs
10912@opindex mno-explicit-relocs
10913Older Alpha assemblers provided no way to generate symbol relocations
10914except via assembler macros.  Use of these macros does not allow
10915optimal instruction scheduling.  GNU binutils as of version 2.12
10916supports a new syntax that allows the compiler to explicitly mark
10917which relocations should apply to which instructions.  This option
10918is mostly useful for debugging, as GCC detects the capabilities of
10919the assembler when it is built and sets the default accordingly.
10920
10921@item -msmall-data
10922@itemx -mlarge-data
10923@opindex msmall-data
10924@opindex mlarge-data
10925When @option{-mexplicit-relocs} is in effect, static data is
10926accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
10927is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
10928(the @code{.sdata} and @code{.sbss} sections) and are accessed via
1092916-bit relocations off of the @code{$gp} register.  This limits the
10930size of the small data area to 64KB, but allows the variables to be
10931directly accessed via a single instruction.
10932
10933The default is @option{-mlarge-data}.  With this option the data area
10934is limited to just below 2GB@.  Programs that require more than 2GB of
10935data must use @code{malloc} or @code{mmap} to allocate the data in the
10936heap instead of in the program's data segment.
10937
10938When generating code for shared libraries, @option{-fpic} implies
10939@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
10940
10941@item -msmall-text
10942@itemx -mlarge-text
10943@opindex msmall-text
10944@opindex mlarge-text
10945When @option{-msmall-text} is used, the compiler assumes that the
10946code of the entire program (or shared library) fits in 4MB, and is
10947thus reachable with a branch instruction.  When @option{-msmall-data}
10948is used, the compiler can assume that all local symbols share the
10949same @code{$gp} value, and thus reduce the number of instructions
10950required for a function call from 4 to 1.
10951
10952The default is @option{-mlarge-text}.
10953
10954@item -mcpu=@var{cpu_type}
10955@opindex mcpu
10956Set the instruction set and instruction scheduling parameters for
10957machine type @var{cpu_type}.  You can specify either the @samp{EV}
10958style name or the corresponding chip number.  GCC supports scheduling
10959parameters for the EV4, EV5 and EV6 family of processors and will
10960choose the default values for the instruction set from the processor
10961you specify.  If you do not specify a processor type, GCC will default
10962to the processor on which the compiler was built.
10963
10964Supported values for @var{cpu_type} are
10965
10966@table @samp
10967@item ev4
10968@itemx ev45
10969@itemx 21064
10970Schedules as an EV4 and has no instruction set extensions.
10971
10972@item ev5
10973@itemx 21164
10974Schedules as an EV5 and has no instruction set extensions.
10975
10976@item ev56
10977@itemx 21164a
10978Schedules as an EV5 and supports the BWX extension.
10979
10980@item pca56
10981@itemx 21164pc
10982@itemx 21164PC
10983Schedules as an EV5 and supports the BWX and MAX extensions.
10984
10985@item ev6
10986@itemx 21264
10987Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
10988
10989@item ev67
10990@itemx 21264a
10991Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
10992@end table
10993
10994Native Linux/GNU toolchains also support the value @samp{native},
10995which selects the best architecture option for the host processor.
10996@option{-mcpu=native} has no effect if GCC does not recognize
10997the processor.
10998
10999@item -mtune=@var{cpu_type}
11000@opindex mtune
11001Set only the instruction scheduling parameters for machine type
11002@var{cpu_type}.  The instruction set is not changed.
11003
11004Native Linux/GNU toolchains also support the value @samp{native},
11005which selects the best architecture option for the host processor.
11006@option{-mtune=native} has no effect if GCC does not recognize
11007the processor.
11008
11009@item -mmemory-latency=@var{time}
11010@opindex mmemory-latency
11011Sets the latency the scheduler should assume for typical memory
11012references as seen by the application.  This number is highly
11013dependent on the memory access patterns used by the application
11014and the size of the external cache on the machine.
11015
11016Valid options for @var{time} are
11017
11018@table @samp
11019@item @var{number}
11020A decimal number representing clock cycles.
11021
11022@item L1
11023@itemx L2
11024@itemx L3
11025@itemx main
11026The compiler contains estimates of the number of clock cycles for
11027``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
11028(also called Dcache, Scache, and Bcache), as well as to main memory.
11029Note that L3 is only valid for EV5.
11030
11031@end table
11032@end table
11033
11034@node DEC Alpha/VMS Options
11035@subsection DEC Alpha/VMS Options
11036
11037These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
11038
11039@table @gcctabopt
11040@item -mvms-return-codes
11041@opindex mvms-return-codes
11042Return VMS condition codes from main.  The default is to return POSIX
11043style condition (e.g.@: error) codes.
11044
11045@item -mdebug-main=@var{prefix}
11046@opindex mdebug-main=@var{prefix}
11047Flag the first routine whose name starts with @var{prefix} as the main
11048routine for the debugger.
11049
11050@item -mmalloc64
11051@opindex mmalloc64
11052Default to 64bit memory allocation routines.
11053@end table
11054
11055@node FR30 Options
11056@subsection FR30 Options
11057@cindex FR30 Options
11058
11059These options are defined specifically for the FR30 port.
11060
11061@table @gcctabopt
11062
11063@item -msmall-model
11064@opindex msmall-model
11065Use the small address space model.  This can produce smaller code, but
11066it does assume that all symbolic values and addresses will fit into a
1106720-bit range.
11068
11069@item -mno-lsim
11070@opindex mno-lsim
11071Assume that run-time support has been provided and so there is no need
11072to include the simulator library (@file{libsim.a}) on the linker
11073command line.
11074
11075@end table
11076
11077@node FRV Options
11078@subsection FRV Options
11079@cindex FRV Options
11080
11081@table @gcctabopt
11082@item -mgpr-32
11083@opindex mgpr-32
11084
11085Only use the first 32 general purpose registers.
11086
11087@item -mgpr-64
11088@opindex mgpr-64
11089
11090Use all 64 general purpose registers.
11091
11092@item -mfpr-32
11093@opindex mfpr-32
11094
11095Use only the first 32 floating point registers.
11096
11097@item -mfpr-64
11098@opindex mfpr-64
11099
11100Use all 64 floating point registers
11101
11102@item -mhard-float
11103@opindex mhard-float
11104
11105Use hardware instructions for floating point operations.
11106
11107@item -msoft-float
11108@opindex msoft-float
11109
11110Use library routines for floating point operations.
11111
11112@item -malloc-cc
11113@opindex malloc-cc
11114
11115Dynamically allocate condition code registers.
11116
11117@item -mfixed-cc
11118@opindex mfixed-cc
11119
11120Do not try to dynamically allocate condition code registers, only
11121use @code{icc0} and @code{fcc0}.
11122
11123@item -mdword
11124@opindex mdword
11125
11126Change ABI to use double word insns.
11127
11128@item -mno-dword
11129@opindex mno-dword
11130
11131Do not use double word instructions.
11132
11133@item -mdouble
11134@opindex mdouble
11135
11136Use floating point double instructions.
11137
11138@item -mno-double
11139@opindex mno-double
11140
11141Do not use floating point double instructions.
11142
11143@item -mmedia
11144@opindex mmedia
11145
11146Use media instructions.
11147
11148@item -mno-media
11149@opindex mno-media
11150
11151Do not use media instructions.
11152
11153@item -mmuladd
11154@opindex mmuladd
11155
11156Use multiply and add/subtract instructions.
11157
11158@item -mno-muladd
11159@opindex mno-muladd
11160
11161Do not use multiply and add/subtract instructions.
11162
11163@item -mfdpic
11164@opindex mfdpic
11165
11166Select the FDPIC ABI, that uses function descriptors to represent
11167pointers to functions.  Without any PIC/PIE-related options, it
11168implies @option{-fPIE}.  With @option{-fpic} or @option{-fpie}, it
11169assumes GOT entries and small data are within a 12-bit range from the
11170GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
11171are computed with 32 bits.
11172With a @samp{bfin-elf} target, this option implies @option{-msim}.
11173
11174@item -minline-plt
11175@opindex minline-plt
11176
11177Enable inlining of PLT entries in function calls to functions that are
11178not known to bind locally.  It has no effect without @option{-mfdpic}.
11179It's enabled by default if optimizing for speed and compiling for
11180shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
11181optimization option such as @option{-O3} or above is present in the
11182command line.
11183
11184@item -mTLS
11185@opindex mTLS
11186
11187Assume a large TLS segment when generating thread-local code.
11188
11189@item -mtls
11190@opindex mtls
11191
11192Do not assume a large TLS segment when generating thread-local code.
11193
11194@item -mgprel-ro
11195@opindex mgprel-ro
11196
11197Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
11198that is known to be in read-only sections.  It's enabled by default,
11199except for @option{-fpic} or @option{-fpie}: even though it may help
11200make the global offset table smaller, it trades 1 instruction for 4.
11201With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
11202one of which may be shared by multiple symbols, and it avoids the need
11203for a GOT entry for the referenced symbol, so it's more likely to be a
11204win.  If it is not, @option{-mno-gprel-ro} can be used to disable it.
11205
11206@item -multilib-library-pic
11207@opindex multilib-library-pic
11208
11209Link with the (library, not FD) pic libraries.  It's implied by
11210@option{-mlibrary-pic}, as well as by @option{-fPIC} and
11211@option{-fpic} without @option{-mfdpic}.  You should never have to use
11212it explicitly.
11213
11214@item -mlinked-fp
11215@opindex mlinked-fp
11216
11217Follow the EABI requirement of always creating a frame pointer whenever
11218a stack frame is allocated.  This option is enabled by default and can
11219be disabled with @option{-mno-linked-fp}.
11220
11221@item -mlong-calls
11222@opindex mlong-calls
11223
11224Use indirect addressing to call functions outside the current
11225compilation unit.  This allows the functions to be placed anywhere
11226within the 32-bit address space.
11227
11228@item -malign-labels
11229@opindex malign-labels
11230
11231Try to align labels to an 8-byte boundary by inserting nops into the
11232previous packet.  This option only has an effect when VLIW packing
11233is enabled.  It doesn't create new packets; it merely adds nops to
11234existing ones.
11235
11236@item -mlibrary-pic
11237@opindex mlibrary-pic
11238
11239Generate position-independent EABI code.
11240
11241@item -macc-4
11242@opindex macc-4
11243
11244Use only the first four media accumulator registers.
11245
11246@item -macc-8
11247@opindex macc-8
11248
11249Use all eight media accumulator registers.
11250
11251@item -mpack
11252@opindex mpack
11253
11254Pack VLIW instructions.
11255
11256@item -mno-pack
11257@opindex mno-pack
11258
11259Do not pack VLIW instructions.
11260
11261@item -mno-eflags
11262@opindex mno-eflags
11263
11264Do not mark ABI switches in e_flags.
11265
11266@item -mcond-move
11267@opindex mcond-move
11268
11269Enable the use of conditional-move instructions (default).
11270
11271This switch is mainly for debugging the compiler and will likely be removed
11272in a future version.
11273
11274@item -mno-cond-move
11275@opindex mno-cond-move
11276
11277Disable the use of conditional-move instructions.
11278
11279This switch is mainly for debugging the compiler and will likely be removed
11280in a future version.
11281
11282@item -mscc
11283@opindex mscc
11284
11285Enable the use of conditional set instructions (default).
11286
11287This switch is mainly for debugging the compiler and will likely be removed
11288in a future version.
11289
11290@item -mno-scc
11291@opindex mno-scc
11292
11293Disable the use of conditional set instructions.
11294
11295This switch is mainly for debugging the compiler and will likely be removed
11296in a future version.
11297
11298@item -mcond-exec
11299@opindex mcond-exec
11300
11301Enable the use of conditional execution (default).
11302
11303This switch is mainly for debugging the compiler and will likely be removed
11304in a future version.
11305
11306@item -mno-cond-exec
11307@opindex mno-cond-exec
11308
11309Disable the use of conditional execution.
11310
11311This switch is mainly for debugging the compiler and will likely be removed
11312in a future version.
11313
11314@item -mvliw-branch
11315@opindex mvliw-branch
11316
11317Run a pass to pack branches into VLIW instructions (default).
11318
11319This switch is mainly for debugging the compiler and will likely be removed
11320in a future version.
11321
11322@item -mno-vliw-branch
11323@opindex mno-vliw-branch
11324
11325Do not run a pass to pack branches into VLIW instructions.
11326
11327This switch is mainly for debugging the compiler and will likely be removed
11328in a future version.
11329
11330@item -mmulti-cond-exec
11331@opindex mmulti-cond-exec
11332
11333Enable optimization of @code{&&} and @code{||} in conditional execution
11334(default).
11335
11336This switch is mainly for debugging the compiler and will likely be removed
11337in a future version.
11338
11339@item -mno-multi-cond-exec
11340@opindex mno-multi-cond-exec
11341
11342Disable optimization of @code{&&} and @code{||} in conditional execution.
11343
11344This switch is mainly for debugging the compiler and will likely be removed
11345in a future version.
11346
11347@item -mnested-cond-exec
11348@opindex mnested-cond-exec
11349
11350Enable nested conditional execution optimizations (default).
11351
11352This switch is mainly for debugging the compiler and will likely be removed
11353in a future version.
11354
11355@item -mno-nested-cond-exec
11356@opindex mno-nested-cond-exec
11357
11358Disable nested conditional execution optimizations.
11359
11360This switch is mainly for debugging the compiler and will likely be removed
11361in a future version.
11362
11363@item -moptimize-membar
11364@opindex moptimize-membar
11365
11366This switch removes redundant @code{membar} instructions from the
11367compiler generated code.  It is enabled by default.
11368
11369@item -mno-optimize-membar
11370@opindex mno-optimize-membar
11371
11372This switch disables the automatic removal of redundant @code{membar}
11373instructions from the generated code.
11374
11375@item -mtomcat-stats
11376@opindex mtomcat-stats
11377
11378Cause gas to print out tomcat statistics.
11379
11380@item -mcpu=@var{cpu}
11381@opindex mcpu
11382
11383Select the processor type for which to generate code.  Possible values are
11384@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
11385@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
11386
11387@end table
11388
11389@node GNU/Linux Options
11390@subsection GNU/Linux Options
11391
11392These @samp{-m} options are defined for GNU/Linux targets:
11393
11394@table @gcctabopt
11395@item -mglibc
11396@opindex mglibc
11397Use the GNU C library instead of uClibc.  This is the default except
11398on @samp{*-*-linux-*uclibc*} targets.
11399
11400@item -muclibc
11401@opindex muclibc
11402Use uClibc instead of the GNU C library.  This is the default on
11403@samp{*-*-linux-*uclibc*} targets.
11404@end table
11405
11406@node H8/300 Options
11407@subsection H8/300 Options
11408
11409These @samp{-m} options are defined for the H8/300 implementations:
11410
11411@table @gcctabopt
11412@item -mrelax
11413@opindex mrelax
11414Shorten some address references at link time, when possible; uses the
11415linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
11416ld, Using ld}, for a fuller description.
11417
11418@item -mh
11419@opindex mh
11420Generate code for the H8/300H@.
11421
11422@item -ms
11423@opindex ms
11424Generate code for the H8S@.
11425
11426@item -mn
11427@opindex mn
11428Generate code for the H8S and H8/300H in the normal mode.  This switch
11429must be used either with @option{-mh} or @option{-ms}.
11430
11431@item -ms2600
11432@opindex ms2600
11433Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
11434
11435@item -mint32
11436@opindex mint32
11437Make @code{int} data 32 bits by default.
11438
11439@item -malign-300
11440@opindex malign-300
11441On the H8/300H and H8S, use the same alignment rules as for the H8/300.
11442The default for the H8/300H and H8S is to align longs and floats on 4
11443byte boundaries.
11444@option{-malign-300} causes them to be aligned on 2 byte boundaries.
11445This option has no effect on the H8/300.
11446@end table
11447
11448@node HPPA Options
11449@subsection HPPA Options
11450@cindex HPPA Options
11451
11452These @samp{-m} options are defined for the HPPA family of computers:
11453
11454@table @gcctabopt
11455@item -march=@var{architecture-type}
11456@opindex march
11457Generate code for the specified architecture.  The choices for
11458@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
114591.1, and @samp{2.0} for PA 2.0 processors.  Refer to
11460@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
11461architecture option for your machine.  Code compiled for lower numbered
11462architectures will run on higher numbered architectures, but not the
11463other way around.
11464
11465@item -mpa-risc-1-0
11466@itemx -mpa-risc-1-1
11467@itemx -mpa-risc-2-0
11468@opindex mpa-risc-1-0
11469@opindex mpa-risc-1-1
11470@opindex mpa-risc-2-0
11471Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
11472
11473@item -mbig-switch
11474@opindex mbig-switch
11475Generate code suitable for big switch tables.  Use this option only if
11476the assembler/linker complain about out of range branches within a switch
11477table.
11478
11479@item -mjump-in-delay
11480@opindex mjump-in-delay
11481Fill delay slots of function calls with unconditional jump instructions
11482by modifying the return pointer for the function call to be the target
11483of the conditional jump.
11484
11485@item -mdisable-fpregs
11486@opindex mdisable-fpregs
11487Prevent floating point registers from being used in any manner.  This is
11488necessary for compiling kernels which perform lazy context switching of
11489floating point registers.  If you use this option and attempt to perform
11490floating point operations, the compiler will abort.
11491
11492@item -mdisable-indexing
11493@opindex mdisable-indexing
11494Prevent the compiler from using indexing address modes.  This avoids some
11495rather obscure problems when compiling MIG generated code under MACH@.
11496
11497@item -mno-space-regs
11498@opindex mno-space-regs
11499Generate code that assumes the target has no space registers.  This allows
11500GCC to generate faster indirect calls and use unscaled index address modes.
11501
11502Such code is suitable for level 0 PA systems and kernels.
11503
11504@item -mfast-indirect-calls
11505@opindex mfast-indirect-calls
11506Generate code that assumes calls never cross space boundaries.  This
11507allows GCC to emit code which performs faster indirect calls.
11508
11509This option will not work in the presence of shared libraries or nested
11510functions.
11511
11512@item -mfixed-range=@var{register-range}
11513@opindex mfixed-range
11514Generate code treating the given register range as fixed registers.
11515A fixed register is one that the register allocator can not use.  This is
11516useful when compiling kernel code.  A register range is specified as
11517two registers separated by a dash.  Multiple register ranges can be
11518specified separated by a comma.
11519
11520@item -mlong-load-store
11521@opindex mlong-load-store
11522Generate 3-instruction load and store sequences as sometimes required by
11523the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
11524the HP compilers.
11525
11526@item -mportable-runtime
11527@opindex mportable-runtime
11528Use the portable calling conventions proposed by HP for ELF systems.
11529
11530@item -mgas
11531@opindex mgas
11532Enable the use of assembler directives only GAS understands.
11533
11534@item -mschedule=@var{cpu-type}
11535@opindex mschedule
11536Schedule code according to the constraints for the machine type
11537@var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
11538@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
11539to @file{/usr/lib/sched.models} on an HP-UX system to determine the
11540proper scheduling option for your machine.  The default scheduling is
11541@samp{8000}.
11542
11543@item -mlinker-opt
11544@opindex mlinker-opt
11545Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
11546debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
11547linkers in which they give bogus error messages when linking some programs.
11548
11549@item -msoft-float
11550@opindex msoft-float
11551Generate output containing library calls for floating point.
11552@strong{Warning:} the requisite libraries are not available for all HPPA
11553targets.  Normally the facilities of the machine's usual C compiler are
11554used, but this cannot be done directly in cross-compilation.  You must make
11555your own arrangements to provide suitable library functions for
11556cross-compilation.
11557
11558@option{-msoft-float} changes the calling convention in the output file;
11559therefore, it is only useful if you compile @emph{all} of a program with
11560this option.  In particular, you need to compile @file{libgcc.a}, the
11561library that comes with GCC, with @option{-msoft-float} in order for
11562this to work.
11563
11564@item -msio
11565@opindex msio
11566Generate the predefine, @code{_SIO}, for server IO@.  The default is
11567@option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
11568@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@.  These
11569options are available under HP-UX and HI-UX@.
11570
11571@item -mgnu-ld
11572@opindex mgnu-ld
11573Use GNU ld specific options.  This passes @option{-shared} to ld when
11574building a shared library.  It is the default when GCC is configured,
11575explicitly or implicitly, with the GNU linker.  This option does not
11576have any affect on which ld is called, it only changes what parameters
11577are passed to that ld.  The ld that is called is determined by the
11578@option{--with-ld} configure option, GCC's program search path, and
11579finally by the user's @env{PATH}.  The linker used by GCC can be printed
11580using @samp{which `gcc -print-prog-name=ld`}.  This option is only available
11581on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
11582
11583@item -mhp-ld
11584@opindex mhp-ld
11585Use HP ld specific options.  This passes @option{-b} to ld when building
11586a shared library and passes @option{+Accept TypeMismatch} to ld on all
11587links.  It is the default when GCC is configured, explicitly or
11588implicitly, with the HP linker.  This option does not have any affect on
11589which ld is called, it only changes what parameters are passed to that
11590ld.  The ld that is called is determined by the @option{--with-ld}
11591configure option, GCC's program search path, and finally by the user's
11592@env{PATH}.  The linker used by GCC can be printed using @samp{which
11593`gcc -print-prog-name=ld`}.  This option is only available on the 64 bit
11594HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
11595
11596@item -mlong-calls
11597@opindex mno-long-calls
11598Generate code that uses long call sequences.  This ensures that a call
11599is always able to reach linker generated stubs.  The default is to generate
11600long calls only when the distance from the call site to the beginning
11601of the function or translation unit, as the case may be, exceeds a
11602predefined limit set by the branch type being used.  The limits for
11603normal calls are 7,600,000 and 240,000 bytes, respectively for the
11604PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
11605240,000 bytes.
11606
11607Distances are measured from the beginning of functions when using the
11608@option{-ffunction-sections} option, or when using the @option{-mgas}
11609and @option{-mno-portable-runtime} options together under HP-UX with
11610the SOM linker.
11611
11612It is normally not desirable to use this option as it will degrade
11613performance.  However, it may be useful in large applications,
11614particularly when partial linking is used to build the application.
11615
11616The types of long calls used depends on the capabilities of the
11617assembler and linker, and the type of code being generated.  The
11618impact on systems that support long absolute calls, and long pic
11619symbol-difference or pc-relative calls should be relatively small.
11620However, an indirect call is used on 32-bit ELF systems in pic code
11621and it is quite long.
11622
11623@item -munix=@var{unix-std}
11624@opindex march
11625Generate compiler predefines and select a startfile for the specified
11626UNIX standard.  The choices for @var{unix-std} are @samp{93}, @samp{95}
11627and @samp{98}.  @samp{93} is supported on all HP-UX versions.  @samp{95}
11628is available on HP-UX 10.10 and later.  @samp{98} is available on HP-UX
1162911.11 and later.  The default values are @samp{93} for HP-UX 10.00,
11630@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
11631and later.
11632
11633@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
11634@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
11635and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
11636@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
11637@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
11638@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
11639
11640It is @emph{important} to note that this option changes the interfaces
11641for various library routines.  It also affects the operational behavior
11642of the C library.  Thus, @emph{extreme} care is needed in using this
11643option.
11644
11645Library code that is intended to operate with more than one UNIX
11646standard must test, set and restore the variable @var{__xpg4_extended_mask}
11647as appropriate.  Most GNU software doesn't provide this capability.
11648
11649@item -nolibdld
11650@opindex nolibdld
11651Suppress the generation of link options to search libdld.sl when the
11652@option{-static} option is specified on HP-UX 10 and later.
11653
11654@item -static
11655@opindex static
11656The HP-UX implementation of setlocale in libc has a dependency on
11657libdld.sl.  There isn't an archive version of libdld.sl.  Thus,
11658when the @option{-static} option is specified, special link options
11659are needed to resolve this dependency.
11660
11661On HP-UX 10 and later, the GCC driver adds the necessary options to
11662link with libdld.sl when the @option{-static} option is specified.
11663This causes the resulting binary to be dynamic.  On the 64-bit port,
11664the linkers generate dynamic binaries by default in any case.  The
11665@option{-nolibdld} option can be used to prevent the GCC driver from
11666adding these link options.
11667
11668@item -threads
11669@opindex threads
11670Add support for multithreading with the @dfn{dce thread} library
11671under HP-UX@.  This option sets flags for both the preprocessor and
11672linker.
11673@end table
11674
11675@node i386 and x86-64 Options
11676@subsection Intel 386 and AMD x86-64 Options
11677@cindex i386 Options
11678@cindex x86-64 Options
11679@cindex Intel 386 Options
11680@cindex AMD x86-64 Options
11681
11682These @samp{-m} options are defined for the i386 and x86-64 family of
11683computers:
11684
11685@table @gcctabopt
11686@item -mtune=@var{cpu-type}
11687@opindex mtune
11688Tune to @var{cpu-type} everything applicable about the generated code, except
11689for the ABI and the set of available instructions.  The choices for
11690@var{cpu-type} are:
11691@table @emph
11692@item generic
11693Produce code optimized for the most common IA32/AMD64/EM64T processors.
11694If you know the CPU on which your code will run, then you should use
11695the corresponding @option{-mtune} option instead of
11696@option{-mtune=generic}.  But, if you do not know exactly what CPU users
11697of your application will have, then you should use this option.
11698
11699As new processors are deployed in the marketplace, the behavior of this
11700option will change.  Therefore, if you upgrade to a newer version of
11701GCC, the code generated option will change to reflect the processors
11702that were most common when that version of GCC was released.
11703
11704There is no @option{-march=generic} option because @option{-march}
11705indicates the instruction set the compiler can use, and there is no
11706generic instruction set applicable to all processors.  In contrast,
11707@option{-mtune} indicates the processor (or, in this case, collection of
11708processors) for which the code is optimized.
11709@item native
11710This selects the CPU to tune for at compilation time by determining
11711the processor type of the compiling machine.  Using @option{-mtune=native}
11712will produce code optimized for the local machine under the constraints
11713of the selected instruction set.  Using @option{-march=native} will
11714enable all instruction subsets supported by the local machine (hence
11715the result might not run on different machines).
11716@item i386
11717Original Intel's i386 CPU@.
11718@item i486
11719Intel's i486 CPU@.  (No scheduling is implemented for this chip.)
11720@item i586, pentium
11721Intel Pentium CPU with no MMX support.
11722@item pentium-mmx
11723Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
11724@item pentiumpro
11725Intel PentiumPro CPU@.
11726@item i686
11727Same as @code{generic}, but when used as @code{march} option, PentiumPro
11728instruction set will be used, so the code will run on all i686 family chips.
11729@item pentium2
11730Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
11731@item pentium3, pentium3m
11732Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
11733support.
11734@item pentium-m
11735Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
11736support.  Used by Centrino notebooks.
11737@item pentium4, pentium4m
11738Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
11739@item prescott
11740Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
11741set support.
11742@item nocona
11743Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
11744SSE2 and SSE3 instruction set support.
11745@item core2
11746Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
11747instruction set support.
11748@item atom
11749Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
11750instruction set support.
11751@item k6
11752AMD K6 CPU with MMX instruction set support.
11753@item k6-2, k6-3
11754Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
11755@item athlon, athlon-tbird
11756AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
11757support.
11758@item athlon-4, athlon-xp, athlon-mp
11759Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
11760instruction set support.
11761@item k8, opteron, athlon64, athlon-fx
11762AMD K8 core based CPUs with x86-64 instruction set support.  (This supersets
11763MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit instruction set extensions.)
11764@item k8-sse3, opteron-sse3, athlon64-sse3
11765Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
11766@item amdfam10, barcelona
11767AMD Family 10h core based CPUs with x86-64 instruction set support.  (This
11768supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
11769instruction set extensions.)
11770@item winchip-c6
11771IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
11772set support.
11773@item winchip2
11774IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
11775instruction set support.
11776@item c3
11777Via C3 CPU with MMX and 3DNow!@: instruction set support.  (No scheduling is
11778implemented for this chip.)
11779@item c3-2
11780Via C3-2 CPU with MMX and SSE instruction set support.  (No scheduling is
11781implemented for this chip.)
11782@item geode
11783Embedded AMD CPU with MMX and 3DNow!@: instruction set support.
11784@end table
11785
11786While picking a specific @var{cpu-type} will schedule things appropriately
11787for that particular chip, the compiler will not generate any code that
11788does not run on the i386 without the @option{-march=@var{cpu-type}} option
11789being used.
11790
11791@item -march=@var{cpu-type}
11792@opindex march
11793Generate instructions for the machine type @var{cpu-type}.  The choices
11794for @var{cpu-type} are the same as for @option{-mtune}.  Moreover,
11795specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
11796
11797@item -mcpu=@var{cpu-type}
11798@opindex mcpu
11799A deprecated synonym for @option{-mtune}.
11800
11801@item -mfpmath=@var{unit}
11802@opindex mfpmath
11803Generate floating point arithmetics for selected unit @var{unit}.  The choices
11804for @var{unit} are:
11805
11806@table @samp
11807@item 387
11808Use the standard 387 floating point coprocessor present majority of chips and
11809emulated otherwise.  Code compiled with this option will run almost everywhere.
11810The temporary results are computed in 80bit precision instead of precision
11811specified by the type resulting in slightly different results compared to most
11812of other chips.  See @option{-ffloat-store} for more detailed description.
11813
11814This is the default choice for i386 compiler.
11815
11816@item sse
11817Use scalar floating point instructions present in the SSE instruction set.
11818This instruction set is supported by Pentium3 and newer chips, in the AMD line
11819by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
11820instruction set supports only single precision arithmetics, thus the double and
11821extended precision arithmetics is still done using 387.  Later version, present
11822only in Pentium4 and the future AMD x86-64 chips supports double precision
11823arithmetics too.
11824
11825For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
11826or @option{-msse2} switches to enable SSE extensions and make this option
11827effective.  For the x86-64 compiler, these extensions are enabled by default.
11828
11829The resulting code should be considerably faster in the majority of cases and avoid
11830the numerical instability problems of 387 code, but may break some existing
11831code that expects temporaries to be 80bit.
11832
11833This is the default choice for the x86-64 compiler.
11834
11835@item sse,387
11836@itemx sse+387
11837@itemx both
11838Attempt to utilize both instruction sets at once.  This effectively double the
11839amount of available registers and on chips with separate execution units for
11840387 and SSE the execution resources too.  Use this option with care, as it is
11841still experimental, because the GCC register allocator does not model separate
11842functional units well resulting in instable performance.
11843@end table
11844
11845@item -masm=@var{dialect}
11846@opindex masm=@var{dialect}
11847Output asm instructions using selected @var{dialect}.  Supported
11848choices are @samp{intel} or @samp{att} (the default one).  Darwin does
11849not support @samp{intel}.
11850
11851@item -mieee-fp
11852@itemx -mno-ieee-fp
11853@opindex mieee-fp
11854@opindex mno-ieee-fp
11855Control whether or not the compiler uses IEEE floating point
11856comparisons.  These handle correctly the case where the result of a
11857comparison is unordered.
11858
11859@item -msoft-float
11860@opindex msoft-float
11861Generate output containing library calls for floating point.
11862@strong{Warning:} the requisite libraries are not part of GCC@.
11863Normally the facilities of the machine's usual C compiler are used, but
11864this can't be done directly in cross-compilation.  You must make your
11865own arrangements to provide suitable library functions for
11866cross-compilation.
11867
11868On machines where a function returns floating point results in the 80387
11869register stack, some floating point opcodes may be emitted even if
11870@option{-msoft-float} is used.
11871
11872@item -mno-fp-ret-in-387
11873@opindex mno-fp-ret-in-387
11874Do not use the FPU registers for return values of functions.
11875
11876The usual calling convention has functions return values of types
11877@code{float} and @code{double} in an FPU register, even if there
11878is no FPU@.  The idea is that the operating system should emulate
11879an FPU@.
11880
11881The option @option{-mno-fp-ret-in-387} causes such values to be returned
11882in ordinary CPU registers instead.
11883
11884@item -mno-fancy-math-387
11885@opindex mno-fancy-math-387
11886Some 387 emulators do not support the @code{sin}, @code{cos} and
11887@code{sqrt} instructions for the 387.  Specify this option to avoid
11888generating those instructions.  This option is the default on FreeBSD,
11889OpenBSD and NetBSD@.  This option is overridden when @option{-march}
11890indicates that the target CPU will always have an FPU and so the
11891instruction will not need emulation.  As of revision 2.6.1, these
11892instructions are not generated unless you also use the
11893@option{-funsafe-math-optimizations} switch.
11894
11895@item -malign-double
11896@itemx -mno-align-double
11897@opindex malign-double
11898@opindex mno-align-double
11899Control whether GCC aligns @code{double}, @code{long double}, and
11900@code{long long} variables on a two word boundary or a one word
11901boundary.  Aligning @code{double} variables on a two word boundary will
11902produce code that runs somewhat faster on a @samp{Pentium} at the
11903expense of more memory.
11904
11905On x86-64, @option{-malign-double} is enabled by default.
11906
11907@strong{Warning:} if you use the @option{-malign-double} switch,
11908structures containing the above types will be aligned differently than
11909the published application binary interface specifications for the 386
11910and will not be binary compatible with structures in code compiled
11911without that switch.
11912
11913@item -m96bit-long-double
11914@itemx -m128bit-long-double
11915@opindex m96bit-long-double
11916@opindex m128bit-long-double
11917These switches control the size of @code{long double} type.  The i386
11918application binary interface specifies the size to be 96 bits,
11919so @option{-m96bit-long-double} is the default in 32 bit mode.
11920
11921Modern architectures (Pentium and newer) would prefer @code{long double}
11922to be aligned to an 8 or 16 byte boundary.  In arrays or structures
11923conforming to the ABI, this would not be possible.  So specifying a
11924@option{-m128bit-long-double} will align @code{long double}
11925to a 16 byte boundary by padding the @code{long double} with an additional
1192632 bit zero.
11927
11928In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
11929its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
11930
11931Notice that neither of these options enable any extra precision over the x87
11932standard of 80 bits for a @code{long double}.
11933
11934@strong{Warning:} if you override the default value for your target ABI, the
11935structures and arrays containing @code{long double} variables will change
11936their size as well as function calling convention for function taking
11937@code{long double} will be modified.  Hence they will not be binary
11938compatible with arrays or structures in code compiled without that switch.
11939
11940@item -mlarge-data-threshold=@var{number}
11941@opindex mlarge-data-threshold=@var{number}
11942When @option{-mcmodel=medium} is specified, the data greater than
11943@var{threshold} are placed in large data section.  This value must be the
11944same across all object linked into the binary and defaults to 65535.
11945
11946@item -mrtd
11947@opindex mrtd
11948Use a different function-calling convention, in which functions that
11949take a fixed number of arguments return with the @code{ret} @var{num}
11950instruction, which pops their arguments while returning.  This saves one
11951instruction in the caller since there is no need to pop the arguments
11952there.
11953
11954You can specify that an individual function is called with this calling
11955sequence with the function attribute @samp{stdcall}.  You can also
11956override the @option{-mrtd} option by using the function attribute
11957@samp{cdecl}.  @xref{Function Attributes}.
11958
11959@strong{Warning:} this calling convention is incompatible with the one
11960normally used on Unix, so you cannot use it if you need to call
11961libraries compiled with the Unix compiler.
11962
11963Also, you must provide function prototypes for all functions that
11964take variable numbers of arguments (including @code{printf});
11965otherwise incorrect code will be generated for calls to those
11966functions.
11967
11968In addition, seriously incorrect code will result if you call a
11969function with too many arguments.  (Normally, extra arguments are
11970harmlessly ignored.)
11971
11972@item -mregparm=@var{num}
11973@opindex mregparm
11974Control how many registers are used to pass integer arguments.  By
11975default, no registers are used to pass arguments, and at most 3
11976registers can be used.  You can control this behavior for a specific
11977function by using the function attribute @samp{regparm}.
11978@xref{Function Attributes}.
11979
11980@strong{Warning:} if you use this switch, and
11981@var{num} is nonzero, then you must build all modules with the same
11982value, including any libraries.  This includes the system libraries and
11983startup modules.
11984
11985@item -msseregparm
11986@opindex msseregparm
11987Use SSE register passing conventions for float and double arguments
11988and return values.  You can control this behavior for a specific
11989function by using the function attribute @samp{sseregparm}.
11990@xref{Function Attributes}.
11991
11992@strong{Warning:} if you use this switch then you must build all
11993modules with the same value, including any libraries.  This includes
11994the system libraries and startup modules.
11995
11996@item -mpc32
11997@itemx -mpc64
11998@itemx -mpc80
11999@opindex mpc32
12000@opindex mpc64
12001@opindex mpc80
12002
12003Set 80387 floating-point precision to 32, 64 or 80 bits.  When @option{-mpc32}
12004is specified, the significands of results of floating-point operations are
12005rounded to 24 bits (single precision); @option{-mpc64} rounds the
12006significands of results of floating-point operations to 53 bits (double
12007precision) and @option{-mpc80} rounds the significands of results of
12008floating-point operations to 64 bits (extended double precision), which is
12009the default.  When this option is used, floating-point operations in higher
12010precisions are not available to the programmer without setting the FPU
12011control word explicitly.
12012
12013Setting the rounding of floating-point operations to less than the default
1201480 bits can speed some programs by 2% or more.  Note that some mathematical
12015libraries assume that extended precision (80 bit) floating-point operations
12016are enabled by default; routines in such libraries could suffer significant
12017loss of accuracy, typically through so-called "catastrophic cancellation",
12018when this option is used to set the precision to less than extended precision.
12019
12020@item -mstackrealign
12021@opindex mstackrealign
12022Realign the stack at entry.  On the Intel x86, the @option{-mstackrealign}
12023option will generate an alternate prologue and epilogue that realigns the
12024runtime stack if necessary.  This supports mixing legacy codes that keep
12025a 4-byte aligned stack with modern codes that keep a 16-byte stack for
12026SSE compatibility.  See also the attribute @code{force_align_arg_pointer},
12027applicable to individual functions.
12028
12029@item -mpreferred-stack-boundary=@var{num}
12030@opindex mpreferred-stack-boundary
12031Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
12032byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
12033the default is 4 (16 bytes or 128 bits).
12034
12035@item -mincoming-stack-boundary=@var{num}
12036@opindex mincoming-stack-boundary
12037Assume the incoming stack is aligned to a 2 raised to @var{num} byte
12038boundary.  If @option{-mincoming-stack-boundary} is not specified,
12039the one specified by @option{-mpreferred-stack-boundary} will be used.
12040
12041On Pentium and PentiumPro, @code{double} and @code{long double} values
12042should be aligned to an 8 byte boundary (see @option{-malign-double}) or
12043suffer significant run time performance penalties.  On Pentium III, the
12044Streaming SIMD Extension (SSE) data type @code{__m128} may not work
12045properly if it is not 16 byte aligned.
12046
12047To ensure proper alignment of this values on the stack, the stack boundary
12048must be as aligned as that required by any value stored on the stack.
12049Further, every function must be generated such that it keeps the stack
12050aligned.  Thus calling a function compiled with a higher preferred
12051stack boundary from a function compiled with a lower preferred stack
12052boundary will most likely misalign the stack.  It is recommended that
12053libraries that use callbacks always use the default setting.
12054
12055This extra alignment does consume extra stack space, and generally
12056increases code size.  Code that is sensitive to stack space usage, such
12057as embedded systems and operating system kernels, may want to reduce the
12058preferred alignment to @option{-mpreferred-stack-boundary=2}.
12059
12060@item -mmmx
12061@itemx -mno-mmx
12062@itemx -msse
12063@itemx -mno-sse
12064@itemx -msse2
12065@itemx -mno-sse2
12066@itemx -msse3
12067@itemx -mno-sse3
12068@itemx -mssse3
12069@itemx -mno-ssse3
12070@itemx -msse4.1
12071@itemx -mno-sse4.1
12072@itemx -msse4.2
12073@itemx -mno-sse4.2
12074@itemx -msse4
12075@itemx -mno-sse4
12076@itemx -mavx
12077@itemx -mno-avx
12078@itemx -maes
12079@itemx -mno-aes
12080@itemx -mpclmul
12081@itemx -mno-pclmul
12082@itemx -msse4a
12083@itemx -mno-sse4a
12084@itemx -mfma4
12085@itemx -mno-fma4
12086@itemx -mxop
12087@itemx -mno-xop
12088@itemx -mlwp
12089@itemx -mno-lwp
12090@itemx -m3dnow
12091@itemx -mno-3dnow
12092@itemx -mpopcnt
12093@itemx -mno-popcnt
12094@itemx -mabm
12095@itemx -mno-abm
12096@opindex mmmx
12097@opindex mno-mmx
12098@opindex msse
12099@opindex mno-sse
12100@opindex m3dnow
12101@opindex mno-3dnow
12102These switches enable or disable the use of instructions in the MMX,
12103SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AES, PCLMUL, SSE4A, FMA4, XOP,
12104LWP, ABM or 3DNow!@: extended instruction sets.
12105These extensions are also available as built-in functions: see
12106@ref{X86 Built-in Functions}, for details of the functions enabled and
12107disabled by these switches.
12108
12109To have SSE/SSE2 instructions generated automatically from floating-point
12110code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
12111
12112GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
12113generates new AVX instructions or AVX equivalence for all SSEx instructions
12114when needed.
12115
12116These options will enable GCC to use these extended instructions in
12117generated code, even without @option{-mfpmath=sse}.  Applications which
12118perform runtime CPU detection must compile separate files for each
12119supported architecture, using the appropriate flags.  In particular,
12120the file containing the CPU detection code should be compiled without
12121these options.
12122
12123@item -mfused-madd
12124@itemx -mno-fused-madd
12125@opindex mfused-madd
12126@opindex mno-fused-madd
12127Do (don't) generate code that uses the fused multiply/add or multiply/subtract
12128instructions.  The default is to use these instructions.
12129
12130@item -mcld
12131@opindex mcld
12132This option instructs GCC to emit a @code{cld} instruction in the prologue
12133of functions that use string instructions.  String instructions depend on
12134the DF flag to select between autoincrement or autodecrement mode.  While the
12135ABI specifies the DF flag to be cleared on function entry, some operating
12136systems violate this specification by not clearing the DF flag in their
12137exception dispatchers.  The exception handler can be invoked with the DF flag
12138set which leads to wrong direction mode, when string instructions are used.
12139This option can be enabled by default on 32-bit x86 targets by configuring
12140GCC with the @option{--enable-cld} configure option.  Generation of @code{cld}
12141instructions can be suppressed with the @option{-mno-cld} compiler option
12142in this case.
12143
12144@item -mcx16
12145@opindex mcx16
12146This option will enable GCC to use CMPXCHG16B instruction in generated code.
12147CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
12148data types.  This is useful for high resolution counters that could be updated
12149by multiple processors (or cores).  This instruction is generated as part of
12150atomic built-in functions: see @ref{Atomic Builtins} for details.
12151
12152@item -msahf
12153@opindex msahf
12154This option will enable GCC to use SAHF instruction in generated 64-bit code.
12155Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
12156by AMD64 until introduction of Pentium 4 G1 step in December 2005.  LAHF and
12157SAHF are load and store instructions, respectively, for certain status flags.
12158In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
12159or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
12160
12161@item -mmovbe
12162@opindex mmovbe
12163This option will enable GCC to use movbe instruction to implement
12164@code{__builtin_bswap32} and @code{__builtin_bswap64}.
12165
12166@item -mcrc32
12167@opindex mcrc32
12168This option will enable built-in functions, @code{__builtin_ia32_crc32qi},
12169@code{__builtin_ia32_crc32hi}. @code{__builtin_ia32_crc32si} and
12170@code{__builtin_ia32_crc32di} to generate the crc32 machine instruction.
12171
12172@item -mrecip
12173@opindex mrecip
12174This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
12175vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
12176to increase precision instead of DIVSS and SQRTSS (and their vectorized
12177variants) for single precision floating point arguments.  These instructions
12178are generated only when @option{-funsafe-math-optimizations} is enabled
12179together with @option{-finite-math-only} and @option{-fno-trapping-math}.
12180Note that while the throughput of the sequence is higher than the throughput
12181of the non-reciprocal instruction, the precision of the sequence can be
12182decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
12183
12184Note that GCC implements 1.0f/sqrtf(x) in terms of RSQRTSS (or RSQRTPS)
12185already with @option{-ffast-math} (or the above option combination), and
12186doesn't need @option{-mrecip}.
12187
12188@item -mveclibabi=@var{type}
12189@opindex mveclibabi
12190Specifies the ABI type to use for vectorizing intrinsics using an
12191external library.  Supported types are @code{svml} for the Intel short
12192vector math library and @code{acml} for the AMD math core library style
12193of interfacing.  GCC will currently emit calls to @code{vmldExp2},
12194@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
12195@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
12196@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
12197@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
12198@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
12199@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
12200@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
12201@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
12202@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
12203function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
12204@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
12205@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
12206@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
12207@code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
12208when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
12209@option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
12210compatible library will have to be specified at link time.
12211
12212@item -mabi=@var{name}
12213@opindex mabi
12214Generate code for the specified calling convention.  Permissible values
12215are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
12216@samp{ms} for the Microsoft ABI.  The default is to use the Microsoft
12217ABI when targeting Windows.  On all other systems, the default is the
12218SYSV ABI.  You can control this behavior for a specific function by
12219using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
12220@xref{Function Attributes}.
12221
12222@item -mpush-args
12223@itemx -mno-push-args
12224@opindex mpush-args
12225@opindex mno-push-args
12226Use PUSH operations to store outgoing parameters.  This method is shorter
12227and usually equally fast as method using SUB/MOV operations and is enabled
12228by default.  In some cases disabling it may improve performance because of
12229improved scheduling and reduced dependencies.
12230
12231@item -maccumulate-outgoing-args
12232@opindex maccumulate-outgoing-args
12233If enabled, the maximum amount of space required for outgoing arguments will be
12234computed in the function prologue.  This is faster on most modern CPUs
12235because of reduced dependencies, improved scheduling and reduced stack usage
12236when preferred stack boundary is not equal to 2.  The drawback is a notable
12237increase in code size.  This switch implies @option{-mno-push-args}.
12238
12239@item -mthreads
12240@opindex mthreads
12241Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
12242on thread-safe exception handling must compile and link all code with the
12243@option{-mthreads} option.  When compiling, @option{-mthreads} defines
12244@option{-D_MT}; when linking, it links in a special thread helper library
12245@option{-lmingwthrd} which cleans up per thread exception handling data.
12246
12247@item -mno-align-stringops
12248@opindex mno-align-stringops
12249Do not align destination of inlined string operations.  This switch reduces
12250code size and improves performance in case the destination is already aligned,
12251but GCC doesn't know about it.
12252
12253@item -minline-all-stringops
12254@opindex minline-all-stringops
12255By default GCC inlines string operations only when destination is known to be
12256aligned at least to 4 byte boundary.  This enables more inlining, increase code
12257size, but may improve performance of code that depends on fast memcpy, strlen
12258and memset for short lengths.
12259
12260@item -minline-stringops-dynamically
12261@opindex minline-stringops-dynamically
12262For string operation of unknown size, inline runtime checks so for small
12263blocks inline code is used, while for large blocks library call is used.
12264
12265@item -mstringop-strategy=@var{alg}
12266@opindex mstringop-strategy=@var{alg}
12267Overwrite internal decision heuristic about particular algorithm to inline
12268string operation with.  The allowed values are @code{rep_byte},
12269@code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
12270of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
12271expanding inline loop, @code{libcall} for always expanding library call.
12272
12273@item -momit-leaf-frame-pointer
12274@opindex momit-leaf-frame-pointer
12275Don't keep the frame pointer in a register for leaf functions.  This
12276avoids the instructions to save, set up and restore frame pointers and
12277makes an extra register available in leaf functions.  The option
12278@option{-fomit-frame-pointer} removes the frame pointer for all functions
12279which might make debugging harder.
12280
12281@item -mtls-direct-seg-refs
12282@itemx -mno-tls-direct-seg-refs
12283@opindex mtls-direct-seg-refs
12284Controls whether TLS variables may be accessed with offsets from the
12285TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
12286or whether the thread base pointer must be added.  Whether or not this
12287is legal depends on the operating system, and whether it maps the
12288segment to cover the entire TLS area.
12289
12290For systems that use GNU libc, the default is on.
12291
12292@item -msse2avx
12293@itemx -mno-sse2avx
12294@opindex msse2avx
12295Specify that the assembler should encode SSE instructions with VEX
12296prefix.  The option @option{-mavx} turns this on by default.
12297@end table
12298
12299These @samp{-m} switches are supported in addition to the above
12300on AMD x86-64 processors in 64-bit environments.
12301
12302@table @gcctabopt
12303@item -m32
12304@itemx -m64
12305@opindex m32
12306@opindex m64
12307Generate code for a 32-bit or 64-bit environment.
12308The 32-bit environment sets int, long and pointer to 32 bits and
12309generates code that runs on any i386 system.
12310The 64-bit environment sets int to 32 bits and long and pointer
12311to 64 bits and generates code for AMD's x86-64 architecture. For
12312darwin only the -m64 option turns off the @option{-fno-pic} and
12313@option{-mdynamic-no-pic} options.
12314
12315@item -mno-red-zone
12316@opindex mno-red-zone
12317Do not use a so called red zone for x86-64 code.  The red zone is mandated
12318by the x86-64 ABI, it is a 128-byte area beyond the location of the
12319stack pointer that will not be modified by signal or interrupt handlers
12320and therefore can be used for temporary data without adjusting the stack
12321pointer.  The flag @option{-mno-red-zone} disables this red zone.
12322
12323@item -mcmodel=small
12324@opindex mcmodel=small
12325Generate code for the small code model: the program and its symbols must
12326be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
12327Programs can be statically or dynamically linked.  This is the default
12328code model.
12329
12330@item -mcmodel=kernel
12331@opindex mcmodel=kernel
12332Generate code for the kernel code model.  The kernel runs in the
12333negative 2 GB of the address space.
12334This model has to be used for Linux kernel code.
12335
12336@item -mcmodel=medium
12337@opindex mcmodel=medium
12338Generate code for the medium model: The program is linked in the lower 2
12339GB of the address space.  Small symbols are also placed there.  Symbols
12340with sizes larger than @option{-mlarge-data-threshold} are put into
12341large data or bss sections and can be located above 2GB.  Programs can
12342be statically or dynamically linked.
12343
12344@item -mcmodel=large
12345@opindex mcmodel=large
12346Generate code for the large model: This model makes no assumptions
12347about addresses and sizes of sections.
12348@end table
12349
12350@node i386 and x86-64 Windows Options
12351@subsection i386 and x86-64 Windows Options
12352@cindex i386 and x86-64 Windows Options
12353
12354These additional options are available for Windows targets:
12355
12356@table @gcctabopt
12357@item -mconsole
12358@opindex mconsole
12359This option is available for Cygwin and MinGW targets.  It
12360specifies that a console application is to be generated, by
12361instructing the linker to set the PE header subsystem type
12362required for console applications.
12363This is the default behavior for Cygwin and MinGW targets.
12364
12365@item -mcygwin
12366@opindex mcygwin
12367This option is available for Cygwin targets.  It specifies that
12368the Cygwin internal interface is to be used for predefined
12369preprocessor macros, C runtime libraries and related linker
12370paths and options.  For Cygwin targets this is the default behavior.
12371This option is deprecated and will be removed in a future release.
12372
12373@item -mno-cygwin
12374@opindex mno-cygwin
12375This option is available for Cygwin targets.  It specifies that
12376the MinGW internal interface is to be used instead of Cygwin's, by
12377setting MinGW-related predefined macros and linker paths and default
12378library options.
12379This option is deprecated and will be removed in a future release.
12380
12381@item -mdll
12382@opindex mdll
12383This option is available for Cygwin and MinGW targets.  It
12384specifies that a DLL - a dynamic link library - is to be
12385generated, enabling the selection of the required runtime
12386startup object and entry point.
12387
12388@item -mnop-fun-dllimport
12389@opindex mnop-fun-dllimport
12390This option is available for Cygwin and MinGW targets.  It
12391specifies that the dllimport attribute should be ignored.
12392
12393@item -mthread
12394@opindex mthread
12395This option is available for MinGW targets. It specifies
12396that MinGW-specific thread support is to be used.
12397
12398@item -municode
12399@opindex municode
12400This option is available for mingw-w64 targets.  It specifies
12401that the UNICODE macro is getting pre-defined and that the
12402unicode capable runtime startup code is chosen.
12403
12404@item -mwin32
12405@opindex mwin32
12406This option is available for Cygwin and MinGW targets.  It
12407specifies that the typical Windows pre-defined macros are to
12408be set in the pre-processor, but does not influence the choice
12409of runtime library/startup code.
12410
12411@item -mwindows
12412@opindex mwindows
12413This option is available for Cygwin and MinGW targets.  It
12414specifies that a GUI application is to be generated by
12415instructing the linker to set the PE header subsystem type
12416appropriately.
12417
12418@item -fno-set-stack-executable
12419@opindex fno-set-stack-executable
12420This option is available for MinGW targets. It specifies that
12421the executable flag for stack used by nested functions isn't
12422set. This is necessary for binaries running in kernel mode of
12423Windows, as there the user32 API, which is used to set executable
12424privileges, isn't available.
12425
12426@item -mpe-aligned-commons
12427@opindex mpe-aligned-commons
12428This option is available for Cygwin and MinGW targets.  It
12429specifies that the GNU extension to the PE file format that
12430permits the correct alignment of COMMON variables should be
12431used when generating code.  It will be enabled by default if
12432GCC detects that the target assembler found during configuration
12433supports the feature.
12434@end table
12435
12436See also under @ref{i386 and x86-64 Options} for standard options.
12437
12438@node IA-64 Options
12439@subsection IA-64 Options
12440@cindex IA-64 Options
12441
12442These are the @samp{-m} options defined for the Intel IA-64 architecture.
12443
12444@table @gcctabopt
12445@item -mbig-endian
12446@opindex mbig-endian
12447Generate code for a big endian target.  This is the default for HP-UX@.
12448
12449@item -mlittle-endian
12450@opindex mlittle-endian
12451Generate code for a little endian target.  This is the default for AIX5
12452and GNU/Linux.
12453
12454@item -mgnu-as
12455@itemx -mno-gnu-as
12456@opindex mgnu-as
12457@opindex mno-gnu-as
12458Generate (or don't) code for the GNU assembler.  This is the default.
12459@c Also, this is the default if the configure option @option{--with-gnu-as}
12460@c is used.
12461
12462@item -mgnu-ld
12463@itemx -mno-gnu-ld
12464@opindex mgnu-ld
12465@opindex mno-gnu-ld
12466Generate (or don't) code for the GNU linker.  This is the default.
12467@c Also, this is the default if the configure option @option{--with-gnu-ld}
12468@c is used.
12469
12470@item -mno-pic
12471@opindex mno-pic
12472Generate code that does not use a global pointer register.  The result
12473is not position independent code, and violates the IA-64 ABI@.
12474
12475@item -mvolatile-asm-stop
12476@itemx -mno-volatile-asm-stop
12477@opindex mvolatile-asm-stop
12478@opindex mno-volatile-asm-stop
12479Generate (or don't) a stop bit immediately before and after volatile asm
12480statements.
12481
12482@item -mregister-names
12483@itemx -mno-register-names
12484@opindex mregister-names
12485@opindex mno-register-names
12486Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
12487the stacked registers.  This may make assembler output more readable.
12488
12489@item -mno-sdata
12490@itemx -msdata
12491@opindex mno-sdata
12492@opindex msdata
12493Disable (or enable) optimizations that use the small data section.  This may
12494be useful for working around optimizer bugs.
12495
12496@item -mconstant-gp
12497@opindex mconstant-gp
12498Generate code that uses a single constant global pointer value.  This is
12499useful when compiling kernel code.
12500
12501@item -mauto-pic
12502@opindex mauto-pic
12503Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
12504This is useful when compiling firmware code.
12505
12506@item -minline-float-divide-min-latency
12507@opindex minline-float-divide-min-latency
12508Generate code for inline divides of floating point values
12509using the minimum latency algorithm.
12510
12511@item -minline-float-divide-max-throughput
12512@opindex minline-float-divide-max-throughput
12513Generate code for inline divides of floating point values
12514using the maximum throughput algorithm.
12515
12516@item -mno-inline-float-divide
12517@opindex mno-inline-float-divide
12518Do not generate inline code for divides of floating point values.
12519
12520@item -minline-int-divide-min-latency
12521@opindex minline-int-divide-min-latency
12522Generate code for inline divides of integer values
12523using the minimum latency algorithm.
12524
12525@item -minline-int-divide-max-throughput
12526@opindex minline-int-divide-max-throughput
12527Generate code for inline divides of integer values
12528using the maximum throughput algorithm.
12529
12530@item -mno-inline-int-divide
12531@opindex mno-inline-int-divide
12532Do not generate inline code for divides of integer values.
12533
12534@item -minline-sqrt-min-latency
12535@opindex minline-sqrt-min-latency
12536Generate code for inline square roots
12537using the minimum latency algorithm.
12538
12539@item -minline-sqrt-max-throughput
12540@opindex minline-sqrt-max-throughput
12541Generate code for inline square roots
12542using the maximum throughput algorithm.
12543
12544@item -mno-inline-sqrt
12545@opindex mno-inline-sqrt
12546Do not generate inline code for sqrt.
12547
12548@item -mfused-madd
12549@itemx -mno-fused-madd
12550@opindex mfused-madd
12551@opindex mno-fused-madd
12552Do (don't) generate code that uses the fused multiply/add or multiply/subtract
12553instructions.  The default is to use these instructions.
12554
12555@item -mno-dwarf2-asm
12556@itemx -mdwarf2-asm
12557@opindex mno-dwarf2-asm
12558@opindex mdwarf2-asm
12559Don't (or do) generate assembler code for the DWARF2 line number debugging
12560info.  This may be useful when not using the GNU assembler.
12561
12562@item -mearly-stop-bits
12563@itemx -mno-early-stop-bits
12564@opindex mearly-stop-bits
12565@opindex mno-early-stop-bits
12566Allow stop bits to be placed earlier than immediately preceding the
12567instruction that triggered the stop bit.  This can improve instruction
12568scheduling, but does not always do so.
12569
12570@item -mfixed-range=@var{register-range}
12571@opindex mfixed-range
12572Generate code treating the given register range as fixed registers.
12573A fixed register is one that the register allocator can not use.  This is
12574useful when compiling kernel code.  A register range is specified as
12575two registers separated by a dash.  Multiple register ranges can be
12576specified separated by a comma.
12577
12578@item -mtls-size=@var{tls-size}
12579@opindex mtls-size
12580Specify bit size of immediate TLS offsets.  Valid values are 14, 22, and
1258164.
12582
12583@item -mtune=@var{cpu-type}
12584@opindex mtune
12585Tune the instruction scheduling for a particular CPU, Valid values are
12586itanium, itanium1, merced, itanium2, and mckinley.
12587
12588@item -milp32
12589@itemx -mlp64
12590@opindex milp32
12591@opindex mlp64
12592Generate code for a 32-bit or 64-bit environment.
12593The 32-bit environment sets int, long and pointer to 32 bits.
12594The 64-bit environment sets int to 32 bits and long and pointer
12595to 64 bits.  These are HP-UX specific flags.
12596
12597@item -mno-sched-br-data-spec
12598@itemx -msched-br-data-spec
12599@opindex mno-sched-br-data-spec
12600@opindex msched-br-data-spec
12601(Dis/En)able data speculative scheduling before reload.
12602This will result in generation of the ld.a instructions and
12603the corresponding check instructions (ld.c / chk.a).
12604The default is 'disable'.
12605
12606@item -msched-ar-data-spec
12607@itemx -mno-sched-ar-data-spec
12608@opindex msched-ar-data-spec
12609@opindex mno-sched-ar-data-spec
12610(En/Dis)able data speculative scheduling after reload.
12611This will result in generation of the ld.a instructions and
12612the corresponding check instructions (ld.c / chk.a).
12613The default is 'enable'.
12614
12615@item -mno-sched-control-spec
12616@itemx -msched-control-spec
12617@opindex mno-sched-control-spec
12618@opindex msched-control-spec
12619(Dis/En)able control speculative scheduling.  This feature is
12620available only during region scheduling (i.e.@: before reload).
12621This will result in generation of the ld.s instructions and
12622the corresponding check instructions chk.s .
12623The default is 'disable'.
12624
12625@item -msched-br-in-data-spec
12626@itemx -mno-sched-br-in-data-spec
12627@opindex msched-br-in-data-spec
12628@opindex mno-sched-br-in-data-spec
12629(En/Dis)able speculative scheduling of the instructions that
12630are dependent on the data speculative loads before reload.
12631This is effective only with @option{-msched-br-data-spec} enabled.
12632The default is 'enable'.
12633
12634@item -msched-ar-in-data-spec
12635@itemx -mno-sched-ar-in-data-spec
12636@opindex msched-ar-in-data-spec
12637@opindex mno-sched-ar-in-data-spec
12638(En/Dis)able speculative scheduling of the instructions that
12639are dependent on the data speculative loads after reload.
12640This is effective only with @option{-msched-ar-data-spec} enabled.
12641The default is 'enable'.
12642
12643@item -msched-in-control-spec
12644@itemx -mno-sched-in-control-spec
12645@opindex msched-in-control-spec
12646@opindex mno-sched-in-control-spec
12647(En/Dis)able speculative scheduling of the instructions that
12648are dependent on the control speculative loads.
12649This is effective only with @option{-msched-control-spec} enabled.
12650The default is 'enable'.
12651
12652@item -mno-sched-prefer-non-data-spec-insns
12653@itemx -msched-prefer-non-data-spec-insns
12654@opindex mno-sched-prefer-non-data-spec-insns
12655@opindex msched-prefer-non-data-spec-insns
12656If enabled, data speculative instructions will be chosen for schedule
12657only if there are no other choices at the moment.  This will make
12658the use of the data speculation much more conservative.
12659The default is 'disable'.
12660
12661@item -mno-sched-prefer-non-control-spec-insns
12662@itemx -msched-prefer-non-control-spec-insns
12663@opindex mno-sched-prefer-non-control-spec-insns
12664@opindex msched-prefer-non-control-spec-insns
12665If enabled, control speculative instructions will be chosen for schedule
12666only if there are no other choices at the moment.  This will make
12667the use of the control speculation much more conservative.
12668The default is 'disable'.
12669
12670@item -mno-sched-count-spec-in-critical-path
12671@itemx -msched-count-spec-in-critical-path
12672@opindex mno-sched-count-spec-in-critical-path
12673@opindex msched-count-spec-in-critical-path
12674If enabled, speculative dependencies will be considered during
12675computation of the instructions priorities.  This will make the use of the
12676speculation a bit more conservative.
12677The default is 'disable'.
12678
12679@item -msched-spec-ldc
12680@opindex msched-spec-ldc
12681Use a simple data speculation check.  This option is on by default.
12682
12683@item -msched-control-spec-ldc
12684@opindex msched-spec-ldc
12685Use a simple check for control speculation.  This option is on by default.
12686
12687@item -msched-stop-bits-after-every-cycle
12688@opindex msched-stop-bits-after-every-cycle
12689Place a stop bit after every cycle when scheduling.  This option is on
12690by default.
12691
12692@item -msched-fp-mem-deps-zero-cost
12693@opindex msched-fp-mem-deps-zero-cost
12694Assume that floating-point stores and loads are not likely to cause a conflict
12695when placed into the same instruction group.  This option is disabled by
12696default.
12697
12698@item -msel-sched-dont-check-control-spec
12699@opindex msel-sched-dont-check-control-spec
12700Generate checks for control speculation in selective scheduling.
12701This flag is disabled by default.
12702
12703@item -msched-max-memory-insns=@var{max-insns}
12704@opindex msched-max-memory-insns
12705Limit on the number of memory insns per instruction group, giving lower
12706priority to subsequent memory insns attempting to schedule in the same
12707instruction group. Frequently useful to prevent cache bank conflicts.
12708The default value is 1.
12709
12710@item -msched-max-memory-insns-hard-limit
12711@opindex msched-max-memory-insns-hard-limit
12712Disallow more than `msched-max-memory-insns' in instruction group.
12713Otherwise, limit is `soft' meaning that we would prefer non-memory operations
12714when limit is reached but may still schedule memory operations.
12715
12716@end table
12717
12718@node IA-64/VMS Options
12719@subsection IA-64/VMS Options
12720
12721These @samp{-m} options are defined for the IA-64/VMS implementations:
12722
12723@table @gcctabopt
12724@item -mvms-return-codes
12725@opindex mvms-return-codes
12726Return VMS condition codes from main. The default is to return POSIX
12727style condition (e.g.@ error) codes.
12728
12729@item -mdebug-main=@var{prefix}
12730@opindex mdebug-main=@var{prefix}
12731Flag the first routine whose name starts with @var{prefix} as the main
12732routine for the debugger.
12733
12734@item -mmalloc64
12735@opindex mmalloc64
12736Default to 64bit memory allocation routines.
12737@end table
12738
12739@node LM32 Options
12740@subsection LM32 Options
12741@cindex LM32 options
12742
12743These @option{-m} options are defined for the Lattice Mico32 architecture:
12744
12745@table @gcctabopt
12746@item -mbarrel-shift-enabled
12747@opindex mbarrel-shift-enabled
12748Enable barrel-shift instructions.
12749
12750@item -mdivide-enabled
12751@opindex mdivide-enabled
12752Enable divide and modulus instructions.
12753
12754@item -mmultiply-enabled
12755@opindex multiply-enabled
12756Enable multiply instructions.
12757
12758@item -msign-extend-enabled
12759@opindex msign-extend-enabled
12760Enable sign extend instructions.
12761
12762@item -muser-enabled
12763@opindex muser-enabled
12764Enable user-defined instructions.
12765
12766@end table
12767
12768@node M32C Options
12769@subsection M32C Options
12770@cindex M32C options
12771
12772@table @gcctabopt
12773@item -mcpu=@var{name}
12774@opindex mcpu=
12775Select the CPU for which code is generated.  @var{name} may be one of
12776@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
12777/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
12778the M32C/80 series.
12779
12780@item -msim
12781@opindex msim
12782Specifies that the program will be run on the simulator.  This causes
12783an alternate runtime library to be linked in which supports, for
12784example, file I/O@.  You must not use this option when generating
12785programs that will run on real hardware; you must provide your own
12786runtime library for whatever I/O functions are needed.
12787
12788@item -memregs=@var{number}
12789@opindex memregs=
12790Specifies the number of memory-based pseudo-registers GCC will use
12791during code generation.  These pseudo-registers will be used like real
12792registers, so there is a tradeoff between GCC's ability to fit the
12793code into available registers, and the performance penalty of using
12794memory instead of registers.  Note that all modules in a program must
12795be compiled with the same value for this option.  Because of that, you
12796must not use this option with the default runtime libraries gcc
12797builds.
12798
12799@end table
12800
12801@node M32R/D Options
12802@subsection M32R/D Options
12803@cindex M32R/D options
12804
12805These @option{-m} options are defined for Renesas M32R/D architectures:
12806
12807@table @gcctabopt
12808@item -m32r2
12809@opindex m32r2
12810Generate code for the M32R/2@.
12811
12812@item -m32rx
12813@opindex m32rx
12814Generate code for the M32R/X@.
12815
12816@item -m32r
12817@opindex m32r
12818Generate code for the M32R@.  This is the default.
12819
12820@item -mmodel=small
12821@opindex mmodel=small
12822Assume all objects live in the lower 16MB of memory (so that their addresses
12823can be loaded with the @code{ld24} instruction), and assume all subroutines
12824are reachable with the @code{bl} instruction.
12825This is the default.
12826
12827The addressability of a particular object can be set with the
12828@code{model} attribute.
12829
12830@item -mmodel=medium
12831@opindex mmodel=medium
12832Assume objects may be anywhere in the 32-bit address space (the compiler
12833will generate @code{seth/add3} instructions to load their addresses), and
12834assume all subroutines are reachable with the @code{bl} instruction.
12835
12836@item -mmodel=large
12837@opindex mmodel=large
12838Assume objects may be anywhere in the 32-bit address space (the compiler
12839will generate @code{seth/add3} instructions to load their addresses), and
12840assume subroutines may not be reachable with the @code{bl} instruction
12841(the compiler will generate the much slower @code{seth/add3/jl}
12842instruction sequence).
12843
12844@item -msdata=none
12845@opindex msdata=none
12846Disable use of the small data area.  Variables will be put into
12847one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
12848@code{section} attribute has been specified).
12849This is the default.
12850
12851The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
12852Objects may be explicitly put in the small data area with the
12853@code{section} attribute using one of these sections.
12854
12855@item -msdata=sdata
12856@opindex msdata=sdata
12857Put small global and static data in the small data area, but do not
12858generate special code to reference them.
12859
12860@item -msdata=use
12861@opindex msdata=use
12862Put small global and static data in the small data area, and generate
12863special instructions to reference them.
12864
12865@item -G @var{num}
12866@opindex G
12867@cindex smaller data references
12868Put global and static objects less than or equal to @var{num} bytes
12869into the small data or bss sections instead of the normal data or bss
12870sections.  The default value of @var{num} is 8.
12871The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
12872for this option to have any effect.
12873
12874All modules should be compiled with the same @option{-G @var{num}} value.
12875Compiling with different values of @var{num} may or may not work; if it
12876doesn't the linker will give an error message---incorrect code will not be
12877generated.
12878
12879@item -mdebug
12880@opindex mdebug
12881Makes the M32R specific code in the compiler display some statistics
12882that might help in debugging programs.
12883
12884@item -malign-loops
12885@opindex malign-loops
12886Align all loops to a 32-byte boundary.
12887
12888@item -mno-align-loops
12889@opindex mno-align-loops
12890Do not enforce a 32-byte alignment for loops.  This is the default.
12891
12892@item -missue-rate=@var{number}
12893@opindex missue-rate=@var{number}
12894Issue @var{number} instructions per cycle.  @var{number} can only be 1
12895or 2.
12896
12897@item -mbranch-cost=@var{number}
12898@opindex mbranch-cost=@var{number}
12899@var{number} can only be 1 or 2.  If it is 1 then branches will be
12900preferred over conditional code, if it is 2, then the opposite will
12901apply.
12902
12903@item -mflush-trap=@var{number}
12904@opindex mflush-trap=@var{number}
12905Specifies the trap number to use to flush the cache.  The default is
1290612.  Valid numbers are between 0 and 15 inclusive.
12907
12908@item -mno-flush-trap
12909@opindex mno-flush-trap
12910Specifies that the cache cannot be flushed by using a trap.
12911
12912@item -mflush-func=@var{name}
12913@opindex mflush-func=@var{name}
12914Specifies the name of the operating system function to call to flush
12915the cache.  The default is @emph{_flush_cache}, but a function call
12916will only be used if a trap is not available.
12917
12918@item -mno-flush-func
12919@opindex mno-flush-func
12920Indicates that there is no OS function for flushing the cache.
12921
12922@end table
12923
12924@node M680x0 Options
12925@subsection M680x0 Options
12926@cindex M680x0 options
12927
12928These are the @samp{-m} options defined for M680x0 and ColdFire processors.
12929The default settings depend on which architecture was selected when
12930the compiler was configured; the defaults for the most common choices
12931are given below.
12932
12933@table @gcctabopt
12934@item -march=@var{arch}
12935@opindex march
12936Generate code for a specific M680x0 or ColdFire instruction set
12937architecture.  Permissible values of @var{arch} for M680x0
12938architectures are: @samp{68000}, @samp{68010}, @samp{68020},
12939@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}.  ColdFire
12940architectures are selected according to Freescale's ISA classification
12941and the permissible values are: @samp{isaa}, @samp{isaaplus},
12942@samp{isab} and @samp{isac}.
12943
12944gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
12945code for a ColdFire target.  The @var{arch} in this macro is one of the
12946@option{-march} arguments given above.
12947
12948When used together, @option{-march} and @option{-mtune} select code
12949that runs on a family of similar processors but that is optimized
12950for a particular microarchitecture.
12951
12952@item -mcpu=@var{cpu}
12953@opindex mcpu
12954Generate code for a specific M680x0 or ColdFire processor.
12955The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
12956@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
12957and @samp{cpu32}.  The ColdFire @var{cpu}s are given by the table
12958below, which also classifies the CPUs into families:
12959
12960@multitable @columnfractions 0.20 0.80
12961@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
12962@item @samp{51} @tab @samp{51} @samp{51ac} @samp{51cn} @samp{51em} @samp{51qe}
12963@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
12964@item @samp{5206e} @tab @samp{5206e}
12965@item @samp{5208} @tab @samp{5207} @samp{5208}
12966@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
12967@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
12968@item @samp{5216} @tab @samp{5214} @samp{5216}
12969@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
12970@item @samp{5225} @tab @samp{5224} @samp{5225}
12971@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
12972@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
12973@item @samp{5249} @tab @samp{5249}
12974@item @samp{5250} @tab @samp{5250}
12975@item @samp{5271} @tab @samp{5270} @samp{5271}
12976@item @samp{5272} @tab @samp{5272}
12977@item @samp{5275} @tab @samp{5274} @samp{5275}
12978@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
12979@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
12980@item @samp{5307} @tab @samp{5307}
12981@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
12982@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
12983@item @samp{5407} @tab @samp{5407}
12984@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}
12985@end multitable
12986
12987@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
12988@var{arch} is compatible with @var{cpu}.  Other combinations of
12989@option{-mcpu} and @option{-march} are rejected.
12990
12991gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
12992@var{cpu} is selected.  It also defines @samp{__mcf_family_@var{family}},
12993where the value of @var{family} is given by the table above.
12994
12995@item -mtune=@var{tune}
12996@opindex mtune
12997Tune the code for a particular microarchitecture, within the
12998constraints set by @option{-march} and @option{-mcpu}.
12999The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
13000@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
13001and @samp{cpu32}.  The ColdFire microarchitectures
13002are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
13003
13004You can also use @option{-mtune=68020-40} for code that needs
13005to run relatively well on 68020, 68030 and 68040 targets.
13006@option{-mtune=68020-60} is similar but includes 68060 targets
13007as well.  These two options select the same tuning decisions as
13008@option{-m68020-40} and @option{-m68020-60} respectively.
13009
13010gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
13011when tuning for 680x0 architecture @var{arch}.  It also defines
13012@samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
13013option is used.  If gcc is tuning for a range of architectures,
13014as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
13015it defines the macros for every architecture in the range.
13016
13017gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
13018ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
13019of the arguments given above.
13020
13021@item -m68000
13022@itemx -mc68000
13023@opindex m68000
13024@opindex mc68000
13025Generate output for a 68000.  This is the default
13026when the compiler is configured for 68000-based systems.
13027It is equivalent to @option{-march=68000}.
13028
13029Use this option for microcontrollers with a 68000 or EC000 core,
13030including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
13031
13032@item -m68010
13033@opindex m68010
13034Generate output for a 68010.  This is the default
13035when the compiler is configured for 68010-based systems.
13036It is equivalent to @option{-march=68010}.
13037
13038@item -m68020
13039@itemx -mc68020
13040@opindex m68020
13041@opindex mc68020
13042Generate output for a 68020.  This is the default
13043when the compiler is configured for 68020-based systems.
13044It is equivalent to @option{-march=68020}.
13045
13046@item -m68030
13047@opindex m68030
13048Generate output for a 68030.  This is the default when the compiler is
13049configured for 68030-based systems.  It is equivalent to
13050@option{-march=68030}.
13051
13052@item -m68040
13053@opindex m68040
13054Generate output for a 68040.  This is the default when the compiler is
13055configured for 68040-based systems.  It is equivalent to
13056@option{-march=68040}.
13057
13058This option inhibits the use of 68881/68882 instructions that have to be
13059emulated by software on the 68040.  Use this option if your 68040 does not
13060have code to emulate those instructions.
13061
13062@item -m68060
13063@opindex m68060
13064Generate output for a 68060.  This is the default when the compiler is
13065configured for 68060-based systems.  It is equivalent to
13066@option{-march=68060}.
13067
13068This option inhibits the use of 68020 and 68881/68882 instructions that
13069have to be emulated by software on the 68060.  Use this option if your 68060
13070does not have code to emulate those instructions.
13071
13072@item -mcpu32
13073@opindex mcpu32
13074Generate output for a CPU32.  This is the default
13075when the compiler is configured for CPU32-based systems.
13076It is equivalent to @option{-march=cpu32}.
13077
13078Use this option for microcontrollers with a
13079CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
1308068336, 68340, 68341, 68349 and 68360.
13081
13082@item -m5200
13083@opindex m5200
13084Generate output for a 520X ColdFire CPU@.  This is the default
13085when the compiler is configured for 520X-based systems.
13086It is equivalent to @option{-mcpu=5206}, and is now deprecated
13087in favor of that option.
13088
13089Use this option for microcontroller with a 5200 core, including
13090the MCF5202, MCF5203, MCF5204 and MCF5206.
13091
13092@item -m5206e
13093@opindex m5206e
13094Generate output for a 5206e ColdFire CPU@.  The option is now
13095deprecated in favor of the equivalent @option{-mcpu=5206e}.
13096
13097@item -m528x
13098@opindex m528x
13099Generate output for a member of the ColdFire 528X family.
13100The option is now deprecated in favor of the equivalent
13101@option{-mcpu=528x}.
13102
13103@item -m5307
13104@opindex m5307
13105Generate output for a ColdFire 5307 CPU@.  The option is now deprecated
13106in favor of the equivalent @option{-mcpu=5307}.
13107
13108@item -m5407
13109@opindex m5407
13110Generate output for a ColdFire 5407 CPU@.  The option is now deprecated
13111in favor of the equivalent @option{-mcpu=5407}.
13112
13113@item -mcfv4e
13114@opindex mcfv4e
13115Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
13116This includes use of hardware floating point instructions.
13117The option is equivalent to @option{-mcpu=547x}, and is now
13118deprecated in favor of that option.
13119
13120@item -m68020-40
13121@opindex m68020-40
13122Generate output for a 68040, without using any of the new instructions.
13123This results in code which can run relatively efficiently on either a
1312468020/68881 or a 68030 or a 68040.  The generated code does use the
1312568881 instructions that are emulated on the 68040.
13126
13127The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
13128
13129@item -m68020-60
13130@opindex m68020-60
13131Generate output for a 68060, without using any of the new instructions.
13132This results in code which can run relatively efficiently on either a
1313368020/68881 or a 68030 or a 68040.  The generated code does use the
1313468881 instructions that are emulated on the 68060.
13135
13136The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
13137
13138@item -mhard-float
13139@itemx -m68881
13140@opindex mhard-float
13141@opindex m68881
13142Generate floating-point instructions.  This is the default for 68020
13143and above, and for ColdFire devices that have an FPU@.  It defines the
13144macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
13145on ColdFire targets.
13146
13147@item -msoft-float
13148@opindex msoft-float
13149Do not generate floating-point instructions; use library calls instead.
13150This is the default for 68000, 68010, and 68832 targets.  It is also
13151the default for ColdFire devices that have no FPU.
13152
13153@item -mdiv
13154@itemx -mno-div
13155@opindex mdiv
13156@opindex mno-div
13157Generate (do not generate) ColdFire hardware divide and remainder
13158instructions.  If @option{-march} is used without @option{-mcpu},
13159the default is ``on'' for ColdFire architectures and ``off'' for M680x0
13160architectures.  Otherwise, the default is taken from the target CPU
13161(either the default CPU, or the one specified by @option{-mcpu}).  For
13162example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
13163@option{-mcpu=5206e}.
13164
13165gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
13166
13167@item -mshort
13168@opindex mshort
13169Consider type @code{int} to be 16 bits wide, like @code{short int}.
13170Additionally, parameters passed on the stack are also aligned to a
1317116-bit boundary even on targets whose API mandates promotion to 32-bit.
13172
13173@item -mno-short
13174@opindex mno-short
13175Do not consider type @code{int} to be 16 bits wide.  This is the default.
13176
13177@item -mnobitfield
13178@itemx -mno-bitfield
13179@opindex mnobitfield
13180@opindex mno-bitfield
13181Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
13182and @option{-m5200} options imply @w{@option{-mnobitfield}}.
13183
13184@item -mbitfield
13185@opindex mbitfield
13186Do use the bit-field instructions.  The @option{-m68020} option implies
13187@option{-mbitfield}.  This is the default if you use a configuration
13188designed for a 68020.
13189
13190@item -mrtd
13191@opindex mrtd
13192Use a different function-calling convention, in which functions
13193that take a fixed number of arguments return with the @code{rtd}
13194instruction, which pops their arguments while returning.  This
13195saves one instruction in the caller since there is no need to pop
13196the arguments there.
13197
13198This calling convention is incompatible with the one normally
13199used on Unix, so you cannot use it if you need to call libraries
13200compiled with the Unix compiler.
13201
13202Also, you must provide function prototypes for all functions that
13203take variable numbers of arguments (including @code{printf});
13204otherwise incorrect code will be generated for calls to those
13205functions.
13206
13207In addition, seriously incorrect code will result if you call a
13208function with too many arguments.  (Normally, extra arguments are
13209harmlessly ignored.)
13210
13211The @code{rtd} instruction is supported by the 68010, 68020, 68030,
1321268040, 68060 and CPU32 processors, but not by the 68000 or 5200.
13213
13214@item -mno-rtd
13215@opindex mno-rtd
13216Do not use the calling conventions selected by @option{-mrtd}.
13217This is the default.
13218
13219@item -malign-int
13220@itemx -mno-align-int
13221@opindex malign-int
13222@opindex mno-align-int
13223Control whether GCC aligns @code{int}, @code{long}, @code{long long},
13224@code{float}, @code{double}, and @code{long double} variables on a 32-bit
13225boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
13226Aligning variables on 32-bit boundaries produces code that runs somewhat
13227faster on processors with 32-bit busses at the expense of more memory.
13228
13229@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
13230align structures containing the above types  differently than
13231most published application binary interface specifications for the m68k.
13232
13233@item -mpcrel
13234@opindex mpcrel
13235Use the pc-relative addressing mode of the 68000 directly, instead of
13236using a global offset table.  At present, this option implies @option{-fpic},
13237allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
13238not presently supported with @option{-mpcrel}, though this could be supported for
1323968020 and higher processors.
13240
13241@item -mno-strict-align
13242@itemx -mstrict-align
13243@opindex mno-strict-align
13244@opindex mstrict-align
13245Do not (do) assume that unaligned memory references will be handled by
13246the system.
13247
13248@item -msep-data
13249Generate code that allows the data segment to be located in a different
13250area of memory from the text segment.  This allows for execute in place in
13251an environment without virtual memory management.  This option implies
13252@option{-fPIC}.
13253
13254@item -mno-sep-data
13255Generate code that assumes that the data segment follows the text segment.
13256This is the default.
13257
13258@item -mid-shared-library
13259Generate code that supports shared libraries via the library ID method.
13260This allows for execute in place and shared libraries in an environment
13261without virtual memory management.  This option implies @option{-fPIC}.
13262
13263@item -mno-id-shared-library
13264Generate code that doesn't assume ID based shared libraries are being used.
13265This is the default.
13266
13267@item -mshared-library-id=n
13268Specified the identification number of the ID based shared library being
13269compiled.  Specifying a value of 0 will generate more compact code, specifying
13270other values will force the allocation of that number to the current
13271library but is no more space or time efficient than omitting this option.
13272
13273@item -mxgot
13274@itemx -mno-xgot
13275@opindex mxgot
13276@opindex mno-xgot
13277When generating position-independent code for ColdFire, generate code
13278that works if the GOT has more than 8192 entries.  This code is
13279larger and slower than code generated without this option.  On M680x0
13280processors, this option is not needed; @option{-fPIC} suffices.
13281
13282GCC normally uses a single instruction to load values from the GOT@.
13283While this is relatively efficient, it only works if the GOT
13284is smaller than about 64k.  Anything larger causes the linker
13285to report an error such as:
13286
13287@cindex relocation truncated to fit (ColdFire)
13288@smallexample
13289relocation truncated to fit: R_68K_GOT16O foobar
13290@end smallexample
13291
13292If this happens, you should recompile your code with @option{-mxgot}.
13293It should then work with very large GOTs.  However, code generated with
13294@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
13295the value of a global symbol.
13296
13297Note that some linkers, including newer versions of the GNU linker,
13298can create multiple GOTs and sort GOT entries.  If you have such a linker,
13299you should only need to use @option{-mxgot} when compiling a single
13300object file that accesses more than 8192 GOT entries.  Very few do.
13301
13302These options have no effect unless GCC is generating
13303position-independent code.
13304
13305@end table
13306
13307@node M68hc1x Options
13308@subsection M68hc1x Options
13309@cindex M68hc1x options
13310
13311These are the @samp{-m} options defined for the 68hc11 and 68hc12
13312microcontrollers.  The default values for these options depends on
13313which style of microcontroller was selected when the compiler was configured;
13314the defaults for the most common choices are given below.
13315
13316@table @gcctabopt
13317@item -m6811
13318@itemx -m68hc11
13319@opindex m6811
13320@opindex m68hc11
13321Generate output for a 68HC11.  This is the default
13322when the compiler is configured for 68HC11-based systems.
13323
13324@item -m6812
13325@itemx -m68hc12
13326@opindex m6812
13327@opindex m68hc12
13328Generate output for a 68HC12.  This is the default
13329when the compiler is configured for 68HC12-based systems.
13330
13331@item -m68S12
13332@itemx -m68hcs12
13333@opindex m68S12
13334@opindex m68hcs12
13335Generate output for a 68HCS12.
13336
13337@item -mauto-incdec
13338@opindex mauto-incdec
13339Enable the use of 68HC12 pre and post auto-increment and auto-decrement
13340addressing modes.
13341
13342@item -minmax
13343@itemx -mnominmax
13344@opindex minmax
13345@opindex mnominmax
13346Enable the use of 68HC12 min and max instructions.
13347
13348@item -mlong-calls
13349@itemx -mno-long-calls
13350@opindex mlong-calls
13351@opindex mno-long-calls
13352Treat all calls as being far away (near).  If calls are assumed to be
13353far away, the compiler will use the @code{call} instruction to
13354call a function and the @code{rtc} instruction for returning.
13355
13356@item -mshort
13357@opindex mshort
13358Consider type @code{int} to be 16 bits wide, like @code{short int}.
13359
13360@item -msoft-reg-count=@var{count}
13361@opindex msoft-reg-count
13362Specify the number of pseudo-soft registers which are used for the
13363code generation.  The maximum number is 32.  Using more pseudo-soft
13364register may or may not result in better code depending on the program.
13365The default is 4 for 68HC11 and 2 for 68HC12.
13366
13367@end table
13368
13369@node MCore Options
13370@subsection MCore Options
13371@cindex MCore options
13372
13373These are the @samp{-m} options defined for the Motorola M*Core
13374processors.
13375
13376@table @gcctabopt
13377
13378@item -mhardlit
13379@itemx -mno-hardlit
13380@opindex mhardlit
13381@opindex mno-hardlit
13382Inline constants into the code stream if it can be done in two
13383instructions or less.
13384
13385@item -mdiv
13386@itemx -mno-div
13387@opindex mdiv
13388@opindex mno-div
13389Use the divide instruction.  (Enabled by default).
13390
13391@item -mrelax-immediate
13392@itemx -mno-relax-immediate
13393@opindex mrelax-immediate
13394@opindex mno-relax-immediate
13395Allow arbitrary sized immediates in bit operations.
13396
13397@item -mwide-bitfields
13398@itemx -mno-wide-bitfields
13399@opindex mwide-bitfields
13400@opindex mno-wide-bitfields
13401Always treat bit-fields as int-sized.
13402
13403@item -m4byte-functions
13404@itemx -mno-4byte-functions
13405@opindex m4byte-functions
13406@opindex mno-4byte-functions
13407Force all functions to be aligned to a four byte boundary.
13408
13409@item -mcallgraph-data
13410@itemx -mno-callgraph-data
13411@opindex mcallgraph-data
13412@opindex mno-callgraph-data
13413Emit callgraph information.
13414
13415@item -mslow-bytes
13416@itemx -mno-slow-bytes
13417@opindex mslow-bytes
13418@opindex mno-slow-bytes
13419Prefer word access when reading byte quantities.
13420
13421@item -mlittle-endian
13422@itemx -mbig-endian
13423@opindex mlittle-endian
13424@opindex mbig-endian
13425Generate code for a little endian target.
13426
13427@item -m210
13428@itemx -m340
13429@opindex m210
13430@opindex m340
13431Generate code for the 210 processor.
13432
13433@item -mno-lsim
13434@opindex mno-lsim
13435Assume that run-time support has been provided and so omit the
13436simulator library (@file{libsim.a)} from the linker command line.
13437
13438@item -mstack-increment=@var{size}
13439@opindex mstack-increment
13440Set the maximum amount for a single stack increment operation.  Large
13441values can increase the speed of programs which contain functions
13442that need a large amount of stack space, but they can also trigger a
13443segmentation fault if the stack is extended too much.  The default
13444value is 0x1000.
13445
13446@end table
13447
13448@node MeP Options
13449@subsection MeP Options
13450@cindex MeP options
13451
13452@table @gcctabopt
13453
13454@item -mabsdiff
13455@opindex mabsdiff
13456Enables the @code{abs} instruction, which is the absolute difference
13457between two registers.
13458
13459@item -mall-opts
13460@opindex mall-opts
13461Enables all the optional instructions - average, multiply, divide, bit
13462operations, leading zero, absolute difference, min/max, clip, and
13463saturation.
13464
13465
13466@item -maverage
13467@opindex maverage
13468Enables the @code{ave} instruction, which computes the average of two
13469registers.
13470
13471@item -mbased=@var{n}
13472@opindex mbased=
13473Variables of size @var{n} bytes or smaller will be placed in the
13474@code{.based} section by default.  Based variables use the @code{$tp}
13475register as a base register, and there is a 128 byte limit to the
13476@code{.based} section.
13477
13478@item -mbitops
13479@opindex mbitops
13480Enables the bit operation instructions - bit test (@code{btstm}), set
13481(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
13482test-and-set (@code{tas}).
13483
13484@item -mc=@var{name}
13485@opindex mc=
13486Selects which section constant data will be placed in.  @var{name} may
13487be @code{tiny}, @code{near}, or @code{far}.
13488
13489@item -mclip
13490@opindex mclip
13491Enables the @code{clip} instruction.  Note that @code{-mclip} is not
13492useful unless you also provide @code{-mminmax}.
13493
13494@item -mconfig=@var{name}
13495@opindex mconfig=
13496Selects one of the build-in core configurations.  Each MeP chip has
13497one or more modules in it; each module has a core CPU and a variety of
13498coprocessors, optional instructions, and peripherals.  The
13499@code{MeP-Integrator} tool, not part of GCC, provides these
13500configurations through this option; using this option is the same as
13501using all the corresponding command line options.  The default
13502configuration is @code{default}.
13503
13504@item -mcop
13505@opindex mcop
13506Enables the coprocessor instructions.  By default, this is a 32-bit
13507coprocessor.  Note that the coprocessor is normally enabled via the
13508@code{-mconfig=} option.
13509
13510@item -mcop32
13511@opindex mcop32
13512Enables the 32-bit coprocessor's instructions.
13513
13514@item -mcop64
13515@opindex mcop64
13516Enables the 64-bit coprocessor's instructions.
13517
13518@item -mivc2
13519@opindex mivc2
13520Enables IVC2 scheduling.  IVC2 is a 64-bit VLIW coprocessor.
13521
13522@item -mdc
13523@opindex mdc
13524Causes constant variables to be placed in the @code{.near} section.
13525
13526@item -mdiv
13527@opindex mdiv
13528Enables the @code{div} and @code{divu} instructions.
13529
13530@item -meb
13531@opindex meb
13532Generate big-endian code.
13533
13534@item -mel
13535@opindex mel
13536Generate little-endian code.
13537
13538@item -mio-volatile
13539@opindex mio-volatile
13540Tells the compiler that any variable marked with the @code{io}
13541attribute is to be considered volatile.
13542
13543@item -ml
13544@opindex ml
13545Causes variables to be assigned to the @code{.far} section by default.
13546
13547@item -mleadz
13548@opindex mleadz
13549Enables the @code{leadz} (leading zero) instruction.
13550
13551@item -mm
13552@opindex mm
13553Causes variables to be assigned to the @code{.near} section by default.
13554
13555@item -mminmax
13556@opindex mminmax
13557Enables the @code{min} and @code{max} instructions.
13558
13559@item -mmult
13560@opindex mmult
13561Enables the multiplication and multiply-accumulate instructions.
13562
13563@item -mno-opts
13564@opindex mno-opts
13565Disables all the optional instructions enabled by @code{-mall-opts}.
13566
13567@item -mrepeat
13568@opindex mrepeat
13569Enables the @code{repeat} and @code{erepeat} instructions, used for
13570low-overhead looping.
13571
13572@item -ms
13573@opindex ms
13574Causes all variables to default to the @code{.tiny} section.  Note
13575that there is a 65536 byte limit to this section.  Accesses to these
13576variables use the @code{%gp} base register.
13577
13578@item -msatur
13579@opindex msatur
13580Enables the saturation instructions.  Note that the compiler does not
13581currently generate these itself, but this option is included for
13582compatibility with other tools, like @code{as}.
13583
13584@item -msdram
13585@opindex msdram
13586Link the SDRAM-based runtime instead of the default ROM-based runtime.
13587
13588@item -msim
13589@opindex msim
13590Link the simulator runtime libraries.
13591
13592@item -msimnovec
13593@opindex msimnovec
13594Link the simulator runtime libraries, excluding built-in support
13595for reset and exception vectors and tables.
13596
13597@item -mtf
13598@opindex mtf
13599Causes all functions to default to the @code{.far} section.  Without
13600this option, functions default to the @code{.near} section.
13601
13602@item -mtiny=@var{n}
13603@opindex mtiny=
13604Variables that are @var{n} bytes or smaller will be allocated to the
13605@code{.tiny} section.  These variables use the @code{$gp} base
13606register.  The default for this option is 4, but note that there's a
1360765536 byte limit to the @code{.tiny} section.
13608
13609@end table
13610
13611@node MIPS Options
13612@subsection MIPS Options
13613@cindex MIPS options
13614
13615@table @gcctabopt
13616
13617@item -EB
13618@opindex EB
13619Generate big-endian code.
13620
13621@item -EL
13622@opindex EL
13623Generate little-endian code.  This is the default for @samp{mips*el-*-*}
13624configurations.
13625
13626@item -march=@var{arch}
13627@opindex march
13628Generate code that will run on @var{arch}, which can be the name of a
13629generic MIPS ISA, or the name of a particular processor.
13630The ISA names are:
13631@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
13632@samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
13633The processor names are:
13634@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
13635@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
13636@samp{5kc}, @samp{5kf},
13637@samp{20kc},
13638@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
13639@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
13640@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
13641@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
13642@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
13643@samp{loongson2e}, @samp{loongson2f},
13644@samp{m4k},
13645@samp{octeon},
13646@samp{orion},
13647@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
13648@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
13649@samp{rm7000}, @samp{rm9000},
13650@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
13651@samp{sb1},
13652@samp{sr71000},
13653@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
13654@samp{vr5000}, @samp{vr5400}, @samp{vr5500}
13655and @samp{xlr}.
13656The special value @samp{from-abi} selects the
13657most compatible architecture for the selected ABI (that is,
13658@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
13659
13660Native Linux/GNU toolchains also support the value @samp{native},
13661which selects the best architecture option for the host processor.
13662@option{-march=native} has no effect if GCC does not recognize
13663the processor.
13664
13665In processor names, a final @samp{000} can be abbreviated as @samp{k}
13666(for example, @samp{-march=r2k}).  Prefixes are optional, and
13667@samp{vr} may be written @samp{r}.
13668
13669Names of the form @samp{@var{n}f2_1} refer to processors with
13670FPUs clocked at half the rate of the core, names of the form
13671@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
13672rate as the core, and names of the form @samp{@var{n}f3_2} refer to
13673processors with FPUs clocked a ratio of 3:2 with respect to the core.
13674For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
13675for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
13676accepted as synonyms for @samp{@var{n}f1_1}.
13677
13678GCC defines two macros based on the value of this option.  The first
13679is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
13680a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
13681where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
13682For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
13683to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
13684
13685Note that the @samp{_MIPS_ARCH} macro uses the processor names given
13686above.  In other words, it will have the full prefix and will not
13687abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
13688the macro names the resolved architecture (either @samp{"mips1"} or
13689@samp{"mips3"}).  It names the default architecture when no
13690@option{-march} option is given.
13691
13692@item -mtune=@var{arch}
13693@opindex mtune
13694Optimize for @var{arch}.  Among other things, this option controls
13695the way instructions are scheduled, and the perceived cost of arithmetic
13696operations.  The list of @var{arch} values is the same as for
13697@option{-march}.
13698
13699When this option is not used, GCC will optimize for the processor
13700specified by @option{-march}.  By using @option{-march} and
13701@option{-mtune} together, it is possible to generate code that will
13702run on a family of processors, but optimize the code for one
13703particular member of that family.
13704
13705@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
13706@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
13707@samp{-march} ones described above.
13708
13709@item -mips1
13710@opindex mips1
13711Equivalent to @samp{-march=mips1}.
13712
13713@item -mips2
13714@opindex mips2
13715Equivalent to @samp{-march=mips2}.
13716
13717@item -mips3
13718@opindex mips3
13719Equivalent to @samp{-march=mips3}.
13720
13721@item -mips4
13722@opindex mips4
13723Equivalent to @samp{-march=mips4}.
13724
13725@item -mips32
13726@opindex mips32
13727Equivalent to @samp{-march=mips32}.
13728
13729@item -mips32r2
13730@opindex mips32r2
13731Equivalent to @samp{-march=mips32r2}.
13732
13733@item -mips64
13734@opindex mips64
13735Equivalent to @samp{-march=mips64}.
13736
13737@item -mips64r2
13738@opindex mips64r2
13739Equivalent to @samp{-march=mips64r2}.
13740
13741@item -mips16
13742@itemx -mno-mips16
13743@opindex mips16
13744@opindex mno-mips16
13745Generate (do not generate) MIPS16 code.  If GCC is targetting a
13746MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
13747
13748MIPS16 code generation can also be controlled on a per-function basis
13749by means of @code{mips16} and @code{nomips16} attributes.
13750@xref{Function Attributes}, for more information.
13751
13752@item -mflip-mips16
13753@opindex mflip-mips16
13754Generate MIPS16 code on alternating functions.  This option is provided
13755for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
13756not intended for ordinary use in compiling user code.
13757
13758@item -minterlink-mips16
13759@itemx -mno-interlink-mips16
13760@opindex minterlink-mips16
13761@opindex mno-interlink-mips16
13762Require (do not require) that non-MIPS16 code be link-compatible with
13763MIPS16 code.
13764
13765For example, non-MIPS16 code cannot jump directly to MIPS16 code;
13766it must either use a call or an indirect jump.  @option{-minterlink-mips16}
13767therefore disables direct jumps unless GCC knows that the target of the
13768jump is not MIPS16.
13769
13770@item -mabi=32
13771@itemx -mabi=o64
13772@itemx -mabi=n32
13773@itemx -mabi=64
13774@itemx -mabi=eabi
13775@opindex mabi=32
13776@opindex mabi=o64
13777@opindex mabi=n32
13778@opindex mabi=64
13779@opindex mabi=eabi
13780Generate code for the given ABI@.
13781
13782Note that the EABI has a 32-bit and a 64-bit variant.  GCC normally
13783generates 64-bit code when you select a 64-bit architecture, but you
13784can use @option{-mgp32} to get 32-bit code instead.
13785
13786For information about the O64 ABI, see
13787@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
13788
13789GCC supports a variant of the o32 ABI in which floating-point registers
13790are 64 rather than 32 bits wide.  You can select this combination with
13791@option{-mabi=32} @option{-mfp64}.  This ABI relies on the @samp{mthc1}
13792and @samp{mfhc1} instructions and is therefore only supported for
13793MIPS32R2 processors.
13794
13795The register assignments for arguments and return values remain the
13796same, but each scalar value is passed in a single 64-bit register
13797rather than a pair of 32-bit registers.  For example, scalar
13798floating-point values are returned in @samp{$f0} only, not a
13799@samp{$f0}/@samp{$f1} pair.  The set of call-saved registers also
13800remains the same, but all 64 bits are saved.
13801
13802@item -mabicalls
13803@itemx -mno-abicalls
13804@opindex mabicalls
13805@opindex mno-abicalls
13806Generate (do not generate) code that is suitable for SVR4-style
13807dynamic objects.  @option{-mabicalls} is the default for SVR4-based
13808systems.
13809
13810@item -mshared
13811@itemx -mno-shared
13812Generate (do not generate) code that is fully position-independent,
13813and that can therefore be linked into shared libraries.  This option
13814only affects @option{-mabicalls}.
13815
13816All @option{-mabicalls} code has traditionally been position-independent,
13817regardless of options like @option{-fPIC} and @option{-fpic}.  However,
13818as an extension, the GNU toolchain allows executables to use absolute
13819accesses for locally-binding symbols.  It can also use shorter GP
13820initialization sequences and generate direct calls to locally-defined
13821functions.  This mode is selected by @option{-mno-shared}.
13822
13823@option{-mno-shared} depends on binutils 2.16 or higher and generates
13824objects that can only be linked by the GNU linker.  However, the option
13825does not affect the ABI of the final executable; it only affects the ABI
13826of relocatable objects.  Using @option{-mno-shared} will generally make
13827executables both smaller and quicker.
13828
13829@option{-mshared} is the default.
13830
13831@item -mplt
13832@itemx -mno-plt
13833@opindex mplt
13834@opindex mno-plt
13835Assume (do not assume) that the static and dynamic linkers
13836support PLTs and copy relocations.  This option only affects
13837@samp{-mno-shared -mabicalls}.  For the n64 ABI, this option
13838has no effect without @samp{-msym32}.
13839
13840You can make @option{-mplt} the default by configuring
13841GCC with @option{--with-mips-plt}.  The default is
13842@option{-mno-plt} otherwise.
13843
13844@item -mxgot
13845@itemx -mno-xgot
13846@opindex mxgot
13847@opindex mno-xgot
13848Lift (do not lift) the usual restrictions on the size of the global
13849offset table.
13850
13851GCC normally uses a single instruction to load values from the GOT@.
13852While this is relatively efficient, it will only work if the GOT
13853is smaller than about 64k.  Anything larger will cause the linker
13854to report an error such as:
13855
13856@cindex relocation truncated to fit (MIPS)
13857@smallexample
13858relocation truncated to fit: R_MIPS_GOT16 foobar
13859@end smallexample
13860
13861If this happens, you should recompile your code with @option{-mxgot}.
13862It should then work with very large GOTs, although it will also be
13863less efficient, since it will take three instructions to fetch the
13864value of a global symbol.
13865
13866Note that some linkers can create multiple GOTs.  If you have such a
13867linker, you should only need to use @option{-mxgot} when a single object
13868file accesses more than 64k's worth of GOT entries.  Very few do.
13869
13870These options have no effect unless GCC is generating position
13871independent code.
13872
13873@item -mgp32
13874@opindex mgp32
13875Assume that general-purpose registers are 32 bits wide.
13876
13877@item -mgp64
13878@opindex mgp64
13879Assume that general-purpose registers are 64 bits wide.
13880
13881@item -mfp32
13882@opindex mfp32
13883Assume that floating-point registers are 32 bits wide.
13884
13885@item -mfp64
13886@opindex mfp64
13887Assume that floating-point registers are 64 bits wide.
13888
13889@item -mhard-float
13890@opindex mhard-float
13891Use floating-point coprocessor instructions.
13892
13893@item -msoft-float
13894@opindex msoft-float
13895Do not use floating-point coprocessor instructions.  Implement
13896floating-point calculations using library calls instead.
13897
13898@item -msingle-float
13899@opindex msingle-float
13900Assume that the floating-point coprocessor only supports single-precision
13901operations.
13902
13903@item -mdouble-float
13904@opindex mdouble-float
13905Assume that the floating-point coprocessor supports double-precision
13906operations.  This is the default.
13907
13908@item -mllsc
13909@itemx -mno-llsc
13910@opindex mllsc
13911@opindex mno-llsc
13912Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
13913implement atomic memory built-in functions.  When neither option is
13914specified, GCC will use the instructions if the target architecture
13915supports them.
13916
13917@option{-mllsc} is useful if the runtime environment can emulate the
13918instructions and @option{-mno-llsc} can be useful when compiling for
13919nonstandard ISAs.  You can make either option the default by
13920configuring GCC with @option{--with-llsc} and @option{--without-llsc}
13921respectively.  @option{--with-llsc} is the default for some
13922configurations; see the installation documentation for details.
13923
13924@item -mdsp
13925@itemx -mno-dsp
13926@opindex mdsp
13927@opindex mno-dsp
13928Use (do not use) revision 1 of the MIPS DSP ASE@.
13929@xref{MIPS DSP Built-in Functions}.  This option defines the
13930preprocessor macro @samp{__mips_dsp}.  It also defines
13931@samp{__mips_dsp_rev} to 1.
13932
13933@item -mdspr2
13934@itemx -mno-dspr2
13935@opindex mdspr2
13936@opindex mno-dspr2
13937Use (do not use) revision 2 of the MIPS DSP ASE@.
13938@xref{MIPS DSP Built-in Functions}.  This option defines the
13939preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
13940It also defines @samp{__mips_dsp_rev} to 2.
13941
13942@item -msmartmips
13943@itemx -mno-smartmips
13944@opindex msmartmips
13945@opindex mno-smartmips
13946Use (do not use) the MIPS SmartMIPS ASE.
13947
13948@item -mpaired-single
13949@itemx -mno-paired-single
13950@opindex mpaired-single
13951@opindex mno-paired-single
13952Use (do not use) paired-single floating-point instructions.
13953@xref{MIPS Paired-Single Support}.  This option requires
13954hardware floating-point support to be enabled.
13955
13956@item -mdmx
13957@itemx -mno-mdmx
13958@opindex mdmx
13959@opindex mno-mdmx
13960Use (do not use) MIPS Digital Media Extension instructions.
13961This option can only be used when generating 64-bit code and requires
13962hardware floating-point support to be enabled.
13963
13964@item -mips3d
13965@itemx -mno-mips3d
13966@opindex mips3d
13967@opindex mno-mips3d
13968Use (do not use) the MIPS-3D ASE@.  @xref{MIPS-3D Built-in Functions}.
13969The option @option{-mips3d} implies @option{-mpaired-single}.
13970
13971@item -mmt
13972@itemx -mno-mt
13973@opindex mmt
13974@opindex mno-mt
13975Use (do not use) MT Multithreading instructions.
13976
13977@item -mlong64
13978@opindex mlong64
13979Force @code{long} types to be 64 bits wide.  See @option{-mlong32} for
13980an explanation of the default and the way that the pointer size is
13981determined.
13982
13983@item -mlong32
13984@opindex mlong32
13985Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
13986
13987The default size of @code{int}s, @code{long}s and pointers depends on
13988the ABI@.  All the supported ABIs use 32-bit @code{int}s.  The n64 ABI
13989uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
1399032-bit @code{long}s.  Pointers are the same size as @code{long}s,
13991or the same size as integer registers, whichever is smaller.
13992
13993@item -msym32
13994@itemx -mno-sym32
13995@opindex msym32
13996@opindex mno-sym32
13997Assume (do not assume) that all symbols have 32-bit values, regardless
13998of the selected ABI@.  This option is useful in combination with
13999@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
14000to generate shorter and faster references to symbolic addresses.
14001
14002@item -G @var{num}
14003@opindex G
14004Put definitions of externally-visible data in a small data section
14005if that data is no bigger than @var{num} bytes.  GCC can then access
14006the data more efficiently; see @option{-mgpopt} for details.
14007
14008The default @option{-G} option depends on the configuration.
14009
14010@item -mlocal-sdata
14011@itemx -mno-local-sdata
14012@opindex mlocal-sdata
14013@opindex mno-local-sdata
14014Extend (do not extend) the @option{-G} behavior to local data too,
14015such as to static variables in C@.  @option{-mlocal-sdata} is the
14016default for all configurations.
14017
14018If the linker complains that an application is using too much small data,
14019you might want to try rebuilding the less performance-critical parts with
14020@option{-mno-local-sdata}.  You might also want to build large
14021libraries with @option{-mno-local-sdata}, so that the libraries leave
14022more room for the main program.
14023
14024@item -mextern-sdata
14025@itemx -mno-extern-sdata
14026@opindex mextern-sdata
14027@opindex mno-extern-sdata
14028Assume (do not assume) that externally-defined data will be in
14029a small data section if that data is within the @option{-G} limit.
14030@option{-mextern-sdata} is the default for all configurations.
14031
14032If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
14033@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
14034that is no bigger than @var{num} bytes, you must make sure that @var{Var}
14035is placed in a small data section.  If @var{Var} is defined by another
14036module, you must either compile that module with a high-enough
14037@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
14038definition.  If @var{Var} is common, you must link the application
14039with a high-enough @option{-G} setting.
14040
14041The easiest way of satisfying these restrictions is to compile
14042and link every module with the same @option{-G} option.  However,
14043you may wish to build a library that supports several different
14044small data limits.  You can do this by compiling the library with
14045the highest supported @option{-G} setting and additionally using
14046@option{-mno-extern-sdata} to stop the library from making assumptions
14047about externally-defined data.
14048
14049@item -mgpopt
14050@itemx -mno-gpopt
14051@opindex mgpopt
14052@opindex mno-gpopt
14053Use (do not use) GP-relative accesses for symbols that are known to be
14054in a small data section; see @option{-G}, @option{-mlocal-sdata} and
14055@option{-mextern-sdata}.  @option{-mgpopt} is the default for all
14056configurations.
14057
14058@option{-mno-gpopt} is useful for cases where the @code{$gp} register
14059might not hold the value of @code{_gp}.  For example, if the code is
14060part of a library that might be used in a boot monitor, programs that
14061call boot monitor routines will pass an unknown value in @code{$gp}.
14062(In such situations, the boot monitor itself would usually be compiled
14063with @option{-G0}.)
14064
14065@option{-mno-gpopt} implies @option{-mno-local-sdata} and
14066@option{-mno-extern-sdata}.
14067
14068@item -membedded-data
14069@itemx -mno-embedded-data
14070@opindex membedded-data
14071@opindex mno-embedded-data
14072Allocate variables to the read-only data section first if possible, then
14073next in the small data section if possible, otherwise in data.  This gives
14074slightly slower code than the default, but reduces the amount of RAM required
14075when executing, and thus may be preferred for some embedded systems.
14076
14077@item -muninit-const-in-rodata
14078@itemx -mno-uninit-const-in-rodata
14079@opindex muninit-const-in-rodata
14080@opindex mno-uninit-const-in-rodata
14081Put uninitialized @code{const} variables in the read-only data section.
14082This option is only meaningful in conjunction with @option{-membedded-data}.
14083
14084@item -mcode-readable=@var{setting}
14085@opindex mcode-readable
14086Specify whether GCC may generate code that reads from executable sections.
14087There are three possible settings:
14088
14089@table @gcctabopt
14090@item -mcode-readable=yes
14091Instructions may freely access executable sections.  This is the
14092default setting.
14093
14094@item -mcode-readable=pcrel
14095MIPS16 PC-relative load instructions can access executable sections,
14096but other instructions must not do so.  This option is useful on 4KSc
14097and 4KSd processors when the code TLBs have the Read Inhibit bit set.
14098It is also useful on processors that can be configured to have a dual
14099instruction/data SRAM interface and that, like the M4K, automatically
14100redirect PC-relative loads to the instruction RAM.
14101
14102@item -mcode-readable=no
14103Instructions must not access executable sections.  This option can be
14104useful on targets that are configured to have a dual instruction/data
14105SRAM interface but that (unlike the M4K) do not automatically redirect
14106PC-relative loads to the instruction RAM.
14107@end table
14108
14109@item -msplit-addresses
14110@itemx -mno-split-addresses
14111@opindex msplit-addresses
14112@opindex mno-split-addresses
14113Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
14114relocation operators.  This option has been superseded by
14115@option{-mexplicit-relocs} but is retained for backwards compatibility.
14116
14117@item -mexplicit-relocs
14118@itemx -mno-explicit-relocs
14119@opindex mexplicit-relocs
14120@opindex mno-explicit-relocs
14121Use (do not use) assembler relocation operators when dealing with symbolic
14122addresses.  The alternative, selected by @option{-mno-explicit-relocs},
14123is to use assembler macros instead.
14124
14125@option{-mexplicit-relocs} is the default if GCC was configured
14126to use an assembler that supports relocation operators.
14127
14128@item -mcheck-zero-division
14129@itemx -mno-check-zero-division
14130@opindex mcheck-zero-division
14131@opindex mno-check-zero-division
14132Trap (do not trap) on integer division by zero.
14133
14134The default is @option{-mcheck-zero-division}.
14135
14136@item -mdivide-traps
14137@itemx -mdivide-breaks
14138@opindex mdivide-traps
14139@opindex mdivide-breaks
14140MIPS systems check for division by zero by generating either a
14141conditional trap or a break instruction.  Using traps results in
14142smaller code, but is only supported on MIPS II and later.  Also, some
14143versions of the Linux kernel have a bug that prevents trap from
14144generating the proper signal (@code{SIGFPE}).  Use @option{-mdivide-traps} to
14145allow conditional traps on architectures that support them and
14146@option{-mdivide-breaks} to force the use of breaks.
14147
14148The default is usually @option{-mdivide-traps}, but this can be
14149overridden at configure time using @option{--with-divide=breaks}.
14150Divide-by-zero checks can be completely disabled using
14151@option{-mno-check-zero-division}.
14152
14153@item -mmemcpy
14154@itemx -mno-memcpy
14155@opindex mmemcpy
14156@opindex mno-memcpy
14157Force (do not force) the use of @code{memcpy()} for non-trivial block
14158moves.  The default is @option{-mno-memcpy}, which allows GCC to inline
14159most constant-sized copies.
14160
14161@item -mlong-calls
14162@itemx -mno-long-calls
14163@opindex mlong-calls
14164@opindex mno-long-calls
14165Disable (do not disable) use of the @code{jal} instruction.  Calling
14166functions using @code{jal} is more efficient but requires the caller
14167and callee to be in the same 256 megabyte segment.
14168
14169This option has no effect on abicalls code.  The default is
14170@option{-mno-long-calls}.
14171
14172@item -mmad
14173@itemx -mno-mad
14174@opindex mmad
14175@opindex mno-mad
14176Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
14177instructions, as provided by the R4650 ISA@.
14178
14179@item -mfused-madd
14180@itemx -mno-fused-madd
14181@opindex mfused-madd
14182@opindex mno-fused-madd
14183Enable (disable) use of the floating point multiply-accumulate
14184instructions, when they are available.  The default is
14185@option{-mfused-madd}.
14186
14187When multiply-accumulate instructions are used, the intermediate
14188product is calculated to infinite precision and is not subject to
14189the FCSR Flush to Zero bit.  This may be undesirable in some
14190circumstances.
14191
14192@item -nocpp
14193@opindex nocpp
14194Tell the MIPS assembler to not run its preprocessor over user
14195assembler files (with a @samp{.s} suffix) when assembling them.
14196
14197@item -mfix-r4000
14198@itemx -mno-fix-r4000
14199@opindex mfix-r4000
14200@opindex mno-fix-r4000
14201Work around certain R4000 CPU errata:
14202@itemize @minus
14203@item
14204A double-word or a variable shift may give an incorrect result if executed
14205immediately after starting an integer division.
14206@item
14207A double-word or a variable shift may give an incorrect result if executed
14208while an integer multiplication is in progress.
14209@item
14210An integer division may give an incorrect result if started in a delay slot
14211of a taken branch or a jump.
14212@end itemize
14213
14214@item -mfix-r4400
14215@itemx -mno-fix-r4400
14216@opindex mfix-r4400
14217@opindex mno-fix-r4400
14218Work around certain R4400 CPU errata:
14219@itemize @minus
14220@item
14221A double-word or a variable shift may give an incorrect result if executed
14222immediately after starting an integer division.
14223@end itemize
14224
14225@item -mfix-r10000
14226@itemx -mno-fix-r10000
14227@opindex mfix-r10000
14228@opindex mno-fix-r10000
14229Work around certain R10000 errata:
14230@itemize @minus
14231@item
14232@code{ll}/@code{sc} sequences may not behave atomically on revisions
14233prior to 3.0.  They may deadlock on revisions 2.6 and earlier.
14234@end itemize
14235
14236This option can only be used if the target architecture supports
14237branch-likely instructions.  @option{-mfix-r10000} is the default when
14238@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
14239otherwise.
14240
14241@item -mfix-vr4120
14242@itemx -mno-fix-vr4120
14243@opindex mfix-vr4120
14244Work around certain VR4120 errata:
14245@itemize @minus
14246@item
14247@code{dmultu} does not always produce the correct result.
14248@item
14249@code{div} and @code{ddiv} do not always produce the correct result if one
14250of the operands is negative.
14251@end itemize
14252The workarounds for the division errata rely on special functions in
14253@file{libgcc.a}.  At present, these functions are only provided by
14254the @code{mips64vr*-elf} configurations.
14255
14256Other VR4120 errata require a nop to be inserted between certain pairs of
14257instructions.  These errata are handled by the assembler, not by GCC itself.
14258
14259@item -mfix-vr4130
14260@opindex mfix-vr4130
14261Work around the VR4130 @code{mflo}/@code{mfhi} errata.  The
14262workarounds are implemented by the assembler rather than by GCC,
14263although GCC will avoid using @code{mflo} and @code{mfhi} if the
14264VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
14265instructions are available instead.
14266
14267@item -mfix-sb1
14268@itemx -mno-fix-sb1
14269@opindex mfix-sb1
14270Work around certain SB-1 CPU core errata.
14271(This flag currently works around the SB-1 revision 2
14272``F1'' and ``F2'' floating point errata.)
14273
14274@item -mr10k-cache-barrier=@var{setting}
14275@opindex mr10k-cache-barrier
14276Specify whether GCC should insert cache barriers to avoid the
14277side-effects of speculation on R10K processors.
14278
14279In common with many processors, the R10K tries to predict the outcome
14280of a conditional branch and speculatively executes instructions from
14281the ``taken'' branch.  It later aborts these instructions if the
14282predicted outcome was wrong.  However, on the R10K, even aborted
14283instructions can have side effects.
14284
14285This problem only affects kernel stores and, depending on the system,
14286kernel loads.  As an example, a speculatively-executed store may load
14287the target memory into cache and mark the cache line as dirty, even if
14288the store itself is later aborted.  If a DMA operation writes to the
14289same area of memory before the ``dirty'' line is flushed, the cached
14290data will overwrite the DMA-ed data.  See the R10K processor manual
14291for a full description, including other potential problems.
14292
14293One workaround is to insert cache barrier instructions before every memory
14294access that might be speculatively executed and that might have side
14295effects even if aborted.  @option{-mr10k-cache-barrier=@var{setting}}
14296controls GCC's implementation of this workaround.  It assumes that
14297aborted accesses to any byte in the following regions will not have
14298side effects:
14299
14300@enumerate
14301@item
14302the memory occupied by the current function's stack frame;
14303
14304@item
14305the memory occupied by an incoming stack argument;
14306
14307@item
14308the memory occupied by an object with a link-time-constant address.
14309@end enumerate
14310
14311It is the kernel's responsibility to ensure that speculative
14312accesses to these regions are indeed safe.
14313
14314If the input program contains a function declaration such as:
14315
14316@smallexample
14317void foo (void);
14318@end smallexample
14319
14320then the implementation of @code{foo} must allow @code{j foo} and
14321@code{jal foo} to be executed speculatively.  GCC honors this
14322restriction for functions it compiles itself.  It expects non-GCC
14323functions (such as hand-written assembly code) to do the same.
14324
14325The option has three forms:
14326
14327@table @gcctabopt
14328@item -mr10k-cache-barrier=load-store
14329Insert a cache barrier before a load or store that might be
14330speculatively executed and that might have side effects even
14331if aborted.
14332
14333@item -mr10k-cache-barrier=store
14334Insert a cache barrier before a store that might be speculatively
14335executed and that might have side effects even if aborted.
14336
14337@item -mr10k-cache-barrier=none
14338Disable the insertion of cache barriers.  This is the default setting.
14339@end table
14340
14341@item -mflush-func=@var{func}
14342@itemx -mno-flush-func
14343@opindex mflush-func
14344Specifies the function to call to flush the I and D caches, or to not
14345call any such function.  If called, the function must take the same
14346arguments as the common @code{_flush_func()}, that is, the address of the
14347memory range for which the cache is being flushed, the size of the
14348memory range, and the number 3 (to flush both caches).  The default
14349depends on the target GCC was configured for, but commonly is either
14350@samp{_flush_func} or @samp{__cpu_flush}.
14351
14352@item mbranch-cost=@var{num}
14353@opindex mbranch-cost
14354Set the cost of branches to roughly @var{num} ``simple'' instructions.
14355This cost is only a heuristic and is not guaranteed to produce
14356consistent results across releases.  A zero cost redundantly selects
14357the default, which is based on the @option{-mtune} setting.
14358
14359@item -mbranch-likely
14360@itemx -mno-branch-likely
14361@opindex mbranch-likely
14362@opindex mno-branch-likely
14363Enable or disable use of Branch Likely instructions, regardless of the
14364default for the selected architecture.  By default, Branch Likely
14365instructions may be generated if they are supported by the selected
14366architecture.  An exception is for the MIPS32 and MIPS64 architectures
14367and processors which implement those architectures; for those, Branch
14368Likely instructions will not be generated by default because the MIPS32
14369and MIPS64 architectures specifically deprecate their use.
14370
14371@item -mfp-exceptions
14372@itemx -mno-fp-exceptions
14373@opindex mfp-exceptions
14374Specifies whether FP exceptions are enabled.  This affects how we schedule
14375FP instructions for some processors.  The default is that FP exceptions are
14376enabled.
14377
14378For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
1437964-bit code, then we can use both FP pipes.  Otherwise, we can only use one
14380FP pipe.
14381
14382@item -mvr4130-align
14383@itemx -mno-vr4130-align
14384@opindex mvr4130-align
14385The VR4130 pipeline is two-way superscalar, but can only issue two
14386instructions together if the first one is 8-byte aligned.  When this
14387option is enabled, GCC will align pairs of instructions that it
14388thinks should execute in parallel.
14389
14390This option only has an effect when optimizing for the VR4130.
14391It normally makes code faster, but at the expense of making it bigger.
14392It is enabled by default at optimization level @option{-O3}.
14393
14394@item -msynci
14395@itemx -mno-synci
14396@opindex msynci
14397Enable (disable) generation of @code{synci} instructions on
14398architectures that support it.  The @code{synci} instructions (if
14399enabled) will be generated when @code{__builtin___clear_cache()} is
14400compiled.
14401
14402This option defaults to @code{-mno-synci}, but the default can be
14403overridden by configuring with @code{--with-synci}.
14404
14405When compiling code for single processor systems, it is generally safe
14406to use @code{synci}.  However, on many multi-core (SMP) systems, it
14407will not invalidate the instruction caches on all cores and may lead
14408to undefined behavior.
14409
14410@item -mrelax-pic-calls
14411@itemx -mno-relax-pic-calls
14412@opindex mrelax-pic-calls
14413Try to turn PIC calls that are normally dispatched via register
14414@code{$25} into direct calls.  This is only possible if the linker can
14415resolve the destination at link-time and if the destination is within
14416range for a direct call.
14417
14418@option{-mrelax-pic-calls} is the default if GCC was configured to use
14419an assembler and a linker that supports the @code{.reloc} assembly
14420directive and @code{-mexplicit-relocs} is in effect.  With
14421@code{-mno-explicit-relocs}, this optimization can be performed by the
14422assembler and the linker alone without help from the compiler.
14423
14424@item -mmcount-ra-address
14425@itemx -mno-mcount-ra-address
14426@opindex mmcount-ra-address
14427@opindex mno-mcount-ra-address
14428Emit (do not emit) code that allows @code{_mcount} to modify the
14429calling function's return address.  When enabled, this option extends
14430the usual @code{_mcount} interface with a new @var{ra-address}
14431parameter, which has type @code{intptr_t *} and is passed in register
14432@code{$12}.  @code{_mcount} can then modify the return address by
14433doing both of the following:
14434@itemize
14435@item
14436Returning the new address in register @code{$31}.
14437@item
14438Storing the new address in @code{*@var{ra-address}},
14439if @var{ra-address} is nonnull.
14440@end itemize
14441
14442The default is @option{-mno-mcount-ra-address}.
14443
14444@end table
14445
14446@node MMIX Options
14447@subsection MMIX Options
14448@cindex MMIX Options
14449
14450These options are defined for the MMIX:
14451
14452@table @gcctabopt
14453@item -mlibfuncs
14454@itemx -mno-libfuncs
14455@opindex mlibfuncs
14456@opindex mno-libfuncs
14457Specify that intrinsic library functions are being compiled, passing all
14458values in registers, no matter the size.
14459
14460@item -mepsilon
14461@itemx -mno-epsilon
14462@opindex mepsilon
14463@opindex mno-epsilon
14464Generate floating-point comparison instructions that compare with respect
14465to the @code{rE} epsilon register.
14466
14467@item -mabi=mmixware
14468@itemx -mabi=gnu
14469@opindex mabi=mmixware
14470@opindex mabi=gnu
14471Generate code that passes function parameters and return values that (in
14472the called function) are seen as registers @code{$0} and up, as opposed to
14473the GNU ABI which uses global registers @code{$231} and up.
14474
14475@item -mzero-extend
14476@itemx -mno-zero-extend
14477@opindex mzero-extend
14478@opindex mno-zero-extend
14479When reading data from memory in sizes shorter than 64 bits, use (do not
14480use) zero-extending load instructions by default, rather than
14481sign-extending ones.
14482
14483@item -mknuthdiv
14484@itemx -mno-knuthdiv
14485@opindex mknuthdiv
14486@opindex mno-knuthdiv
14487Make the result of a division yielding a remainder have the same sign as
14488the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
14489remainder follows the sign of the dividend.  Both methods are
14490arithmetically valid, the latter being almost exclusively used.
14491
14492@item -mtoplevel-symbols
14493@itemx -mno-toplevel-symbols
14494@opindex mtoplevel-symbols
14495@opindex mno-toplevel-symbols
14496Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
14497code can be used with the @code{PREFIX} assembly directive.
14498
14499@item -melf
14500@opindex melf
14501Generate an executable in the ELF format, rather than the default
14502@samp{mmo} format used by the @command{mmix} simulator.
14503
14504@item -mbranch-predict
14505@itemx -mno-branch-predict
14506@opindex mbranch-predict
14507@opindex mno-branch-predict
14508Use (do not use) the probable-branch instructions, when static branch
14509prediction indicates a probable branch.
14510
14511@item -mbase-addresses
14512@itemx -mno-base-addresses
14513@opindex mbase-addresses
14514@opindex mno-base-addresses
14515Generate (do not generate) code that uses @emph{base addresses}.  Using a
14516base address automatically generates a request (handled by the assembler
14517and the linker) for a constant to be set up in a global register.  The
14518register is used for one or more base address requests within the range 0
14519to 255 from the value held in the register.  The generally leads to short
14520and fast code, but the number of different data items that can be
14521addressed is limited.  This means that a program that uses lots of static
14522data may require @option{-mno-base-addresses}.
14523
14524@item -msingle-exit
14525@itemx -mno-single-exit
14526@opindex msingle-exit
14527@opindex mno-single-exit
14528Force (do not force) generated code to have a single exit point in each
14529function.
14530@end table
14531
14532@node MN10300 Options
14533@subsection MN10300 Options
14534@cindex MN10300 options
14535
14536These @option{-m} options are defined for Matsushita MN10300 architectures:
14537
14538@table @gcctabopt
14539@item -mmult-bug
14540@opindex mmult-bug
14541Generate code to avoid bugs in the multiply instructions for the MN10300
14542processors.  This is the default.
14543
14544@item -mno-mult-bug
14545@opindex mno-mult-bug
14546Do not generate code to avoid bugs in the multiply instructions for the
14547MN10300 processors.
14548
14549@item -mam33
14550@opindex mam33
14551Generate code which uses features specific to the AM33 processor.
14552
14553@item -mno-am33
14554@opindex mno-am33
14555Do not generate code which uses features specific to the AM33 processor.  This
14556is the default.
14557
14558@item -mreturn-pointer-on-d0
14559@opindex mreturn-pointer-on-d0
14560When generating a function which returns a pointer, return the pointer
14561in both @code{a0} and @code{d0}.  Otherwise, the pointer is returned
14562only in a0, and attempts to call such functions without a prototype
14563would result in errors.  Note that this option is on by default; use
14564@option{-mno-return-pointer-on-d0} to disable it.
14565
14566@item -mno-crt0
14567@opindex mno-crt0
14568Do not link in the C run-time initialization object file.
14569
14570@item -mrelax
14571@opindex mrelax
14572Indicate to the linker that it should perform a relaxation optimization pass
14573to shorten branches, calls and absolute memory addresses.  This option only
14574has an effect when used on the command line for the final link step.
14575
14576This option makes symbolic debugging impossible.
14577@end table
14578
14579@node PDP-11 Options
14580@subsection PDP-11 Options
14581@cindex PDP-11 Options
14582
14583These options are defined for the PDP-11:
14584
14585@table @gcctabopt
14586@item -mfpu
14587@opindex mfpu
14588Use hardware FPP floating point.  This is the default.  (FIS floating
14589point on the PDP-11/40 is not supported.)
14590
14591@item -msoft-float
14592@opindex msoft-float
14593Do not use hardware floating point.
14594
14595@item -mac0
14596@opindex mac0
14597Return floating-point results in ac0 (fr0 in Unix assembler syntax).
14598
14599@item -mno-ac0
14600@opindex mno-ac0
14601Return floating-point results in memory.  This is the default.
14602
14603@item -m40
14604@opindex m40
14605Generate code for a PDP-11/40.
14606
14607@item -m45
14608@opindex m45
14609Generate code for a PDP-11/45.  This is the default.
14610
14611@item -m10
14612@opindex m10
14613Generate code for a PDP-11/10.
14614
14615@item -mbcopy-builtin
14616@opindex mbcopy-builtin
14617Use inline @code{movmemhi} patterns for copying memory.  This is the
14618default.
14619
14620@item -mbcopy
14621@opindex mbcopy
14622Do not use inline @code{movmemhi} patterns for copying memory.
14623
14624@item -mint16
14625@itemx -mno-int32
14626@opindex mint16
14627@opindex mno-int32
14628Use 16-bit @code{int}.  This is the default.
14629
14630@item -mint32
14631@itemx -mno-int16
14632@opindex mint32
14633@opindex mno-int16
14634Use 32-bit @code{int}.
14635
14636@item -mfloat64
14637@itemx -mno-float32
14638@opindex mfloat64
14639@opindex mno-float32
14640Use 64-bit @code{float}.  This is the default.
14641
14642@item -mfloat32
14643@itemx -mno-float64
14644@opindex mfloat32
14645@opindex mno-float64
14646Use 32-bit @code{float}.
14647
14648@item -mabshi
14649@opindex mabshi
14650Use @code{abshi2} pattern.  This is the default.
14651
14652@item -mno-abshi
14653@opindex mno-abshi
14654Do not use @code{abshi2} pattern.
14655
14656@item -mbranch-expensive
14657@opindex mbranch-expensive
14658Pretend that branches are expensive.  This is for experimenting with
14659code generation only.
14660
14661@item -mbranch-cheap
14662@opindex mbranch-cheap
14663Do not pretend that branches are expensive.  This is the default.
14664
14665@item -msplit
14666@opindex msplit
14667Generate code for a system with split I&D@.
14668
14669@item -mno-split
14670@opindex mno-split
14671Generate code for a system without split I&D@.  This is the default.
14672
14673@item -munix-asm
14674@opindex munix-asm
14675Use Unix assembler syntax.  This is the default when configured for
14676@samp{pdp11-*-bsd}.
14677
14678@item -mdec-asm
14679@opindex mdec-asm
14680Use DEC assembler syntax.  This is the default when configured for any
14681PDP-11 target other than @samp{pdp11-*-bsd}.
14682@end table
14683
14684@node picoChip Options
14685@subsection picoChip Options
14686@cindex picoChip options
14687
14688These @samp{-m} options are defined for picoChip implementations:
14689
14690@table @gcctabopt
14691
14692@item -mae=@var{ae_type}
14693@opindex mcpu
14694Set the instruction set, register set, and instruction scheduling
14695parameters for array element type @var{ae_type}.  Supported values
14696for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
14697
14698@option{-mae=ANY} selects a completely generic AE type.  Code
14699generated with this option will run on any of the other AE types.  The
14700code will not be as efficient as it would be if compiled for a specific
14701AE type, and some types of operation (e.g., multiplication) will not
14702work properly on all types of AE.
14703
14704@option{-mae=MUL} selects a MUL AE type.  This is the most useful AE type
14705for compiled code, and is the default.
14706
14707@option{-mae=MAC} selects a DSP-style MAC AE.  Code compiled with this
14708option may suffer from poor performance of byte (char) manipulation,
14709since the DSP AE does not provide hardware support for byte load/stores.
14710
14711@item -msymbol-as-address
14712Enable the compiler to directly use a symbol name as an address in a
14713load/store instruction, without first loading it into a
14714register.  Typically, the use of this option will generate larger
14715programs, which run faster than when the option isn't used.  However, the
14716results vary from program to program, so it is left as a user option,
14717rather than being permanently enabled.
14718
14719@item -mno-inefficient-warnings
14720Disables warnings about the generation of inefficient code.  These
14721warnings can be generated, for example, when compiling code which
14722performs byte-level memory operations on the MAC AE type.  The MAC AE has
14723no hardware support for byte-level memory operations, so all byte
14724load/stores must be synthesized from word load/store operations.  This is
14725inefficient and a warning will be generated indicating to the programmer
14726that they should rewrite the code to avoid byte operations, or to target
14727an AE type which has the necessary hardware support.  This option enables
14728the warning to be turned off.
14729
14730@end table
14731
14732@node PowerPC Options
14733@subsection PowerPC Options
14734@cindex PowerPC options
14735
14736These are listed under @xref{RS/6000 and PowerPC Options}.
14737
14738@node RS/6000 and PowerPC Options
14739@subsection IBM RS/6000 and PowerPC Options
14740@cindex RS/6000 and PowerPC Options
14741@cindex IBM RS/6000 and PowerPC Options
14742
14743These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
14744@table @gcctabopt
14745@item -mpower
14746@itemx -mno-power
14747@itemx -mpower2
14748@itemx -mno-power2
14749@itemx -mpowerpc
14750@itemx -mno-powerpc
14751@itemx -mpowerpc-gpopt
14752@itemx -mno-powerpc-gpopt
14753@itemx -mpowerpc-gfxopt
14754@itemx -mno-powerpc-gfxopt
14755@itemx -mpowerpc64
14756@itemx -mno-powerpc64
14757@itemx -mmfcrf
14758@itemx -mno-mfcrf
14759@itemx -mpopcntb
14760@itemx -mno-popcntb
14761@itemx -mpopcntd
14762@itemx -mno-popcntd
14763@itemx -mfprnd
14764@itemx -mno-fprnd
14765@itemx -mcmpb
14766@itemx -mno-cmpb
14767@itemx -mmfpgpr
14768@itemx -mno-mfpgpr
14769@itemx -mhard-dfp
14770@itemx -mno-hard-dfp
14771@opindex mpower
14772@opindex mno-power
14773@opindex mpower2
14774@opindex mno-power2
14775@opindex mpowerpc
14776@opindex mno-powerpc
14777@opindex mpowerpc-gpopt
14778@opindex mno-powerpc-gpopt
14779@opindex mpowerpc-gfxopt
14780@opindex mno-powerpc-gfxopt
14781@opindex mpowerpc64
14782@opindex mno-powerpc64
14783@opindex mmfcrf
14784@opindex mno-mfcrf
14785@opindex mpopcntb
14786@opindex mno-popcntb
14787@opindex mpopcntd
14788@opindex mno-popcntd
14789@opindex mfprnd
14790@opindex mno-fprnd
14791@opindex mcmpb
14792@opindex mno-cmpb
14793@opindex mmfpgpr
14794@opindex mno-mfpgpr
14795@opindex mhard-dfp
14796@opindex mno-hard-dfp
14797GCC supports two related instruction set architectures for the
14798RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
14799instructions supported by the @samp{rios} chip set used in the original
14800RS/6000 systems and the @dfn{PowerPC} instruction set is the
14801architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
14802the IBM 4xx, 6xx, and follow-on microprocessors.
14803
14804Neither architecture is a subset of the other.  However there is a
14805large common subset of instructions supported by both.  An MQ
14806register is included in processors supporting the POWER architecture.
14807
14808You use these options to specify which instructions are available on the
14809processor you are using.  The default value of these options is
14810determined when configuring GCC@.  Specifying the
14811@option{-mcpu=@var{cpu_type}} overrides the specification of these
14812options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
14813rather than the options listed above.
14814
14815The @option{-mpower} option allows GCC to generate instructions that
14816are found only in the POWER architecture and to use the MQ register.
14817Specifying @option{-mpower2} implies @option{-power} and also allows GCC
14818to generate instructions that are present in the POWER2 architecture but
14819not the original POWER architecture.
14820
14821The @option{-mpowerpc} option allows GCC to generate instructions that
14822are found only in the 32-bit subset of the PowerPC architecture.
14823Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
14824GCC to use the optional PowerPC architecture instructions in the
14825General Purpose group, including floating-point square root.  Specifying
14826@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
14827use the optional PowerPC architecture instructions in the Graphics
14828group, including floating-point select.
14829
14830The @option{-mmfcrf} option allows GCC to generate the move from
14831condition register field instruction implemented on the POWER4
14832processor and other processors that support the PowerPC V2.01
14833architecture.
14834The @option{-mpopcntb} option allows GCC to generate the popcount and
14835double precision FP reciprocal estimate instruction implemented on the
14836POWER5 processor and other processors that support the PowerPC V2.02
14837architecture.
14838The @option{-mpopcntd} option allows GCC to generate the popcount
14839instruction implemented on the POWER7 processor and other processors
14840that support the PowerPC V2.06 architecture.
14841The @option{-mfprnd} option allows GCC to generate the FP round to
14842integer instructions implemented on the POWER5+ processor and other
14843processors that support the PowerPC V2.03 architecture.
14844The @option{-mcmpb} option allows GCC to generate the compare bytes
14845instruction implemented on the POWER6 processor and other processors
14846that support the PowerPC V2.05 architecture.
14847The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
14848general purpose register instructions implemented on the POWER6X
14849processor and other processors that support the extended PowerPC V2.05
14850architecture.
14851The @option{-mhard-dfp} option allows GCC to generate the decimal floating
14852point instructions implemented on some POWER processors.
14853
14854The @option{-mpowerpc64} option allows GCC to generate the additional
1485564-bit instructions that are found in the full PowerPC64 architecture
14856and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
14857@option{-mno-powerpc64}.
14858
14859If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
14860will use only the instructions in the common subset of both
14861architectures plus some special AIX common-mode calls, and will not use
14862the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
14863permits GCC to use any instruction from either architecture and to
14864allow use of the MQ register; specify this for the Motorola MPC601.
14865
14866@item -mnew-mnemonics
14867@itemx -mold-mnemonics
14868@opindex mnew-mnemonics
14869@opindex mold-mnemonics
14870Select which mnemonics to use in the generated assembler code.  With
14871@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
14872the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
14873assembler mnemonics defined for the POWER architecture.  Instructions
14874defined in only one architecture have only one mnemonic; GCC uses that
14875mnemonic irrespective of which of these options is specified.
14876
14877GCC defaults to the mnemonics appropriate for the architecture in
14878use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
14879value of these option.  Unless you are building a cross-compiler, you
14880should normally not specify either @option{-mnew-mnemonics} or
14881@option{-mold-mnemonics}, but should instead accept the default.
14882
14883@item -mcpu=@var{cpu_type}
14884@opindex mcpu
14885Set architecture type, register usage, choice of mnemonics, and
14886instruction scheduling parameters for machine type @var{cpu_type}.
14887Supported values for @var{cpu_type} are @samp{401}, @samp{403},
14888@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
14889@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
14890@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
14891@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
14892@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
14893@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
14894@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
14895@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
14896@samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
14897@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
14898
14899@option{-mcpu=common} selects a completely generic processor.  Code
14900generated under this option will run on any POWER or PowerPC processor.
14901GCC will use only the instructions in the common subset of both
14902architectures, and will not use the MQ register.  GCC assumes a generic
14903processor model for scheduling purposes.
14904
14905@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
14906@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
14907PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
14908types, with an appropriate, generic processor model assumed for
14909scheduling purposes.
14910
14911The other options specify a specific processor.  Code generated under
14912those options will run best on that processor, and may not run at all on
14913others.
14914
14915The @option{-mcpu} options automatically enable or disable the
14916following options:
14917
14918@gccoptlist{-maltivec  -mfprnd  -mhard-float  -mmfcrf  -mmultiple @gol
14919-mnew-mnemonics  -mpopcntb -mpopcntd  -mpower  -mpower2  -mpowerpc64 @gol
14920-mpowerpc-gpopt  -mpowerpc-gfxopt  -msingle-float -mdouble-float @gol
14921-msimple-fpu -mstring  -mmulhw  -mdlmzb  -mmfpgpr -mvsx}
14922
14923The particular options set for any particular CPU will vary between
14924compiler versions, depending on what setting seems to produce optimal
14925code for that CPU; it doesn't necessarily reflect the actual hardware's
14926capabilities.  If you wish to set an individual option to a particular
14927value, you may specify it after the @option{-mcpu} option, like
14928@samp{-mcpu=970 -mno-altivec}.
14929
14930On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
14931not enabled or disabled by the @option{-mcpu} option at present because
14932AIX does not have full support for these options.  You may still
14933enable or disable them individually if you're sure it'll work in your
14934environment.
14935
14936@item -mtune=@var{cpu_type}
14937@opindex mtune
14938Set the instruction scheduling parameters for machine type
14939@var{cpu_type}, but do not set the architecture type, register usage, or
14940choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
14941values for @var{cpu_type} are used for @option{-mtune} as for
14942@option{-mcpu}.  If both are specified, the code generated will use the
14943architecture, registers, and mnemonics set by @option{-mcpu}, but the
14944scheduling parameters set by @option{-mtune}.
14945
14946@item -mswdiv
14947@itemx -mno-swdiv
14948@opindex mswdiv
14949@opindex mno-swdiv
14950Generate code to compute division as reciprocal estimate and iterative
14951refinement, creating opportunities for increased throughput.  This
14952feature requires: optional PowerPC Graphics instruction set for single
14953precision and FRE instruction for double precision, assuming divides
14954cannot generate user-visible traps, and the domain values not include
14955Infinities, denormals or zero denominator.
14956
14957@item -maltivec
14958@itemx -mno-altivec
14959@opindex maltivec
14960@opindex mno-altivec
14961Generate code that uses (does not use) AltiVec instructions, and also
14962enable the use of built-in functions that allow more direct access to
14963the AltiVec instruction set.  You may also need to set
14964@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
14965enhancements.
14966
14967@item -mvrsave
14968@itemx -mno-vrsave
14969@opindex mvrsave
14970@opindex mno-vrsave
14971Generate VRSAVE instructions when generating AltiVec code.
14972
14973@item -mgen-cell-microcode
14974@opindex mgen-cell-microcode
14975Generate Cell microcode instructions
14976
14977@item -mwarn-cell-microcode
14978@opindex mwarn-cell-microcode
14979Warning when a Cell microcode instruction is going to emitted.  An example
14980of a Cell microcode instruction is a variable shift.
14981
14982@item -msecure-plt
14983@opindex msecure-plt
14984Generate code that allows ld and ld.so to build executables and shared
14985libraries with non-exec .plt and .got sections.  This is a PowerPC
1498632-bit SYSV ABI option.
14987
14988@item -mbss-plt
14989@opindex mbss-plt
14990Generate code that uses a BSS .plt section that ld.so fills in, and
14991requires .plt and .got sections that are both writable and executable.
14992This is a PowerPC 32-bit SYSV ABI option.
14993
14994@item -misel
14995@itemx -mno-isel
14996@opindex misel
14997@opindex mno-isel
14998This switch enables or disables the generation of ISEL instructions.
14999
15000@item -misel=@var{yes/no}
15001This switch has been deprecated.  Use @option{-misel} and
15002@option{-mno-isel} instead.
15003
15004@item -mspe
15005@itemx -mno-spe
15006@opindex mspe
15007@opindex mno-spe
15008This switch enables or disables the generation of SPE simd
15009instructions.
15010
15011@item -mpaired
15012@itemx -mno-paired
15013@opindex mpaired
15014@opindex mno-paired
15015This switch enables or disables the generation of PAIRED simd
15016instructions.
15017
15018@item -mspe=@var{yes/no}
15019This option has been deprecated.  Use @option{-mspe} and
15020@option{-mno-spe} instead.
15021
15022@item -mvsx
15023@itemx -mno-vsx
15024@opindex mvsx
15025@opindex mno-vsx
15026Generate code that uses (does not use) vector/scalar (VSX)
15027instructions, and also enable the use of built-in functions that allow
15028more direct access to the VSX instruction set.
15029
15030@item -mfloat-gprs=@var{yes/single/double/no}
15031@itemx -mfloat-gprs
15032@opindex mfloat-gprs
15033This switch enables or disables the generation of floating point
15034operations on the general purpose registers for architectures that
15035support it.
15036
15037The argument @var{yes} or @var{single} enables the use of
15038single-precision floating point operations.
15039
15040The argument @var{double} enables the use of single and
15041double-precision floating point operations.
15042
15043The argument @var{no} disables floating point operations on the
15044general purpose registers.
15045
15046This option is currently only available on the MPC854x.
15047
15048@item -m32
15049@itemx -m64
15050@opindex m32
15051@opindex m64
15052Generate code for 32-bit or 64-bit environments of Darwin and SVR4
15053targets (including GNU/Linux).  The 32-bit environment sets int, long
15054and pointer to 32 bits and generates code that runs on any PowerPC
15055variant.  The 64-bit environment sets int to 32 bits and long and
15056pointer to 64 bits, and generates code for PowerPC64, as for
15057@option{-mpowerpc64}.
15058
15059@item -mfull-toc
15060@itemx -mno-fp-in-toc
15061@itemx -mno-sum-in-toc
15062@itemx -mminimal-toc
15063@opindex mfull-toc
15064@opindex mno-fp-in-toc
15065@opindex mno-sum-in-toc
15066@opindex mminimal-toc
15067Modify generation of the TOC (Table Of Contents), which is created for
15068every executable file.  The @option{-mfull-toc} option is selected by
15069default.  In that case, GCC will allocate at least one TOC entry for
15070each unique non-automatic variable reference in your program.  GCC
15071will also place floating-point constants in the TOC@.  However, only
1507216,384 entries are available in the TOC@.
15073
15074If you receive a linker error message that saying you have overflowed
15075the available TOC space, you can reduce the amount of TOC space used
15076with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
15077@option{-mno-fp-in-toc} prevents GCC from putting floating-point
15078constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
15079generate code to calculate the sum of an address and a constant at
15080run-time instead of putting that sum into the TOC@.  You may specify one
15081or both of these options.  Each causes GCC to produce very slightly
15082slower and larger code at the expense of conserving TOC space.
15083
15084If you still run out of space in the TOC even when you specify both of
15085these options, specify @option{-mminimal-toc} instead.  This option causes
15086GCC to make only one TOC entry for every file.  When you specify this
15087option, GCC will produce code that is slower and larger but which
15088uses extremely little TOC space.  You may wish to use this option
15089only on files that contain less frequently executed code.
15090
15091@item -maix64
15092@itemx -maix32
15093@opindex maix64
15094@opindex maix32
15095Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
15096@code{long} type, and the infrastructure needed to support them.
15097Specifying @option{-maix64} implies @option{-mpowerpc64} and
15098@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
15099implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
15100
15101@item -mxl-compat
15102@itemx -mno-xl-compat
15103@opindex mxl-compat
15104@opindex mno-xl-compat
15105Produce code that conforms more closely to IBM XL compiler semantics
15106when using AIX-compatible ABI@.  Pass floating-point arguments to
15107prototyped functions beyond the register save area (RSA) on the stack
15108in addition to argument FPRs.  Do not assume that most significant
15109double in 128-bit long double value is properly rounded when comparing
15110values and converting to double.  Use XL symbol names for long double
15111support routines.
15112
15113The AIX calling convention was extended but not initially documented to
15114handle an obscure K&R C case of calling a function that takes the
15115address of its arguments with fewer arguments than declared.  IBM XL
15116compilers access floating point arguments which do not fit in the
15117RSA from the stack when a subroutine is compiled without
15118optimization.  Because always storing floating-point arguments on the
15119stack is inefficient and rarely needed, this option is not enabled by
15120default and only is necessary when calling subroutines compiled by IBM
15121XL compilers without optimization.
15122
15123@item -mpe
15124@opindex mpe
15125Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
15126application written to use message passing with special startup code to
15127enable the application to run.  The system must have PE installed in the
15128standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
15129must be overridden with the @option{-specs=} option to specify the
15130appropriate directory location.  The Parallel Environment does not
15131support threads, so the @option{-mpe} option and the @option{-pthread}
15132option are incompatible.
15133
15134@item -malign-natural
15135@itemx -malign-power
15136@opindex malign-natural
15137@opindex malign-power
15138On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
15139@option{-malign-natural} overrides the ABI-defined alignment of larger
15140types, such as floating-point doubles, on their natural size-based boundary.
15141The option @option{-malign-power} instructs GCC to follow the ABI-specified
15142alignment rules.  GCC defaults to the standard alignment defined in the ABI@.
15143
15144On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
15145is not supported.
15146
15147@item -msoft-float
15148@itemx -mhard-float
15149@opindex msoft-float
15150@opindex mhard-float
15151Generate code that does not use (uses) the floating-point register set.
15152Software floating point emulation is provided if you use the
15153@option{-msoft-float} option, and pass the option to GCC when linking.
15154
15155@item -msingle-float
15156@itemx -mdouble-float
15157@opindex msingle-float
15158@opindex mdouble-float
15159Generate code for single or double-precision floating point operations.
15160@option{-mdouble-float} implies @option{-msingle-float}.
15161
15162@item -msimple-fpu
15163@opindex msimple-fpu
15164Do not generate sqrt and div instructions for hardware floating point unit.
15165
15166@item -mfpu
15167@opindex mfpu
15168Specify type of floating point unit.  Valid values are @var{sp_lite}
15169(equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
15170to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
15171and @var{dp_full} (equivalent to -mdouble-float).
15172
15173@item -mxilinx-fpu
15174@opindex mxilinx-fpu
15175Perform optimizations for floating point unit on Xilinx PPC 405/440.
15176
15177@item -mmultiple
15178@itemx -mno-multiple
15179@opindex mmultiple
15180@opindex mno-multiple
15181Generate code that uses (does not use) the load multiple word
15182instructions and the store multiple word instructions.  These
15183instructions are generated by default on POWER systems, and not
15184generated on PowerPC systems.  Do not use @option{-mmultiple} on little
15185endian PowerPC systems, since those instructions do not work when the
15186processor is in little endian mode.  The exceptions are PPC740 and
15187PPC750 which permit the instructions usage in little endian mode.
15188
15189@item -mstring
15190@itemx -mno-string
15191@opindex mstring
15192@opindex mno-string
15193Generate code that uses (does not use) the load string instructions
15194and the store string word instructions to save multiple registers and
15195do small block moves.  These instructions are generated by default on
15196POWER systems, and not generated on PowerPC systems.  Do not use
15197@option{-mstring} on little endian PowerPC systems, since those
15198instructions do not work when the processor is in little endian mode.
15199The exceptions are PPC740 and PPC750 which permit the instructions
15200usage in little endian mode.
15201
15202@item -mupdate
15203@itemx -mno-update
15204@opindex mupdate
15205@opindex mno-update
15206Generate code that uses (does not use) the load or store instructions
15207that update the base register to the address of the calculated memory
15208location.  These instructions are generated by default.  If you use
15209@option{-mno-update}, there is a small window between the time that the
15210stack pointer is updated and the address of the previous frame is
15211stored, which means code that walks the stack frame across interrupts or
15212signals may get corrupted data.
15213
15214@item -mavoid-indexed-addresses
15215@itemx -mno-avoid-indexed-addresses
15216@opindex mavoid-indexed-addresses
15217@opindex mno-avoid-indexed-addresses
15218Generate code that tries to avoid (not avoid) the use of indexed load
15219or store instructions. These instructions can incur a performance
15220penalty on Power6 processors in certain situations, such as when
15221stepping through large arrays that cross a 16M boundary.  This option
15222is enabled by default when targetting Power6 and disabled otherwise.
15223
15224@item -mfused-madd
15225@itemx -mno-fused-madd
15226@opindex mfused-madd
15227@opindex mno-fused-madd
15228Generate code that uses (does not use) the floating point multiply and
15229accumulate instructions.  These instructions are generated by default if
15230hardware floating is used.
15231
15232@item -mmulhw
15233@itemx -mno-mulhw
15234@opindex mmulhw
15235@opindex mno-mulhw
15236Generate code that uses (does not use) the half-word multiply and
15237multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
15238These instructions are generated by default when targetting those
15239processors.
15240
15241@item -mdlmzb
15242@itemx -mno-dlmzb
15243@opindex mdlmzb
15244@opindex mno-dlmzb
15245Generate code that uses (does not use) the string-search @samp{dlmzb}
15246instruction on the IBM 405, 440, 464 and 476 processors.  This instruction is
15247generated by default when targetting those processors.
15248
15249@item -mno-bit-align
15250@itemx -mbit-align
15251@opindex mno-bit-align
15252@opindex mbit-align
15253On System V.4 and embedded PowerPC systems do not (do) force structures
15254and unions that contain bit-fields to be aligned to the base type of the
15255bit-field.
15256
15257For example, by default a structure containing nothing but 8
15258@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
15259boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
15260the structure would be aligned to a 1 byte boundary and be one byte in
15261size.
15262
15263@item -mno-strict-align
15264@itemx -mstrict-align
15265@opindex mno-strict-align
15266@opindex mstrict-align
15267On System V.4 and embedded PowerPC systems do not (do) assume that
15268unaligned memory references will be handled by the system.
15269
15270@item -mrelocatable
15271@itemx -mno-relocatable
15272@opindex mrelocatable
15273@opindex mno-relocatable
15274On embedded PowerPC systems generate code that allows (does not allow)
15275the program to be relocated to a different address at runtime.  If you
15276use @option{-mrelocatable} on any module, all objects linked together must
15277be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
15278
15279@item -mrelocatable-lib
15280@itemx -mno-relocatable-lib
15281@opindex mrelocatable-lib
15282@opindex mno-relocatable-lib
15283On embedded PowerPC systems generate code that allows (does not allow)
15284the program to be relocated to a different address at runtime.  Modules
15285compiled with @option{-mrelocatable-lib} can be linked with either modules
15286compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
15287with modules compiled with the @option{-mrelocatable} options.
15288
15289@item -mno-toc
15290@itemx -mtoc
15291@opindex mno-toc
15292@opindex mtoc
15293On System V.4 and embedded PowerPC systems do not (do) assume that
15294register 2 contains a pointer to a global area pointing to the addresses
15295used in the program.
15296
15297@item -mlittle
15298@itemx -mlittle-endian
15299@opindex mlittle
15300@opindex mlittle-endian
15301On System V.4 and embedded PowerPC systems compile code for the
15302processor in little endian mode.  The @option{-mlittle-endian} option is
15303the same as @option{-mlittle}.
15304
15305@item -mbig
15306@itemx -mbig-endian
15307@opindex mbig
15308@opindex mbig-endian
15309On System V.4 and embedded PowerPC systems compile code for the
15310processor in big endian mode.  The @option{-mbig-endian} option is
15311the same as @option{-mbig}.
15312
15313@item -mdynamic-no-pic
15314@opindex mdynamic-no-pic
15315On Darwin and Mac OS X systems, compile code so that it is not
15316relocatable, but that its external references are relocatable.  The
15317resulting code is suitable for applications, but not shared
15318libraries.
15319
15320@item -mprioritize-restricted-insns=@var{priority}
15321@opindex mprioritize-restricted-insns
15322This option controls the priority that is assigned to
15323dispatch-slot restricted instructions during the second scheduling
15324pass.  The argument @var{priority} takes the value @var{0/1/2} to assign
15325@var{no/highest/second-highest} priority to dispatch slot restricted
15326instructions.
15327
15328@item -msched-costly-dep=@var{dependence_type}
15329@opindex msched-costly-dep
15330This option controls which dependences are considered costly
15331by the target during instruction scheduling.  The argument
15332@var{dependence_type} takes one of the following values:
15333@var{no}: no dependence is costly,
15334@var{all}: all dependences are costly,
15335@var{true_store_to_load}: a true dependence from store to load is costly,
15336@var{store_to_load}: any dependence from store to load is costly,
15337@var{number}: any dependence which latency >= @var{number} is costly.
15338
15339@item -minsert-sched-nops=@var{scheme}
15340@opindex minsert-sched-nops
15341This option controls which nop insertion scheme will be used during
15342the second scheduling pass.  The argument @var{scheme} takes one of the
15343following values:
15344@var{no}: Don't insert nops.
15345@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
15346according to the scheduler's grouping.
15347@var{regroup_exact}: Insert nops to force costly dependent insns into
15348separate groups.  Insert exactly as many nops as needed to force an insn
15349to a new group, according to the estimated processor grouping.
15350@var{number}: Insert nops to force costly dependent insns into
15351separate groups.  Insert @var{number} nops to force an insn to a new group.
15352
15353@item -mcall-sysv
15354@opindex mcall-sysv
15355On System V.4 and embedded PowerPC systems compile code using calling
15356conventions that adheres to the March 1995 draft of the System V
15357Application Binary Interface, PowerPC processor supplement.  This is the
15358default unless you configured GCC using @samp{powerpc-*-eabiaix}.
15359
15360@item -mcall-sysv-eabi
15361@itemx -mcall-eabi
15362@opindex mcall-sysv-eabi
15363@opindex mcall-eabi
15364Specify both @option{-mcall-sysv} and @option{-meabi} options.
15365
15366@item -mcall-sysv-noeabi
15367@opindex mcall-sysv-noeabi
15368Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
15369
15370@item -mcall-aixdesc
15371@opindex m
15372On System V.4 and embedded PowerPC systems compile code for the AIX
15373operating system.
15374
15375@item -mcall-linux
15376@opindex mcall-linux
15377On System V.4 and embedded PowerPC systems compile code for the
15378Linux-based GNU system.
15379
15380@item -mcall-gnu
15381@opindex mcall-gnu
15382On System V.4 and embedded PowerPC systems compile code for the
15383Hurd-based GNU system.
15384
15385@item -mcall-freebsd
15386@opindex mcall-freebsd
15387On System V.4 and embedded PowerPC systems compile code for the
15388FreeBSD operating system.
15389
15390@item -mcall-netbsd
15391@opindex mcall-netbsd
15392On System V.4 and embedded PowerPC systems compile code for the
15393NetBSD operating system.
15394
15395@item -mcall-openbsd
15396@opindex mcall-netbsd
15397On System V.4 and embedded PowerPC systems compile code for the
15398OpenBSD operating system.
15399
15400@item -maix-struct-return
15401@opindex maix-struct-return
15402Return all structures in memory (as specified by the AIX ABI)@.
15403
15404@item -msvr4-struct-return
15405@opindex msvr4-struct-return
15406Return structures smaller than 8 bytes in registers (as specified by the
15407SVR4 ABI)@.
15408
15409@item -mabi=@var{abi-type}
15410@opindex mabi
15411Extend the current ABI with a particular extension, or remove such extension.
15412Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
15413@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
15414
15415@item -mabi=spe
15416@opindex mabi=spe
15417Extend the current ABI with SPE ABI extensions.  This does not change
15418the default ABI, instead it adds the SPE ABI extensions to the current
15419ABI@.
15420
15421@item -mabi=no-spe
15422@opindex mabi=no-spe
15423Disable Booke SPE ABI extensions for the current ABI@.
15424
15425@item -mabi=ibmlongdouble
15426@opindex mabi=ibmlongdouble
15427Change the current ABI to use IBM extended precision long double.
15428This is a PowerPC 32-bit SYSV ABI option.
15429
15430@item -mabi=ieeelongdouble
15431@opindex mabi=ieeelongdouble
15432Change the current ABI to use IEEE extended precision long double.
15433This is a PowerPC 32-bit Linux ABI option.
15434
15435@item -mprototype
15436@itemx -mno-prototype
15437@opindex mprototype
15438@opindex mno-prototype
15439On System V.4 and embedded PowerPC systems assume that all calls to
15440variable argument functions are properly prototyped.  Otherwise, the
15441compiler must insert an instruction before every non prototyped call to
15442set or clear bit 6 of the condition code register (@var{CR}) to
15443indicate whether floating point values were passed in the floating point
15444registers in case the function takes a variable arguments.  With
15445@option{-mprototype}, only calls to prototyped variable argument functions
15446will set or clear the bit.
15447
15448@item -msim
15449@opindex msim
15450On embedded PowerPC systems, assume that the startup module is called
15451@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
15452@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}
15453configurations.
15454
15455@item -mmvme
15456@opindex mmvme
15457On embedded PowerPC systems, assume that the startup module is called
15458@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
15459@file{libc.a}.
15460
15461@item -mads
15462@opindex mads
15463On embedded PowerPC systems, assume that the startup module is called
15464@file{crt0.o} and the standard C libraries are @file{libads.a} and
15465@file{libc.a}.
15466
15467@item -myellowknife
15468@opindex myellowknife
15469On embedded PowerPC systems, assume that the startup module is called
15470@file{crt0.o} and the standard C libraries are @file{libyk.a} and
15471@file{libc.a}.
15472
15473@item -mvxworks
15474@opindex mvxworks
15475On System V.4 and embedded PowerPC systems, specify that you are
15476compiling for a VxWorks system.
15477
15478@item -memb
15479@opindex memb
15480On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
15481header to indicate that @samp{eabi} extended relocations are used.
15482
15483@item -meabi
15484@itemx -mno-eabi
15485@opindex meabi
15486@opindex mno-eabi
15487On System V.4 and embedded PowerPC systems do (do not) adhere to the
15488Embedded Applications Binary Interface (eabi) which is a set of
15489modifications to the System V.4 specifications.  Selecting @option{-meabi}
15490means that the stack is aligned to an 8 byte boundary, a function
15491@code{__eabi} is called to from @code{main} to set up the eabi
15492environment, and the @option{-msdata} option can use both @code{r2} and
15493@code{r13} to point to two separate small data areas.  Selecting
15494@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
15495do not call an initialization function from @code{main}, and the
15496@option{-msdata} option will only use @code{r13} to point to a single
15497small data area.  The @option{-meabi} option is on by default if you
15498configured GCC using one of the @samp{powerpc*-*-eabi*} options.
15499
15500@item -msdata=eabi
15501@opindex msdata=eabi
15502On System V.4 and embedded PowerPC systems, put small initialized
15503@code{const} global and static data in the @samp{.sdata2} section, which
15504is pointed to by register @code{r2}.  Put small initialized
15505non-@code{const} global and static data in the @samp{.sdata} section,
15506which is pointed to by register @code{r13}.  Put small uninitialized
15507global and static data in the @samp{.sbss} section, which is adjacent to
15508the @samp{.sdata} section.  The @option{-msdata=eabi} option is
15509incompatible with the @option{-mrelocatable} option.  The
15510@option{-msdata=eabi} option also sets the @option{-memb} option.
15511
15512@item -msdata=sysv
15513@opindex msdata=sysv
15514On System V.4 and embedded PowerPC systems, put small global and static
15515data in the @samp{.sdata} section, which is pointed to by register
15516@code{r13}.  Put small uninitialized global and static data in the
15517@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
15518The @option{-msdata=sysv} option is incompatible with the
15519@option{-mrelocatable} option.
15520
15521@item -msdata=default
15522@itemx -msdata
15523@opindex msdata=default
15524@opindex msdata
15525On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
15526compile code the same as @option{-msdata=eabi}, otherwise compile code the
15527same as @option{-msdata=sysv}.
15528
15529@item -msdata=data
15530@opindex msdata=data
15531On System V.4 and embedded PowerPC systems, put small global
15532data in the @samp{.sdata} section.  Put small uninitialized global
15533data in the @samp{.sbss} section.  Do not use register @code{r13}
15534to address small data however.  This is the default behavior unless
15535other @option{-msdata} options are used.
15536
15537@item -msdata=none
15538@itemx -mno-sdata
15539@opindex msdata=none
15540@opindex mno-sdata
15541On embedded PowerPC systems, put all initialized global and static data
15542in the @samp{.data} section, and all uninitialized data in the
15543@samp{.bss} section.
15544
15545@item -G @var{num}
15546@opindex G
15547@cindex smaller data references (PowerPC)
15548@cindex .sdata/.sdata2 references (PowerPC)
15549On embedded PowerPC systems, put global and static items less than or
15550equal to @var{num} bytes into the small data or bss sections instead of
15551the normal data or bss section.  By default, @var{num} is 8.  The
15552@option{-G @var{num}} switch is also passed to the linker.
15553All modules should be compiled with the same @option{-G @var{num}} value.
15554
15555@item -mregnames
15556@itemx -mno-regnames
15557@opindex mregnames
15558@opindex mno-regnames
15559On System V.4 and embedded PowerPC systems do (do not) emit register
15560names in the assembly language output using symbolic forms.
15561
15562@item -mlongcall
15563@itemx -mno-longcall
15564@opindex mlongcall
15565@opindex mno-longcall
15566By default assume that all calls are far away so that a longer more
15567expensive calling sequence is required.  This is required for calls
15568further than 32 megabytes (33,554,432 bytes) from the current location.
15569A short call will be generated if the compiler knows
15570the call cannot be that far away.  This setting can be overridden by
15571the @code{shortcall} function attribute, or by @code{#pragma
15572longcall(0)}.
15573
15574Some linkers are capable of detecting out-of-range calls and generating
15575glue code on the fly.  On these systems, long calls are unnecessary and
15576generate slower code.  As of this writing, the AIX linker can do this,
15577as can the GNU linker for PowerPC/64.  It is planned to add this feature
15578to the GNU linker for 32-bit PowerPC systems as well.
15579
15580On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
15581callee, L42'', plus a ``branch island'' (glue code).  The two target
15582addresses represent the callee and the ``branch island''.  The
15583Darwin/PPC linker will prefer the first address and generate a ``bl
15584callee'' if the PPC ``bl'' instruction will reach the callee directly;
15585otherwise, the linker will generate ``bl L42'' to call the ``branch
15586island''.  The ``branch island'' is appended to the body of the
15587calling function; it computes the full 32-bit address of the callee
15588and jumps to it.
15589
15590On Mach-O (Darwin) systems, this option directs the compiler emit to
15591the glue for every direct call, and the Darwin linker decides whether
15592to use or discard it.
15593
15594In the future, we may cause GCC to ignore all longcall specifications
15595when the linker is known to generate glue.
15596
15597@item -mtls-markers
15598@itemx -mno-tls-markers
15599@opindex mtls-markers
15600@opindex mno-tls-markers
15601Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
15602specifying the function argument.  The relocation allows ld to
15603reliably associate function call with argument setup instructions for
15604TLS optimization, which in turn allows gcc to better schedule the
15605sequence.
15606
15607@item -pthread
15608@opindex pthread
15609Adds support for multithreading with the @dfn{pthreads} library.
15610This option sets flags for both the preprocessor and linker.
15611
15612@end table
15613
15614@node RX Options
15615@subsection RX Options
15616@cindex RX Options
15617
15618These command line options are defined for RX targets:
15619
15620@table @gcctabopt
15621@item -m64bit-doubles
15622@itemx -m32bit-doubles
15623@opindex m64bit-doubles
15624@opindex m32bit-doubles
15625Make the @code{double} data type be 64-bits (@option{-m64bit-doubles})
15626or 32-bits (@option{-m32bit-doubles}) in size.  The default is
15627@option{-m32bit-doubles}.  @emph{Note} RX floating point hardware only
15628works on 32-bit values, which is why the default is
15629@option{-m32bit-doubles}.
15630
15631@item -fpu
15632@itemx -nofpu
15633@opindex fpu
15634@opindex nofpu
15635Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
15636floating point hardware.  The default is enabled for the @var{RX600}
15637series and disabled for the @var{RX200} series.
15638
15639Floating point instructions will only be generated for 32-bit floating
15640point values however, so if the @option{-m64bit-doubles} option is in
15641use then the FPU hardware will not be used for doubles.
15642
15643@emph{Note} If the @option{-fpu} option is enabled then
15644@option{-funsafe-math-optimizations} is also enabled automatically.
15645This is because the RX FPU instructions are themselves unsafe.
15646
15647@item -mcpu=@var{name}
15648@itemx -patch=@var{name}
15649@opindex -mcpu
15650@opindex -patch
15651Selects the type of RX CPU to be targeted.  Currently three types are
15652supported, the generic @var{RX600} and @var{RX200} series hardware and
15653the specific @var{RX610} CPU.  The default is @var{RX600}.
15654
15655The only difference between @var{RX600} and @var{RX610} is that the
15656@var{RX610} does not support the @code{MVTIPL} instruction.
15657
15658The @var{RX200} series does not have a hardware floating point unit
15659and so @option{-nofpu} is enabled by default when this type is
15660selected.
15661
15662@item -mbig-endian-data
15663@itemx -mlittle-endian-data
15664@opindex mbig-endian-data
15665@opindex mlittle-endian-data
15666Store data (but not code) in the big-endian format.  The default is
15667@option{-mlittle-endian-data}, ie to store data in the little endian
15668format.
15669
15670@item -msmall-data-limit=@var{N}
15671@opindex msmall-data-limit
15672Specifies the maximum size in bytes of global and static variables
15673which can be placed into the small data area.  Using the small data
15674area can lead to smaller and faster code, but the size of area is
15675limited and it is up to the programmer to ensure that the area does
15676not overflow.  Also when the small data area is used one of the RX's
15677registers (@code{r13}) is reserved for use pointing to this area, so
15678it is no longer available for use by the compiler.  This could result
15679in slower and/or larger code if variables which once could have been
15680held in @code{r13} are now pushed onto the stack.
15681
15682Note, common variables (variables which have not been initialised) and
15683constants are not placed into the small data area as they are assigned
15684to other sections in the output executable.
15685
15686The default value is zero, which disables this feature.  Note, this
15687feature is not enabled by default with higher optimization levels
15688(@option{-O2} etc) because of the potentially detrimental effects of
15689reserving register @code{r13}.  It is up to the programmer to
15690experiment and discover whether this feature is of benefit to their
15691program.
15692
15693@item -msim
15694@itemx -mno-sim
15695@opindex msim
15696@opindex mno-sim
15697Use the simulator runtime.  The default is to use the libgloss board
15698specific runtime.
15699
15700@item -mas100-syntax
15701@itemx -mno-as100-syntax
15702@opindex mas100-syntax
15703@opindex mno-as100-syntax
15704When generating assembler output use a syntax that is compatible with
15705Renesas's AS100 assembler.  This syntax can also be handled by the GAS
15706assembler but it has some restrictions so generating it is not the
15707default option.
15708
15709@item -mmax-constant-size=@var{N}
15710@opindex mmax-constant-size
15711Specifies the maximum size, in bytes, of a constant that can be used as
15712an operand in a RX instruction.  Although the RX instruction set does
15713allow constants of up to 4 bytes in length to be used in instructions,
15714a longer value equates to a longer instruction.  Thus in some
15715circumstances it can be beneficial to restrict the size of constants
15716that are used in instructions.  Constants that are too big are instead
15717placed into a constant pool and referenced via register indirection.
15718
15719The value @var{N} can be between 0 and 4.  A value of 0 (the default)
15720or 4 means that constants of any size are allowed.
15721
15722@item -mrelax
15723@opindex mrelax
15724Enable linker relaxation.  Linker relaxation is a process whereby the
15725linker will attempt to reduce the size of a program by finding shorter
15726versions of various instructions.  Disabled by default.
15727
15728@item -mint-register=@var{N}
15729@opindex mint-register
15730Specify the number of registers to reserve for fast interrupt handler
15731functions.  The value @var{N} can be between 0 and 4.  A value of 1
15732means that register @code{r13} will be reserved for the exclusive use
15733of fast interrupt handlers.  A value of 2 reserves @code{r13} and
15734@code{r12}.  A value of 3 reserves @code{r13}, @code{r12} and
15735@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
15736A value of 0, the default, does not reserve any registers.
15737
15738@item -msave-acc-in-interrupts
15739@opindex msave-acc-in-interrupts
15740Specifies that interrupt handler functions should preserve the
15741accumulator register.  This is only necessary if normal code might use
15742the accumulator register, for example because it performs 64-bit
15743multiplications.  The default is to ignore the accumulator as this
15744makes the interrupt handlers faster.
15745
15746@end table
15747
15748@emph{Note:} The generic GCC command line @option{-ffixed-@var{reg}}
15749has special significance to the RX port when used with the
15750@code{interrupt} function attribute.  This attribute indicates a
15751function intended to process fast interrupts.  GCC will will ensure
15752that it only uses the registers @code{r10}, @code{r11}, @code{r12}
15753and/or @code{r13} and only provided that the normal use of the
15754corresponding registers have been restricted via the
15755@option{-ffixed-@var{reg}} or @option{-mint-register} command line
15756options.
15757
15758@node S/390 and zSeries Options
15759@subsection S/390 and zSeries Options
15760@cindex S/390 and zSeries Options
15761
15762These are the @samp{-m} options defined for the S/390 and zSeries architecture.
15763
15764@table @gcctabopt
15765@item -mhard-float
15766@itemx -msoft-float
15767@opindex mhard-float
15768@opindex msoft-float
15769Use (do not use) the hardware floating-point instructions and registers
15770for floating-point operations.  When @option{-msoft-float} is specified,
15771functions in @file{libgcc.a} will be used to perform floating-point
15772operations.  When @option{-mhard-float} is specified, the compiler
15773generates IEEE floating-point instructions.  This is the default.
15774
15775@item -mhard-dfp
15776@itemx -mno-hard-dfp
15777@opindex mhard-dfp
15778@opindex mno-hard-dfp
15779Use (do not use) the hardware decimal-floating-point instructions for
15780decimal-floating-point operations.  When @option{-mno-hard-dfp} is
15781specified, functions in @file{libgcc.a} will be used to perform
15782decimal-floating-point operations.  When @option{-mhard-dfp} is
15783specified, the compiler generates decimal-floating-point hardware
15784instructions.  This is the default for @option{-march=z9-ec} or higher.
15785
15786@item -mlong-double-64
15787@itemx -mlong-double-128
15788@opindex mlong-double-64
15789@opindex mlong-double-128
15790These switches control the size of @code{long double} type. A size
15791of 64bit makes the @code{long double} type equivalent to the @code{double}
15792type. This is the default.
15793
15794@item -mbackchain
15795@itemx -mno-backchain
15796@opindex mbackchain
15797@opindex mno-backchain
15798Store (do not store) the address of the caller's frame as backchain pointer
15799into the callee's stack frame.
15800A backchain may be needed to allow debugging using tools that do not understand
15801DWARF-2 call frame information.
15802When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
15803at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
15804the backchain is placed into the topmost word of the 96/160 byte register
15805save area.
15806
15807In general, code compiled with @option{-mbackchain} is call-compatible with
15808code compiled with @option{-mmo-backchain}; however, use of the backchain
15809for debugging purposes usually requires that the whole binary is built with
15810@option{-mbackchain}.  Note that the combination of @option{-mbackchain},
15811@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
15812to build a linux kernel use @option{-msoft-float}.
15813
15814The default is to not maintain the backchain.
15815
15816@item -mpacked-stack
15817@itemx -mno-packed-stack
15818@opindex mpacked-stack
15819@opindex mno-packed-stack
15820Use (do not use) the packed stack layout.  When @option{-mno-packed-stack} is
15821specified, the compiler uses the all fields of the 96/160 byte register save
15822area only for their default purpose; unused fields still take up stack space.
15823When @option{-mpacked-stack} is specified, register save slots are densely
15824packed at the top of the register save area; unused space is reused for other
15825purposes, allowing for more efficient use of the available stack space.
15826However, when @option{-mbackchain} is also in effect, the topmost word of
15827the save area is always used to store the backchain, and the return address
15828register is always saved two words below the backchain.
15829
15830As long as the stack frame backchain is not used, code generated with
15831@option{-mpacked-stack} is call-compatible with code generated with
15832@option{-mno-packed-stack}.  Note that some non-FSF releases of GCC 2.95 for
15833S/390 or zSeries generated code that uses the stack frame backchain at run
15834time, not just for debugging purposes.  Such code is not call-compatible
15835with code compiled with @option{-mpacked-stack}.  Also, note that the
15836combination of @option{-mbackchain},
15837@option{-mpacked-stack} and @option{-mhard-float} is not supported.  In order
15838to build a linux kernel use @option{-msoft-float}.
15839
15840The default is to not use the packed stack layout.
15841
15842@item -msmall-exec
15843@itemx -mno-small-exec
15844@opindex msmall-exec
15845@opindex mno-small-exec
15846Generate (or do not generate) code using the @code{bras} instruction
15847to do subroutine calls.
15848This only works reliably if the total executable size does not
15849exceed 64k.  The default is to use the @code{basr} instruction instead,
15850which does not have this limitation.
15851
15852@item -m64
15853@itemx -m31
15854@opindex m64
15855@opindex m31
15856When @option{-m31} is specified, generate code compliant to the
15857GNU/Linux for S/390 ABI@.  When @option{-m64} is specified, generate
15858code compliant to the GNU/Linux for zSeries ABI@.  This allows GCC in
15859particular to generate 64-bit instructions.  For the @samp{s390}
15860targets, the default is @option{-m31}, while the @samp{s390x}
15861targets default to @option{-m64}.
15862
15863@item -mzarch
15864@itemx -mesa
15865@opindex mzarch
15866@opindex mesa
15867When @option{-mzarch} is specified, generate code using the
15868instructions available on z/Architecture.
15869When @option{-mesa} is specified, generate code using the
15870instructions available on ESA/390.  Note that @option{-mesa} is
15871not possible with @option{-m64}.
15872When generating code compliant to the GNU/Linux for S/390 ABI,
15873the default is @option{-mesa}.  When generating code compliant
15874to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
15875
15876@item -mmvcle
15877@itemx -mno-mvcle
15878@opindex mmvcle
15879@opindex mno-mvcle
15880Generate (or do not generate) code using the @code{mvcle} instruction
15881to perform block moves.  When @option{-mno-mvcle} is specified,
15882use a @code{mvc} loop instead.  This is the default unless optimizing for
15883size.
15884
15885@item -mdebug
15886@itemx -mno-debug
15887@opindex mdebug
15888@opindex mno-debug
15889Print (or do not print) additional debug information when compiling.
15890The default is to not print debug information.
15891
15892@item -march=@var{cpu-type}
15893@opindex march
15894Generate code that will run on @var{cpu-type}, which is the name of a system
15895representing a certain processor type.  Possible values for
15896@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
15897@samp{z9-109}, @samp{z9-ec} and @samp{z10}.
15898When generating code using the instructions available on z/Architecture,
15899the default is @option{-march=z900}.  Otherwise, the default is
15900@option{-march=g5}.
15901
15902@item -mtune=@var{cpu-type}
15903@opindex mtune
15904Tune to @var{cpu-type} everything applicable about the generated code,
15905except for the ABI and the set of available instructions.
15906The list of @var{cpu-type} values is the same as for @option{-march}.
15907The default is the value used for @option{-march}.
15908
15909@item -mtpf-trace
15910@itemx -mno-tpf-trace
15911@opindex mtpf-trace
15912@opindex mno-tpf-trace
15913Generate code that adds (does not add) in TPF OS specific branches to trace
15914routines in the operating system.  This option is off by default, even
15915when compiling for the TPF OS@.
15916
15917@item -mfused-madd
15918@itemx -mno-fused-madd
15919@opindex mfused-madd
15920@opindex mno-fused-madd
15921Generate code that uses (does not use) the floating point multiply and
15922accumulate instructions.  These instructions are generated by default if
15923hardware floating point is used.
15924
15925@item -mwarn-framesize=@var{framesize}
15926@opindex mwarn-framesize
15927Emit a warning if the current function exceeds the given frame size.  Because
15928this is a compile time check it doesn't need to be a real problem when the program
15929runs.  It is intended to identify functions which most probably cause
15930a stack overflow.  It is useful to be used in an environment with limited stack
15931size e.g.@: the linux kernel.
15932
15933@item -mwarn-dynamicstack
15934@opindex mwarn-dynamicstack
15935Emit a warning if the function calls alloca or uses dynamically
15936sized arrays.  This is generally a bad idea with a limited stack size.
15937
15938@item -mstack-guard=@var{stack-guard}
15939@itemx -mstack-size=@var{stack-size}
15940@opindex mstack-guard
15941@opindex mstack-size
15942If these options are provided the s390 back end emits additional instructions in
15943the function prologue which trigger a trap if the stack size is @var{stack-guard}
15944bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
15945If the @var{stack-guard} option is omitted the smallest power of 2 larger than
15946the frame size of the compiled function is chosen.
15947These options are intended to be used to help debugging stack overflow problems.
15948The additionally emitted code causes only little overhead and hence can also be
15949used in production like systems without greater performance degradation.  The given
15950values have to be exact powers of 2 and @var{stack-size} has to be greater than
15951@var{stack-guard} without exceeding 64k.
15952In order to be efficient the extra code makes the assumption that the stack starts
15953at an address aligned to the value given by @var{stack-size}.
15954The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
15955@end table
15956
15957@node Score Options
15958@subsection Score Options
15959@cindex Score Options
15960
15961These options are defined for Score implementations:
15962
15963@table @gcctabopt
15964@item -meb
15965@opindex meb
15966Compile code for big endian mode.  This is the default.
15967
15968@item -mel
15969@opindex mel
15970Compile code for little endian mode.
15971
15972@item -mnhwloop
15973@opindex mnhwloop
15974Disable generate bcnz instruction.
15975
15976@item -muls
15977@opindex muls
15978Enable generate unaligned load and store instruction.
15979
15980@item -mmac
15981@opindex mmac
15982Enable the use of multiply-accumulate instructions. Disabled by default.
15983
15984@item -mscore5
15985@opindex mscore5
15986Specify the SCORE5 as the target architecture.
15987
15988@item -mscore5u
15989@opindex mscore5u
15990Specify the SCORE5U of the target architecture.
15991
15992@item -mscore7
15993@opindex mscore7
15994Specify the SCORE7 as the target architecture. This is the default.
15995
15996@item -mscore7d
15997@opindex mscore7d
15998Specify the SCORE7D as the target architecture.
15999@end table
16000
16001@node SH Options
16002@subsection SH Options
16003
16004These @samp{-m} options are defined for the SH implementations:
16005
16006@table @gcctabopt
16007@item -m1
16008@opindex m1
16009Generate code for the SH1.
16010
16011@item -m2
16012@opindex m2
16013Generate code for the SH2.
16014
16015@item -m2e
16016Generate code for the SH2e.
16017
16018@item -m2a-nofpu
16019@opindex m2a-nofpu
16020Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
16021that the floating-point unit is not used.
16022
16023@item -m2a-single-only
16024@opindex m2a-single-only
16025Generate code for the SH2a-FPU, in such a way that no double-precision
16026floating point operations are used.
16027
16028@item -m2a-single
16029@opindex m2a-single
16030Generate code for the SH2a-FPU assuming the floating-point unit is in
16031single-precision mode by default.
16032
16033@item -m2a
16034@opindex m2a
16035Generate code for the SH2a-FPU assuming the floating-point unit is in
16036double-precision mode by default.
16037
16038@item -m3
16039@opindex m3
16040Generate code for the SH3.
16041
16042@item -m3e
16043@opindex m3e
16044Generate code for the SH3e.
16045
16046@item -m4-nofpu
16047@opindex m4-nofpu
16048Generate code for the SH4 without a floating-point unit.
16049
16050@item -m4-single-only
16051@opindex m4-single-only
16052Generate code for the SH4 with a floating-point unit that only
16053supports single-precision arithmetic.
16054
16055@item -m4-single
16056@opindex m4-single
16057Generate code for the SH4 assuming the floating-point unit is in
16058single-precision mode by default.
16059
16060@item -m4
16061@opindex m4
16062Generate code for the SH4.
16063
16064@item -m4a-nofpu
16065@opindex m4a-nofpu
16066Generate code for the SH4al-dsp, or for a SH4a in such a way that the
16067floating-point unit is not used.
16068
16069@item -m4a-single-only
16070@opindex m4a-single-only
16071Generate code for the SH4a, in such a way that no double-precision
16072floating point operations are used.
16073
16074@item -m4a-single
16075@opindex m4a-single
16076Generate code for the SH4a assuming the floating-point unit is in
16077single-precision mode by default.
16078
16079@item -m4a
16080@opindex m4a
16081Generate code for the SH4a.
16082
16083@item -m4al
16084@opindex m4al
16085Same as @option{-m4a-nofpu}, except that it implicitly passes
16086@option{-dsp} to the assembler.  GCC doesn't generate any DSP
16087instructions at the moment.
16088
16089@item -mb
16090@opindex mb
16091Compile code for the processor in big endian mode.
16092
16093@item -ml
16094@opindex ml
16095Compile code for the processor in little endian mode.
16096
16097@item -mdalign
16098@opindex mdalign
16099Align doubles at 64-bit boundaries.  Note that this changes the calling
16100conventions, and thus some functions from the standard C library will
16101not work unless you recompile it first with @option{-mdalign}.
16102
16103@item -mrelax
16104@opindex mrelax
16105Shorten some address references at link time, when possible; uses the
16106linker option @option{-relax}.
16107
16108@item -mbigtable
16109@opindex mbigtable
16110Use 32-bit offsets in @code{switch} tables.  The default is to use
1611116-bit offsets.
16112
16113@item -mbitops
16114@opindex mbitops
16115Enable the use of bit manipulation instructions on SH2A.
16116
16117@item -mfmovd
16118@opindex mfmovd
16119Enable the use of the instruction @code{fmovd}.  Check @option{-mdalign} for
16120alignment constraints.
16121
16122@item -mhitachi
16123@opindex mhitachi
16124Comply with the calling conventions defined by Renesas.
16125
16126@item -mrenesas
16127@opindex mhitachi
16128Comply with the calling conventions defined by Renesas.
16129
16130@item -mno-renesas
16131@opindex mhitachi
16132Comply with the calling conventions defined for GCC before the Renesas
16133conventions were available.  This option is the default for all
16134targets of the SH toolchain except for @samp{sh-symbianelf}.
16135
16136@item -mnomacsave
16137@opindex mnomacsave
16138Mark the @code{MAC} register as call-clobbered, even if
16139@option{-mhitachi} is given.
16140
16141@item -mieee
16142@opindex mieee
16143Increase IEEE-compliance of floating-point code.
16144At the moment, this is equivalent to @option{-fno-finite-math-only}.
16145When generating 16 bit SH opcodes, getting IEEE-conforming results for
16146comparisons of NANs / infinities incurs extra overhead in every
16147floating point comparison, therefore the default is set to
16148@option{-ffinite-math-only}.
16149
16150@item -minline-ic_invalidate
16151@opindex minline-ic_invalidate
16152Inline code to invalidate instruction cache entries after setting up
16153nested function trampolines.
16154This option has no effect if -musermode is in effect and the selected
16155code generation option (e.g. -m4) does not allow the use of the icbi
16156instruction.
16157If the selected code generation option does not allow the use of the icbi
16158instruction, and -musermode is not in effect, the inlined code will
16159manipulate the instruction cache address array directly with an associative
16160write.  This not only requires privileged mode, but it will also
16161fail if the cache line had been mapped via the TLB and has become unmapped.
16162
16163@item -misize
16164@opindex misize
16165Dump instruction size and location in the assembly code.
16166
16167@item -mpadstruct
16168@opindex mpadstruct
16169This option is deprecated.  It pads structures to multiple of 4 bytes,
16170which is incompatible with the SH ABI@.
16171
16172@item -mspace
16173@opindex mspace
16174Optimize for space instead of speed.  Implied by @option{-Os}.
16175
16176@item -mprefergot
16177@opindex mprefergot
16178When generating position-independent code, emit function calls using
16179the Global Offset Table instead of the Procedure Linkage Table.
16180
16181@item -musermode
16182@opindex musermode
16183Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
16184if the inlined code would not work in user mode.
16185This is the default when the target is @code{sh-*-linux*}.
16186
16187@item -multcost=@var{number}
16188@opindex multcost=@var{number}
16189Set the cost to assume for a multiply insn.
16190
16191@item -mdiv=@var{strategy}
16192@opindex mdiv=@var{strategy}
16193Set the division strategy to use for SHmedia code.  @var{strategy} must be
16194one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
16195inv:call2, inv:fp .
16196"fp" performs the operation in floating point.  This has a very high latency,
16197but needs only a few instructions, so it might be a good choice if
16198your code has enough easily exploitable ILP to allow the compiler to
16199schedule the floating point instructions together with other instructions.
16200Division by zero causes a floating point exception.
16201"inv" uses integer operations to calculate the inverse of the divisor,
16202and then multiplies the dividend with the inverse.  This strategy allows
16203cse and hoisting of the inverse calculation.  Division by zero calculates
16204an unspecified result, but does not trap.
16205"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
16206have been found, or if the entire operation has been hoisted to the same
16207place, the last stages of the inverse calculation are intertwined with the
16208final multiply to reduce the overall latency, at the expense of using a few
16209more instructions, and thus offering fewer scheduling opportunities with
16210other code.
16211"call" calls a library function that usually implements the inv:minlat
16212strategy.
16213This gives high code density for m5-*media-nofpu compilations.
16214"call2" uses a different entry point of the same library function, where it
16215assumes that a pointer to a lookup table has already been set up, which
16216exposes the pointer load to cse / code hoisting optimizations.
16217"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
16218code generation, but if the code stays unoptimized, revert to the "call",
16219"call2", or "fp" strategies, respectively.  Note that the
16220potentially-trapping side effect of division by zero is carried by a
16221separate instruction, so it is possible that all the integer instructions
16222are hoisted out, but the marker for the side effect stays where it is.
16223A recombination to fp operations or a call is not possible in that case.
16224"inv20u" and "inv20l" are variants of the "inv:minlat" strategy.  In the case
16225that the inverse calculation was nor separated from the multiply, they speed
16226up division where the dividend fits into 20 bits (plus sign where applicable),
16227by inserting a test to skip a number of operations in this case; this test
16228slows down the case of larger dividends.  inv20u assumes the case of a such
16229a small dividend to be unlikely, and inv20l assumes it to be likely.
16230
16231@item -mdivsi3_libfunc=@var{name}
16232@opindex mdivsi3_libfunc=@var{name}
16233Set the name of the library function used for 32 bit signed division to
16234@var{name}.  This only affect the name used in the call and inv:call
16235division strategies, and the compiler will still expect the same
16236sets of input/output/clobbered registers as if this option was not present.
16237
16238@item -mfixed-range=@var{register-range}
16239@opindex mfixed-range
16240Generate code treating the given register range as fixed registers.
16241A fixed register is one that the register allocator can not use.  This is
16242useful when compiling kernel code.  A register range is specified as
16243two registers separated by a dash.  Multiple register ranges can be
16244specified separated by a comma.
16245
16246@item -madjust-unroll
16247@opindex madjust-unroll
16248Throttle unrolling to avoid thrashing target registers.
16249This option only has an effect if the gcc code base supports the
16250TARGET_ADJUST_UNROLL_MAX target hook.
16251
16252@item -mindexed-addressing
16253@opindex mindexed-addressing
16254Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
16255This is only safe if the hardware and/or OS implement 32 bit wrap-around
16256semantics for the indexed addressing mode.  The architecture allows the
16257implementation of processors with 64 bit MMU, which the OS could use to
16258get 32 bit addressing, but since no current hardware implementation supports
16259this or any other way to make the indexed addressing mode safe to use in
16260the 32 bit ABI, the default is -mno-indexed-addressing.
16261
16262@item -mgettrcost=@var{number}
16263@opindex mgettrcost=@var{number}
16264Set the cost assumed for the gettr instruction to @var{number}.
16265The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
16266
16267@item -mpt-fixed
16268@opindex mpt-fixed
16269Assume pt* instructions won't trap.  This will generally generate better
16270scheduled code, but is unsafe on current hardware.  The current architecture
16271definition says that ptabs and ptrel trap when the target anded with 3 is 3.
16272This has the unintentional effect of making it unsafe to schedule ptabs /
16273ptrel before a branch, or hoist it out of a loop.  For example,
16274__do_global_ctors, a part of libgcc that runs constructors at program
16275startup, calls functions in a list which is delimited by @minus{}1.  With the
16276-mpt-fixed option, the ptabs will be done before testing against @minus{}1.
16277That means that all the constructors will be run a bit quicker, but when
16278the loop comes to the end of the list, the program crashes because ptabs
16279loads @minus{}1 into a target register.  Since this option is unsafe for any
16280hardware implementing the current architecture specification, the default
16281is -mno-pt-fixed.  Unless the user specifies a specific cost with
16282@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
16283this deters register allocation using target registers for storing
16284ordinary integers.
16285
16286@item -minvalid-symbols
16287@opindex minvalid-symbols
16288Assume symbols might be invalid.  Ordinary function symbols generated by
16289the compiler will always be valid to load with movi/shori/ptabs or
16290movi/shori/ptrel, but with assembler and/or linker tricks it is possible
16291to generate symbols that will cause ptabs / ptrel to trap.
16292This option is only meaningful when @option{-mno-pt-fixed} is in effect.
16293It will then prevent cross-basic-block cse, hoisting and most scheduling
16294of symbol loads.  The default is @option{-mno-invalid-symbols}.
16295@end table
16296
16297@node SPARC Options
16298@subsection SPARC Options
16299@cindex SPARC options
16300
16301These @samp{-m} options are supported on the SPARC:
16302
16303@table @gcctabopt
16304@item -mno-app-regs
16305@itemx -mapp-regs
16306@opindex mno-app-regs
16307@opindex mapp-regs
16308Specify @option{-mapp-regs} to generate output using the global registers
163092 through 4, which the SPARC SVR4 ABI reserves for applications.  This
16310is the default.
16311
16312To be fully SVR4 ABI compliant at the cost of some performance loss,
16313specify @option{-mno-app-regs}.  You should compile libraries and system
16314software with this option.
16315
16316@item -mfpu
16317@itemx -mhard-float
16318@opindex mfpu
16319@opindex mhard-float
16320Generate output containing floating point instructions.  This is the
16321default.
16322
16323@item -mno-fpu
16324@itemx -msoft-float
16325@opindex mno-fpu
16326@opindex msoft-float
16327Generate output containing library calls for floating point.
16328@strong{Warning:} the requisite libraries are not available for all SPARC
16329targets.  Normally the facilities of the machine's usual C compiler are
16330used, but this cannot be done directly in cross-compilation.  You must make
16331your own arrangements to provide suitable library functions for
16332cross-compilation.  The embedded targets @samp{sparc-*-aout} and
16333@samp{sparclite-*-*} do provide software floating point support.
16334
16335@option{-msoft-float} changes the calling convention in the output file;
16336therefore, it is only useful if you compile @emph{all} of a program with
16337this option.  In particular, you need to compile @file{libgcc.a}, the
16338library that comes with GCC, with @option{-msoft-float} in order for
16339this to work.
16340
16341@item -mhard-quad-float
16342@opindex mhard-quad-float
16343Generate output containing quad-word (long double) floating point
16344instructions.
16345
16346@item -msoft-quad-float
16347@opindex msoft-quad-float
16348Generate output containing library calls for quad-word (long double)
16349floating point instructions.  The functions called are those specified
16350in the SPARC ABI@.  This is the default.
16351
16352As of this writing, there are no SPARC implementations that have hardware
16353support for the quad-word floating point instructions.  They all invoke
16354a trap handler for one of these instructions, and then the trap handler
16355emulates the effect of the instruction.  Because of the trap handler overhead,
16356this is much slower than calling the ABI library routines.  Thus the
16357@option{-msoft-quad-float} option is the default.
16358
16359@item -mno-unaligned-doubles
16360@itemx -munaligned-doubles
16361@opindex mno-unaligned-doubles
16362@opindex munaligned-doubles
16363Assume that doubles have 8 byte alignment.  This is the default.
16364
16365With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
16366alignment only if they are contained in another type, or if they have an
16367absolute address.  Otherwise, it assumes they have 4 byte alignment.
16368Specifying this option avoids some rare compatibility problems with code
16369generated by other compilers.  It is not the default because it results
16370in a performance loss, especially for floating point code.
16371
16372@item -mno-faster-structs
16373@itemx -mfaster-structs
16374@opindex mno-faster-structs
16375@opindex mfaster-structs
16376With @option{-mfaster-structs}, the compiler assumes that structures
16377should have 8 byte alignment.  This enables the use of pairs of
16378@code{ldd} and @code{std} instructions for copies in structure
16379assignment, in place of twice as many @code{ld} and @code{st} pairs.
16380However, the use of this changed alignment directly violates the SPARC
16381ABI@.  Thus, it's intended only for use on targets where the developer
16382acknowledges that their resulting code will not be directly in line with
16383the rules of the ABI@.
16384
16385@item -mimpure-text
16386@opindex mimpure-text
16387@option{-mimpure-text}, used in addition to @option{-shared}, tells
16388the compiler to not pass @option{-z text} to the linker when linking a
16389shared object.  Using this option, you can link position-dependent
16390code into a shared object.
16391
16392@option{-mimpure-text} suppresses the ``relocations remain against
16393allocatable but non-writable sections'' linker error message.
16394However, the necessary relocations will trigger copy-on-write, and the
16395shared object is not actually shared across processes.  Instead of
16396using @option{-mimpure-text}, you should compile all source code with
16397@option{-fpic} or @option{-fPIC}.
16398
16399This option is only available on SunOS and Solaris.
16400
16401@item -mcpu=@var{cpu_type}
16402@opindex mcpu
16403Set the instruction set, register set, and instruction scheduling parameters
16404for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
16405@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
16406@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
16407@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
16408@samp{ultrasparc3}, @samp{niagara} and @samp{niagara2}.
16409
16410Default instruction scheduling parameters are used for values that select
16411an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
16412@samp{sparclite}, @samp{sparclet}, @samp{v9}.
16413
16414Here is a list of each supported architecture and their supported
16415implementations.
16416
16417@smallexample
16418    v7:             cypress
16419    v8:             supersparc, hypersparc
16420    sparclite:      f930, f934, sparclite86x
16421    sparclet:       tsc701
16422    v9:             ultrasparc, ultrasparc3, niagara, niagara2
16423@end smallexample
16424
16425By default (unless configured otherwise), GCC generates code for the V7
16426variant of the SPARC architecture.  With @option{-mcpu=cypress}, the compiler
16427additionally optimizes it for the Cypress CY7C602 chip, as used in the
16428SPARCStation/SPARCServer 3xx series.  This is also appropriate for the older
16429SPARCStation 1, 2, IPX etc.
16430
16431With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
16432architecture.  The only difference from V7 code is that the compiler emits
16433the integer multiply and integer divide instructions which exist in SPARC-V8
16434but not in SPARC-V7.  With @option{-mcpu=supersparc}, the compiler additionally
16435optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
164362000 series.
16437
16438With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
16439the SPARC architecture.  This adds the integer multiply, integer divide step
16440and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
16441With @option{-mcpu=f930}, the compiler additionally optimizes it for the
16442Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@.  With
16443@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
16444MB86934 chip, which is the more recent SPARClite with FPU@.
16445
16446With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
16447the SPARC architecture.  This adds the integer multiply, multiply/accumulate,
16448integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
16449but not in SPARC-V7.  With @option{-mcpu=tsc701}, the compiler additionally
16450optimizes it for the TEMIC SPARClet chip.
16451
16452With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
16453architecture.  This adds 64-bit integer and floating-point move instructions,
164543 additional floating-point condition code registers and conditional move
16455instructions.  With @option{-mcpu=ultrasparc}, the compiler additionally
16456optimizes it for the Sun UltraSPARC I/II/IIi chips.  With
16457@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
16458Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips.  With
16459@option{-mcpu=niagara}, the compiler additionally optimizes it for
16460Sun UltraSPARC T1 chips.  With @option{-mcpu=niagara2}, the compiler
16461additionally optimizes it for Sun UltraSPARC T2 chips.
16462
16463@item -mtune=@var{cpu_type}
16464@opindex mtune
16465Set the instruction scheduling parameters for machine type
16466@var{cpu_type}, but do not set the instruction set or register set that the
16467option @option{-mcpu=@var{cpu_type}} would.
16468
16469The same values for @option{-mcpu=@var{cpu_type}} can be used for
16470@option{-mtune=@var{cpu_type}}, but the only useful values are those
16471that select a particular CPU implementation.  Those are @samp{cypress},
16472@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
16473@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
16474@samp{ultrasparc3}, @samp{niagara}, and @samp{niagara2}.
16475
16476@item -mv8plus
16477@itemx -mno-v8plus
16478@opindex mv8plus
16479@opindex mno-v8plus
16480With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@.  The
16481difference from the V8 ABI is that the global and out registers are
16482considered 64-bit wide.  This is enabled by default on Solaris in 32-bit
16483mode for all SPARC-V9 processors.
16484
16485@item -mvis
16486@itemx -mno-vis
16487@opindex mvis
16488@opindex mno-vis
16489With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
16490Visual Instruction Set extensions.  The default is @option{-mno-vis}.
16491@end table
16492
16493These @samp{-m} options are supported in addition to the above
16494on SPARC-V9 processors in 64-bit environments:
16495
16496@table @gcctabopt
16497@item -mlittle-endian
16498@opindex mlittle-endian
16499Generate code for a processor running in little-endian mode.  It is only
16500available for a few configurations and most notably not on Solaris and Linux.
16501
16502@item -m32
16503@itemx -m64
16504@opindex m32
16505@opindex m64
16506Generate code for a 32-bit or 64-bit environment.
16507The 32-bit environment sets int, long and pointer to 32 bits.
16508The 64-bit environment sets int to 32 bits and long and pointer
16509to 64 bits.
16510
16511@item -mcmodel=medlow
16512@opindex mcmodel=medlow
16513Generate code for the Medium/Low code model: 64-bit addresses, programs
16514must be linked in the low 32 bits of memory.  Programs can be statically
16515or dynamically linked.
16516
16517@item -mcmodel=medmid
16518@opindex mcmodel=medmid
16519Generate code for the Medium/Middle code model: 64-bit addresses, programs
16520must be linked in the low 44 bits of memory, the text and data segments must
16521be less than 2GB in size and the data segment must be located within 2GB of
16522the text segment.
16523
16524@item -mcmodel=medany
16525@opindex mcmodel=medany
16526Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
16527may be linked anywhere in memory, the text and data segments must be less
16528than 2GB in size and the data segment must be located within 2GB of the
16529text segment.
16530
16531@item -mcmodel=embmedany
16532@opindex mcmodel=embmedany
16533Generate code for the Medium/Anywhere code model for embedded systems:
1653464-bit addresses, the text and data segments must be less than 2GB in
16535size, both starting anywhere in memory (determined at link time).  The
16536global register %g4 points to the base of the data segment.  Programs
16537are statically linked and PIC is not supported.
16538
16539@item -mstack-bias
16540@itemx -mno-stack-bias
16541@opindex mstack-bias
16542@opindex mno-stack-bias
16543With @option{-mstack-bias}, GCC assumes that the stack pointer, and
16544frame pointer if present, are offset by @minus{}2047 which must be added back
16545when making stack frame references.  This is the default in 64-bit mode.
16546Otherwise, assume no such offset is present.
16547@end table
16548
16549These switches are supported in addition to the above on Solaris:
16550
16551@table @gcctabopt
16552@item -threads
16553@opindex threads
16554Add support for multithreading using the Solaris threads library.  This
16555option sets flags for both the preprocessor and linker.  This option does
16556not affect the thread safety of object code produced by the compiler or
16557that of libraries supplied with it.
16558
16559@item -pthreads
16560@opindex pthreads
16561Add support for multithreading using the POSIX threads library.  This
16562option sets flags for both the preprocessor and linker.  This option does
16563not affect the thread safety of object code produced  by the compiler or
16564that of libraries supplied with it.
16565
16566@item -pthread
16567@opindex pthread
16568This is a synonym for @option{-pthreads}.
16569@end table
16570
16571@node SPU Options
16572@subsection SPU Options
16573@cindex SPU options
16574
16575These @samp{-m} options are supported on the SPU:
16576
16577@table @gcctabopt
16578@item -mwarn-reloc
16579@itemx -merror-reloc
16580@opindex mwarn-reloc
16581@opindex merror-reloc
16582
16583The loader for SPU does not handle dynamic relocations.  By default, GCC
16584will give an error when it generates code that requires a dynamic
16585relocation.  @option{-mno-error-reloc} disables the error,
16586@option{-mwarn-reloc} will generate a warning instead.
16587
16588@item -msafe-dma
16589@itemx -munsafe-dma
16590@opindex msafe-dma
16591@opindex munsafe-dma
16592
16593Instructions which initiate or test completion of DMA must not be
16594reordered with respect to loads and stores of the memory which is being
16595accessed.  Users typically address this problem using the volatile
16596keyword, but that can lead to inefficient code in places where the
16597memory is known to not change.  Rather than mark the memory as volatile
16598we treat the DMA instructions as potentially effecting all memory.  With
16599@option{-munsafe-dma} users must use the volatile keyword to protect
16600memory accesses.
16601
16602@item -mbranch-hints
16603@opindex mbranch-hints
16604
16605By default, GCC will generate a branch hint instruction to avoid
16606pipeline stalls for always taken or probably taken branches.  A hint
16607will not be generated closer than 8 instructions away from its branch.
16608There is little reason to disable them, except for debugging purposes,
16609or to make an object a little bit smaller.
16610
16611@item -msmall-mem
16612@itemx -mlarge-mem
16613@opindex msmall-mem
16614@opindex mlarge-mem
16615
16616By default, GCC generates code assuming that addresses are never larger
16617than 18 bits.  With @option{-mlarge-mem} code is generated that assumes
16618a full 32 bit address.
16619
16620@item -mstdmain
16621@opindex mstdmain
16622
16623By default, GCC links against startup code that assumes the SPU-style
16624main function interface (which has an unconventional parameter list).
16625With @option{-mstdmain}, GCC will link your program against startup
16626code that assumes a C99-style interface to @code{main}, including a
16627local copy of @code{argv} strings.
16628
16629@item -mfixed-range=@var{register-range}
16630@opindex mfixed-range
16631Generate code treating the given register range as fixed registers.
16632A fixed register is one that the register allocator can not use.  This is
16633useful when compiling kernel code.  A register range is specified as
16634two registers separated by a dash.  Multiple register ranges can be
16635specified separated by a comma.
16636
16637@item -mea32
16638@itemx -mea64
16639@opindex mea32
16640@opindex mea64
16641Compile code assuming that pointers to the PPU address space accessed
16642via the @code{__ea} named address space qualifier are either 32 or 64
16643bits wide.  The default is 32 bits.  As this is an ABI changing option,
16644all object code in an executable must be compiled with the same setting.
16645
16646@item -maddress-space-conversion
16647@itemx -mno-address-space-conversion
16648@opindex maddress-space-conversion
16649@opindex mno-address-space-conversion
16650Allow/disallow treating the @code{__ea} address space as superset
16651of the generic address space.  This enables explicit type casts
16652between @code{__ea} and generic pointer as well as implicit
16653conversions of generic pointers to @code{__ea} pointers.  The
16654default is to allow address space pointer conversions.
16655
16656@item -mcache-size=@var{cache-size}
16657@opindex mcache-size
16658This option controls the version of libgcc that the compiler links to an
16659executable and selects a software-managed cache for accessing variables
16660in the @code{__ea} address space with a particular cache size.  Possible
16661options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
16662and @samp{128}.  The default cache size is 64KB.
16663
16664@item -matomic-updates
16665@itemx -mno-atomic-updates
16666@opindex matomic-updates
16667@opindex mno-atomic-updates
16668This option controls the version of libgcc that the compiler links to an
16669executable and selects whether atomic updates to the software-managed
16670cache of PPU-side variables are used.  If you use atomic updates, changes
16671to a PPU variable from SPU code using the @code{__ea} named address space
16672qualifier will not interfere with changes to other PPU variables residing
16673in the same cache line from PPU code.  If you do not use atomic updates,
16674such interference may occur; however, writing back cache lines will be
16675more efficient.  The default behavior is to use atomic updates.
16676
16677@item -mdual-nops
16678@itemx -mdual-nops=@var{n}
16679@opindex mdual-nops
16680By default, GCC will insert nops to increase dual issue when it expects
16681it to increase performance.  @var{n} can be a value from 0 to 10.  A
16682smaller @var{n} will insert fewer nops.  10 is the default, 0 is the
16683same as @option{-mno-dual-nops}.  Disabled with @option{-Os}.
16684
16685@item -mhint-max-nops=@var{n}
16686@opindex mhint-max-nops
16687Maximum number of nops to insert for a branch hint.  A branch hint must
16688be at least 8 instructions away from the branch it is effecting.  GCC
16689will insert up to @var{n} nops to enforce this, otherwise it will not
16690generate the branch hint.
16691
16692@item -mhint-max-distance=@var{n}
16693@opindex mhint-max-distance
16694The encoding of the branch hint instruction limits the hint to be within
16695256 instructions of the branch it is effecting.  By default, GCC makes
16696sure it is within 125.
16697
16698@item -msafe-hints
16699@opindex msafe-hints
16700Work around a hardware bug which causes the SPU to stall indefinitely.
16701By default, GCC will insert the @code{hbrp} instruction to make sure
16702this stall won't happen.
16703
16704@end table
16705
16706@node System V Options
16707@subsection Options for System V
16708
16709These additional options are available on System V Release 4 for
16710compatibility with other compilers on those systems:
16711
16712@table @gcctabopt
16713@item -G
16714@opindex G
16715Create a shared object.
16716It is recommended that @option{-symbolic} or @option{-shared} be used instead.
16717
16718@item -Qy
16719@opindex Qy
16720Identify the versions of each tool used by the compiler, in a
16721@code{.ident} assembler directive in the output.
16722
16723@item -Qn
16724@opindex Qn
16725Refrain from adding @code{.ident} directives to the output file (this is
16726the default).
16727
16728@item -YP,@var{dirs}
16729@opindex YP
16730Search the directories @var{dirs}, and no others, for libraries
16731specified with @option{-l}.
16732
16733@item -Ym,@var{dir}
16734@opindex Ym
16735Look in the directory @var{dir} to find the M4 preprocessor.
16736The assembler uses this option.
16737@c This is supposed to go with a -Yd for predefined M4 macro files, but
16738@c the generic assembler that comes with Solaris takes just -Ym.
16739@end table
16740
16741@node V850 Options
16742@subsection V850 Options
16743@cindex V850 Options
16744
16745These @samp{-m} options are defined for V850 implementations:
16746
16747@table @gcctabopt
16748@item -mlong-calls
16749@itemx -mno-long-calls
16750@opindex mlong-calls
16751@opindex mno-long-calls
16752Treat all calls as being far away (near).  If calls are assumed to be
16753far away, the compiler will always load the functions address up into a
16754register, and call indirect through the pointer.
16755
16756@item -mno-ep
16757@itemx -mep
16758@opindex mno-ep
16759@opindex mep
16760Do not optimize (do optimize) basic blocks that use the same index
16761pointer 4 or more times to copy pointer into the @code{ep} register, and
16762use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
16763option is on by default if you optimize.
16764
16765@item -mno-prolog-function
16766@itemx -mprolog-function
16767@opindex mno-prolog-function
16768@opindex mprolog-function
16769Do not use (do use) external functions to save and restore registers
16770at the prologue and epilogue of a function.  The external functions
16771are slower, but use less code space if more than one function saves
16772the same number of registers.  The @option{-mprolog-function} option
16773is on by default if you optimize.
16774
16775@item -mspace
16776@opindex mspace
16777Try to make the code as small as possible.  At present, this just turns
16778on the @option{-mep} and @option{-mprolog-function} options.
16779
16780@item -mtda=@var{n}
16781@opindex mtda
16782Put static or global variables whose size is @var{n} bytes or less into
16783the tiny data area that register @code{ep} points to.  The tiny data
16784area can hold up to 256 bytes in total (128 bytes for byte references).
16785
16786@item -msda=@var{n}
16787@opindex msda
16788Put static or global variables whose size is @var{n} bytes or less into
16789the small data area that register @code{gp} points to.  The small data
16790area can hold up to 64 kilobytes.
16791
16792@item -mzda=@var{n}
16793@opindex mzda
16794Put static or global variables whose size is @var{n} bytes or less into
16795the first 32 kilobytes of memory.
16796
16797@item -mv850
16798@opindex mv850
16799Specify that the target processor is the V850.
16800
16801@item -mbig-switch
16802@opindex mbig-switch
16803Generate code suitable for big switch tables.  Use this option only if
16804the assembler/linker complain about out of range branches within a switch
16805table.
16806
16807@item -mapp-regs
16808@opindex mapp-regs
16809This option will cause r2 and r5 to be used in the code generated by
16810the compiler.  This setting is the default.
16811
16812@item -mno-app-regs
16813@opindex mno-app-regs
16814This option will cause r2 and r5 to be treated as fixed registers.
16815
16816@item -mv850e1
16817@opindex mv850e1
16818Specify that the target processor is the V850E1.  The preprocessor
16819constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
16820this option is used.
16821
16822@item -mv850e
16823@opindex mv850e
16824Specify that the target processor is the V850E@.  The preprocessor
16825constant @samp{__v850e__} will be defined if this option is used.
16826
16827If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
16828are defined then a default target processor will be chosen and the
16829relevant @samp{__v850*__} preprocessor constant will be defined.
16830
16831The preprocessor constants @samp{__v850} and @samp{__v851__} are always
16832defined, regardless of which processor variant is the target.
16833
16834@item -mdisable-callt
16835@opindex mdisable-callt
16836This option will suppress generation of the CALLT instruction for the
16837v850e and v850e1 flavors of the v850 architecture.  The default is
16838@option{-mno-disable-callt} which allows the CALLT instruction to be used.
16839
16840@end table
16841
16842@node VAX Options
16843@subsection VAX Options
16844@cindex VAX options
16845
16846These @samp{-m} options are defined for the VAX:
16847
16848@table @gcctabopt
16849@item -munix
16850@opindex munix
16851Do not output certain jump instructions (@code{aobleq} and so on)
16852that the Unix assembler for the VAX cannot handle across long
16853ranges.
16854
16855@item -mgnu
16856@opindex mgnu
16857Do output those jump instructions, on the assumption that you
16858will assemble with the GNU assembler.
16859
16860@item -mg
16861@opindex mg
16862Output code for g-format floating point numbers instead of d-format.
16863@end table
16864
16865@node VxWorks Options
16866@subsection VxWorks Options
16867@cindex VxWorks Options
16868
16869The options in this section are defined for all VxWorks targets.
16870Options specific to the target hardware are listed with the other
16871options for that target.
16872
16873@table @gcctabopt
16874@item -mrtp
16875@opindex mrtp
16876GCC can generate code for both VxWorks kernels and real time processes
16877(RTPs).  This option switches from the former to the latter.  It also
16878defines the preprocessor macro @code{__RTP__}.
16879
16880@item -non-static
16881@opindex non-static
16882Link an RTP executable against shared libraries rather than static
16883libraries.  The options @option{-static} and @option{-shared} can
16884also be used for RTPs (@pxref{Link Options}); @option{-static}
16885is the default.
16886
16887@item -Bstatic
16888@itemx -Bdynamic
16889@opindex Bstatic
16890@opindex Bdynamic
16891These options are passed down to the linker.  They are defined for
16892compatibility with Diab.
16893
16894@item -Xbind-lazy
16895@opindex Xbind-lazy
16896Enable lazy binding of function calls.  This option is equivalent to
16897@option{-Wl,-z,now} and is defined for compatibility with Diab.
16898
16899@item -Xbind-now
16900@opindex Xbind-now
16901Disable lazy binding of function calls.  This option is the default and
16902is defined for compatibility with Diab.
16903@end table
16904
16905@node x86-64 Options
16906@subsection x86-64 Options
16907@cindex x86-64 options
16908
16909These are listed under @xref{i386 and x86-64 Options}.
16910
16911@node Xstormy16 Options
16912@subsection Xstormy16 Options
16913@cindex Xstormy16 Options
16914
16915These options are defined for Xstormy16:
16916
16917@table @gcctabopt
16918@item -msim
16919@opindex msim
16920Choose startup files and linker script suitable for the simulator.
16921@end table
16922
16923@node Xtensa Options
16924@subsection Xtensa Options
16925@cindex Xtensa Options
16926
16927These options are supported for Xtensa targets:
16928
16929@table @gcctabopt
16930@item -mconst16
16931@itemx -mno-const16
16932@opindex mconst16
16933@opindex mno-const16
16934Enable or disable use of @code{CONST16} instructions for loading
16935constant values.  The @code{CONST16} instruction is currently not a
16936standard option from Tensilica.  When enabled, @code{CONST16}
16937instructions are always used in place of the standard @code{L32R}
16938instructions.  The use of @code{CONST16} is enabled by default only if
16939the @code{L32R} instruction is not available.
16940
16941@item -mfused-madd
16942@itemx -mno-fused-madd
16943@opindex mfused-madd
16944@opindex mno-fused-madd
16945Enable or disable use of fused multiply/add and multiply/subtract
16946instructions in the floating-point option.  This has no effect if the
16947floating-point option is not also enabled.  Disabling fused multiply/add
16948and multiply/subtract instructions forces the compiler to use separate
16949instructions for the multiply and add/subtract operations.  This may be
16950desirable in some cases where strict IEEE 754-compliant results are
16951required: the fused multiply add/subtract instructions do not round the
16952intermediate result, thereby producing results with @emph{more} bits of
16953precision than specified by the IEEE standard.  Disabling fused multiply
16954add/subtract instructions also ensures that the program output is not
16955sensitive to the compiler's ability to combine multiply and add/subtract
16956operations.
16957
16958@item -mserialize-volatile
16959@itemx -mno-serialize-volatile
16960@opindex mserialize-volatile
16961@opindex mno-serialize-volatile
16962When this option is enabled, GCC inserts @code{MEMW} instructions before
16963@code{volatile} memory references to guarantee sequential consistency.
16964The default is @option{-mserialize-volatile}.  Use
16965@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
16966
16967@item -mtext-section-literals
16968@itemx -mno-text-section-literals
16969@opindex mtext-section-literals
16970@opindex mno-text-section-literals
16971Control the treatment of literal pools.  The default is
16972@option{-mno-text-section-literals}, which places literals in a separate
16973section in the output file.  This allows the literal pool to be placed
16974in a data RAM/ROM, and it also allows the linker to combine literal
16975pools from separate object files to remove redundant literals and
16976improve code size.  With @option{-mtext-section-literals}, the literals
16977are interspersed in the text section in order to keep them as close as
16978possible to their references.  This may be necessary for large assembly
16979files.
16980
16981@item -mtarget-align
16982@itemx -mno-target-align
16983@opindex mtarget-align
16984@opindex mno-target-align
16985When this option is enabled, GCC instructs the assembler to
16986automatically align instructions to reduce branch penalties at the
16987expense of some code density.  The assembler attempts to widen density
16988instructions to align branch targets and the instructions following call
16989instructions.  If there are not enough preceding safe density
16990instructions to align a target, no widening will be performed.  The
16991default is @option{-mtarget-align}.  These options do not affect the
16992treatment of auto-aligned instructions like @code{LOOP}, which the
16993assembler will always align, either by widening density instructions or
16994by inserting no-op instructions.
16995
16996@item -mlongcalls
16997@itemx -mno-longcalls
16998@opindex mlongcalls
16999@opindex mno-longcalls
17000When this option is enabled, GCC instructs the assembler to translate
17001direct calls to indirect calls unless it can determine that the target
17002of a direct call is in the range allowed by the call instruction.  This
17003translation typically occurs for calls to functions in other source
17004files.  Specifically, the assembler translates a direct @code{CALL}
17005instruction into an @code{L32R} followed by a @code{CALLX} instruction.
17006The default is @option{-mno-longcalls}.  This option should be used in
17007programs where the call target can potentially be out of range.  This
17008option is implemented in the assembler, not the compiler, so the
17009assembly code generated by GCC will still show direct call
17010instructions---look at the disassembled object code to see the actual
17011instructions.  Note that the assembler will use an indirect call for
17012every cross-file call, not just those that really will be out of range.
17013@end table
17014
17015@node zSeries Options
17016@subsection zSeries Options
17017@cindex zSeries options
17018
17019These are listed under @xref{S/390 and zSeries Options}.
17020
17021@node Code Gen Options
17022@section Options for Code Generation Conventions
17023@cindex code generation conventions
17024@cindex options, code generation
17025@cindex run-time options
17026
17027These machine-independent options control the interface conventions
17028used in code generation.
17029
17030Most of them have both positive and negative forms; the negative form
17031of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
17032one of the forms is listed---the one which is not the default.  You
17033can figure out the other form by either removing @samp{no-} or adding
17034it.
17035
17036@table @gcctabopt
17037@item -fbounds-check
17038@opindex fbounds-check
17039For front-ends that support it, generate additional code to check that
17040indices used to access arrays are within the declared range.  This is
17041currently only supported by the Java and Fortran front-ends, where
17042this option defaults to true and false respectively.
17043
17044@item -ftrapv
17045@opindex ftrapv
17046This option generates traps for signed overflow on addition, subtraction,
17047multiplication operations.
17048
17049@item -fwrapv
17050@opindex fwrapv
17051This option instructs the compiler to assume that signed arithmetic
17052overflow of addition, subtraction and multiplication wraps around
17053using twos-complement representation.  This flag enables some optimizations
17054and disables others.  This option is enabled by default for the Java
17055front-end, as required by the Java language specification.
17056
17057@item -fexceptions
17058@opindex fexceptions
17059Enable exception handling.  Generates extra code needed to propagate
17060exceptions.  For some targets, this implies GCC will generate frame
17061unwind information for all functions, which can produce significant data
17062size overhead, although it does not affect execution.  If you do not
17063specify this option, GCC will enable it by default for languages like
17064C++ which normally require exception handling, and disable it for
17065languages like C that do not normally require it.  However, you may need
17066to enable this option when compiling C code that needs to interoperate
17067properly with exception handlers written in C++.  You may also wish to
17068disable this option if you are compiling older C++ programs that don't
17069use exception handling.
17070
17071@item -fnon-call-exceptions
17072@opindex fnon-call-exceptions
17073Generate code that allows trapping instructions to throw exceptions.
17074Note that this requires platform-specific runtime support that does
17075not exist everywhere.  Moreover, it only allows @emph{trapping}
17076instructions to throw exceptions, i.e.@: memory references or floating
17077point instructions.  It does not allow exceptions to be thrown from
17078arbitrary signal handlers such as @code{SIGALRM}.
17079
17080@item -funwind-tables
17081@opindex funwind-tables
17082Similar to @option{-fexceptions}, except that it will just generate any needed
17083static data, but will not affect the generated code in any other way.
17084You will normally not enable this option; instead, a language processor
17085that needs this handling would enable it on your behalf.
17086
17087@item -fasynchronous-unwind-tables
17088@opindex fasynchronous-unwind-tables
17089Generate unwind table in dwarf2 format, if supported by target machine.  The
17090table is exact at each instruction boundary, so it can be used for stack
17091unwinding from asynchronous events (such as debugger or garbage collector).
17092
17093@item -fpcc-struct-return
17094@opindex fpcc-struct-return
17095Return ``short'' @code{struct} and @code{union} values in memory like
17096longer ones, rather than in registers.  This convention is less
17097efficient, but it has the advantage of allowing intercallability between
17098GCC-compiled files and files compiled with other compilers, particularly
17099the Portable C Compiler (pcc).
17100
17101The precise convention for returning structures in memory depends
17102on the target configuration macros.
17103
17104Short structures and unions are those whose size and alignment match
17105that of some integer type.
17106
17107@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
17108switch is not binary compatible with code compiled with the
17109@option{-freg-struct-return} switch.
17110Use it to conform to a non-default application binary interface.
17111
17112@item -freg-struct-return
17113@opindex freg-struct-return
17114Return @code{struct} and @code{union} values in registers when possible.
17115This is more efficient for small structures than
17116@option{-fpcc-struct-return}.
17117
17118If you specify neither @option{-fpcc-struct-return} nor
17119@option{-freg-struct-return}, GCC defaults to whichever convention is
17120standard for the target.  If there is no standard convention, GCC
17121defaults to @option{-fpcc-struct-return}, except on targets where GCC is
17122the principal compiler.  In those cases, we can choose the standard, and
17123we chose the more efficient register return alternative.
17124
17125@strong{Warning:} code compiled with the @option{-freg-struct-return}
17126switch is not binary compatible with code compiled with the
17127@option{-fpcc-struct-return} switch.
17128Use it to conform to a non-default application binary interface.
17129
17130@item -fshort-enums
17131@opindex fshort-enums
17132Allocate to an @code{enum} type only as many bytes as it needs for the
17133declared range of possible values.  Specifically, the @code{enum} type
17134will be equivalent to the smallest integer type which has enough room.
17135
17136@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
17137code that is not binary compatible with code generated without that switch.
17138Use it to conform to a non-default application binary interface.
17139
17140@item -fshort-double
17141@opindex fshort-double
17142Use the same size for @code{double} as for @code{float}.
17143
17144@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
17145code that is not binary compatible with code generated without that switch.
17146Use it to conform to a non-default application binary interface.
17147
17148@item -fshort-wchar
17149@opindex fshort-wchar
17150Override the underlying type for @samp{wchar_t} to be @samp{short
17151unsigned int} instead of the default for the target.  This option is
17152useful for building programs to run under WINE@.
17153
17154@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
17155code that is not binary compatible with code generated without that switch.
17156Use it to conform to a non-default application binary interface.
17157
17158@item -fno-common
17159@opindex fno-common
17160In C code, controls the placement of uninitialized global variables.
17161Unix C compilers have traditionally permitted multiple definitions of
17162such variables in different compilation units by placing the variables
17163in a common block.
17164This is the behavior specified by @option{-fcommon}, and is the default
17165for GCC on most targets.
17166On the other hand, this behavior is not required by ISO C, and on some
17167targets may carry a speed or code size penalty on variable references.
17168The @option{-fno-common} option specifies that the compiler should place
17169uninitialized global variables in the data section of the object file,
17170rather than generating them as common blocks.
17171This has the effect that if the same variable is declared
17172(without @code{extern}) in two different compilations,
17173you will get a multiple-definition error when you link them.
17174In this case, you must compile with @option{-fcommon} instead.
17175Compiling with @option{-fno-common} is useful on targets for which
17176it provides better performance, or if you wish to verify that the
17177program will work on other systems which always treat uninitialized
17178variable declarations this way.
17179
17180@item -fno-ident
17181@opindex fno-ident
17182Ignore the @samp{#ident} directive.
17183
17184@item -finhibit-size-directive
17185@opindex finhibit-size-directive
17186Don't output a @code{.size} assembler directive, or anything else that
17187would cause trouble if the function is split in the middle, and the
17188two halves are placed at locations far apart in memory.  This option is
17189used when compiling @file{crtstuff.c}; you should not need to use it
17190for anything else.
17191
17192@item -fverbose-asm
17193@opindex fverbose-asm
17194Put extra commentary information in the generated assembly code to
17195make it more readable.  This option is generally only of use to those
17196who actually need to read the generated assembly code (perhaps while
17197debugging the compiler itself).
17198
17199@option{-fno-verbose-asm}, the default, causes the
17200extra information to be omitted and is useful when comparing two assembler
17201files.
17202
17203@item -frecord-gcc-switches
17204@opindex frecord-gcc-switches
17205This switch causes the command line that was used to invoke the
17206compiler to be recorded into the object file that is being created.
17207This switch is only implemented on some targets and the exact format
17208of the recording is target and binary file format dependent, but it
17209usually takes the form of a section containing ASCII text.  This
17210switch is related to the @option{-fverbose-asm} switch, but that
17211switch only records information in the assembler output file as
17212comments, so it never reaches the object file.
17213
17214@item -fpic
17215@opindex fpic
17216@cindex global offset table
17217@cindex PIC
17218Generate position-independent code (PIC) suitable for use in a shared
17219library, if supported for the target machine.  Such code accesses all
17220constant addresses through a global offset table (GOT)@.  The dynamic
17221loader resolves the GOT entries when the program starts (the dynamic
17222loader is not part of GCC; it is part of the operating system).  If
17223the GOT size for the linked executable exceeds a machine-specific
17224maximum size, you get an error message from the linker indicating that
17225@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
17226instead.  (These maximums are 8k on the SPARC and 32k
17227on the m68k and RS/6000.  The 386 has no such limit.)
17228
17229Position-independent code requires special support, and therefore works
17230only on certain machines.  For the 386, GCC supports PIC for System V
17231but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
17232position-independent.
17233
17234When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17235are defined to 1.
17236
17237@item -fPIC
17238@opindex fPIC
17239If supported for the target machine, emit position-independent code,
17240suitable for dynamic linking and avoiding any limit on the size of the
17241global offset table.  This option makes a difference on the m68k,
17242PowerPC and SPARC@.
17243
17244Position-independent code requires special support, and therefore works
17245only on certain machines.
17246
17247When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17248are defined to 2.
17249
17250@item -fpie
17251@itemx -fPIE
17252@opindex fpie
17253@opindex fPIE
17254These options are similar to @option{-fpic} and @option{-fPIC}, but
17255generated position independent code can be only linked into executables.
17256Usually these options are used when @option{-pie} GCC option will be
17257used during linking.
17258
17259@option{-fpie} and @option{-fPIE} both define the macros
17260@code{__pie__} and @code{__PIE__}.  The macros have the value 1
17261for @option{-fpie} and 2 for @option{-fPIE}.
17262
17263@item -fno-jump-tables
17264@opindex fno-jump-tables
17265Do not use jump tables for switch statements even where it would be
17266more efficient than other code generation strategies.  This option is
17267of use in conjunction with @option{-fpic} or @option{-fPIC} for
17268building code which forms part of a dynamic linker and cannot
17269reference the address of a jump table.  On some targets, jump tables
17270do not require a GOT and this option is not needed.
17271
17272@item -ffixed-@var{reg}
17273@opindex ffixed
17274Treat the register named @var{reg} as a fixed register; generated code
17275should never refer to it (except perhaps as a stack pointer, frame
17276pointer or in some other fixed role).
17277
17278@var{reg} must be the name of a register.  The register names accepted
17279are machine-specific and are defined in the @code{REGISTER_NAMES}
17280macro in the machine description macro file.
17281
17282This flag does not have a negative form, because it specifies a
17283three-way choice.
17284
17285@item -fcall-used-@var{reg}
17286@opindex fcall-used
17287Treat the register named @var{reg} as an allocable register that is
17288clobbered by function calls.  It may be allocated for temporaries or
17289variables that do not live across a call.  Functions compiled this way
17290will not save and restore the register @var{reg}.
17291
17292It is an error to used this flag with the frame pointer or stack pointer.
17293Use of this flag for other registers that have fixed pervasive roles in
17294the machine's execution model will produce disastrous results.
17295
17296This flag does not have a negative form, because it specifies a
17297three-way choice.
17298
17299@item -fcall-saved-@var{reg}
17300@opindex fcall-saved
17301Treat the register named @var{reg} as an allocable register saved by
17302functions.  It may be allocated even for temporaries or variables that
17303live across a call.  Functions compiled this way will save and restore
17304the register @var{reg} if they use it.
17305
17306It is an error to used this flag with the frame pointer or stack pointer.
17307Use of this flag for other registers that have fixed pervasive roles in
17308the machine's execution model will produce disastrous results.
17309
17310A different sort of disaster will result from the use of this flag for
17311a register in which function values may be returned.
17312
17313This flag does not have a negative form, because it specifies a
17314three-way choice.
17315
17316@item -fpack-struct[=@var{n}]
17317@opindex fpack-struct
17318Without a value specified, pack all structure members together without
17319holes.  When a value is specified (which must be a small power of two), pack
17320structure members according to this value, representing the maximum
17321alignment (that is, objects with default alignment requirements larger than
17322this will be output potentially unaligned at the next fitting location.
17323
17324@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
17325code that is not binary compatible with code generated without that switch.
17326Additionally, it makes the code suboptimal.
17327Use it to conform to a non-default application binary interface.
17328
17329@item -finstrument-functions
17330@opindex finstrument-functions
17331Generate instrumentation calls for entry and exit to functions.  Just
17332after function entry and just before function exit, the following
17333profiling functions will be called with the address of the current
17334function and its call site.  (On some platforms,
17335@code{__builtin_return_address} does not work beyond the current
17336function, so the call site information may not be available to the
17337profiling functions otherwise.)
17338
17339@smallexample
17340void __cyg_profile_func_enter (void *this_fn,
17341                               void *call_site);
17342void __cyg_profile_func_exit  (void *this_fn,
17343                               void *call_site);
17344@end smallexample
17345
17346The first argument is the address of the start of the current function,
17347which may be looked up exactly in the symbol table.
17348
17349This instrumentation is also done for functions expanded inline in other
17350functions.  The profiling calls will indicate where, conceptually, the
17351inline function is entered and exited.  This means that addressable
17352versions of such functions must be available.  If all your uses of a
17353function are expanded inline, this may mean an additional expansion of
17354code size.  If you use @samp{extern inline} in your C code, an
17355addressable version of such functions must be provided.  (This is
17356normally the case anyways, but if you get lucky and the optimizer always
17357expands the functions inline, you might have gotten away without
17358providing static copies.)
17359
17360A function may be given the attribute @code{no_instrument_function}, in
17361which case this instrumentation will not be done.  This can be used, for
17362example, for the profiling functions listed above, high-priority
17363interrupt routines, and any functions from which the profiling functions
17364cannot safely be called (perhaps signal handlers, if the profiling
17365routines generate output or allocate memory).
17366
17367@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17368@opindex finstrument-functions-exclude-file-list
17369
17370Set the list of functions that are excluded from instrumentation (see
17371the description of @code{-finstrument-functions}).  If the file that
17372contains a function definition matches with one of @var{file}, then
17373that function is not instrumented.  The match is done on substrings:
17374if the @var{file} parameter is a substring of the file name, it is
17375considered to be a match.
17376
17377For example,
17378@code{-finstrument-functions-exclude-file-list=/bits/stl,include/sys}
17379will exclude any inline function defined in files whose pathnames
17380contain @code{/bits/stl} or @code{include/sys}.
17381
17382If, for some reason, you want to include letter @code{','} in one of
17383@var{sym}, write @code{'\,'}. For example,
17384@code{-finstrument-functions-exclude-file-list='\,\,tmp'}
17385(note the single quote surrounding the option).
17386
17387@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
17388@opindex finstrument-functions-exclude-function-list
17389
17390This is similar to @code{-finstrument-functions-exclude-file-list},
17391but this option sets the list of function names to be excluded from
17392instrumentation.  The function name to be matched is its user-visible
17393name, such as @code{vector<int> blah(const vector<int> &)}, not the
17394internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}).  The
17395match is done on substrings: if the @var{sym} parameter is a substring
17396of the function name, it is considered to be a match.  For C99 and C++
17397extended identifiers, the function name must be given in UTF-8, not
17398using universal character names.
17399
17400@item -fstack-check
17401@opindex fstack-check
17402Generate code to verify that you do not go beyond the boundary of the
17403stack.  You should specify this flag if you are running in an
17404environment with multiple threads, but only rarely need to specify it in
17405a single-threaded environment since stack overflow is automatically
17406detected on nearly all systems if there is only one stack.
17407
17408Note that this switch does not actually cause checking to be done; the
17409operating system or the language runtime must do that.  The switch causes
17410generation of code to ensure that they see the stack being extended.
17411
17412You can additionally specify a string parameter: @code{no} means no
17413checking, @code{generic} means force the use of old-style checking,
17414@code{specific} means use the best checking method and is equivalent
17415to bare @option{-fstack-check}.
17416
17417Old-style checking is a generic mechanism that requires no specific
17418target support in the compiler but comes with the following drawbacks:
17419
17420@enumerate
17421@item
17422Modified allocation strategy for large objects: they will always be
17423allocated dynamically if their size exceeds a fixed threshold.
17424
17425@item
17426Fixed limit on the size of the static frame of functions: when it is
17427topped by a particular function, stack checking is not reliable and
17428a warning is issued by the compiler.
17429
17430@item
17431Inefficiency: because of both the modified allocation strategy and the
17432generic implementation, the performances of the code are hampered.
17433@end enumerate
17434
17435Note that old-style stack checking is also the fallback method for
17436@code{specific} if no target support has been added in the compiler.
17437
17438@item -fstack-limit-register=@var{reg}
17439@itemx -fstack-limit-symbol=@var{sym}
17440@itemx -fno-stack-limit
17441@opindex fstack-limit-register
17442@opindex fstack-limit-symbol
17443@opindex fno-stack-limit
17444Generate code to ensure that the stack does not grow beyond a certain value,
17445either the value of a register or the address of a symbol.  If the stack
17446would grow beyond the value, a signal is raised.  For most targets,
17447the signal is raised before the stack overruns the boundary, so
17448it is possible to catch the signal without taking special precautions.
17449
17450For instance, if the stack starts at absolute address @samp{0x80000000}
17451and grows downwards, you can use the flags
17452@option{-fstack-limit-symbol=__stack_limit} and
17453@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
17454of 128KB@.  Note that this may only work with the GNU linker.
17455
17456@cindex aliasing of parameters
17457@cindex parameters, aliased
17458@item -fargument-alias
17459@itemx -fargument-noalias
17460@itemx -fargument-noalias-global
17461@itemx -fargument-noalias-anything
17462@opindex fargument-alias
17463@opindex fargument-noalias
17464@opindex fargument-noalias-global
17465@opindex fargument-noalias-anything
17466Specify the possible relationships among parameters and between
17467parameters and global data.
17468
17469@option{-fargument-alias} specifies that arguments (parameters) may
17470alias each other and may alias global storage.@*
17471@option{-fargument-noalias} specifies that arguments do not alias
17472each other, but may alias global storage.@*
17473@option{-fargument-noalias-global} specifies that arguments do not
17474alias each other and do not alias global storage.
17475@option{-fargument-noalias-anything} specifies that arguments do not
17476alias any other storage.
17477
17478Each language will automatically use whatever option is required by
17479the language standard.  You should not need to use these options yourself.
17480
17481@item -fleading-underscore
17482@opindex fleading-underscore
17483This option and its counterpart, @option{-fno-leading-underscore}, forcibly
17484change the way C symbols are represented in the object file.  One use
17485is to help link with legacy assembly code.
17486
17487@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
17488generate code that is not binary compatible with code generated without that
17489switch.  Use it to conform to a non-default application binary interface.
17490Not all targets provide complete support for this switch.
17491
17492@item -ftls-model=@var{model}
17493@opindex ftls-model
17494Alter the thread-local storage model to be used (@pxref{Thread-Local}).
17495The @var{model} argument should be one of @code{global-dynamic},
17496@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
17497
17498The default without @option{-fpic} is @code{initial-exec}; with
17499@option{-fpic} the default is @code{global-dynamic}.
17500
17501@item -fvisibility=@var{default|internal|hidden|protected}
17502@opindex fvisibility
17503Set the default ELF image symbol visibility to the specified option---all
17504symbols will be marked with this unless overridden within the code.
17505Using this feature can very substantially improve linking and
17506load times of shared object libraries, produce more optimized
17507code, provide near-perfect API export and prevent symbol clashes.
17508It is @strong{strongly} recommended that you use this in any shared objects
17509you distribute.
17510
17511Despite the nomenclature, @code{default} always means public ie;
17512available to be linked against from outside the shared object.
17513@code{protected} and @code{internal} are pretty useless in real-world
17514usage so the only other commonly used option will be @code{hidden}.
17515The default if @option{-fvisibility} isn't specified is
17516@code{default}, i.e., make every
17517symbol public---this causes the same behavior as previous versions of
17518GCC@.
17519
17520A good explanation of the benefits offered by ensuring ELF
17521symbols have the correct visibility is given by ``How To Write
17522Shared Libraries'' by Ulrich Drepper (which can be found at
17523@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
17524solution made possible by this option to marking things hidden when
17525the default is public is to make the default hidden and mark things
17526public.  This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
17527and @code{__attribute__ ((visibility("default")))} instead of
17528@code{__declspec(dllexport)} you get almost identical semantics with
17529identical syntax.  This is a great boon to those working with
17530cross-platform projects.
17531
17532For those adding visibility support to existing code, you may find
17533@samp{#pragma GCC visibility} of use.  This works by you enclosing
17534the declarations you wish to set visibility for with (for example)
17535@samp{#pragma GCC visibility push(hidden)} and
17536@samp{#pragma GCC visibility pop}.
17537Bear in mind that symbol visibility should be viewed @strong{as
17538part of the API interface contract} and thus all new code should
17539always specify visibility when it is not the default ie; declarations
17540only for use within the local DSO should @strong{always} be marked explicitly
17541as hidden as so to avoid PLT indirection overheads---making this
17542abundantly clear also aids readability and self-documentation of the code.
17543Note that due to ISO C++ specification requirements, operator new and
17544operator delete must always be of default visibility.
17545
17546Be aware that headers from outside your project, in particular system
17547headers and headers from any other library you use, may not be
17548expecting to be compiled with visibility other than the default.  You
17549may need to explicitly say @samp{#pragma GCC visibility push(default)}
17550before including any such headers.
17551
17552@samp{extern} declarations are not affected by @samp{-fvisibility}, so
17553a lot of code can be recompiled with @samp{-fvisibility=hidden} with
17554no modifications.  However, this means that calls to @samp{extern}
17555functions with no explicit visibility will use the PLT, so it is more
17556effective to use @samp{__attribute ((visibility))} and/or
17557@samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
17558declarations should be treated as hidden.
17559
17560Note that @samp{-fvisibility} does affect C++ vague linkage
17561entities. This means that, for instance, an exception class that will
17562be thrown between DSOs must be explicitly marked with default
17563visibility so that the @samp{type_info} nodes will be unified between
17564the DSOs.
17565
17566An overview of these techniques, their benefits and how to use them
17567is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
17568
17569@end table
17570
17571@c man end
17572
17573@node Environment Variables
17574@section Environment Variables Affecting GCC
17575@cindex environment variables
17576
17577@c man begin ENVIRONMENT
17578This section describes several environment variables that affect how GCC
17579operates.  Some of them work by specifying directories or prefixes to use
17580when searching for various kinds of files.  Some are used to specify other
17581aspects of the compilation environment.
17582
17583Note that you can also specify places to search using options such as
17584@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
17585take precedence over places specified using environment variables, which
17586in turn take precedence over those specified by the configuration of GCC@.
17587@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
17588GNU Compiler Collection (GCC) Internals}.
17589
17590@table @env
17591@item LANG
17592@itemx LC_CTYPE
17593@c @itemx LC_COLLATE
17594@itemx LC_MESSAGES
17595@c @itemx LC_MONETARY
17596@c @itemx LC_NUMERIC
17597@c @itemx LC_TIME
17598@itemx LC_ALL
17599@findex LANG
17600@findex LC_CTYPE
17601@c @findex LC_COLLATE
17602@findex LC_MESSAGES
17603@c @findex LC_MONETARY
17604@c @findex LC_NUMERIC
17605@c @findex LC_TIME
17606@findex LC_ALL
17607@cindex locale
17608These environment variables control the way that GCC uses
17609localization information that allow GCC to work with different
17610national conventions.  GCC inspects the locale categories
17611@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
17612so.  These locale categories can be set to any value supported by your
17613installation.  A typical value is @samp{en_GB.UTF-8} for English in the United
17614Kingdom encoded in UTF-8.
17615
17616The @env{LC_CTYPE} environment variable specifies character
17617classification.  GCC uses it to determine the character boundaries in
17618a string; this is needed for some multibyte encodings that contain quote
17619and escape characters that would otherwise be interpreted as a string
17620end or escape.
17621
17622The @env{LC_MESSAGES} environment variable specifies the language to
17623use in diagnostic messages.
17624
17625If the @env{LC_ALL} environment variable is set, it overrides the value
17626of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
17627and @env{LC_MESSAGES} default to the value of the @env{LANG}
17628environment variable.  If none of these variables are set, GCC
17629defaults to traditional C English behavior.
17630
17631@item TMPDIR
17632@findex TMPDIR
17633If @env{TMPDIR} is set, it specifies the directory to use for temporary
17634files.  GCC uses temporary files to hold the output of one stage of
17635compilation which is to be used as input to the next stage: for example,
17636the output of the preprocessor, which is the input to the compiler
17637proper.
17638
17639@item GCC_EXEC_PREFIX
17640@findex GCC_EXEC_PREFIX
17641If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
17642names of the subprograms executed by the compiler.  No slash is added
17643when this prefix is combined with the name of a subprogram, but you can
17644specify a prefix that ends with a slash if you wish.
17645
17646If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
17647an appropriate prefix to use based on the pathname it was invoked with.
17648
17649If GCC cannot find the subprogram using the specified prefix, it
17650tries looking in the usual places for the subprogram.
17651
17652The default value of @env{GCC_EXEC_PREFIX} is
17653@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
17654the installed compiler. In many cases @var{prefix} is the value
17655of @code{prefix} when you ran the @file{configure} script.
17656
17657Other prefixes specified with @option{-B} take precedence over this prefix.
17658
17659This prefix is also used for finding files such as @file{crt0.o} that are
17660used for linking.
17661
17662In addition, the prefix is used in an unusual way in finding the
17663directories to search for header files.  For each of the standard
17664directories whose name normally begins with @samp{/usr/local/lib/gcc}
17665(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
17666replacing that beginning with the specified prefix to produce an
17667alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
17668@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
17669These alternate directories are searched first; the standard directories
17670come next. If a standard directory begins with the configured
17671@var{prefix} then the value of @var{prefix} is replaced by
17672@env{GCC_EXEC_PREFIX} when looking for header files.
17673
17674@item COMPILER_PATH
17675@findex COMPILER_PATH
17676The value of @env{COMPILER_PATH} is a colon-separated list of
17677directories, much like @env{PATH}.  GCC tries the directories thus
17678specified when searching for subprograms, if it can't find the
17679subprograms using @env{GCC_EXEC_PREFIX}.
17680
17681@item LIBRARY_PATH
17682@findex LIBRARY_PATH
17683The value of @env{LIBRARY_PATH} is a colon-separated list of
17684directories, much like @env{PATH}.  When configured as a native compiler,
17685GCC tries the directories thus specified when searching for special
17686linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
17687using GCC also uses these directories when searching for ordinary
17688libraries for the @option{-l} option (but directories specified with
17689@option{-L} come first).
17690
17691@item LANG
17692@findex LANG
17693@cindex locale definition
17694This variable is used to pass locale information to the compiler.  One way in
17695which this information is used is to determine the character set to be used
17696when character literals, string literals and comments are parsed in C and C++.
17697When the compiler is configured to allow multibyte characters,
17698the following values for @env{LANG} are recognized:
17699
17700@table @samp
17701@item C-JIS
17702Recognize JIS characters.
17703@item C-SJIS
17704Recognize SJIS characters.
17705@item C-EUCJP
17706Recognize EUCJP characters.
17707@end table
17708
17709If @env{LANG} is not defined, or if it has some other value, then the
17710compiler will use mblen and mbtowc as defined by the default locale to
17711recognize and translate multibyte characters.
17712@end table
17713
17714@noindent
17715Some additional environments variables affect the behavior of the
17716preprocessor.
17717
17718@include cppenv.texi
17719
17720@c man end
17721
17722@node Precompiled Headers
17723@section Using Precompiled Headers
17724@cindex precompiled headers
17725@cindex speed of compilation
17726
17727Often large projects have many header files that are included in every
17728source file.  The time the compiler takes to process these header files
17729over and over again can account for nearly all of the time required to
17730build the project.  To make builds faster, GCC allows users to
17731`precompile' a header file; then, if builds can use the precompiled
17732header file they will be much faster.
17733
17734To create a precompiled header file, simply compile it as you would any
17735other file, if necessary using the @option{-x} option to make the driver
17736treat it as a C or C++ header file.  You will probably want to use a
17737tool like @command{make} to keep the precompiled header up-to-date when
17738the headers it contains change.
17739
17740A precompiled header file will be searched for when @code{#include} is
17741seen in the compilation.  As it searches for the included file
17742(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
17743compiler looks for a precompiled header in each directory just before it
17744looks for the include file in that directory.  The name searched for is
17745the name specified in the @code{#include} with @samp{.gch} appended.  If
17746the precompiled header file can't be used, it is ignored.
17747
17748For instance, if you have @code{#include "all.h"}, and you have
17749@file{all.h.gch} in the same directory as @file{all.h}, then the
17750precompiled header file will be used if possible, and the original
17751header will be used otherwise.
17752
17753Alternatively, you might decide to put the precompiled header file in a
17754directory and use @option{-I} to ensure that directory is searched
17755before (or instead of) the directory containing the original header.
17756Then, if you want to check that the precompiled header file is always
17757used, you can put a file of the same name as the original header in this
17758directory containing an @code{#error} command.
17759
17760This also works with @option{-include}.  So yet another way to use
17761precompiled headers, good for projects not designed with precompiled
17762header files in mind, is to simply take most of the header files used by
17763a project, include them from another header file, precompile that header
17764file, and @option{-include} the precompiled header.  If the header files
17765have guards against multiple inclusion, they will be skipped because
17766they've already been included (in the precompiled header).
17767
17768If you need to precompile the same header file for different
17769languages, targets, or compiler options, you can instead make a
17770@emph{directory} named like @file{all.h.gch}, and put each precompiled
17771header in the directory, perhaps using @option{-o}.  It doesn't matter
17772what you call the files in the directory, every precompiled header in
17773the directory will be considered.  The first precompiled header
17774encountered in the directory that is valid for this compilation will
17775be used; they're searched in no particular order.
17776
17777There are many other possibilities, limited only by your imagination,
17778good sense, and the constraints of your build system.
17779
17780A precompiled header file can be used only when these conditions apply:
17781
17782@itemize
17783@item
17784Only one precompiled header can be used in a particular compilation.
17785
17786@item
17787A precompiled header can't be used once the first C token is seen.  You
17788can have preprocessor directives before a precompiled header; you can
17789even include a precompiled header from inside another header, so long as
17790there are no C tokens before the @code{#include}.
17791
17792@item
17793The precompiled header file must be produced for the same language as
17794the current compilation.  You can't use a C precompiled header for a C++
17795compilation.
17796
17797@item
17798The precompiled header file must have been produced by the same compiler
17799binary as the current compilation is using.
17800
17801@item
17802Any macros defined before the precompiled header is included must
17803either be defined in the same way as when the precompiled header was
17804generated, or must not affect the precompiled header, which usually
17805means that they don't appear in the precompiled header at all.
17806
17807The @option{-D} option is one way to define a macro before a
17808precompiled header is included; using a @code{#define} can also do it.
17809There are also some options that define macros implicitly, like
17810@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
17811defined this way.
17812
17813@item If debugging information is output when using the precompiled
17814header, using @option{-g} or similar, the same kind of debugging information
17815must have been output when building the precompiled header.  However,
17816a precompiled header built using @option{-g} can be used in a compilation
17817when no debugging information is being output.
17818
17819@item The same @option{-m} options must generally be used when building
17820and using the precompiled header.  @xref{Submodel Options},
17821for any cases where this rule is relaxed.
17822
17823@item Each of the following options must be the same when building and using
17824the precompiled header:
17825
17826@gccoptlist{-fexceptions}
17827
17828@item
17829Some other command-line options starting with @option{-f},
17830@option{-p}, or @option{-O} must be defined in the same way as when
17831the precompiled header was generated.  At present, it's not clear
17832which options are safe to change and which are not; the safest choice
17833is to use exactly the same options when generating and using the
17834precompiled header.  The following are known to be safe:
17835
17836@gccoptlist{-fmessage-length=  -fpreprocessed  -fsched-interblock @gol
17837-fsched-spec  -fsched-spec-load  -fsched-spec-load-dangerous @gol
17838-fsched-verbose=<number>  -fschedule-insns  -fvisibility= @gol
17839-pedantic-errors}
17840
17841@end itemize
17842
17843For all of these except the last, the compiler will automatically
17844ignore the precompiled header if the conditions aren't met.  If you
17845find an option combination that doesn't work and doesn't cause the
17846precompiled header to be ignored, please consider filing a bug report,
17847see @ref{Bugs}.
17848
17849If you do use differing options when generating and using the
17850precompiled header, the actual behavior will be a mixture of the
17851behavior for the options.  For instance, if you use @option{-g} to
17852generate the precompiled header but not when using it, you may or may
17853not get debugging information for routines in the precompiled header.
17854