]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/invoke.texi
Add Go frontend, libgo library, and Go testsuite.
[thirdparty/gcc.git] / gcc / doc / invoke.texi
CommitLineData
d0a5eb32 1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
c41b7b13 2@c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
5b3e6663 3@c Free Software Foundation, Inc.
74291a4b
MM
4@c This is part of the GCC manual.
5@c For copying conditions, see the file gcc.texi.
6
9d86bffc 7@ignore
9d530538
MM
8@c man begin INCLUDE
9@include gcc-vers.texi
10@c man end
11
9d86bffc 12@c man begin COPYRIGHT
2b6dd222 13Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
c41b7b13 141999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
28a08168 15Free Software Foundation, Inc.
9d86bffc 16
77bd67cb 17Permission is granted to copy, distribute and/or modify this document
07a67d6a 18under the terms of the GNU Free Documentation License, Version 1.3 or
77bd67cb
JM
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.
9d86bffc 24
77bd67cb 25(a) The FSF's Front-Cover Text is:
9d86bffc 26
77bd67cb
JM
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.
9d86bffc
JM
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
630d3d5a
JM
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{}]
9d530538 45 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
9d86bffc
JM
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
77bd67cb 51gpl(7), gfdl(7), fsf-funding(7),
b4117c30
ZW
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},
9d86bffc
JM
54@file{ld}, @file{binutils} and @file{gdb}.
55@c man end
2642624b
JM
56@c man begin BUGS
57For instructions on reporting bugs, see
2f41c1d6 58@w{@value{BUGURL}}.
2642624b
JM
59@c man end
60@c man begin AUTHOR
24dbb440
GP
61See the Info entry for @command{gcc}, or
62@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
63for contributors to GCC@.
2642624b 64@c man end
9d86bffc
JM
65@end ignore
66
74291a4b 67@node Invoking GCC
0c2d1a2a
JB
68@chapter GCC Command Options
69@cindex GCC command options
74291a4b 70@cindex command options
0c2d1a2a 71@cindex options, GCC command
74291a4b 72
9d86bffc 73@c man begin DESCRIPTION
0c2d1a2a 74When you invoke GCC, it normally does preprocessing, compilation,
74291a4b 75assembly and linking. The ``overall options'' allow you to stop this
630d3d5a 76process at an intermediate stage. For example, the @option{-c} option
74291a4b
MM
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
0c2d1a2a 86Most of the command line options that you can use with GCC are useful
74291a4b
MM
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
bedc7537 98The @command{gcc} program accepts options and file names as operands. Many
b192711e 99options have multi-letter names; therefore multiple single-letter options
cb7c15f8
JH
100may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
101-v}}.
74291a4b
MM
102
103@cindex order of options
104@cindex options, order
105You can mix options and other arguments. For the most part, the order
70f57af1
ILT
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.
74291a4b
MM
110
111Many options have long names starting with @samp{-f} or with
cb7ad97b 112@samp{-W}---for example,
efa1cdf0 113@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
74291a4b 114these have both positive and negative forms; the negative form of
630d3d5a 115@option{-ffoo} would be @option{-fno-foo}. This manual documents
74291a4b
MM
116only one of these two forms, whichever one is not the default.
117
9d86bffc
JM
118@c man end
119
cd3bb277
JM
120@xref{Option Index}, for an index to GCC's options.
121
74291a4b 122@menu
6ccde948 123* Option Summary:: Brief list of all options, without explanations.
74291a4b
MM
124* Overall Options:: Controlling the kind of output:
125 an executable, object files, assembler files,
126 or preprocessed source.
6ccde948 127* Invoking G++:: Compiling C++ programs.
74291a4b
MM
128* C Dialect Options:: Controlling the variant of C language compiled.
129* C++ Dialect Options:: Variations on C++.
46e34f96
ZL
130* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
131 and Objective-C++.
764dbbf2 132* Language Independent Options:: Controlling how diagnostics should be
02f52e19 133 formatted.
74291a4b
MM
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.
a743d340 143* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 144* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
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.
0c2d1a2a 149* Environment Variables:: Env vars that affect GCC.
17211ab5 150* Precompiled Headers:: Compiling a header once, and using it many times.
74291a4b
MM
151@end menu
152
4bc1997b
JM
153@c man begin OPTIONS
154
74291a4b
MM
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}.
c3224d6f 164@gccoptlist{-c -S -E -o @var{file} -no-canonical-prefixes @gol
ba0c638e 165-pipe -pass-exit-codes @gol
0631b69f 166-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
ab940b73 167--version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
c6a13190 168-fdump-ada-spec@r{[}-slim@r{]}} -fdump-go-spec=@var{file}
74291a4b
MM
169
170@item C Language Options
171@xref{C Dialect Options,,Options Controlling C Dialect}.
da1c7394
ILT
172@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
173-aux-info @var{filename} @gol
9a94f7f3 174-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
478a1c5b 175-fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
8a035a6b 176-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
00c8e9f6 177-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
4bc1997b 178-fsigned-bitfields -fsigned-char @gol
3521b33c 179-funsigned-bitfields -funsigned-char}
74291a4b
MM
180
181@item C++ Language Options
182@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
9a94f7f3 183@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
cfb10bd3 184-fconserve-space -ffriend-injection @gol
aa0cc562 185-fno-elide-constructors @gol
7813d14c 186-fno-enforce-eh-specs @gol
1dbb6023 187-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
90ecce3e 188-fno-implicit-templates @gol
4bc1997b
JM
189-fno-implicit-inline-templates @gol
190-fno-implement-inlines -fms-extensions @gol
d3f28910 191-fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
4bc1997b 192-fno-optional-diags -fpermissive @gol
6ea2bd47 193-fno-pretty-templates @gol
124e0d27 194-frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
40aac948 195-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
d7afec4b 196-fno-default-inline -fvisibility-inlines-hidden @gol
ddbfd28d 197-fvisibility-ms-compat @gol
17251338 198-Wabi -Wconversion-null -Wctor-dtor-privacy @gol
59f9c2ed 199-Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
899015a0 200-Weffc++ -Wstrict-null-sentinel @gol
4bc1997b
JM
201-Wno-non-template-friend -Wold-style-cast @gol
202-Woverloaded-virtual -Wno-pmf-conversions @gol
4e2db7a8 203-Wsign-promo}
74291a4b 204
46e34f96
ZL
205@item Objective-C and Objective-C++ Language Options
206@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
207Objective-C and Objective-C++ Dialects}.
dd508457 208@gccoptlist{-fconstant-string-class=@var{class-name} @gol
264fa2db
ZL
209-fgnu-runtime -fnext-runtime @gol
210-fno-nil-receivers @gol
6e955430
ZL
211-fobjc-call-cxx-cdtors @gol
212-fobjc-direct-dispatch @gol
264fa2db 213-fobjc-exceptions @gol
6e955430 214-fobjc-gc @gol
22d8d616 215-fobjc-std=objc1 @gol
264fa2db
ZL
216-freplace-objc-classes @gol
217-fzero-link @gol
218-gen-decls @gol
6e955430
ZL
219-Wassign-intercept @gol
220-Wno-protocol -Wselector @gol
221-Wstrict-selector-match @gol
222-Wundeclared-selector}
60de6385 223
764dbbf2
GDR
224@item Language Independent Options
225@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
9a94f7f3 226@gccoptlist{-fmessage-length=@var{n} @gol
dd508457
BM
227-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
228-fdiagnostics-show-option}
764dbbf2 229
74291a4b
MM
230@item Warning Options
231@xref{Warning Options,,Options to Request or Suppress Warnings}.
3a789837
NF
232@gccoptlist{-fsyntax-only fmax-errors=@var{n} -pedantic @gol
233-pedantic-errors @gol
f6aa72dd 234-w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
c047ce93
SB
235-Wno-attributes -Wno-builtin-macro-redefined @gol
236-Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
e1f1ee86 237-Wchar-subscripts -Wclobbered -Wcomment @gol
87cf0651 238-Wconversion -Wcoverage-mismatch -Wcpp -Wno-deprecated @gol
1ebc7e68 239-Wno-deprecated-declarations -Wdisabled-optimization @gol
0a0b3574
MM
240-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
241-Wno-endif-labels -Werror -Werror=* @gol
c65a01af 242-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
802e3f8c 243-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
a214518f 244-Wformat-security -Wformat-y2k @gol
e1b7793c 245-Wframe-larger-than=@var{len} -Wjump-misses-init -Wignored-qualifiers @gol
fb0317c6 246-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
c24d4112 247-Winit-self -Winline @gol
63a08740 248-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
e8fc888d 249-Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
63a08740 250-Wlogical-op -Wlong-long @gol
eaac4679 251-Wmain -Wmissing-braces -Wmissing-field-initializers @gol
b02398bd 252-Wmissing-format-attribute -Wmissing-include-dirs @gol
7ea6b6cf 253-Wno-mudflap @gol
71834ad3 254-Wno-multichar -Wnonnull -Wno-overflow @gol
2cd36c22 255-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
94564826
KT
256-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
257-Wpointer-arith -Wno-pointer-to-int-cast @gol
53a2494e 258-Wredundant-decls @gol
4bc1997b 259-Wreturn-type -Wsequence-point -Wshadow @gol
7060db96 260-Wsign-compare -Wsign-conversion -Wstack-protector @gol
79bedddc 261-Wstrict-aliasing -Wstrict-aliasing=n @gol
6ac01510 262-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
212580ff 263-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
23462d4d 264-Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
8ffadef9
MG
265-Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
266-Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
6ec637a4 267-Wunsuffixed-float-constants -Wunused -Wunused-function @gol
ab940b73
RW
268-Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value @gol
269-Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable @gol
270-Wvariadic-macros -Wvla -Wvolatile-register-var -Wwrite-strings}
74291a4b 271
670b0231 272@item C and Objective-C-only Warning Options
9a94f7f3 273@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
b1ed4cb4
MLI
274-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
275-Wold-style-declaration -Wold-style-definition @gol
05170031 276-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
f4e9414e 277-Wdeclaration-after-statement -Wpointer-sign}
fe50c0eb 278
74291a4b
MM
279@item Debugging Options
280@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
9a94f7f3 281@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
0a090f42 282-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
2aa7c49b 283-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
058e97ec 284-fdump-translation-unit@r{[}-@var{n}@r{]} @gol
aee96fe9 285-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
fed39e22 286-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
9fe0cb7d 287-fdump-statistics @gol
6de9cd9a 288-fdump-tree-all @gol
9a94f7f3
JM
289-fdump-tree-original@r{[}-@var{n}@r{]} @gol
290-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
6de9cd9a
DN
291-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
292-fdump-tree-ch @gol
293-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
294-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
295-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
296-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
297-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
248fc9f3 298-fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
6de9cd9a
DN
299-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
300-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
301-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
79fe1b3b 302-fdump-tree-nrv -fdump-tree-vect @gol
fa555252 303-fdump-tree-sink @gol
6de9cd9a 304-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
248fc9f3 305-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
ff2ad0f7 306-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
08873e96 307-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
c866976a 308-ftree-vectorizer-verbose=@var{n} @gol
0bca51f0 309-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
2153915d
AO
310-fdump-final-insns=@var{file} @gol
311-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
a37db56b 312-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
e713adf6 313-feliminate-unused-debug-symbols -femit-class-debug-always @gol
77831620 314-fenable-icf-debug @gol
a5573239 315-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
a37db56b 316-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
e855c69d 317-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
d3c12306 318-fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
b55b184a 319-fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
53b2323e 320-g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
dc67413d
JJ
321-ggdb -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
322-gvms -gxcoff -gxcoff+ @gol
8f57ac5a
JJ
323-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
324-fdebug-prefix-map=@var{old}=@var{new} @gol
39ef6592
LC
325-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
326-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
4bc1997b 327-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
de55f03a 328-print-multi-directory -print-multi-lib -print-multi-os-directory @gol
4bc1997b 329-print-prog-name=@var{program} -print-search-dirs -Q @gol
3def1397 330-print-sysroot -print-sysroot-headers-suffix @gol
bdde878c 331-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
74291a4b
MM
332
333@item Optimization Options
334@xref{Optimize Options,,Options that Control Optimization}.
ab940b73 335@gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
71733172
KZ
336-falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
337-fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
338-fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
ccaeeafe
NC
339-fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
340-fcprop-registers -fcrossjumping @gol
ab940b73
RW
341-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
342-fcx-limited-range @gol
8cc6d3e0 343-fdata-sections -fdce -fdce @gol
71733172 344-fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse @gol
07ffa034 345-fearly-inlining -fipa-sra -fexpensive-optimizations -ffast-math @gol
8ce94e44 346-ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
16949072 347-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
384a5197 348-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
3e293154
MJ
349-fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
350-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
ab940b73
RW
351-finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
352-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
353-fipa-struct-reorg -fira-algorithm=@var{algorithm} @gol
22b0982c 354-fira-region=@var{region} @gol
1833192f 355-fira-loop-pressure -fno-ira-share-save-slots @gol
058e97ec
VM
356-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
357-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
98af4c9f 358-floop-block -floop-flatten -floop-interchange -floop-strip-mine @gol
3abe8cab
JH
359-floop-parallelize-all -flto -flto-compression-level
360-flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
852e4bd2
JH
361-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
362-fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
ab940b73 363-fno-default-inline @gol
71733172
KZ
364-fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
365-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
366-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
367-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
368-fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
ab940b73
RW
369-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
370-fprefetch-loop-arrays @gol
52c76998
PY
371-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
372-fprofile-generate=@var{path} @gol
2f908293
SP
373-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
374-freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
71733172
KZ
375-freorder-blocks-and-partition -freorder-functions @gol
376-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
57257f0d 377-frounding-math -fsched2-use-superblocks -fsched-pressure @gol
ce18efcb 378-fsched-spec-load -fsched-spec-load-dangerous @gol
71733172 379-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
ee4764a8 380-fsched-group-heuristic -fsched-critical-path-heuristic @gol
ce18efcb
VM
381-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
382-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
8393a9c8 383-fschedule-insns -fschedule-insns2 -fsection-anchors @gol
e855c69d
AB
384-fselective-scheduling -fselective-scheduling2 @gol
385-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
71733172
KZ
386-fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
387-fsplit-wide-types -fstack-protector -fstack-protector-all @gol
ab940b73
RW
388-fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
389-ftree-bit-ccp @gol
c2699190 390-ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
384a5197 391-ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
bd544141
SP
392-ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
393-ftree-loop-if-convert-memory-writes -ftree-loop-im @gol
20769d5e 394-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
71733172 395-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
248fc9f3 396-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
dce2b2f6 397-ftree-sink -ftree-sra -ftree-switch-conversion @gol
b6e99746
MJ
398-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
399-funit-at-a-time -funroll-all-loops -funroll-loops @gol
400-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
71733172 401-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
3abe8cab 402-fwhole-program -fwpa -fuse-linker-plugin @gol
3af64fd6 403--param @var{name}=@var{value}
be6d3f0e 404-O -O0 -O1 -O2 -O3 -Os -Ofast}
74291a4b
MM
405
406@item Preprocessor Options
407@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
c2d635bc 408@gccoptlist{-A@var{question}=@var{answer} @gol
9a94f7f3 409-A-@var{question}@r{[}=@var{answer}@r{]} @gol
4bc1997b
JM
410-C -dD -dI -dM -dN @gol
411-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
412-idirafter @var{dir} @gol
413-include @var{file} -imacros @var{file} @gol
414-iprefix @var{file} -iwithprefix @var{dir} @gol
bdd42dd9 415-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
2b6dd222 416-imultilib @var{dir} -isysroot @var{dir} @gol
b20d9f0c
AO
417-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
418-P -fworking-directory -remap @gol
9a94f7f3
JM
419-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
420-Xpreprocessor @var{option}}
74291a4b
MM
421
422@item Assembler Option
423@xref{Assembler Options,,Passing Options to the Assembler}.
9a94f7f3 424@gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
74291a4b
MM
425
426@item Linker Options
427@xref{Link Options,,Options for Linking}.
9a94f7f3 428@gccoptlist{@var{object-file-name} -l@var{library} @gol
0cbc4d77 429-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
96be7a11
ILT
430-s -static -static-libgcc -static-libstdc++ -shared @gol
431-shared-libgcc -symbolic @gol
3027350e 432-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
4bc1997b 433-u @var{symbol}}
74291a4b
MM
434
435@item Directory Options
436@xref{Directory Options,,Options for Directory Search}.
4adbd5dd
MK
437@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir}}
438-iquote@var{dir} -L@var{dir} -specs=@var{file} -I-
439--sysroot=@var{dir}
74291a4b 440
74291a4b
MM
441@item Machine Dependent Options
442@xref{Submodel Options,,Hardware Models and Configurations}.
39bc1876
NS
443@c This list is ordered alphanumerically by subsection name.
444@c Try and put the significant identifier (CPU or system) first,
445@c so users have a clue at guessing where the ones they want will be.
5d22c1a5 446
39bc1876
NS
447@emph{ARC Options}
448@gccoptlist{-EB -EL @gol
449-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
450-mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
74291a4b 451
74291a4b 452@emph{ARM Options}
9a94f7f3 453@gccoptlist{-mapcs-frame -mno-apcs-frame @gol
5848830f 454-mabi=@var{name} @gol
310668e8
JM
455-mapcs-stack-check -mno-apcs-stack-check @gol
456-mapcs-float -mno-apcs-float @gol
457-mapcs-reentrant -mno-apcs-reentrant @gol
458-msched-prolog -mno-sched-prolog @gol
459-mlittle-endian -mbig-endian -mwords-little-endian @gol
34a86306 460-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
0fd8c3ad 461-mfp16-format=@var{name}
310668e8 462-mthumb-interwork -mno-thumb-interwork @gol
9b66ebb1 463-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
247f8561 464-mstructure-size-boundary=@var{n} @gol
4bc1997b 465-mabort-on-noreturn @gol
310668e8
JM
466-mlong-calls -mno-long-calls @gol
467-msingle-pic-base -mno-single-pic-base @gol
247f8561
PB
468-mpic-register=@var{reg} @gol
469-mnop-fun-dllimport @gol
9b6b54e2 470-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
247f8561 471-mpoke-function-name @gol
310668e8
JM
472-mthumb -marm @gol
473-mtpcs-frame -mtpcs-leaf-frame @gol
d3585b76 474-mcaller-super-interworking -mcallee-super-interworking @gol
5fd42423
PB
475-mtp=@var{name} @gol
476-mword-relocations @gol
477-mfix-cortex-m3-ldrd}
74291a4b 478
39bc1876 479@emph{AVR Options}
007a178c 480@gccoptlist{-mmcu=@var{mcu} -mno-interrupts @gol
4223ff5f 481-mcall-prologues -mtiny-stack -mint8}
861bb6c1 482
0d4a78eb 483@emph{Blackfin Options}
ea2382be
JZ
484@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
485-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
486-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
487-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
488-mno-id-shared-library -mshared-library-id=@var{n} @gol
489-mleaf-id-shared-library -mno-leaf-id-shared-library @gol
490-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
bf85bc3d
BS
491-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
492-micplb}
0d4a78eb 493
39bc1876
NS
494@emph{CRIS Options}
495@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
496-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
497-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
498-mstack-align -mdata-align -mconst-align @gol
499-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
500-melf -maout -melinux -mlinux -sim -sim2 @gol
501-mmul-bug-workaround -mno-mul-bug-workaround}
74291a4b 502
53054e77
PW
503@emph{CRX Options}
504@gccoptlist{-mmac -mpush-args}
505
48aec0bc 506@emph{Darwin Options}
6d2f9dd3
JM
507@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
508-arch_only -bind_at_load -bundle -bundle_loader @gol
509-client_name -compatibility_version -current_version @gol
5079843a 510-dead_strip @gol
6d2f9dd3
JM
511-dependency-file -dylib_file -dylinker_install_name @gol
512-dynamic -dynamiclib -exported_symbols_list @gol
513-filelist -flat_namespace -force_cpusubtype_ALL @gol
514-force_flat_namespace -headerpad_max_install_names @gol
1f1d5130 515-iframework @gol
6d2f9dd3
JM
516-image_base -init -install_name -keep_private_externs @gol
517-multi_module -multiply_defined -multiply_defined_unused @gol
5079843a
DP
518-noall_load -no_dead_strip_inits_and_terms @gol
519-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
6d2f9dd3
JM
520-pagezero_size -prebind -prebind_all_twolevel_modules @gol
521-private_bundle -read_only_relocs -sectalign @gol
522-sectobjectsymbols -whyload -seg1addr @gol
523-sectcreate -sectobjectsymbols -sectorder @gol
5826770c 524-segaddr -segs_read_only_addr -segs_read_write_addr @gol
6d2f9dd3
JM
525-seg_addr_table -seg_addr_table_filename -seglinkedit @gol
526-segprot -segs_read_only_addr -segs_read_write_addr @gol
527-single_module -static -sub_library -sub_umbrella @gol
528-twolevel_namespace -umbrella -undefined @gol
529-unexported_symbols_list -weak_reference_mismatches @gol
337f2a22 530-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
57164024 531-mkernel -mone-byte-bool}
48aec0bc 532
74291a4b 533@emph{DEC Alpha Options}
9a94f7f3 534@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
4bc1997b
JM
535-mieee -mieee-with-inexact -mieee-conformant @gol
536-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
537-mtrap-precision=@var{mode} -mbuild-constants @gol
58605ba0
RH
538-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
539-mbwx -mmax -mfix -mcix @gol
540-mfloat-vax -mfloat-ieee @gol
9a94f7f3
JM
541-mexplicit-relocs -msmall-data -mlarge-data @gol
542-msmall-text -mlarge-text @gol
4bc1997b 543-mmemory-latency=@var{time}}
74291a4b 544
d7c23cdc 545@emph{DEC Alpha/VMS Options}
5e3fef6c 546@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
d7c23cdc 547
18a3bdcb
NC
548@emph{FR30 Options}
549@gccoptlist{-msmall-model -mno-lsim}
550
39bc1876
NS
551@emph{FRV Options}
552@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
553-mhard-float -msoft-float @gol
554-malloc-cc -mfixed-cc -mdword -mno-dword @gol
555-mdouble -mno-double @gol
556-mmedia -mno-media -mmuladd -mno-muladd @gol
c557edf4
RS
557-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
558-mlinked-fp -mlong-calls -malign-labels @gol
559-mlibrary-pic -macc-4 -macc-8 @gol
39bc1876 560-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
38c28a25 561-moptimize-membar -mno-optimize-membar @gol
39bc1876
NS
562-mscc -mno-scc -mcond-exec -mno-cond-exec @gol
563-mvliw-branch -mno-vliw-branch @gol
564-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
565-mno-nested-cond-exec -mtomcat-stats @gol
e4dd71de 566-mTLS -mtls @gol
39bc1876
NS
567-mcpu=@var{cpu}}
568
464aea98 569@emph{GNU/Linux Options}
51b9db92
MK
570@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
571-tno-android-cc -tno-android-ld}
464aea98 572
74291a4b 573@emph{H8/300 Options}
9a94f7f3 574@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
74291a4b 575
39bc1876
NS
576@emph{HPPA Options}
577@gccoptlist{-march=@var{architecture-type} @gol
578-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
579-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
a2017852 580-mfixed-range=@var{register-range} @gol
39bc1876
NS
581-mjump-in-delay -mlinker-opt -mlong-calls @gol
582-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
583-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
584-mno-jump-in-delay -mno-long-load-store @gol
585-mno-portable-runtime -mno-soft-float @gol
586-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
587-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
588-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
d711cf67 589-munix=@var{unix-std} -nolibdld -static -threads}
74291a4b 590
39bc1876
NS
591@emph{i386 and x86-64 Options}
592@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
593-mfpmath=@var{unit} @gol
594-masm=@var{dialect} -mno-fancy-math-387 @gol
c33104d6 595-mno-fp-ret-in-387 -msoft-float @gol
39bc1876 596-mno-wide-multiply -mrtd -malign-double @gol
2e3f842f 597-mpreferred-stack-boundary=@var{num}
ab940b73 598-mincoming-stack-boundary=@var{num} @gol
2767a7f2 599-mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip -mvzeroupper @gol
31cb596a 600-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
4ee89d5f 601-maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfused-madd @gol
94d13ad1 602-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlwp @gol
39bc1876 603-mthreads -mno-align-stringops -minline-all-stringops @gol
9946ca2d 604-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
39bc1876 605-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
fa283935 606-m96bit-long-double -mregparm=@var{num} -msseregparm @gol
2770264a
RO
607-mveclibabi=@var{type} -mvect8-ret-in-mem @gol
608-mpc32 -mpc64 -mpc80 -mstackrealign @gol
1f97667f 609-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
51212b32 610-mcmodel=@var{code-model} -mabi=@var{name} @gol
04e1d06b 611-m32 -m64 -mlarge-data-threshold=@var{num} @gol
26ec9308 612-msse2avx -mfentry -m8bit-idiv}
56b2d7a7 613
39bc1876
NS
614@emph{IA-64 Options}
615@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
bf3c6caf
SE
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
39bc1876 619-minline-float-divide-max-throughput @gol
bf3c6caf 620-mno-inline-float-divide @gol
39bc1876 621-minline-int-divide-min-latency @gol
28b43def 622-minline-int-divide-max-throughput @gol
bf3c6caf 623-mno-inline-int-divide @gol
28b43def 624-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
bf3c6caf
SE
625-mno-inline-sqrt @gol
626-mdwarf2-asm -mearly-stop-bits @gol
28b43def 627-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
bf3c6caf
SE
628-mtune=@var{cpu-type} -milp32 -mlp64 @gol
629-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
048d0d36 630-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
bf3c6caf
SE
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}}
282a61e6 636
dcad28fd
DR
637@emph{IA-64/VMS Options}
638@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
639
aa4945c1
JB
640@emph{LM32 Options}
641@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
642-msign-extend-enabled -muser-enabled}
643
39bc1876
NS
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}}
83575957 655
38b2d076
DD
656@emph{M32C Options}
657@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
658
39bc1876 659@emph{M680x0 Options}
900ec02d
JB
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
64826589
NS
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
39bc1876 666-malign-int -mstrict-align -msep-data -mno-sep-data @gol
884316ff
JM
667-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
668-mxgot -mno-xgot}
789a3090 669
39bc1876
NS
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}}
052a4b28 674
789a3090 675@emph{MCore Options}
9a94f7f3 676@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
310668e8
JM
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}
f84271d9 681
e2491744
DD
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
80920132
ME
689@emph{MicroBlaze Options}
690@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
691-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
692-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
693-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
694-mxl-mode-@var{app-model}}
695
39bc1876
NS
696@emph{MIPS Options}
697@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
f2d6ca50
AN
698-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
699-mips64 -mips64r2 @gol
f9e4a411 700-mips16 -mno-mips16 -mflip-mips16 @gol
1ec3b87b 701-minterlink-mips16 -mno-interlink-mips16 @gol
f9e4a411 702-mabi=@var{abi} -mabicalls -mno-abicalls @gol
e21d5757
DJ
703-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
704-mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
500fc425 705-msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
0bb7b92e 706-mfpu=@var{fpu-type} @gol
0aa222d1 707-msmartmips -mno-smartmips @gol
500fc425 708-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
66471b47 709-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
fb8136b2 710-mlong64 -mlong32 -msym32 -mno-sym32 @gol
a318179e
RS
711-G@var{num} -mlocal-sdata -mno-local-sdata @gol
712-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
713-membedded-data -mno-embedded-data @gol
39bc1876 714-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
c93c5160 715-mcode-readable=@var{setting} @gol
500fc425
TS
716-msplit-addresses -mno-split-addresses @gol
717-mexplicit-relocs -mno-explicit-relocs @gol
39bc1876 718-mcheck-zero-division -mno-check-zero-division @gol
9f0df97a 719-mdivide-traps -mdivide-breaks @gol
39bc1876
NS
720-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
721-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
722-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
ee9a72e5
JK
723-mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
724-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
39bc1876 725-mflush-func=@var{func} -mno-flush-func @gol
a05bea76 726-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
39bc1876 727-mfp-exceptions -mno-fp-exceptions @gol
b53da244 728-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
c376dbfb 729-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
bcf684c7 730
39bc1876
NS
731@emph{MMIX Options}
732@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
733-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
734-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
735-mno-base-addresses -msingle-exit -mno-single-exit}
df6194d4 736
39bc1876
NS
737@emph{MN10300 Options}
738@gccoptlist{-mmult-bug -mno-mult-bug @gol
f3f63737
NC
739-mno-am33 -mam33 -mam33-2 -mam34 @gol
740-mtune=@var{cpu-type} @gol
b1eb8119 741-mreturn-pointer-on-d0 @gol
39bc1876 742-mno-crt0 -mrelax}
91abf72d 743
9f85bca7 744@emph{PDP-11 Options}
9a94f7f3 745@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
9f85bca7
JM
746-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
747-mint16 -mno-int32 -mfloat32 -mno-float64 @gol
748-mfloat64 -mno-float32 -mabshi -mno-abshi @gol
749-mbranch-expensive -mbranch-cheap @gol
dde9c901 750-munix-asm -mdec-asm}
9f85bca7 751
358da97e 752@emph{picoChip Options}
ab940b73 753@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
358da97e
HS
754-msymbol-as-address -mno-inefficient-warnings}
755
39bc1876
NS
756@emph{PowerPC Options}
757See RS/6000 and PowerPC Options.
758
759@emph{RS/6000 and PowerPC Options}
760@gccoptlist{-mcpu=@var{cpu-type} @gol
761-mtune=@var{cpu-type} @gol
070b27da 762-mcmodel=@var{code-model} @gol
39bc1876
NS
763-mpower -mno-power -mpower2 -mno-power2 @gol
764-mpowerpc -mpowerpc64 -mno-powerpc @gol
765-maltivec -mno-altivec @gol
766-mpowerpc-gpopt -mno-powerpc-gpopt @gol
767-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
29e6733c
MM
768-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
769-mfprnd -mno-fprnd @gol
4daf6471 770-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
39bc1876
NS
771-mnew-mnemonics -mold-mnemonics @gol
772-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
de17c25f 773-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
39bc1876
NS
774-malign-power -malign-natural @gol
775-msoft-float -mhard-float -mmultiple -mno-multiple @gol
696e45ba 776-msingle-float -mdouble-float -msimple-fpu @gol
39bc1876 777-mstring -mno-string -mupdate -mno-update @gol
001b9eb6 778-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
39bc1876
NS
779-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
780-mstrict-align -mno-strict-align -mrelocatable @gol
781-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
782-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
042abba2 783-mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
39bc1876
NS
784-mprioritize-restricted-insns=@var{priority} @gol
785-msched-costly-dep=@var{dependence_type} @gol
786-minsert-sched-nops=@var{scheme} @gol
787-mcall-sysv -mcall-netbsd @gol
788-maix-struct-return -msvr4-struct-return @gol
7f970b70 789-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
d95016e0 790-mblock-move-inline-limit=@var{num} @gol
78f5898b 791-misel -mno-isel @gol
39bc1876 792-misel=yes -misel=no @gol
78f5898b 793-mspe -mno-spe @gol
39bc1876 794-mspe=yes -mspe=no @gol
96038623 795-mpaired @gol
c921bad8 796-mgen-cell-microcode -mwarn-cell-microcode @gol
78f5898b 797-mvrsave -mno-vrsave @gol
131aeb82 798-mmulhw -mno-mulhw @gol
716019c0 799-mdlmzb -mno-dlmzb @gol
4d4cbc0e 800-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
39bc1876
NS
801-mprototype -mno-prototype @gol
802-msim -mmvme -mads -myellowknife -memb -msdata @gol
92902797 803-msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
8bcc0304
MM
804-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision
805-mno-recip-precision @gol
688e4919 806-mveclibabi=@var{type} -mfriz -mno-friz}
39bc1876 807
65a324b4 808@emph{RX Options}
9595a419 809@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
1890bccc 810-mcpu=@gol
65a324b4
NC
811-mbig-endian-data -mlittle-endian-data @gol
812-msmall-data @gol
813-msim -mno-sim@gol
814-mas100-syntax -mno-as100-syntax@gol
815-mrelax@gol
816-mmax-constant-size=@gol
9595a419
NC
817-mint-register=@gol
818-msave-acc-in-interrupts}
65a324b4 819
39bc1876
NS
820@emph{S/390 and zSeries Options}
821@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
59a1bff3
AK
822-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
823-mlong-double-64 -mlong-double-128 @gol
f61a2c7d 824-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
39bc1876
NS
825-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
826-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
d75f90f1
AK
827-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
828-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
39bc1876 829
93ef7c1f 830@emph{Score Options}
c6681463
CL
831@gccoptlist{-meb -mel @gol
832-mnhwloop @gol
833-muls @gol
93ef7c1f 834-mmac @gol
c6681463 835-mscore5 -mscore5u -mscore7 -mscore7d}
cb7ad97b 836
39bc1876 837@emph{SH Options}
b4589acc
TY
838@gccoptlist{-m1 -m2 -m2e @gol
839-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
840-m3 -m3e @gol
39bc1876 841-m4-nofpu -m4-single-only -m4-single -m4 @gol
312209c6 842-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
39bc1876
NS
843-m5-64media -m5-64media-nofpu @gol
844-m5-32media -m5-32media-nofpu @gol
845-m5-compact -m5-compact-nofpu @gol
846-mb -ml -mdalign -mrelax @gol
6a799f6e 847-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
9eb3a0dd 848-mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol
73a4d10b 849-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
3217af3e 850-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
73a4d10b 851-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
7a296495 852-maccumulate-outgoing-args -minvalid-symbols}
39bc1876 853
c28aa982
RO
854@emph{Solaris 2 Options}
855@gccoptlist{-mimpure-text -mno-impure-text @gol
856-threads -pthreads -pthread}
857
39bc1876
NS
858@emph{SPARC Options}
859@gccoptlist{-mcpu=@var{cpu-type} @gol
860-mtune=@var{cpu-type} @gol
861-mcmodel=@var{code-model} @gol
862-m32 -m64 -mapp-regs -mno-app-regs @gol
863-mfaster-structs -mno-faster-structs @gol
864-mfpu -mno-fpu -mhard-float -msoft-float @gol
865-mhard-quad-float -msoft-quad-float @gol
c28aa982 866-mlittle-endian @gol
39bc1876
NS
867-mstack-bias -mno-stack-bias @gol
868-munaligned-doubles -mno-unaligned-doubles @gol
c28aa982 869-mv8plus -mno-v8plus -mvis -mno-vis}
39bc1876 870
85d9c13c
TS
871@emph{SPU Options}
872@gccoptlist{-mwarn-reloc -merror-reloc @gol
873-msafe-dma -munsafe-dma @gol
874-mbranch-hints @gol
32fb22af 875-msmall-mem -mlarge-mem -mstdmain @gol
299456f3
BE
876-mfixed-range=@var{register-range} @gol
877-mea32 -mea64 @gol
878-maddress-space-conversion -mno-address-space-conversion @gol
879-mcache-size=@var{cache-size} @gol
880-matomic-updates -mno-atomic-updates}
85d9c13c 881
39bc1876
NS
882@emph{System V Options}
883@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
884
39bc1876
NS
885@emph{V850 Options}
886@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
887-mprolog-function -mno-prolog-function -mspace @gol
888-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
889-mapp-regs -mno-app-regs @gol
890-mdisable-callt -mno-disable-callt @gol
223a9d64
N
891-mv850e2v3 @gol
892-mv850e2 @gol
39bc1876
NS
893-mv850e1 @gol
894-mv850e @gol
895-mv850 -mbig-switch}
896
897@emph{VAX Options}
898@gccoptlist{-mg -mgnu -munix}
899
cd773ac4
RS
900@emph{VxWorks Options}
901@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
902-Xbind-lazy -Xbind-now}
903
39bc1876
NS
904@emph{x86-64 Options}
905See i386 and x86-64 Options.
906
46994828
KT
907@emph{i386 and x86-64 Windows Options}
908@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
ab940b73
RW
909-mnop-fun-dllimport -mthread @gol
910-municode -mwin32 -mwindows -fno-set-stack-executable}
46994828 911
69a0611f 912@emph{Xstormy16 Options}
9a94f7f3 913@gccoptlist{-msim}
69a0611f 914
03984308 915@emph{Xtensa Options}
6cedbe44 916@gccoptlist{-mconst16 -mno-const16 @gol
9a94f7f3 917-mfused-madd -mno-fused-madd @gol
1b408ba1 918-mforce-no-pic @gol
66e58b33 919-mserialize-volatile -mno-serialize-volatile @gol
9a94f7f3
JM
920-mtext-section-literals -mno-text-section-literals @gol
921-mtarget-align -mno-target-align @gol
922-mlongcalls -mno-longcalls}
03984308 923
39bc1876
NS
924@emph{zSeries Options}
925See S/390 and zSeries Options.
70899148 926
74291a4b
MM
927@item Code Generation Options
928@xref{Code Gen Options,,Options for Code Generation Conventions}.
9a94f7f3
JM
929@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
930-ffixed-@var{reg} -fexceptions @gol
5d22c1a5 931-fnon-call-exceptions -funwind-tables @gol
a944ceb9 932-fasynchronous-unwind-tables @gol
4bc1997b 933-finhibit-size-directive -finstrument-functions @gol
8d5a7d1f
ILT
934-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
935-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
dc170a87 936-fno-common -fno-ident @gol
24a4dd31 937-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
82c0180d 938-fno-jump-tables @gol
e0d9d0dd 939-frecord-gcc-switches @gol
f5e605e5 940-freg-struct-return -fshort-enums @gol
271bd540 941-fshort-double -fshort-wchar @gol
467cecf3 942-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
4bc1997b 943-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
7458026b 944-fno-stack-limit -fsplit-stack @gol
0698a1d2 945-fleading-underscore -ftls-model=@var{model} @gol
d7afec4b 946-ftrapv -fwrapv -fbounds-check @gol
c1721efb 947-fvisibility -fstrict-volatile-bitfields}
74291a4b
MM
948@end table
949
950@menu
951* Overall Options:: Controlling the kind of output:
952 an executable, object files, assembler files,
953 or preprocessed source.
954* C Dialect Options:: Controlling the variant of C language compiled.
955* C++ Dialect Options:: Variations on C++.
46e34f96
ZL
956* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
957 and Objective-C++.
764dbbf2 958* Language Independent Options:: Controlling how diagnostics should be
02f52e19 959 formatted.
74291a4b
MM
960* Warning Options:: How picky should the compiler be?
961* Debugging Options:: Symbol tables, measurements, and debugging dumps.
962* Optimize Options:: How much optimization?
963* Preprocessor Options:: Controlling header files and macro definitions.
964 Also, getting dependency information for Make.
965* Assembler Options:: Passing options to the assembler.
966* Link Options:: Specifying libraries and so on.
967* Directory Options:: Where to find header files and libraries.
968 Where to find the compiler executable files.
a743d340 969* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 970* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
971@end menu
972
973@node Overall Options
974@section Options Controlling the Kind of Output
975
976Compilation can involve up to four stages: preprocessing, compilation
d1bd0ded
GK
977proper, assembly and linking, always in that order. GCC is capable of
978preprocessing and compiling several files either into several
979assembler input files, or into one assembler input file; then each
980assembler input file produces an object file, and linking combines all
981the object files (those newly compiled, and those specified as input)
982into an executable file.
74291a4b
MM
983
984@cindex file name suffix
985For any given input file, the file name suffix determines what kind of
986compilation is done:
987
2642624b 988@table @gcctabopt
74291a4b
MM
989@item @var{file}.c
990C source code which must be preprocessed.
991
992@item @var{file}.i
993C source code which should not be preprocessed.
994
995@item @var{file}.ii
996C++ source code which should not be preprocessed.
997
998@item @var{file}.m
46e34f96
ZL
999Objective-C source code. Note that you must link with the @file{libobjc}
1000library to make an Objective-C program work.
74291a4b 1001
b9265ec1
JM
1002@item @var{file}.mi
1003Objective-C source code which should not be preprocessed.
1004
46e34f96
ZL
1005@item @var{file}.mm
1006@itemx @var{file}.M
1007Objective-C++ source code. Note that you must link with the @file{libobjc}
1008library to make an Objective-C++ program work. Note that @samp{.M} refers
1009to a literal capital M@.
1010
1011@item @var{file}.mii
1012Objective-C++ source code which should not be preprocessed.
1013
74291a4b 1014@item @var{file}.h
46e34f96 1015C, C++, Objective-C or Objective-C++ header file to be turned into a
9cc54940
AC
1016precompiled header (default), or C, C++ header file to be turned into an
1017Ada spec (via the @option{-fdump-ada-spec} switch).
74291a4b
MM
1018
1019@item @var{file}.cc
b9265ec1 1020@itemx @var{file}.cp
74291a4b
MM
1021@itemx @var{file}.cxx
1022@itemx @var{file}.cpp
ee8acf89 1023@itemx @var{file}.CPP
b9265ec1 1024@itemx @var{file}.c++
74291a4b
MM
1025@itemx @var{file}.C
1026C++ source code which must be preprocessed. Note that in @samp{.cxx},
1027the last two letters must both be literally @samp{x}. Likewise,
161d7b59 1028@samp{.C} refers to a literal capital C@.
74291a4b 1029
6e955430
ZL
1030@item @var{file}.mm
1031@itemx @var{file}.M
1032Objective-C++ source code which must be preprocessed.
1033
1034@item @var{file}.mii
1035Objective-C++ source code which should not be preprocessed.
1036
17211ab5
GK
1037@item @var{file}.hh
1038@itemx @var{file}.H
5958f5cb
AM
1039@itemx @var{file}.hp
1040@itemx @var{file}.hxx
1041@itemx @var{file}.hpp
1042@itemx @var{file}.HPP
1043@itemx @var{file}.h++
1044@itemx @var{file}.tcc
9cc54940 1045C++ header file to be turned into a precompiled header or Ada spec.
17211ab5 1046
b9265ec1
JM
1047@item @var{file}.f
1048@itemx @var{file}.for
3135ce84 1049@itemx @var{file}.ftn
80a0c50a 1050Fixed form Fortran source code which should not be preprocessed.
b9265ec1
JM
1051
1052@item @var{file}.F
3135ce84 1053@itemx @var{file}.FOR
b9265ec1
JM
1054@itemx @var{file}.fpp
1055@itemx @var{file}.FPP
3135ce84 1056@itemx @var{file}.FTN
80a0c50a 1057Fixed form Fortran source code which must be preprocessed (with the traditional
b9265ec1
JM
1058preprocessor).
1059
6de9cd9a
DN
1060@item @var{file}.f90
1061@itemx @var{file}.f95
3135ce84
FXC
1062@itemx @var{file}.f03
1063@itemx @var{file}.f08
80a0c50a 1064Free form Fortran source code which should not be preprocessed.
6de9cd9a 1065
5a006700
MR
1066@item @var{file}.F90
1067@itemx @var{file}.F95
3135ce84
FXC
1068@itemx @var{file}.F03
1069@itemx @var{file}.F08
80a0c50a 1070Free form Fortran source code which must be preprocessed (with the
5a006700
MR
1071traditional preprocessor).
1072
7a938933
ILT
1073@item @var{file}.go
1074Go source code.
1075
b9265ec1
JM
1076@c FIXME: Descriptions of Java file types.
1077@c @var{file}.java
1078@c @var{file}.class
1079@c @var{file}.zip
1080@c @var{file}.jar
1081
e23381df
GB
1082@item @var{file}.ads
1083Ada source code file which contains a library unit declaration (a
1084declaration of a package, subprogram, or generic, or a generic
1085instantiation), or a library unit renaming declaration (a package,
1086generic, or subprogram renaming declaration). Such files are also
1087called @dfn{specs}.
1088
33558d94 1089@item @var{file}.adb
e23381df
GB
1090Ada source code file containing a library unit body (a subprogram or
1091package body). Such files are also called @dfn{bodies}.
1092
b9265ec1 1093@c GCC also knows about some suffixes for languages not yet included:
b9265ec1
JM
1094@c Pascal:
1095@c @var{file}.p
1096@c @var{file}.pas
80a0c50a
TS
1097@c Ratfor:
1098@c @var{file}.r
b9265ec1 1099
74291a4b
MM
1100@item @var{file}.s
1101Assembler code.
1102
1103@item @var{file}.S
55b8093e 1104@itemx @var{file}.sx
74291a4b
MM
1105Assembler code which must be preprocessed.
1106
1107@item @var{other}
1108An object file to be fed straight into linking.
1109Any file name with no recognized suffix is treated this way.
1110@end table
1111
cd3bb277 1112@opindex x
630d3d5a 1113You can specify the input language explicitly with the @option{-x} option:
74291a4b 1114
2642624b 1115@table @gcctabopt
74291a4b
MM
1116@item -x @var{language}
1117Specify explicitly the @var{language} for the following input files
1118(rather than letting the compiler choose a default based on the file
1119name suffix). This option applies to all following input files until
630d3d5a 1120the next @option{-x} option. Possible values for @var{language} are:
3ab51846 1121@smallexample
2962b1bb 1122c c-header cpp-output
17211ab5 1123c++ c++-header c++-cpp-output
46e34f96
ZL
1124objective-c objective-c-header objective-c-cpp-output
1125objective-c++ objective-c++-header objective-c++-cpp-output
74291a4b 1126assembler assembler-with-cpp
e23381df 1127ada
b885a4c1 1128f77 f77-cpp-input f95 f95-cpp-input
7a938933 1129go
e23381df 1130java
3ab51846 1131@end smallexample
74291a4b
MM
1132
1133@item -x none
1134Turn off any specification of a language, so that subsequent files are
630d3d5a 1135handled according to their file name suffixes (as they are if @option{-x}
74291a4b 1136has not been used at all).
14a774a9
RK
1137
1138@item -pass-exit-codes
cd3bb277 1139@opindex pass-exit-codes
bedc7537 1140Normally the @command{gcc} program will exit with the code of 1 if any
14a774a9 1141phase of the compiler returns a non-success return code. If you specify
630d3d5a 1142@option{-pass-exit-codes}, the @command{gcc} program will instead return with
14a774a9 1143numerically highest error produced by any phase that returned an error
ddaf3b86
VR
1144indication. The C, C++, and Fortran frontends return 4, if an internal
1145compiler error is encountered.
74291a4b
MM
1146@end table
1147
1148If you only want some of the stages of compilation, you can use
630d3d5a
JM
1149@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1150one of the options @option{-c}, @option{-S}, or @option{-E} to say where
bedc7537
NC
1151@command{gcc} is to stop. Note that some combinations (for example,
1152@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
74291a4b 1153
2642624b 1154@table @gcctabopt
74291a4b 1155@item -c
cd3bb277 1156@opindex c
74291a4b
MM
1157Compile or assemble the source files, but do not link. The linking
1158stage simply is not done. The ultimate output is in the form of an
1159object file for each source file.
1160
1161By default, the object file name for a source file is made by replacing
1162the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1163
1164Unrecognized input files, not requiring compilation or assembly, are
1165ignored.
1166
1167@item -S
cd3bb277 1168@opindex S
74291a4b
MM
1169Stop after the stage of compilation proper; do not assemble. The output
1170is in the form of an assembler code file for each non-assembler input
1171file specified.
1172
1173By default, the assembler file name for a source file is made by
1174replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1175
1176Input files that don't require compilation are ignored.
1177
1178@item -E
cd3bb277 1179@opindex E
74291a4b
MM
1180Stop after the preprocessing stage; do not run the compiler proper. The
1181output is in the form of preprocessed source code, which is sent to the
1182standard output.
1183
1184Input files which don't require preprocessing are ignored.
1185
1186@cindex output file option
1187@item -o @var{file}
cd3bb277 1188@opindex o
74291a4b
MM
1189Place output in file @var{file}. This applies regardless to whatever
1190sort of output is being produced, whether it be an executable file,
1191an object file, an assembler file or preprocessed C code.
1192
488061c8
GK
1193If @option{-o} is not specified, the default is to put an executable
1194file in @file{a.out}, the object file for
1195@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1196assembler file in @file{@var{source}.s}, a precompiled header file in
1197@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1198standard output.
74291a4b
MM
1199
1200@item -v
cd3bb277 1201@opindex v
74291a4b
MM
1202Print (on standard error output) the commands executed to run the stages
1203of compilation. Also print the version number of the compiler driver
1204program and of the preprocessor and the compiler proper.
1205
e8b3c8ac
IR
1206@item -###
1207@opindex ###
09b201fc
JJ
1208Like @option{-v} except the commands are not executed and arguments
1209are quoted unless they contain only alphanumeric characters or @code{./-_}.
1210This is useful for shell scripts to capture the driver-generated command lines.
e8b3c8ac 1211
74291a4b 1212@item -pipe
cd3bb277 1213@opindex pipe
74291a4b
MM
1214Use pipes rather than temporary files for communication between the
1215various stages of compilation. This fails to work on some systems where
1216the assembler is unable to read from a pipe; but the GNU assembler has
1217no trouble.
844642e6
NC
1218
1219@item --help
cd3bb277 1220@opindex help
844642e6 1221Print (on the standard output) a description of the command line options
bedc7537
NC
1222understood by @command{gcc}. If the @option{-v} option is also specified
1223then @option{--help} will also be passed on to the various processes
1224invoked by @command{gcc}, so that they can display the command line options
c662432e
NC
1225they accept. If the @option{-Wextra} option has also been specified
1226(prior to the @option{--help} option), then command line options which
1227have no documentation associated with them will also be displayed.
10501d8f
CC
1228
1229@item --target-help
cd3bb277 1230@opindex target-help
c662432e 1231Print (on the standard output) a description of target-specific command
67e6ba46
NC
1232line options for each tool. For some targets extra target-specific
1233information may also be printed.
e03b7153 1234
0631b69f 1235@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
c662432e 1236Print (on the standard output) a description of the command line
0631b69f
RW
1237options understood by the compiler that fit into all specified classes
1238and qualifiers. These are the supported classes:
c662432e 1239
5bb43e6d
BM
1240@table @asis
1241@item @samp{optimizers}
c662432e
NC
1242This will display all of the optimization options supported by the
1243compiler.
1244
5bb43e6d 1245@item @samp{warnings}
c662432e
NC
1246This will display all of the options controlling warning messages
1247produced by the compiler.
1248
5bb43e6d 1249@item @samp{target}
c662432e
NC
1250This will display target-specific options. Unlike the
1251@option{--target-help} option however, target-specific options of the
1252linker and assembler will not be displayed. This is because those
1253tools do not currently support the extended @option{--help=} syntax.
1254
5bb43e6d 1255@item @samp{params}
c662432e
NC
1256This will display the values recognized by the @option{--param}
1257option.
5bb43e6d
BM
1258
1259@item @var{language}
7a61cf6f
NC
1260This will display the options supported for @var{language}, where
1261@var{language} is the name of one of the languages supported in this
5bb43e6d 1262version of GCC.
06a97569
BM
1263
1264@item @samp{common}
1265This will display the options that are common to all languages.
c662432e
NC
1266@end table
1267
0631b69f 1268These are the supported qualifiers:
c662432e 1269
5bb43e6d
BM
1270@table @asis
1271@item @samp{undocumented}
c662432e
NC
1272Display only those options which are undocumented.
1273
5bb43e6d 1274@item @samp{joined}
c662432e
NC
1275Display options which take an argument that appears after an equal
1276sign in the same continuous piece of text, such as:
1277@samp{--help=target}.
1278
5bb43e6d 1279@item @samp{separate}
c662432e
NC
1280Display options which take an argument that appears as a separate word
1281following the original option, such as: @samp{-o output-file}.
1282@end table
1283
1284Thus for example to display all the undocumented target-specific
1285switches supported by the compiler the following can be used:
1286
1287@smallexample
1288--help=target,undocumented
1289@end smallexample
1290
1291The sense of a qualifier can be inverted by prefixing it with the
0631b69f 1292@samp{^} character, so for example to display all binary warning
021efafc 1293options (i.e., ones that are either on or off and that do not take an
c662432e
NC
1294argument), which have a description the following can be used:
1295
1296@smallexample
1297--help=warnings,^joined,^undocumented
1298@end smallexample
1299
0631b69f
RW
1300The argument to @option{--help=} should not consist solely of inverted
1301qualifiers.
1302
1303Combining several classes is possible, although this usually
c662432e
NC
1304restricts the output by so much that there is nothing to display. One
1305case where it does work however is when one of the classes is
1306@var{target}. So for example to display all the target-specific
1307optimization options the following can be used:
1308
1309@smallexample
1310--help=target,optimizers
1311@end smallexample
1312
1313The @option{--help=} option can be repeated on the command line. Each
1314successive use will display its requested class of options, skipping
1315those that have already been displayed.
1316
1317If the @option{-Q} option appears on the command line before the
1318@option{--help=} option, then the descriptive text displayed by
1319@option{--help=} is changed. Instead of describing the displayed
1320options, an indication is given as to whether the option is enabled,
1321disabled or set to a specific value (assuming that the compiler
1322knows this at the point where the @option{--help=} option is used).
1323
1324Here is a truncated example from the ARM port of @command{gcc}:
1325
1326@smallexample
1327 % gcc -Q -mabi=2 --help=target -c
1328 The following options are target specific:
1329 -mabi= 2
1330 -mabort-on-noreturn [disabled]
1331 -mapcs [disabled]
1332@end smallexample
1333
1334The output is sensitive to the effects of previous command line
1335options, so for example it is possible to find out which optimizations
1336are enabled at @option{-O2} by using:
1337
1338@smallexample
0631b69f 1339-Q -O2 --help=optimizers
c662432e
NC
1340@end smallexample
1341
1342Alternatively you can discover which binary optimizations are enabled
1343by @option{-O3} by using:
1344
1345@smallexample
1346gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1347gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1348diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1349@end smallexample
1350
ba0c638e
SB
1351@item -no-canonical-prefixes
1352@opindex no-canonical-prefixes
1353Do not expand any symbolic links, resolve references to @samp{/../}
1354or @samp{/./}, or make the path absolute when generating a relative
1355prefix.
1356
e03b7153
RS
1357@item --version
1358@opindex version
8a36672b 1359Display the version number and copyrights of the invoked GCC@.
9d530538 1360
fe7df9c4
SP
1361@item -wrapper
1362@opindex wrapper
1363Invoke all subcommands under a wrapper program. It takes a single
1364comma separated list as an argument, which will be used to invoke
1365the wrapper:
1366
1367@smallexample
1368gcc -c t.c -wrapper gdb,--args
1369@end smallexample
1370
1371This will invoke all subprograms of gcc under "gdb --args",
1372thus cc1 invocation will be "gdb --args cc1 ...".
1373
68a607d8
DN
1374@item -fplugin=@var{name}.so
1375Load the plugin code in file @var{name}.so, assumed to be a
1376shared object to be dlopen'd by the compiler. The base name of
1377the shared object file is used to identify the plugin for the
1378purposes of argument parsing (See
1379@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1380Each plugin should define the callback functions specified in the
1381Plugins API.
1382
1383@item -fplugin-arg-@var{name}-@var{key}=@var{value}
1384Define an argument called @var{key} with a value of @var{value}
1385for the plugin called @var{name}.
1386
9cc54940
AC
1387@item -fdump-ada-spec@r{[}-slim@r{]}
1388For C and C++ source and include files, generate corresponding Ada
1389specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1390GNAT User's Guide}, which provides detailed documentation on this feature.
1391
c6a13190
ILT
1392@item -fdump-go-spec=@var{file}
1393For input files in any language, generate corresponding Go
1394declarations in @var{file}. This generates Go @code{const},
1395@code{type}, @code{var}, and @code{func} declarations which may be a
1396useful way to start writing a Go interface to code written in some
1397other language.
1398
9d530538 1399@include @value{srcdir}/../libiberty/at-file.texi
74291a4b
MM
1400@end table
1401
1402@node Invoking G++
1403@section Compiling C++ Programs
1404
1405@cindex suffixes for C++ source
1406@cindex C++ source file suffixes
1407C++ source files conventionally use one of the suffixes @samp{.C},
17211ab5 1408@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
5958f5cb
AM
1409@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1410@samp{.H}, or (for shared template code) @samp{.tcc}; and
0c2d1a2a 1411preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
bba975d4 1412files with these names and compiles them as C++ programs even if you
17211ab5
GK
1413call the compiler the same way as for compiling C programs (usually
1414with the name @command{gcc}).
74291a4b
MM
1415
1416@findex g++
1417@findex c++
63b08b60
MS
1418However, the use of @command{gcc} does not add the C++ library.
1419@command{g++} is a program that calls GCC and treats @samp{.c},
1420@samp{.h} and @samp{.i} files as C++ source files instead of C source
1421files unless @option{-x} is used, and automatically specifies linking
5548b688
MS
1422against the C++ library. This program is also useful when
1423precompiling a C header file with a @samp{.h} extension for use in C++
1424compilations. On many systems, @command{g++} is also installed with
1425the name @command{c++}.
74291a4b 1426
bedc7537 1427@cindex invoking @command{g++}
74291a4b
MM
1428When you compile C++ programs, you may specify many of the same
1429command-line options that you use for compiling programs in any
1430language; or command-line options meaningful for C and related
1431languages; or options that are meaningful only for C++ programs.
1432@xref{C Dialect Options,,Options Controlling C Dialect}, for
161d7b59 1433explanations of options for languages related to C@.
74291a4b
MM
1434@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1435explanations of options that are meaningful only for C++ programs.
1436
1437@node C Dialect Options
1438@section Options Controlling C Dialect
1439@cindex dialect options
1440@cindex language dialect options
1441@cindex options, dialect
1442
1443The following options control the dialect of C (or languages derived
46e34f96
ZL
1444from C, such as C++, Objective-C and Objective-C++) that the compiler
1445accepts:
74291a4b 1446
2642624b 1447@table @gcctabopt
74291a4b 1448@cindex ANSI support
c1030c7c 1449@cindex ISO support
74291a4b 1450@item -ansi
cd3bb277 1451@opindex ansi
7e1542b9 1452In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
89fe7f1b 1453equivalent to @samp{-std=c++98}.
74291a4b 1454
c1030c7c 1455This turns off certain features of GCC that are incompatible with ISO
3764f879 1456C90 (when compiling C code), or of standard C++ (when compiling C++ code),
0c2d1a2a 1457such as the @code{asm} and @code{typeof} keywords, and
74291a4b
MM
1458predefined macros such as @code{unix} and @code{vax} that identify the
1459type of system you are using. It also enables the undesirable and
02f52e19 1460rarely used ISO trigraph feature. For the C compiler,
0c2d1a2a 1461it disables recognition of C++ style @samp{//} comments as well as
775afb25 1462the @code{inline} keyword.
74291a4b
MM
1463
1464The alternate keywords @code{__asm__}, @code{__extension__},
1465@code{__inline__} and @code{__typeof__} continue to work despite
630d3d5a 1466@option{-ansi}. You would not want to use them in an ISO C program, of
74291a4b 1467course, but it is useful to put them in header files that might be included
630d3d5a 1468in compilations done with @option{-ansi}. Alternate predefined macros
74291a4b 1469such as @code{__unix__} and @code{__vax__} are also available, with or
630d3d5a 1470without @option{-ansi}.
74291a4b 1471
630d3d5a
JM
1472The @option{-ansi} option does not cause non-ISO programs to be
1473rejected gratuitously. For that, @option{-pedantic} is required in
1474addition to @option{-ansi}. @xref{Warning Options}.
74291a4b 1475
630d3d5a 1476The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
74291a4b
MM
1477option is used. Some header files may notice this macro and refrain
1478from declaring certain functions or defining certain macros that the
c1030c7c 1479ISO standard doesn't call for; this is to avoid interfering with any
74291a4b
MM
1480programs that might use these names for other things.
1481
89fe7f1b 1482Functions that would normally be built in but do not have semantics
c771326b 1483defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
89fe7f1b 1484functions when @option{-ansi} is used. @xref{Other Builtins,,Other
f0523f02 1485built-in functions provided by GCC}, for details of the functions
01702459 1486affected.
74291a4b 1487
49419c8f 1488@item -std=
cd3bb277 1489@opindex std
89fe7f1b
MLI
1490Determine the language standard. @xref{Standards,,Language Standards
1491Supported by GCC}, for details of these standard versions. This option
7a61cf6f 1492is currently only supported when compiling C or C++.
89fe7f1b 1493
7e1542b9 1494The compiler can accept several base standards, such as @samp{c90} or
93e052a8 1495@samp{c++98}, and GNU dialects of those standards, such as
7e1542b9 1496@samp{gnu90} or @samp{gnu++98}. By specifying a base standard, the
93e052a8
MLI
1497compiler will accept all programs following that standard and those
1498using GNU extensions that do not contradict it. For example,
7e1542b9 1499@samp{-std=c90} turns off certain features of GCC that are
93e052a8
MLI
1500incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1501keywords, but not other GNU extensions that do not have a meaning in
1502ISO C90, such as omitting the middle term of a @code{?:}
a640c13b 1503expression. On the other hand, by specifying a GNU dialect of a
93e052a8
MLI
1504standard, all features the compiler support are enabled, even when
1505those features change the meaning of the base standard and some
1506strict-conforming programs may be rejected. The particular standard
1507is used by @option{-pedantic} to identify which features are GNU
1508extensions given that version of the standard. For example
7e1542b9 1509@samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
93e052a8
MLI
1510comments, while @samp{-std=gnu99 -pedantic} would not.
1511
89fe7f1b 1512A value for this option must be provided; possible values are
3932261a 1513
ee457005 1514@table @samp
7e1542b9
MLI
1515@item c90
1516@itemx c89
aee96fe9 1517@itemx iso9899:1990
93e052a8
MLI
1518Support all ISO C90 programs (certain GNU extensions that conflict
1519with ISO C90 are disabled). Same as @option{-ansi} for C code.
3043b30e
ML
1520
1521@item iso9899:199409
3764f879 1522ISO C90 as modified in amendment 1.
3043b30e 1523
49419c8f 1524@item c99
aee96fe9
JM
1525@itemx c9x
1526@itemx iso9899:1999
1527@itemx iso9899:199x
1528ISO C99. Note that this standard is not yet fully supported; see
1529@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1530names @samp{c9x} and @samp{iso9899:199x} are deprecated.
3043b30e 1531
2778d766
JM
1532@item c1x
1533ISO C1X, the draft of the next revision of the ISO C standard.
1534Support is limited and experimental and features enabled by this
1535option may be changed or removed if changed in or removed from the
1536standard draft.
1537
7e1542b9
MLI
1538@item gnu90
1539@itemx gnu89
93e052a8
MLI
1540GNU dialect of ISO C90 (including some C99 features). This
1541is the default for C code.
3043b30e 1542
49419c8f 1543@item gnu99
31775d31 1544@itemx gnu9x
93e052a8 1545GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
d15a05b3 1546this will become the default. The name @samp{gnu9x} is deprecated.
49419c8f 1547
2778d766
JM
1548@item gnu1x
1549GNU dialect of ISO C1X. Support is limited and experimental and
1550features enabled by this option may be changed or removed if changed
1551in or removed from the standard draft.
1552
f749a36b 1553@item c++98
93e052a8
MLI
1554The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1555C++ code.
f749a36b
NB
1556
1557@item gnu++98
93e052a8
MLI
1558GNU dialect of @option{-std=c++98}. This is the default for
1559C++ code.
966541e3
DG
1560
1561@item c++0x
1562The working draft of the upcoming ISO C++0x standard. This option
1563enables experimental features that are likely to be included in
1564C++0x. The working draft is constantly changing, and any feature that is
1565enabled by this flag may be removed from future versions of GCC if it is
1566not part of the C++0x standard.
1567
1568@item gnu++0x
93e052a8
MLI
1569GNU dialect of @option{-std=c++0x}. This option enables
1570experimental features that may be removed in future versions of GCC.
ee457005 1571@end table
3043b30e 1572
da1c7394
ILT
1573@item -fgnu89-inline
1574@opindex fgnu89-inline
1575The option @option{-fgnu89-inline} tells GCC to use the traditional
1576GNU semantics for @code{inline} functions when in C99 mode.
1577@xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1578is accepted and ignored by GCC versions 4.1.3 up to but not including
15794.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1580C99 mode. Using this option is roughly equivalent to adding the
1581@code{gnu_inline} function attribute to all inline functions
1582(@pxref{Function Attributes}).
1583
1584The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1585C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1586specifies the default behavior). This option was first supported in
7e1542b9
MLI
1587GCC 4.3. This option is not supported in @option{-std=c90} or
1588@option{-std=gnu90} mode.
da1c7394 1589
44c7bd63 1590The preprocessor macros @code{__GNUC_GNU_INLINE__} and
da1c7394
ILT
1591@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1592in effect for @code{inline} functions. @xref{Common Predefined
7d07e4ea 1593Macros,,,cpp,The C Preprocessor}.
da1c7394 1594
b1018de6
AO
1595@item -aux-info @var{filename}
1596@opindex aux-info
1597Output to the given filename prototyped declarations for all functions
1598declared and/or defined in a translation unit, including those in header
161d7b59 1599files. This option is silently ignored in any language other than C@.
b1018de6
AO
1600
1601Besides declarations, the file indicates, in comments, the origin of
1602each declaration (source file and line), whether the declaration was
1603implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1604@samp{O} for old, respectively, in the first character after the line
1605number and the colon), and whether it came from a declaration or a
1606definition (@samp{C} or @samp{F}, respectively, in the following
1607character). In the case of function definitions, a K&R-style list of
1608arguments followed by their declarations is also provided, inside
1609comments, after the declaration.
1610
74291a4b 1611@item -fno-asm
cd3bb277 1612@opindex fno-asm
74291a4b
MM
1613Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1614keyword, so that code can use these words as identifiers. You can use
1615the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
630d3d5a 1616instead. @option{-ansi} implies @option{-fno-asm}.
74291a4b
MM
1617
1618In C++, this switch only affects the @code{typeof} keyword, since
1619@code{asm} and @code{inline} are standard keywords. You may want to
630d3d5a 1620use the @option{-fno-gnu-keywords} flag instead, which has the same
5490d604
JM
1621effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1622switch only affects the @code{asm} and @code{typeof} keywords, since
1623@code{inline} is a standard keyword in ISO C99.
74291a4b
MM
1624
1625@item -fno-builtin
a3926fe1 1626@itemx -fno-builtin-@var{function}
cd3bb277 1627@opindex fno-builtin
c771326b
JM
1628@cindex built-in functions
1629Don't recognize built-in functions that do not begin with
01702459 1630@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
f0523f02 1631functions provided by GCC}, for details of the functions affected,
c771326b 1632including those which are not built-in functions when @option{-ansi} or
5490d604
JM
1633@option{-std} options for strict ISO C conformance are used because they
1634do not have an ISO standard meaning.
74291a4b 1635
c771326b 1636GCC normally generates special code to handle certain built-in functions
74291a4b
MM
1637more efficiently; for instance, calls to @code{alloca} may become single
1638instructions that adjust the stack directly, and calls to @code{memcpy}
1639may become inline copy loops. The resulting code is often both smaller
1640and faster, but since the function calls no longer appear as such, you
1641cannot set a breakpoint on those calls, nor can you change the behavior
e6e931b7
JM
1642of the functions by linking with a different library. In addition,
1643when a function is recognized as a built-in function, GCC may use
1644information about that function to warn about problems with calls to
1645that function, or to generate more efficient code, even if the
1646resulting code still contains calls to that function. For example,
1647warnings are given with @option{-Wformat} for bad calls to
1648@code{printf}, when @code{printf} is built in, and @code{strlen} is
1649known not to modify global memory.
74291a4b 1650
a3926fe1
RS
1651With the @option{-fno-builtin-@var{function}} option
1652only the built-in function @var{function} is
7d14c755 1653disabled. @var{function} must not begin with @samp{__builtin_}. If a
d1facce0 1654function is named that is not built-in in this version of GCC, this
7d14c755
JM
1655option is ignored. There is no corresponding
1656@option{-fbuiltin-@var{function}} option; if you wish to enable
1657built-in functions selectively when using @option{-fno-builtin} or
1658@option{-ffreestanding}, you may define macros such as:
1659
1660@smallexample
1661#define abs(n) __builtin_abs ((n))
1662#define strcpy(d, s) __builtin_strcpy ((d), (s))
1663@end smallexample
1664
861bb6c1 1665@item -fhosted
cd3bb277 1666@opindex fhosted
861bb6c1
JL
1667@cindex hosted environment
1668
1669Assert that compilation takes place in a hosted environment. This implies
630d3d5a 1670@option{-fbuiltin}. A hosted environment is one in which the
861bb6c1
JL
1671entire standard library is available, and in which @code{main} has a return
1672type of @code{int}. Examples are nearly everything except a kernel.
630d3d5a 1673This is equivalent to @option{-fno-freestanding}.
861bb6c1
JL
1674
1675@item -ffreestanding
cd3bb277 1676@opindex ffreestanding
861bb6c1
JL
1677@cindex hosted environment
1678
1679Assert that compilation takes place in a freestanding environment. This
630d3d5a 1680implies @option{-fno-builtin}. A freestanding environment
861bb6c1
JL
1681is one in which the standard library may not exist, and program startup may
1682not necessarily be at @code{main}. The most obvious example is an OS kernel.
630d3d5a 1683This is equivalent to @option{-fno-hosted}.
861bb6c1 1684
c1030c7c
JM
1685@xref{Standards,,Language Standards Supported by GCC}, for details of
1686freestanding and hosted environments.
1687
17d6caa1
AP
1688@item -fopenmp
1689@opindex fopenmp
ab940b73 1690@cindex OpenMP parallel
17d6caa1
AP
1691Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1692@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1693compiler generates parallel code according to the OpenMP Application
848bc769 1694Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
01a550c2
SP
1695implies @option{-pthread}, and thus is only supported on targets that
1696have support for @option{-pthread}.
17d6caa1 1697
750491fc
RH
1698@item -fms-extensions
1699@opindex fms-extensions
1700Accept some non-standard constructs used in Microsoft header files.
1701
b17b584f
KT
1702It allows for c++ that member-names in structures can be similiar
1703to previous types declarations.
1704
1705@smallexample
1706typedef int UOW;
1707struct ABC @{
1708 UOW UOW;
1709@};
1710@end smallexample
1711
2fbebc71
JM
1712Some cases of unnamed fields in structures and unions are only
1713accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1714fields within structs/unions}, for details.
1715
478a1c5b
ILT
1716@item -fplan9-extensions
1717Accept some non-standard constructs used in Plan 9 code.
1718
1719This enables @option{-fms-extensions}, permits passing pointers to
1720structures with anonymous fields to functions which expect pointers to
1721elements of the type of the field, and permits referring to anonymous
1722fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1723struct/union fields within structs/unions}, for details. This is only
1724supported for C, not C++.
1725
74291a4b 1726@item -trigraphs
cd3bb277 1727@opindex trigraphs
3bce8a01
NB
1728Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1729options for strict ISO C conformance) implies @option{-trigraphs}.
74291a4b 1730
8a035a6b
AH
1731@item -no-integrated-cpp
1732@opindex no-integrated-cpp
1733Performs a compilation in two passes: preprocessing and compiling. This
1734option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
8a36672b 1735@option{-B} option. The user supplied compilation step can then add in
8a035a6b 1736an additional preprocessing step after normal preprocessing but before
8a36672b 1737compiling. The default is to use the integrated cpp (internal cpp)
8a035a6b
AH
1738
1739The semantics of this option will change if "cc1", "cc1plus", and
1740"cc1obj" are merged.
1741
74291a4b
MM
1742@cindex traditional C language
1743@cindex C language, traditional
1744@item -traditional
f458d1d5 1745@itemx -traditional-cpp
cd3bb277 1746@opindex traditional-cpp
f458d1d5
ZW
1747@opindex traditional
1748Formerly, these options caused GCC to attempt to emulate a pre-standard
1749C compiler. They are now only supported with the @option{-E} switch.
1750The preprocessor continues to support a pre-standard mode. See the GNU
1751CPP manual for details.
74291a4b
MM
1752
1753@item -fcond-mismatch
cd3bb277 1754@opindex fcond-mismatch
74291a4b 1755Allow conditional expressions with mismatched types in the second and
a7537031
JM
1756third arguments. The value of such an expression is void. This option
1757is not supported for C++.
74291a4b 1758
00c8e9f6
MS
1759@item -flax-vector-conversions
1760@opindex flax-vector-conversions
1761Allow implicit conversions between vectors with differing numbers of
1762elements and/or incompatible element types. This option should not be
1763used for new code.
1764
74291a4b 1765@item -funsigned-char
cd3bb277 1766@opindex funsigned-char
74291a4b
MM
1767Let the type @code{char} be unsigned, like @code{unsigned char}.
1768
1769Each kind of machine has a default for what @code{char} should
1770be. It is either like @code{unsigned char} by default or like
1771@code{signed char} by default.
1772
1773Ideally, a portable program should always use @code{signed char} or
1774@code{unsigned char} when it depends on the signedness of an object.
1775But many programs have been written to use plain @code{char} and
1776expect it to be signed, or expect it to be unsigned, depending on the
1777machines they were written for. This option, and its inverse, let you
1778make such a program work with the opposite default.
1779
1780The type @code{char} is always a distinct type from each of
1781@code{signed char} or @code{unsigned char}, even though its behavior
1782is always just like one of those two.
1783
1784@item -fsigned-char
cd3bb277 1785@opindex fsigned-char
74291a4b
MM
1786Let the type @code{char} be signed, like @code{signed char}.
1787
630d3d5a
JM
1788Note that this is equivalent to @option{-fno-unsigned-char}, which is
1789the negative form of @option{-funsigned-char}. Likewise, the option
1790@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
74291a4b 1791
74291a4b
MM
1792@item -fsigned-bitfields
1793@itemx -funsigned-bitfields
1794@itemx -fno-signed-bitfields
1795@itemx -fno-unsigned-bitfields
cd3bb277
JM
1796@opindex fsigned-bitfields
1797@opindex funsigned-bitfields
1798@opindex fno-signed-bitfields
1799@opindex fno-unsigned-bitfields
c771326b 1800These options control whether a bit-field is signed or unsigned, when the
74291a4b 1801declaration does not use either @code{signed} or @code{unsigned}. By
c771326b 1802default, such a bit-field is signed, because this is consistent: the
74291a4b 1803basic integer types such as @code{int} are signed types.
74291a4b
MM
1804@end table
1805
1806@node C++ Dialect Options
1807@section Options Controlling C++ Dialect
1808
1809@cindex compiler options, C++
1810@cindex C++ options, command line
1811@cindex options, C++
1812This section describes the command-line options that are only meaningful
1813for C++ programs; but you can also use most of the GNU compiler options
1814regardless of what language your program is in. For example, you
1815might compile a file @code{firstClass.C} like this:
1816
3ab51846 1817@smallexample
1dc5fc4b 1818g++ -g -frepo -O -c firstClass.C
3ab51846 1819@end smallexample
74291a4b
MM
1820
1821@noindent
630d3d5a 1822In this example, only @option{-frepo} is an option meant
74291a4b 1823only for C++ programs; you can use the other options with any
161d7b59 1824language supported by GCC@.
74291a4b
MM
1825
1826Here is a list of options that are @emph{only} for compiling C++ programs:
1827
2642624b 1828@table @gcctabopt
2d3e278d
MM
1829
1830@item -fabi-version=@var{n}
1831@opindex fabi-version
8a36672b 1832Use version @var{n} of the C++ ABI@. Version 2 is the version of the
57702a80
MM
1833C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1834the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1835the version that conforms most closely to the C++ ABI specification.
1836Therefore, the ABI obtained using version 0 will change as ABI bugs
1837are fixed.
2d3e278d 1838
d150ccef 1839The default is version 2.
46c83bce 1840
0e7750a0
JM
1841Version 3 corrects an error in mangling a constant address as a
1842template argument.
1843
1844Version 4 implements a standard mangling for vector types.
1845
1846See also @option{-Wabi}.
1847
74291a4b 1848@item -fno-access-control
cd3bb277 1849@opindex fno-access-control
74291a4b
MM
1850Turn off all access checking. This switch is mainly useful for working
1851around bugs in the access control code.
1852
74291a4b 1853@item -fcheck-new
cd3bb277 1854@opindex fcheck-new
74291a4b 1855Check that the pointer returned by @code{operator new} is non-null
6d9c4c83
JW
1856before attempting to modify the storage allocated. This check is
1857normally unnecessary because the C++ standard specifies that
1858@code{operator new} will only return @code{0} if it is declared
1859@samp{throw()}, in which case the compiler will always check the
1860return value even without this option. In all other cases, when
1861@code{operator new} has a non-empty exception specification, memory
1862exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1863@samp{new (nothrow)}.
1dc5fc4b 1864
74291a4b 1865@item -fconserve-space
cd3bb277 1866@opindex fconserve-space
74291a4b
MM
1867Put uninitialized or runtime-initialized global variables into the
1868common segment, as C does. This saves space in the executable at the
1869cost of not diagnosing duplicate definitions. If you compile with this
1870flag and your program mysteriously crashes after @code{main()} has
1871completed, you may have an object that is being destroyed twice because
1872two definitions were merged.
1873
1dc5fc4b
JM
1874This option is no longer useful on most targets, now that support has
1875been added for putting variables into BSS without making them common.
1876
5f5babf1
JM
1877@item -fno-deduce-init-list
1878@opindex fno-deduce-init-list
1879Disable deduction of a template type parameter as
1880std::initializer_list from a brace-enclosed initializer list, i.e.
1881
1882@smallexample
1883template <class T> auto forward(T t) -> decltype (realfn (t))
1884@{
1885 return realfn (t);
1886@}
1887
1888void f()
1889@{
1890 forward(@{1,2@}); // call forward<std::initializer_list<int>>
1891@}
1892@end smallexample
1893
1894This option is present because this deduction is an extension to the
1895current specification in the C++0x working draft, and there was
1896some concern about potential overload resolution problems.
1897
d63d5d0c
ILT
1898@item -ffriend-injection
1899@opindex ffriend-injection
1900Inject friend functions into the enclosing namespace, so that they are
1901visible outside the scope of the class in which they are declared.
1902Friend functions were documented to work this way in the old Annotated
1903C++ Reference Manual, and versions of G++ before 4.1 always worked
1904that way. However, in ISO C++ a friend function which is not declared
1905in an enclosing scope can only be found using argument dependent
1906lookup. This option causes friends to be injected as they were in
1907earlier releases.
1908
1909This option is for compatibility, and may be removed in a future
1910release of G++.
1911
1dc5fc4b 1912@item -fno-elide-constructors
cd3bb277 1913@opindex fno-elide-constructors
1dc5fc4b
JM
1914The C++ standard allows an implementation to omit creating a temporary
1915which is only used to initialize another object of the same type.
aee96fe9 1916Specifying this option disables that optimization, and forces G++ to
1dc5fc4b 1917call the copy constructor in all cases.
74291a4b 1918
dd1ba632 1919@item -fno-enforce-eh-specs
cd3bb277 1920@opindex fno-enforce-eh-specs
4381020e
JM
1921Don't generate code to check for violation of exception specifications
1922at runtime. This option violates the C++ standard, but may be useful
1923for reducing code size in production builds, much like defining
1924@samp{NDEBUG}. This does not give user code permission to throw
1925exceptions in violation of the exception specifications; the compiler
1926will still optimize based on the specifications, so throwing an
1927unexpected exception will result in undefined behavior.
dd1ba632 1928
74291a4b 1929@item -ffor-scope
8c81598d 1930@itemx -fno-for-scope
cd3bb277
JM
1931@opindex ffor-scope
1932@opindex fno-for-scope
695ac33f 1933If @option{-ffor-scope} is specified, the scope of variables declared in
74291a4b 1934a @i{for-init-statement} is limited to the @samp{for} loop itself,
34527c47 1935as specified by the C++ standard.
695ac33f 1936If @option{-fno-for-scope} is specified, the scope of variables declared in
74291a4b 1937a @i{for-init-statement} extends to the end of the enclosing scope,
aee96fe9 1938as was the case in old versions of G++, and other (traditional)
74291a4b
MM
1939implementations of C++.
1940
1941The default if neither flag is given to follow the standard,
1942but to allow and give a warning for old-style code that would
1943otherwise be invalid, or have different behavior.
1944
1945@item -fno-gnu-keywords
cd3bb277 1946@opindex fno-gnu-keywords
9762e8a4 1947Do not recognize @code{typeof} as a keyword, so that code can use this
767094dd 1948word as an identifier. You can use the keyword @code{__typeof__} instead.
630d3d5a 1949@option{-ansi} implies @option{-fno-gnu-keywords}.
74291a4b 1950
1dc5fc4b 1951@item -fno-implicit-templates
cd3bb277 1952@opindex fno-implicit-templates
bba975d4 1953Never emit code for non-inline templates which are instantiated
e979f9e8 1954implicitly (i.e.@: by use); only emit code for explicit instantiations.
bba975d4
JM
1955@xref{Template Instantiation}, for more information.
1956
1957@item -fno-implicit-inline-templates
cd3bb277 1958@opindex fno-implicit-inline-templates
bba975d4
JM
1959Don't emit code for implicit instantiations of inline templates, either.
1960The default is to handle inlines differently so that compiles with and
1961without optimization will need the same set of explicit instantiations.
1dc5fc4b 1962
74291a4b 1963@item -fno-implement-inlines
cd3bb277 1964@opindex fno-implement-inlines
74291a4b
MM
1965To save space, do not emit out-of-line copies of inline functions
1966controlled by @samp{#pragma implementation}. This will cause linker
1967errors if these functions are not inlined everywhere they are called.
1968
631cf95d 1969@item -fms-extensions
cd3bb277 1970@opindex fms-extensions
32fb1fb2
PE
1971Disable pedantic warnings about constructs used in MFC, such as implicit
1972int and getting a pointer to member function via non-standard syntax.
631cf95d 1973
fcca588c 1974@item -fno-nonansi-builtins
cd3bb277 1975@opindex fno-nonansi-builtins
c771326b 1976Disable built-in declarations of functions that are not mandated by
161d7b59 1977ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
fcca588c
MM
1978@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1979
9feb3d6a
JM
1980@item -fnothrow-opt
1981@opindex fnothrow-opt
1982Treat a @code{throw()} exception specification as though it were a
1983@code{noexcept} specification to reduce or eliminate the text size
d3f28910
JM
1984overhead relative to a function with no exception specification. If
1985the function has local variables of types with non-trivial
1986destructors, the exception specification will actually make the
1987function smaller because the EH cleanups for those variables can be
1988optimized away. The semantic effect is that an exception thrown out of
1989a function with such an exception specification will result in a call
1990to @code{terminate} rather than @code{unexpected}.
9feb3d6a 1991
775afb25 1992@item -fno-operator-names
cd3bb277 1993@opindex fno-operator-names
775afb25 1994Do not treat the operator name keywords @code{and}, @code{bitand},
74291a4b 1995@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
775afb25 1996synonyms as keywords.
74291a4b 1997
4f8b4fd9 1998@item -fno-optional-diags
cd3bb277 1999@opindex fno-optional-diags
4f8b4fd9 2000Disable diagnostics that the standard says a compiler does not need to
aee96fe9 2001issue. Currently, the only such diagnostic issued by G++ is the one for
bba975d4 2002a name having multiple meanings within a class.
4f8b4fd9 2003
8c7707b0 2004@item -fpermissive
cd3bb277 2005@opindex fpermissive
4a386498
MM
2006Downgrade some diagnostics about nonconformant code from errors to
2007warnings. Thus, using @option{-fpermissive} will allow some
2008nonconforming code to compile.
8c7707b0 2009
6ea2bd47
JM
2010@item -fno-pretty-templates
2011@opindex fno-pretty-templates
2012When an error message refers to a specialization of a function
2013template, the compiler will normally print the signature of the
2014template followed by the template arguments and any typedefs or
2015typenames in the signature (e.g. @code{void f(T) [with T = int]}
2016rather than @code{void f(int)}) so that it's clear which template is
2017involved. When an error message refers to a specialization of a class
2018template, the compiler will omit any template arguments which match
2019the default template arguments for that template. If either of these
2020behaviors make it harder to understand the error message rather than
2021easier, using @option{-fno-pretty-templates} will disable them.
2022
8c81598d 2023@item -frepo
cd3bb277 2024@opindex frepo
9c34dbbf
ZW
2025Enable automatic template instantiation at link time. This option also
2026implies @option{-fno-implicit-templates}. @xref{Template
2027Instantiation}, for more information.
8c81598d 2028
8c7707b0 2029@item -fno-rtti
cd3bb277 2030@opindex fno-rtti
a7fbfcf9
JM
2031Disable generation of information about every class with virtual
2032functions for use by the C++ runtime type identification features
2033(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
2034of the language, you can save some space by using this flag. Note that
2035exception handling uses the same information, but it will generate it as
6c9384c3 2036needed. The @samp{dynamic_cast} operator can still be used for casts that
a31cfd58 2037do not require runtime type information, i.e.@: casts to @code{void *} or to
6c9384c3 2038unambiguous base classes.
8c7707b0 2039
fcca588c 2040@item -fstats
cd3bb277 2041@opindex fstats
fcca588c
MM
2042Emit statistics about front-end processing at the end of the compilation.
2043This information is generally only useful to the G++ development team.
2044
cbb4feb3
JM
2045@item -fstrict-enums
2046@opindex fstrict-enums
2047Allow the compiler to optimize using the assumption that a value of
2048enumeration type can only be one of the values of the enumeration (as
2049defined in the C++ standard; basically, a value which can be
2050represented in the minimum number of bits needed to represent all the
2051enumerators). This assumption may not be valid if the program uses a
2052cast to convert an arbitrary integer value to the enumeration type.
2053
124e0d27 2054@item -ftemplate-depth=@var{n}
cd3bb277 2055@opindex ftemplate-depth
1dc5fc4b
JM
2056Set the maximum instantiation depth for template classes to @var{n}.
2057A limit on the template instantiation depth is needed to detect
767094dd 2058endless recursions during template class instantiation. ANSI/ISO C++
6c879482
JM
2059conforming programs must not rely on a maximum depth greater than 17
2060(changed to 1024 in C++0x).
1dc5fc4b 2061
40aac948
JM
2062@item -fno-threadsafe-statics
2063@opindex fno-threadsafe-statics
2064Do not emit the extra code to use the routines specified in the C++
2065ABI for thread-safe initialization of local statics. You can use this
2066option to reduce code size slightly in code that doesn't need to be
2067thread-safe.
2068
fc693822 2069@item -fuse-cxa-atexit
cd3bb277 2070@opindex fuse-cxa-atexit
fc693822
MM
2071Register destructors for objects with static storage duration with the
2072@code{__cxa_atexit} function rather than the @code{atexit} function.
2073This option is required for fully standards-compliant handling of static
2074destructors, but will only work if your C library supports
2075@code{__cxa_atexit}.
2076
c7b5e395
GK
2077@item -fno-use-cxa-get-exception-ptr
2078@opindex fno-use-cxa-get-exception-ptr
2079Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2080will cause @code{std::uncaught_exception} to be incorrect, but is necessary
2081if the runtime routine is not available.
2082
d7afec4b
ND
2083@item -fvisibility-inlines-hidden
2084@opindex fvisibility-inlines-hidden
46bdbc00
GK
2085This switch declares that the user does not attempt to compare
2086pointers to inline methods where the addresses of the two functions
2087were taken in different shared objects.
2088
2089The effect of this is that GCC may, effectively, mark inline methods with
d7afec4b
ND
2090@code{__attribute__ ((visibility ("hidden")))} so that they do not
2091appear in the export table of a DSO and do not require a PLT indirection
8a36672b 2092when used within the DSO@. Enabling this option can have a dramatic effect
d7afec4b 2093on load and link times of a DSO as it massively reduces the size of the
46bdbc00
GK
2094dynamic export table when the library makes heavy use of templates.
2095
9f5ed61a 2096The behavior of this switch is not quite the same as marking the
7c0de6a5
GK
2097methods as hidden directly, because it does not affect static variables
2098local to the function or cause the compiler to deduce that
2099the function is defined in only one shared object.
2100
46bdbc00
GK
2101You may mark a method as having a visibility explicitly to negate the
2102effect of the switch for that method. For example, if you do want to
7c0de6a5 2103compare pointers to a particular inline method, you might mark it as
bd741f34
JM
2104having default visibility. Marking the enclosing class with explicit
2105visibility will have no effect.
d7afec4b 2106
dfb84d62
MS
2107Explicitly instantiated inline methods are unaffected by this option
2108as their linkage might otherwise cross a shared library boundary.
2109@xref{Template Instantiation}.
2110
ddbfd28d
GK
2111@item -fvisibility-ms-compat
2112@opindex fvisibility-ms-compat
2113This flag attempts to use visibility settings to make GCC's C++
2114linkage model compatible with that of Microsoft Visual Studio.
2115
2116The flag makes these changes to GCC's linkage model:
2117
2118@enumerate
2119@item
2120It sets the default visibility to @code{hidden}, like
2121@option{-fvisibility=hidden}.
2122
2123@item
2124Types, but not their members, are not hidden by default.
2125
2126@item
2127The One Definition Rule is relaxed for types without explicit
2128visibility specifications which are defined in more than one different
2129shared object: those declarations are permitted if they would have
2130been permitted when this option was not used.
2131@end enumerate
2132
2133In new code it is better to use @option{-fvisibility=hidden} and
2134export those classes which are intended to be externally visible.
2135Unfortunately it is possible for code to rely, perhaps accidentally,
cea618ac 2136on the Visual Studio behavior.
ddbfd28d
GK
2137
2138Among the consequences of these changes are that static data members
2139of the same type with the same name but defined in different shared
2140objects will be different, so changing one will not change the other;
2141and that pointers to function members defined in different shared
2142objects may not compare equal. When this flag is given, it is a
2143violation of the ODR to define types with the same name differently.
2144
02f52e19 2145@item -fno-weak
cd3bb277 2146@opindex fno-weak
90ecce3e 2147Do not use weak symbol support, even if it is provided by the linker.
fcca588c
MM
2148By default, G++ will use weak symbols if they are available. This
2149option exists only for testing, and should not be used by end-users;
2150it will result in inferior code and has no benefits. This option may
2151be removed in a future release of G++.
2152
74291a4b 2153@item -nostdinc++
cd3bb277 2154@opindex nostdinc++
74291a4b
MM
2155Do not search for header files in the standard directories specific to
2156C++, but do still search the other standard directories. (This option
e5e809f4 2157is used when building the C++ library.)
74291a4b
MM
2158@end table
2159
2160In addition, these optimization, warning, and code generation options
2161have meanings only for C++ programs:
2162
2642624b 2163@table @gcctabopt
74291a4b 2164@item -fno-default-inline
cd3bb277 2165@opindex fno-default-inline
74291a4b 2166Do not assume @samp{inline} for functions defined inside a class scope.
1dc5fc4b
JM
2167@xref{Optimize Options,,Options That Control Optimization}. Note that these
2168functions will have linkage like inline functions; they just won't be
2169inlined by default.
74291a4b 2170
bce08d50 2171@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
eca7f13c 2172@opindex Wabi
ccd4e386 2173@opindex Wno-abi
eca7f13c 2174Warn when G++ generates code that is probably not compatible with the
8a36672b 2175vendor-neutral C++ ABI@. Although an effort has been made to warn about
daf2f129 2176all such cases, there are probably some cases that are not warned about,
eca7f13c
MM
2177even though G++ is generating incompatible code. There may also be
2178cases where warnings are emitted even though the code that is generated
2179will be compatible.
2180
2181You should rewrite your code to avoid these warnings if you are
2182concerned about the fact that code generated by G++ may not be binary
2183compatible with code generated by other compilers.
2184
0e7750a0
JM
2185The known incompatibilities in @option{-fabi-version=2} (the default) include:
2186
2187@itemize @bullet
2188
2189@item
2190A template with a non-type template parameter of reference type is
2191mangled incorrectly:
2192@smallexample
2193extern int N;
2194template <int &> struct S @{@};
2195void n (S<N>) @{2@}
2196@end smallexample
2197
2198This is fixed in @option{-fabi-version=3}.
2199
2200@item
2201SIMD vector types declared using @code{__attribute ((vector_size))} are
2202mangled in a non-standard way that does not allow for overloading of
2203functions taking vectors of different sizes.
2204
2205The mangling is changed in @option{-fabi-version=4}.
2206@end itemize
2207
2208The known incompatibilities in @option{-fabi-version=1} include:
eca7f13c
MM
2209
2210@itemize @bullet
2211
2212@item
2213Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2214pack data into the same byte as a base class. For example:
2215
2216@smallexample
2217struct A @{ virtual void f(); int f1 : 1; @};
2218struct B : public A @{ int f2 : 1; @};
2219@end smallexample
2220
2221@noindent
2222In this case, G++ will place @code{B::f2} into the same byte
daf2f129 2223as@code{A::f1}; other compilers will not. You can avoid this problem
eca7f13c
MM
2224by explicitly padding @code{A} so that its size is a multiple of the
2225byte size on your platform; that will cause G++ and other compilers to
2226layout @code{B} identically.
2227
2228@item
2229Incorrect handling of tail-padding for virtual bases. G++ does not use
2230tail padding when laying out virtual bases. For example:
2231
2232@smallexample
2233struct A @{ virtual void f(); char c1; @};
2234struct B @{ B(); char c2; @};
2235struct C : public A, public virtual B @{@};
2236@end smallexample
2237
2238@noindent
2239In this case, G++ will not place @code{B} into the tail-padding for
2240@code{A}; other compilers will. You can avoid this problem by
2241explicitly padding @code{A} so that its size is a multiple of its
2242alignment (ignoring virtual base classes); that will cause G++ and other
2243compilers to layout @code{C} identically.
2244
2d3e278d
MM
2245@item
2246Incorrect handling of bit-fields with declared widths greater than that
2247of their underlying types, when the bit-fields appear in a union. For
2248example:
2249
2250@smallexample
2251union U @{ int i : 4096; @};
2252@end smallexample
2253
2254@noindent
2255Assuming that an @code{int} does not have 4096 bits, G++ will make the
2256union too small by the number of bits in an @code{int}.
2257
956d9305
MM
2258@item
2259Empty classes can be placed at incorrect offsets. For example:
daf2f129 2260
956d9305
MM
2261@smallexample
2262struct A @{@};
2263
2264struct B @{
2265 A a;
2266 virtual void f ();
2267@};
2268
2269struct C : public B, public A @{@};
2270@end smallexample
2271
2272@noindent
c0478a66 2273G++ will place the @code{A} base class of @code{C} at a nonzero offset;
956d9305
MM
2274it should be placed at offset zero. G++ mistakenly believes that the
2275@code{A} data member of @code{B} is already at offset zero.
2276
6397d80b
MM
2277@item
2278Names of template functions whose types involve @code{typename} or
2279template template parameters can be mangled incorrectly.
2280
2281@smallexample
2282template <typename Q>
2283void f(typename Q::X) @{@}
2284
2285template <template <typename> class Q>
2286void f(typename Q<int>::X) @{@}
2287@end smallexample
2288
2289@noindent
3364c33b 2290Instantiations of these templates may be mangled incorrectly.
6397d80b 2291
eca7f13c
MM
2292@end itemize
2293
bce08d50
L
2294It also warns psABI related changes. The known psABI changes at this
2295point include:
2296
2297@itemize @bullet
2298
2299@item
2300For SYSV/x86-64, when passing union with long double, it is changed to
2301pass in memory as specified in psABI. For example:
2302
2303@smallexample
2304union U @{
2305 long double ld;
2306 int i;
2307@};
2308@end smallexample
2309
2310@noindent
2311@code{union U} will always be passed in memory.
2312
2313@end itemize
2314
670b0231 2315@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
cd3bb277 2316@opindex Wctor-dtor-privacy
ccd4e386 2317@opindex Wno-ctor-dtor-privacy
9eff22bc
LG
2318Warn when a class seems unusable because all the constructors or
2319destructors in that class are private, and it has neither friends nor
78d0a54d 2320public static member functions.
bba975d4 2321
59f9c2ed
JM
2322@item -Wnoexcept @r{(C++ and Objective-C++ only)}
2323@opindex Wnoexcept
2324@opindex Wno-noexcept
2325Warn when a noexcept-expression evaluates to false because of a call
2326to a function that does not have a non-throwing exception
2327specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2328the compiler to never throw an exception.
2329
670b0231 2330@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
cd3bb277 2331@opindex Wnon-virtual-dtor
ccd4e386 2332@opindex Wno-non-virtual-dtor
43f14744
PS
2333Warn when a class has virtual functions and accessible non-virtual
2334destructor, in which case it would be possible but unsafe to delete
2335an instance of a derived class through a pointer to the base class.
2336This warning is also enabled if -Weffc++ is specified.
bba975d4 2337
670b0231 2338@item -Wreorder @r{(C++ and Objective-C++ only)}
cd3bb277 2339@opindex Wreorder
ccd4e386 2340@opindex Wno-reorder
bba975d4
JM
2341@cindex reordering, warning
2342@cindex warning for reordering of member initializers
2343Warn when the order of member initializers given in the code does not
2344match the order in which they must be executed. For instance:
2345
2346@smallexample
2347struct A @{
2348 int i;
2349 int j;
2350 A(): j (0), i (1) @{ @}
2351@};
2352@end smallexample
2353
9eff22bc
LG
2354The compiler will rearrange the member initializers for @samp{i}
2355and @samp{j} to match the declaration order of the members, emitting
2356a warning to that effect. This warning is enabled by @option{-Wall}.
bba975d4
JM
2357@end table
2358
630d3d5a 2359The following @option{-W@dots{}} options are not affected by @option{-Wall}.
bba975d4 2360
2642624b 2361@table @gcctabopt
670b0231 2362@item -Weffc++ @r{(C++ and Objective-C++ only)}
cd3bb277 2363@opindex Weffc++
ccd4e386 2364@opindex Wno-effc++
77f6c1eb
RS
2365Warn about violations of the following style guidelines from Scott Meyers'
2366@cite{Effective C++} book:
2367
2368@itemize @bullet
2369@item
2370Item 11: Define a copy constructor and an assignment operator for classes
2371with dynamically allocated memory.
2372
2373@item
2374Item 12: Prefer initialization to assignment in constructors.
2375
2376@item
2377Item 14: Make destructors virtual in base classes.
2378
2379@item
2380Item 15: Have @code{operator=} return a reference to @code{*this}.
2381
2382@item
2383Item 23: Don't try to return a reference when you must return an object.
2384
2385@end itemize
2386
daf2f129 2387Also warn about violations of the following style guidelines from
9eff22bc 2388Scott Meyers' @cite{More Effective C++} book:
77f6c1eb
RS
2389
2390@itemize @bullet
2391@item
2392Item 6: Distinguish between prefix and postfix forms of increment and
2393decrement operators.
2394
2395@item
2396Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2397
2398@end itemize
2399
9eff22bc
LG
2400When selecting this option, be aware that the standard library
2401headers do not obey all of these guidelines; use @samp{grep -v}
77f6c1eb 2402to filter out those warnings.
bba975d4 2403
670b0231 2404@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
b2f97e4a 2405@opindex Wstrict-null-sentinel
ccd4e386 2406@opindex Wno-strict-null-sentinel
b2f97e4a
MM
2407Warn also about the use of an uncasted @code{NULL} as sentinel. When
2408compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2409to @code{__null}. Although it is a null pointer constant not a null pointer,
1df48f5c 2410it is guaranteed to be of the same size as a pointer. But this use is
b2f97e4a
MM
2411not portable across different compilers.
2412
670b0231 2413@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
cd3bb277 2414@opindex Wno-non-template-friend
ccd4e386 2415@opindex Wnon-template-friend
bba975d4 2416Disable warnings when non-templatized friend functions are declared
9eff22bc 2417within a template. Since the advent of explicit template specification
aee96fe9 2418support in G++, if the name of the friend is an unqualified-id (i.e.,
bba975d4 2419@samp{friend foo(int)}), the C++ language specification demands that the
767094dd 2420friend declare or define an ordinary, nontemplate function. (Section
aee96fe9 242114.5.3). Before G++ implemented explicit specification, unqualified-ids
bba975d4 2422could be interpreted as a particular specialization of a templatized
767094dd 2423function. Because this non-conforming behavior is no longer the default
aee96fe9 2424behavior for G++, @option{-Wnon-template-friend} allows the compiler to
9eff22bc 2425check existing code for potential trouble spots and is on by default.
2228d450 2426This new compiler behavior can be turned off with
630d3d5a 2427@option{-Wno-non-template-friend} which keeps the conformant compiler code
2228d450 2428but disables the helpful warning.
bba975d4 2429
670b0231 2430@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
cd3bb277 2431@opindex Wold-style-cast
ccd4e386 2432@opindex Wno-old-style-cast
323728aa 2433Warn if an old-style (C-style) cast to a non-void type is used within
7cd5c075
GP
2434a C++ program. The new-style casts (@samp{dynamic_cast},
2435@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2436less vulnerable to unintended effects and much easier to search for.
bba975d4 2437
670b0231 2438@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
cd3bb277 2439@opindex Woverloaded-virtual
ccd4e386 2440@opindex Wno-overloaded-virtual
ab940b73
RW
2441@cindex overloaded virtual function, warning
2442@cindex warning for overloaded virtual function
3747f3dc
MM
2443Warn when a function declaration hides virtual functions from a
2444base class. For example, in:
2445
2446@smallexample
2447struct A @{
2448 virtual void f();
2449@};
2450
2451struct B: public A @{
2452 void f(int);
2453@};
2454@end smallexample
2455
2456the @code{A} class version of @code{f} is hidden in @code{B}, and code
9eff22bc 2457like:
3747f3dc
MM
2458
2459@smallexample
2460B* b;
2461b->f();
2462@end smallexample
2463
2464will fail to compile.
bba975d4 2465
670b0231 2466@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
cd3bb277 2467@opindex Wno-pmf-conversions
ccd4e386 2468@opindex Wpmf-conversions
bba975d4
JM
2469Disable the diagnostic for converting a bound pointer to member function
2470to a plain pointer.
2471
670b0231 2472@item -Wsign-promo @r{(C++ and Objective-C++ only)}
cd3bb277 2473@opindex Wsign-promo
ccd4e386 2474@opindex Wno-sign-promo
bba975d4 2475Warn when overload resolution chooses a promotion from unsigned or
2eac577f 2476enumerated type to a signed type, over a conversion to an unsigned type of
aee96fe9 2477the same size. Previous versions of G++ would try to preserve
bba975d4
JM
2478unsignedness, but the standard mandates the current behavior.
2479
bba975d4
JM
2480@smallexample
2481struct A @{
2482 operator int ();
2483 A& operator = (int);
2484@};
2485
2486main ()
2487@{
2488 A a,b;
2489 a = b;
2490@}
2491@end smallexample
74291a4b 2492
aee96fe9 2493In this example, G++ will synthesize a default @samp{A& operator =
bba975d4 2494(const A&);}, while cfront will use the user-defined @samp{operator =}.
74291a4b
MM
2495@end table
2496
46e34f96
ZL
2497@node Objective-C and Objective-C++ Dialect Options
2498@section Options Controlling Objective-C and Objective-C++ Dialects
60de6385 2499
46e34f96
ZL
2500@cindex compiler options, Objective-C and Objective-C++
2501@cindex Objective-C and Objective-C++ options, command line
2502@cindex options, Objective-C and Objective-C++
2503(NOTE: This manual does not describe the Objective-C and Objective-C++
2504languages themselves. See @xref{Standards,,Language Standards
2505Supported by GCC}, for references.)
264fa2db 2506
60de6385 2507This section describes the command-line options that are only meaningful
46e34f96
ZL
2508for Objective-C and Objective-C++ programs, but you can also use most of
2509the language-independent GNU compiler options.
2510For example, you might compile a file @code{some_class.m} like this:
60de6385 2511
3ab51846 2512@smallexample
60de6385 2513gcc -g -fgnu-runtime -O -c some_class.m
3ab51846 2514@end smallexample
60de6385
SS
2515
2516@noindent
9eff22bc 2517In this example, @option{-fgnu-runtime} is an option meant only for
46e34f96
ZL
2518Objective-C and Objective-C++ programs; you can use the other options with
2519any language supported by GCC@.
2520
2521Note that since Objective-C is an extension of the C language, Objective-C
f0eb93a8 2522compilations may also use options specific to the C front-end (e.g.,
46e34f96
ZL
2523@option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2524C++-specific options (e.g., @option{-Wabi}).
60de6385
SS
2525
2526Here is a list of options that are @emph{only} for compiling Objective-C
46e34f96 2527and Objective-C++ programs:
60de6385
SS
2528
2529@table @gcctabopt
630d3d5a 2530@item -fconstant-string-class=@var{class-name}
cd3bb277 2531@opindex fconstant-string-class
630d3d5a 2532Use @var{class-name} as the name of the class to instantiate for each
695ac33f 2533literal string specified with the syntax @code{@@"@dots{}"}. The default
264fa2db
ZL
2534class name is @code{NXConstantString} if the GNU runtime is being used, and
2535@code{NSConstantString} if the NeXT runtime is being used (see below). The
2536@option{-fconstant-cfstrings} option, if also present, will override the
2537@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2538to be laid out as constant CoreFoundation strings.
60de6385
SS
2539
2540@item -fgnu-runtime
cd3bb277 2541@opindex fgnu-runtime
60de6385
SS
2542Generate object code compatible with the standard GNU Objective-C
2543runtime. This is the default for most types of systems.
2544
2545@item -fnext-runtime
cd3bb277 2546@opindex fnext-runtime
60de6385 2547Generate output compatible with the NeXT runtime. This is the default
1f676100
NP
2548for NeXT-based systems, including Darwin and Mac OS X@. The macro
2549@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2550used.
60de6385 2551
264fa2db 2552@item -fno-nil-receivers
5ad7ae7f 2553@opindex fno-nil-receivers
35e711d3
NP
2554Assume that all Objective-C message dispatches (@code{[receiver
2555message:arg]}) in this translation unit ensure that the receiver is
2556not @code{nil}. This allows for more efficient entry points in the
2557runtime to be used. Currently, this option is only available in
2558conjunction with the NeXT runtime on Mac OS X 10.3 and later.
264fa2db 2559
6e955430
ZL
2560@item -fobjc-call-cxx-cdtors
2561@opindex fobjc-call-cxx-cdtors
2562For each Objective-C class, check if any of its instance variables is a
2563C++ object with a non-trivial default constructor. If so, synthesize a
2564special @code{- (id) .cxx_construct} instance method that will run
2565non-trivial default constructors on any such instance variables, in order,
2566and then return @code{self}. Similarly, check if any instance variable
2567is a C++ object with a non-trivial destructor, and if so, synthesize a
2568special @code{- (void) .cxx_destruct} method that will run
2569all such default destructors, in reverse order.
2570
35e711d3
NP
2571The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2572methods thusly generated will only operate on instance variables
2573declared in the current Objective-C class, and not those inherited
2574from superclasses. It is the responsibility of the Objective-C
2575runtime to invoke all such methods in an object's inheritance
2576hierarchy. The @code{- (id) .cxx_construct} methods will be invoked
2577by the runtime immediately after a new object instance is allocated;
2578the @code{- (void) .cxx_destruct} methods will be invoked immediately
2579before the runtime deallocates an object instance.
6e955430
ZL
2580
2581As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2582support for invoking the @code{- (id) .cxx_construct} and
2583@code{- (void) .cxx_destruct} methods.
2584
2585@item -fobjc-direct-dispatch
2586@opindex fobjc-direct-dispatch
2587Allow fast jumps to the message dispatcher. On Darwin this is
128a79fb 2588accomplished via the comm page.
6e955430 2589
264fa2db 2590@item -fobjc-exceptions
5ad7ae7f 2591@opindex fobjc-exceptions
35e711d3
NP
2592Enable syntactic support for structured exception handling in
2593Objective-C, similar to what is offered by C++ and Java. This option
2594is required to use the Objective-C keywords @code{@@try},
2595@code{@@throw}, @code{@@catch}, @code{@@finally} and
2596@code{@@synchronized}. This option is available with both the GNU
2597runtime and the NeXT runtime (but not available in conjunction with
2598the NeXT runtime on Mac OS X 10.2 and earlier).
264fa2db 2599
6e955430
ZL
2600@item -fobjc-gc
2601@opindex fobjc-gc
35e711d3
NP
2602Enable garbage collection (GC) in Objective-C and Objective-C++
2603programs. This option is only available with the NeXT runtime; the
2604GNU runtime has a different garbage collection implementation that
2605does not require special compiler flags.
6e955430 2606
22d8d616
NP
2607@item -fobjc-std=objc1
2608@opindex fobjc-std
2609Conform to the language syntax of Objective-C 1.0, the language
2610recognized by GCC 4.0. This only affects the Objective-C additions to
2611the C/C++ language; it does not affect conformance to C/C++ standards,
2612which is controlled by the separate C/C++ dialect option flags. When
2613this option is used with the Objective-C or Objective-C++ compiler,
2614any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2615This is useful if you need to make sure that your Objective-C code can
2616be compiled with older versions of GCC.
2617
264fa2db 2618@item -freplace-objc-classes
5ad7ae7f 2619@opindex freplace-objc-classes
264fa2db
ZL
2620Emit a special marker instructing @command{ld(1)} not to statically link in
2621the resulting object file, and allow @command{dyld(1)} to load it in at
2622run time instead. This is used in conjunction with the Fix-and-Continue
daf2f129 2623debugging mode, where the object file in question may be recompiled and
264fa2db
ZL
2624dynamically reloaded in the course of program execution, without the need
2625to restart the program itself. Currently, Fix-and-Continue functionality
daf2f129 2626is only available in conjunction with the NeXT runtime on Mac OS X 10.3
264fa2db
ZL
2627and later.
2628
2629@item -fzero-link
5ad7ae7f 2630@opindex fzero-link
264fa2db
ZL
2631When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2632to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2633compile time) with static class references that get initialized at load time,
2634which improves run-time performance. Specifying the @option{-fzero-link} flag
2635suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
daf2f129 2636to be retained. This is useful in Zero-Link debugging mode, since it allows
264fa2db 2637for individual class implementations to be modified during program execution.
35e711d3
NP
2638The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2639regardless of command line options.
264fa2db 2640
60de6385 2641@item -gen-decls
cd3bb277 2642@opindex gen-decls
60de6385
SS
2643Dump interface declarations for all classes seen in the source file to a
2644file named @file{@var{sourcename}.decl}.
2645
670b0231 2646@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
6e955430 2647@opindex Wassign-intercept
ccd4e386 2648@opindex Wno-assign-intercept
6e955430
ZL
2649Warn whenever an Objective-C assignment is being intercepted by the
2650garbage collector.
2651
670b0231 2652@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
cd3bb277 2653@opindex Wno-protocol
ccd4e386 2654@opindex Wprotocol
1f676100
NP
2655If a class is declared to implement a protocol, a warning is issued for
2656every method in the protocol that is not implemented by the class. The
6335b0aa 2657default behavior is to issue a warning for every method not explicitly
1f676100 2658implemented in the class, even if a method implementation is inherited
4ec7afd7 2659from the superclass. If you use the @option{-Wno-protocol} option, then
1f676100
NP
2660methods inherited from the superclass are considered to be implemented,
2661and no warning is issued for them.
60de6385 2662
670b0231 2663@item -Wselector @r{(Objective-C and Objective-C++ only)}
cd3bb277 2664@opindex Wselector
ccd4e386 2665@opindex Wno-selector
1f676100
NP
2666Warn if multiple methods of different types for the same selector are
2667found during compilation. The check is performed on the list of methods
2668in the final stage of compilation. Additionally, a check is performed
9eff22bc
LG
2669for each selector appearing in a @code{@@selector(@dots{})}
2670expression, and a corresponding method for that selector has been found
1f676100
NP
2671during compilation. Because these checks scan the method table only at
2672the end of compilation, these warnings are not produced if the final
2673stage of compilation is not reached, for example because an error is
4ec7afd7 2674found during compilation, or because the @option{-fsyntax-only} option is
1f676100
NP
2675being used.
2676
670b0231 2677@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
6e955430 2678@opindex Wstrict-selector-match
ccd4e386 2679@opindex Wno-strict-selector-match
6e955430
ZL
2680Warn if multiple methods with differing argument and/or return types are
2681found for a given selector when attempting to send a message using this
2682selector to a receiver of type @code{id} or @code{Class}. When this flag
2683is off (which is the default behavior), the compiler will omit such warnings
2684if any differences found are confined to types which share the same size
2685and alignment.
2686
670b0231 2687@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
1f676100 2688@opindex Wundeclared-selector
ccd4e386 2689@opindex Wno-undeclared-selector
1f676100
NP
2690Warn if a @code{@@selector(@dots{})} expression referring to an
2691undeclared selector is found. A selector is considered undeclared if no
daf2f129 2692method with that name has been declared before the
9eff22bc
LG
2693@code{@@selector(@dots{})} expression, either explicitly in an
2694@code{@@interface} or @code{@@protocol} declaration, or implicitly in
2695an @code{@@implementation} section. This option always performs its
2696checks as soon as a @code{@@selector(@dots{})} expression is found,
4ec7afd7 2697while @option{-Wselector} only performs its checks in the final stage of
9eff22bc 2698compilation. This also enforces the coding style convention
1f676100 2699that methods and selectors must be declared before being used.
60de6385 2700
7989e4dc 2701@item -print-objc-runtime-info
5ad7ae7f 2702@opindex print-objc-runtime-info
7989e4dc
RO
2703Generate C header describing the largest structure that is passed by
2704value, if any.
60de6385
SS
2705
2706@end table
2707
764dbbf2
GDR
2708@node Language Independent Options
2709@section Options to Control Diagnostic Messages Formatting
2710@cindex options to control diagnostics formatting
2711@cindex diagnostic messages
2712@cindex message formatting
2713
b192711e 2714Traditionally, diagnostic messages have been formatted irrespective of
e979f9e8 2715the output device's aspect (e.g.@: its width, @dots{}). The options described
764dbbf2 2716below can be used to control the diagnostic messages formatting
e979f9e8 2717algorithm, e.g.@: how many characters per line, how often source location
6c0a4eab 2718information should be reported. Right now, only the C++ front end can
764dbbf2 2719honor these options. However it is expected, in the near future, that
6c0a4eab 2720the remaining front ends would be able to digest them correctly.
764dbbf2 2721
2642624b 2722@table @gcctabopt
764dbbf2 2723@item -fmessage-length=@var{n}
cd3bb277 2724@opindex fmessage-length
764dbbf2 2725Try to format error messages so that they fit on lines of about @var{n}
aee96fe9 2726characters. The default is 72 characters for @command{g++} and 0 for the rest of
161d7b59 2727the front ends supported by GCC@. If @var{n} is zero, then no
02f52e19 2728line-wrapping will be done; each error message will appear on a single
764dbbf2
GDR
2729line.
2730
cd3bb277 2731@opindex fdiagnostics-show-location
764dbbf2 2732@item -fdiagnostics-show-location=once
b192711e 2733Only meaningful in line-wrapping mode. Instructs the diagnostic messages
764dbbf2
GDR
2734reporter to emit @emph{once} source location information; that is, in
2735case the message is too long to fit on a single physical line and has to
2736be wrapped, the source location won't be emitted (as prefix) again,
2737over and over, in subsequent continuation lines. This is the default
c21cd8b1 2738behavior.
764dbbf2
GDR
2739
2740@item -fdiagnostics-show-location=every-line
2741Only meaningful in line-wrapping mode. Instructs the diagnostic
2742messages reporter to emit the same source location information (as
4fe9b91c 2743prefix) for physical lines that result from the process of breaking
b192711e 2744a message which is too long to fit on a single line.
764dbbf2 2745
1576e2be
RM
2746@item -fdiagnostics-show-option
2747@opindex fdiagnostics-show-option
ccf08a6e
DD
2748This option instructs the diagnostic machinery to add text to each
2749diagnostic emitted, which indicates which command line option directly
2750controls that diagnostic, when such an option is known to the
2751diagnostic machinery.
2752
16c1c158
RG
2753@item -Wcoverage-mismatch
2754@opindex Wcoverage-mismatch
2755Warn if feedback profiles do not match when using the
2756@option{-fprofile-use} option.
2757If a source file was changed between @option{-fprofile-gen} and
2758@option{-fprofile-use}, the files with the profile feedback can fail
2759to match the source file and GCC can not use the profile feedback
650cfcab
NV
2760information. By default, this warning is enabled and is treated as an
2761error. @option{-Wno-coverage-mismatch} can be used to disable the
2762warning or @option{-Wno-error=coverage-mismatch} can be used to
2763disable the error. Disable the error for this warning can result in
2764poorly optimized code, so disabling the error is useful only in the
2765case of very minor changes such as bug fixes to an existing code-base.
2766Completely disabling the warning is not recommended.
16c1c158 2767
764dbbf2
GDR
2768@end table
2769
74291a4b
MM
2770@node Warning Options
2771@section Options to Request or Suppress Warnings
2772@cindex options to control warnings
2773@cindex warning messages
2774@cindex messages, warning
2775@cindex suppressing warnings
2776
2777Warnings are diagnostic messages that report constructions which
2778are not inherently erroneous but which are risky or suggest there
2779may have been an error.
2780
2b60abb7
MLI
2781The following language-independent options do not enable specific
2782warnings but control the kinds of diagnostics produced by GCC.
74291a4b 2783
2642624b 2784@table @gcctabopt
74291a4b
MM
2785@cindex syntax checking
2786@item -fsyntax-only
cd3bb277 2787@opindex fsyntax-only
74291a4b
MM
2788Check the code for syntax errors, but don't do anything beyond that.
2789
3a789837
NF
2790@item -fmax-errors=@var{n}
2791@opindex fmax-errors
2792Limits the maximum number of error messages to @var{n}, at which point
2793GCC bails out rather than attempting to continue processing the source
2794code. If @var{n} is 0 (the default), there is no limit on the number
2795of error messages produced. If @option{-Wfatal-errors} is also
2796specified, then @option{-Wfatal-errors} takes precedence over this
2797option.
2798
2b60abb7
MLI
2799@item -w
2800@opindex w
2801Inhibit all warning messages.
2802
2803@item -Werror
2804@opindex Werror
ccd4e386 2805@opindex Wno-error
2b60abb7
MLI
2806Make all warnings into errors.
2807
2808@item -Werror=
2809@opindex Werror=
ccd4e386 2810@opindex Wno-error=
2b60abb7
MLI
2811Make the specified warning into an error. The specifier for a warning
2812is appended, for example @option{-Werror=switch} turns the warnings
2813controlled by @option{-Wswitch} into errors. This switch takes a
2814negative form, to be used to negate @option{-Werror} for specific
2815warnings, for example @option{-Wno-error=switch} makes
2816@option{-Wswitch} warnings not be errors, even when @option{-Werror}
2817is in effect. You can use the @option{-fdiagnostics-show-option}
2818option to have each controllable warning amended with the option which
2819controls it, to determine what to use with this option.
2820
2821Note that specifying @option{-Werror=}@var{foo} automatically implies
2822@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
2823imply anything.
2824
2825@item -Wfatal-errors
2826@opindex Wfatal-errors
ccd4e386 2827@opindex Wno-fatal-errors
2b60abb7
MLI
2828This option causes the compiler to abort compilation on the first error
2829occurred rather than trying to keep going and printing further error
2830messages.
2831
2832@end table
2833
2834You can request many specific warnings with options beginning
2835@samp{-W}, for example @option{-Wimplicit} to request warnings on
2836implicit declarations. Each of these specific warning options also
2837has a negative form beginning @samp{-Wno-} to turn off warnings; for
2838example, @option{-Wno-implicit}. This manual lists only one of the
2839two forms, whichever is not the default. For further,
2840language-specific options also refer to @ref{C++ Dialect Options} and
2841@ref{Objective-C and Objective-C++ Dialect Options}.
2842
09ccff9f 2843When an unrecognized warning option is requested (e.g.,
b8360603 2844@option{-Wunknown-warning}), GCC will emit a diagnostic stating
09ccff9f 2845that the option is not recognized. However, if the @option{-Wno-} form
e54655a2
DN
2846is used, the behavior is slightly different: No diagnostic will be
2847produced for @option{-Wno-unknown-warning} unless other diagnostics
2848are being produced. This allows the use of new @option{-Wno-} options
2849with old compilers, but if something goes wrong, the compiler will
2850warn that an unrecognized option was used.
2851
2b60abb7 2852@table @gcctabopt
74291a4b 2853@item -pedantic
cd3bb277 2854@opindex pedantic
074e95e3
JM
2855Issue all the warnings demanded by strict ISO C and ISO C++;
2856reject all programs that use forbidden extensions, and some other
2857programs that do not follow ISO C and ISO C++. For ISO C, follows the
630d3d5a 2858version of the ISO C standard specified by any @option{-std} option used.
74291a4b 2859
074e95e3 2860Valid ISO C and ISO C++ programs should compile properly with or without
5490d604 2861this option (though a rare few will require @option{-ansi} or a
161d7b59 2862@option{-std} option specifying the required version of ISO C)@. However,
b1d16193
JL
2863without this option, certain GNU extensions and traditional C and C++
2864features are supported as well. With this option, they are rejected.
74291a4b 2865
630d3d5a 2866@option{-pedantic} does not cause warning messages for use of the
74291a4b
MM
2867alternate keywords whose names begin and end with @samp{__}. Pedantic
2868warnings are also disabled in the expression that follows
2869@code{__extension__}. However, only system header files should use
2870these escape routes; application programs should avoid them.
2871@xref{Alternate Keywords}.
2872
630d3d5a 2873Some users try to use @option{-pedantic} to check programs for strict ISO
74291a4b 2874C conformance. They soon find that it does not do quite what they want:
c1030c7c 2875it finds some non-ISO practices, but not all---only those for which
074e95e3
JM
2876ISO C @emph{requires} a diagnostic, and some others for which
2877diagnostics have been added.
74291a4b 2878
074e95e3 2879A feature to report any failure to conform to ISO C might be useful in
74291a4b 2880some instances, but would require considerable additional work and would
630d3d5a 2881be quite different from @option{-pedantic}. We don't have plans to
892d0a6d 2882support such a feature in the near future.
74291a4b 2883
91ea548a 2884Where the standard specified with @option{-std} represents a GNU
7e1542b9 2885extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
91ea548a
JM
2886corresponding @dfn{base standard}, the version of ISO C on which the GNU
2887extended dialect is based. Warnings from @option{-pedantic} are given
2888where they are required by the base standard. (It would not make sense
2889for such warnings to be given only for features not in the specified GNU
2890C dialect, since by definition the GNU dialects of C include all
2891features the compiler supports with the given option, and there would be
2892nothing to warn about.)
2893
74291a4b 2894@item -pedantic-errors
cd3bb277 2895@opindex pedantic-errors
630d3d5a 2896Like @option{-pedantic}, except that errors are produced rather than
74291a4b
MM
2897warnings.
2898
60df726b
MLI
2899@item -Wall
2900@opindex Wall
ccd4e386 2901@opindex Wno-all
60df726b
MLI
2902This enables all the warnings about constructions that some users
2903consider questionable, and that are easy to avoid (or modify to
2904prevent the warning), even in conjunction with macros. This also
2905enables some language-specific warnings described in @ref{C++ Dialect
2906Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2907
2908@option{-Wall} turns on the following warning flags:
7b6cb843
MLI
2909
2910@gccoptlist{-Waddress @gol
e4d35515 2911-Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
7b6cb843
MLI
2912-Wc++0x-compat @gol
2913-Wchar-subscripts @gol
6866c6e8 2914-Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
3734d960
MLI
2915-Wimplicit-int @r{(C and Objective-C only)} @gol
2916-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
7b6cb843
MLI
2917-Wcomment @gol
2918-Wformat @gol
2919-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
2920-Wmissing-braces @gol
2921-Wnonnull @gol
2922-Wparentheses @gol
2923-Wpointer-sign @gol
2924-Wreorder @gol
2925-Wreturn-type @gol
2926-Wsequence-point @gol
2927-Wsign-compare @r{(only in C++)} @gol
2928-Wstrict-aliasing @gol
027b740e 2929-Wstrict-overflow=1 @gol
7b6cb843
MLI
2930-Wswitch @gol
2931-Wtrigraphs @gol
2dc74010 2932-Wuninitialized @gol
7b6cb843
MLI
2933-Wunknown-pragmas @gol
2934-Wunused-function @gol
2935-Wunused-label @gol
2936-Wunused-value @gol
2937-Wunused-variable @gol
16302daf 2938-Wvolatile-register-var @gol
60df726b
MLI
2939}
2940
e847d3bf
MLI
2941Note that some warning flags are not implied by @option{-Wall}. Some of
2942them warn about constructions that users generally do not consider
2943questionable, but which occasionally you might wish to check for;
2944others warn about constructions that are necessary or hard to avoid in
2945some cases, and there is no simple way to modify the code to suppress
2946the warning. Some of them are enabled by @option{-Wextra} but many of
2947them must be enabled individually.
2948
2949@item -Wextra
2950@opindex W
2951@opindex Wextra
ccd4e386 2952@opindex Wno-extra
e847d3bf
MLI
2953This enables some extra warning flags that are not enabled by
2954@option{-Wall}. (This option used to be called @option{-W}. The older
2955name is still supported, but the newer name is more descriptive.)
2956
2957@gccoptlist{-Wclobbered @gol
2958-Wempty-body @gol
5db2e9ca 2959-Wignored-qualifiers @gol
e847d3bf
MLI
2960-Wmissing-field-initializers @gol
2961-Wmissing-parameter-type @r{(C only)} @gol
2962-Wold-style-declaration @r{(C only)} @gol
2963-Woverride-init @gol
2964-Wsign-compare @gol
2965-Wtype-limits @gol
2dc74010 2966-Wuninitialized @gol
ebfbbdc5
JJ
2967-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
2968-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
e847d3bf
MLI
2969}
2970
2971The option @option{-Wextra} also prints warning messages for the
2972following cases:
2973
2974@itemize @bullet
2975
2976@item
2977A pointer is compared against integer zero with @samp{<}, @samp{<=},
2978@samp{>}, or @samp{>=}.
2979
7a61cf6f 2980@item
e847d3bf
MLI
2981(C++ only) An enumerator and a non-enumerator both appear in a
2982conditional expression.
2983
7a61cf6f 2984@item
e847d3bf
MLI
2985(C++ only) Ambiguous virtual bases.
2986
7a61cf6f 2987@item
e847d3bf
MLI
2988(C++ only) Subscripting an array which has been declared @samp{register}.
2989
7a61cf6f 2990@item
e847d3bf
MLI
2991(C++ only) Taking the address of a variable which has been declared
2992@samp{register}.
2993
7a61cf6f 2994@item
e847d3bf
MLI
2995(C++ only) A base class is not initialized in a derived class' copy
2996constructor.
2997
2998@end itemize
2999
74291a4b 3000@item -Wchar-subscripts
cd3bb277 3001@opindex Wchar-subscripts
ccd4e386 3002@opindex Wno-char-subscripts
74291a4b
MM
3003Warn if an array subscript has type @code{char}. This is a common cause
3004of error, as programmers often forget that this type is signed on some
3005machines.
69cdf050 3006This warning is enabled by @option{-Wall}.
74291a4b
MM
3007
3008@item -Wcomment
cd3bb277 3009@opindex Wcomment
ccd4e386 3010@opindex Wno-comment
74291a4b
MM
3011Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3012comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
69cdf050 3013This warning is enabled by @option{-Wall}.
74291a4b 3014
87cf0651
SB
3015@item -Wno-cpp \
3016@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3017
3018Suppress warning messages emitted by @code{#warning} directives.
3019
c5ee1358 3020@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
0a0b3574
MM
3021@opindex Wdouble-promotion
3022@opindex Wno-double-promotion
3023Give a warning when a value of type @code{float} is implicitly
3024promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3025floating-point unit implement @code{float} in hardware, but emulate
3026@code{double} in software. On such a machine, doing computations
3027using @code{double} values is much more expensive because of the
3028overhead required for software emulation.
3029
3030It is easy to accidentally do computations with @code{double} because
3031floating-point literals are implicitly of type @code{double}. For
3032example, in:
3033@smallexample
3034@group
3035float area(float radius)
3036@{
3037 return 3.14159 * radius * radius;
3038@}
3039@end group
3040@end smallexample
3041the compiler will perform the entire computation with @code{double}
3042because the floating-point literal is a @code{double}.
3043
74291a4b 3044@item -Wformat
cd3bb277 3045@opindex Wformat
ccd4e386 3046@opindex Wno-format
e6e931b7
JM
3047@opindex ffreestanding
3048@opindex fno-builtin
74291a4b
MM
3049Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3050the arguments supplied have types appropriate to the format string
26f6672d
JM
3051specified, and that the conversions specified in the format string make
3052sense. This includes standard functions, and others specified by format
3053attributes (@pxref{Function Attributes}), in the @code{printf},
3054@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
a2bec818 3055not in the C standard) families (or other target-specific families).
e6e931b7
JM
3056Which functions are checked without format attributes having been
3057specified depends on the standard version selected, and such checks of
3058functions without the attribute specified are disabled by
3059@option{-ffreestanding} or @option{-fno-builtin}.
74291a4b 3060
8308e0b7 3061The formats are checked against the format features supported by GNU
3764f879 3062libc version 2.2. These include all ISO C90 and C99 features, as well
8308e0b7
JM
3063as features from the Single Unix Specification and some BSD and GNU
3064extensions. Other library implementations may not support all these
3065features; GCC does not support warning about features that go beyond a
630d3d5a
JM
3066particular library's limitations. However, if @option{-pedantic} is used
3067with @option{-Wformat}, warnings will be given about format features not
26f6672d
JM
3068in the selected standard version (but not for @code{strfmon} formats,
3069since those are not in any version of the C standard). @xref{C Dialect
3070Options,,Options Controlling C Dialect}.
8308e0b7 3071
b34c7881
JT
3072Since @option{-Wformat} also checks for null format arguments for
3073several functions, @option{-Wformat} also implies @option{-Wnonnull}.
3074
630d3d5a 3075@option{-Wformat} is included in @option{-Wall}. For more control over some
c76f4e8e 3076aspects of format checking, the options @option{-Wformat-y2k},
e964a556
JT
3077@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
3078@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
3079@option{-Wformat=2} are available, but are not included in @option{-Wall}.
4d808927 3080
c76f4e8e
JM
3081@item -Wformat-y2k
3082@opindex Wformat-y2k
ccd4e386 3083@opindex Wno-format-y2k
c76f4e8e 3084If @option{-Wformat} is specified, also warn about @code{strftime}
4d808927
JM
3085formats which may yield only a two-digit year.
3086
802e3f8c
RW
3087@item -Wno-format-contains-nul
3088@opindex Wno-format-contains-nul
3089@opindex Wformat-contains-nul
3090If @option{-Wformat} is specified, do not warn about format strings that
3091contain NUL bytes.
3092
4d808927 3093@item -Wno-format-extra-args
cd3bb277 3094@opindex Wno-format-extra-args
ccd4e386 3095@opindex Wformat-extra-args
630d3d5a 3096If @option{-Wformat} is specified, do not warn about excess arguments to a
4d808927
JM
3097@code{printf} or @code{scanf} format function. The C standard specifies
3098that such arguments are ignored.
3099
7e5fb12f
JM
3100Where the unused arguments lie between used arguments that are
3101specified with @samp{$} operand number specifications, normally
3102warnings are still given, since the implementation could not know what
3103type to pass to @code{va_arg} to skip the unused arguments. However,
3104in the case of @code{scanf} formats, this option will suppress the
3105warning if the unused arguments are all pointers, since the Single
3106Unix Specification says that such unused arguments are allowed.
3107
670b0231 3108@item -Wno-format-zero-length @r{(C and Objective-C only)}
e964a556 3109@opindex Wno-format-zero-length
ccd4e386 3110@opindex Wformat-zero-length
e964a556
JT
3111If @option{-Wformat} is specified, do not warn about zero-length formats.
3112The C standard specifies that zero-length formats are allowed.
3113
4d808927 3114@item -Wformat-nonliteral
cd3bb277 3115@opindex Wformat-nonliteral
ccd4e386 3116@opindex Wno-format-nonliteral
630d3d5a 3117If @option{-Wformat} is specified, also warn if the format string is not a
4d808927
JM
3118string literal and so cannot be checked, unless the format function
3119takes its format arguments as a @code{va_list}.
3120
c907e684 3121@item -Wformat-security
cd3bb277 3122@opindex Wformat-security
ccd4e386 3123@opindex Wno-format-security
630d3d5a 3124If @option{-Wformat} is specified, also warn about uses of format
c907e684
JM
3125functions that represent possible security problems. At present, this
3126warns about calls to @code{printf} and @code{scanf} functions where the
3127format string is not a string literal and there are no format arguments,
3128as in @code{printf (foo);}. This may be a security hole if the format
3129string came from untrusted input and contains @samp{%n}. (This is
630d3d5a
JM
3130currently a subset of what @option{-Wformat-nonliteral} warns about, but
3131in future warnings may be added to @option{-Wformat-security} that are not
3132included in @option{-Wformat-nonliteral}.)
c907e684 3133
4d808927 3134@item -Wformat=2
cd3bb277 3135@opindex Wformat=2
ccd4e386 3136@opindex Wno-format=2
630d3d5a
JM
3137Enable @option{-Wformat} plus format checks not included in
3138@option{-Wformat}. Currently equivalent to @samp{-Wformat
c76f4e8e 3139-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
4d808927 3140
670b0231 3141@item -Wnonnull @r{(C and Objective-C only)}
b34c7881 3142@opindex Wnonnull
ccd4e386 3143@opindex Wno-nonnull
f6d9224f 3144Warn about passing a null pointer for arguments marked as
b34c7881
JT
3145requiring a non-null value by the @code{nonnull} function attribute.
3146
3147@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3148can be disabled with the @option{-Wno-nonnull} option.
3149
46e34f96 3150@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3390f9c9 3151@opindex Winit-self
ccd4e386 3152@opindex Wno-init-self
f6d9224f 3153Warn about uninitialized variables which are initialized with themselves.
2dc74010 3154Note this option can only be used with the @option{-Wuninitialized} option.
3390f9c9 3155
f6d9224f
GP
3156For example, GCC will warn about @code{i} being uninitialized in the
3157following snippet only when @option{-Winit-self} has been specified:
3390f9c9
AP
3158@smallexample
3159@group
3160int f()
3161@{
3162 int i = i;
3163 return i;
3164@}
3165@end group
3166@end smallexample
3167
670b0231 3168@item -Wimplicit-int @r{(C and Objective-C only)}
cd3bb277 3169@opindex Wimplicit-int
ccd4e386 3170@opindex Wno-implicit-int
e9a25f70 3171Warn when a declaration does not specify a type.
69cdf050 3172This warning is enabled by @option{-Wall}.
e9a25f70 3173
670b0231 3174@item -Wimplicit-function-declaration @r{(C and Objective-C only)}
cd3bb277 3175@opindex Wimplicit-function-declaration
dc90f45b
MLI
3176@opindex Wno-implicit-function-declaration
3177Give a warning whenever a function is used before being declared. In
3178C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3179enabled by default and it is made into an error by
3180@option{-pedantic-errors}. This warning is also enabled by
3181@option{-Wall}.
e9a25f70 3182
3734d960 3183@item -Wimplicit @r{(C and Objective-C only)}
cd3bb277 3184@opindex Wimplicit
ccd4e386 3185@opindex Wno-implicit
630d3d5a 3186Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
69cdf050 3187This warning is enabled by @option{-Wall}.
861bb6c1 3188
670b0231 3189@item -Wignored-qualifiers @r{(C and C++ only)}
5db2e9ca
DK
3190@opindex Wignored-qualifiers
3191@opindex Wno-ignored-qualifiers
3192Warn if the return type of a function has a type qualifier
3193such as @code{const}. For ISO C such a type qualifier has no effect,
3194since the value returned by a function is not an lvalue.
3195For C++, the warning is only emitted for scalar types or @code{void}.
3196ISO C prohibits qualified @code{void} return types on function
3197definitions, so such return types always receive a warning
3198even without this option.
3199
3200This warning is also enabled by @option{-Wextra}.
3201
861bb6c1 3202@item -Wmain
cd3bb277 3203@opindex Wmain
ccd4e386 3204@opindex Wno-main
4003301d
MLI
3205Warn if the type of @samp{main} is suspicious. @samp{main} should be
3206a function with external linkage, returning int, taking either zero
3207arguments, two, or three arguments of appropriate types. This warning
3208is enabled by default in C++ and is enabled by either @option{-Wall}
3209or @option{-pedantic}.
4a870dba 3210
1f0c3120 3211@item -Wmissing-braces
cd3bb277 3212@opindex Wmissing-braces
ccd4e386 3213@opindex Wno-missing-braces
1f0c3120
JM
3214Warn if an aggregate or union initializer is not fully bracketed. In
3215the following example, the initializer for @samp{a} is not fully
3216bracketed, but that for @samp{b} is fully bracketed.
3217
3218@smallexample
3219int a[2][2] = @{ 0, 1, 2, 3 @};
3220int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3221@end smallexample
3222
69cdf050
JM
3223This warning is enabled by @option{-Wall}.
3224
46e34f96 3225@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
b02398bd 3226@opindex Wmissing-include-dirs
ccd4e386 3227@opindex Wno-missing-include-dirs
b02398bd
BE
3228Warn if a user-supplied include directory does not exist.
3229
74291a4b 3230@item -Wparentheses
cd3bb277 3231@opindex Wparentheses
ccd4e386 3232@opindex Wno-parentheses
74291a4b
MM
3233Warn if parentheses are omitted in certain contexts, such
3234as when there is an assignment in a context where a truth value
3235is expected, or when operators are nested whose precedence people
2a67bec2 3236often get confused about.
3e3970a2
JM
3237
3238Also warn if a comparison like @samp{x<=y<=z} appears; this is
3239equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3240interpretation from that of ordinary mathematical notation.
74291a4b 3241
e9a25f70
JL
3242Also warn about constructions where there may be confusion to which
3243@code{if} statement an @code{else} branch belongs. Here is an example of
3244such a case:
3245
3246@smallexample
aee96fe9 3247@group
e9a25f70
JL
3248@{
3249 if (a)
3250 if (b)
3251 foo ();
3252 else
3253 bar ();
3254@}
aee96fe9 3255@end group
e9a25f70
JL
3256@end smallexample
3257
2a67bec2
ILT
3258In C/C++, every @code{else} branch belongs to the innermost possible
3259@code{if} statement, which in this example is @code{if (b)}. This is
3260often not what the programmer expected, as illustrated in the above
3261example by indentation the programmer chose. When there is the
3262potential for this confusion, GCC will issue a warning when this flag
3263is specified. To eliminate the warning, add explicit braces around
3264the innermost @code{if} statement so there is no way the @code{else}
3265could belong to the enclosing @code{if}. The resulting code would
3266look like this:
e9a25f70
JL
3267
3268@smallexample
aee96fe9 3269@group
e9a25f70
JL
3270@{
3271 if (a)
3272 @{
3273 if (b)
3274 foo ();
3275 else
3276 bar ();
3277 @}
3278@}
aee96fe9 3279@end group
e9a25f70
JL
3280@end smallexample
3281
d166d4c3
AK
3282Also warn for dangerous uses of the
3283?: with omitted middle operand GNU extension. When the condition
3284in the ?: operator is a boolean expression the omitted value will
3285be always 1. Often the user expects it to be a value computed
3286inside the conditional expression instead.
3287
69cdf050
JM
3288This warning is enabled by @option{-Wall}.
3289
bb58bec5 3290@item -Wsequence-point
cd3bb277 3291@opindex Wsequence-point
ccd4e386 3292@opindex Wno-sequence-point
bb58bec5 3293Warn about code that may have undefined semantics because of violations
7127d9c7
DM
3294of sequence point rules in the C and C++ standards.
3295
3296The C and C++ standards defines the order in which expressions in a C/C++
3297program are evaluated in terms of @dfn{sequence points}, which represent
3298a partial ordering between the execution of parts of the program: those
3299executed before the sequence point, and those executed after it. These
3300occur after the evaluation of a full expression (one which is not part
3301of a larger expression), after the evaluation of the first operand of a
bb58bec5
JM
3302@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3303function is called (but after the evaluation of its arguments and the
3304expression denoting the called function), and in certain other places.
3305Other than as expressed by the sequence point rules, the order of
3306evaluation of subexpressions of an expression is not specified. All
3307these rules describe only a partial order rather than a total order,
3308since, for example, if two functions are called within one expression
3309with no sequence point between them, the order in which the functions
3310are called is not specified. However, the standards committee have
3311ruled that function calls do not overlap.
3312
3313It is not specified when between sequence points modifications to the
3314values of objects take effect. Programs whose behavior depends on this
7127d9c7
DM
3315have undefined behavior; the C and C++ standards specify that ``Between
3316the previous and next sequence point an object shall have its stored
cb7ad97b 3317value modified at most once by the evaluation of an expression.
7127d9c7
DM
3318Furthermore, the prior value shall be read only to determine the value
3319to be stored.''. If a program breaks these rules, the results on any
bb58bec5
JM
3320particular implementation are entirely unpredictable.
3321
3322Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3323= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3324diagnosed by this option, and it may give an occasional false positive
3325result, but in general it has been found fairly effective at detecting
3326this sort of problem in programs.
3327
7127d9c7 3328The standard is worded confusingly, therefore there is some debate
9c34dbbf
ZW
3329over the precise meaning of the sequence point rules in subtle cases.
3330Links to discussions of the problem, including proposed formal
962e6e00 3331definitions, may be found on the GCC readings page, at
ab940b73 3332@uref{http://gcc.gnu.org/@/readings.html}.
bb58bec5 3333
7127d9c7 3334This warning is enabled by @option{-Wall} for C and C++.
69cdf050 3335
74291a4b 3336@item -Wreturn-type
cd3bb277 3337@opindex Wreturn-type
ffd5f276
MLI
3338@opindex Wno-return-type
3339Warn whenever a function is defined with a return-type that defaults
3340to @code{int}. Also warn about any @code{return} statement with no
3341return-value in a function whose return-type is not @code{void}
3342(falling off the end of the function body is considered returning
e4ae5e77 3343without a value), and about a @code{return} statement with an
ffd5f276 3344expression in a function whose return-type is @code{void}.
32c4c36c
ML
3345
3346For C++, a function without return type always produces a diagnostic
767094dd 3347message, even when @option{-Wno-return-type} is specified. The only
32c4c36c 3348exceptions are @samp{main} and functions defined in system headers.
74291a4b 3349
69cdf050
JM
3350This warning is enabled by @option{-Wall}.
3351
74291a4b 3352@item -Wswitch
cd3bb277 3353@opindex Wswitch
ccd4e386 3354@opindex Wno-switch
2eac577f 3355Warn whenever a @code{switch} statement has an index of enumerated type
74291a4b
MM
3356and lacks a @code{case} for one or more of the named codes of that
3357enumeration. (The presence of a @code{default} label prevents this
3358warning.) @code{case} labels outside the enumeration range also
cdb88468
ILT
3359provoke warnings when this option is used (even if there is a
3360@code{default} label).
69cdf050 3361This warning is enabled by @option{-Wall}.
74291a4b 3362
d6961341 3363@item -Wswitch-default
ccd4e386
RW
3364@opindex Wswitch-default
3365@opindex Wno-switch-default
d6961341
AC
3366Warn whenever a @code{switch} statement does not have a @code{default}
3367case.
3368
173028e5
AC
3369@item -Wswitch-enum
3370@opindex Wswitch-enum
ccd4e386 3371@opindex Wno-switch-enum
2eac577f 3372Warn whenever a @code{switch} statement has an index of enumerated type
173028e5
AC
3373and lacks a @code{case} for one or more of the named codes of that
3374enumeration. @code{case} labels outside the enumeration range also
cdb88468
ILT
3375provoke warnings when this option is used. The only difference
3376between @option{-Wswitch} and this option is that this option gives a
3377warning about an omitted enumeration code even if there is a
3378@code{default} label.
173028e5 3379
a072f1cf 3380@item -Wsync-nand @r{(C and C++ only)}
23462d4d
UB
3381@opindex Wsync-nand
3382@opindex Wno-sync-nand
3383Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3384built-in functions are used. These functions changed semantics in GCC 4.4.
3385
74291a4b 3386@item -Wtrigraphs
cd3bb277 3387@opindex Wtrigraphs
ccd4e386 3388@opindex Wno-trigraphs
f2ecb02d
JM
3389Warn if any trigraphs are encountered that might change the meaning of
3390the program (trigraphs within comments are not warned about).
69cdf050 3391This warning is enabled by @option{-Wall}.
74291a4b 3392
ebfbbdc5
JJ
3393@item -Wunused-but-set-parameter
3394@opindex Wunused-but-set-parameter
3395@opindex Wno-unused-but-set-parameter
3396Warn whenever a function parameter is assigned to, but otherwise unused
3397(aside from its declaration).
3398
3399To suppress this warning use the @samp{unused} attribute
3400(@pxref{Variable Attributes}).
3401
3402This warning is also enabled by @option{-Wunused} together with
3403@option{-Wextra}.
3404
3405@item -Wunused-but-set-variable
3406@opindex Wunused-but-set-variable
3407@opindex Wno-unused-but-set-variable
3408Warn whenever a local variable is assigned to, but otherwise unused
3409(aside from its declaration).
3410This warning is enabled by @option{-Wall}.
3411
3412To suppress this warning use the @samp{unused} attribute
3413(@pxref{Variable Attributes}).
3414
3415This warning is also enabled by @option{-Wunused}, which is enabled
3416by @option{-Wall}.
3417
078721e1 3418@item -Wunused-function
cd3bb277 3419@opindex Wunused-function
ccd4e386 3420@opindex Wno-unused-function
078721e1 3421Warn whenever a static function is declared but not defined or a
aa58883c 3422non-inline static function is unused.
69cdf050 3423This warning is enabled by @option{-Wall}.
74291a4b 3424
078721e1 3425@item -Wunused-label
cd3bb277 3426@opindex Wunused-label
ccd4e386 3427@opindex Wno-unused-label
078721e1 3428Warn whenever a label is declared but not used.
69cdf050 3429This warning is enabled by @option{-Wall}.
078721e1
AC
3430
3431To suppress this warning use the @samp{unused} attribute
3432(@pxref{Variable Attributes}).
3433
3434@item -Wunused-parameter
cd3bb277 3435@opindex Wunused-parameter
ccd4e386 3436@opindex Wno-unused-parameter
078721e1
AC
3437Warn whenever a function parameter is unused aside from its declaration.
3438
3439To suppress this warning use the @samp{unused} attribute
3440(@pxref{Variable Attributes}).
956d6950 3441
156f545a
MLI
3442@item -Wno-unused-result
3443@opindex Wunused-result
3444@opindex Wno-unused-result
3445Do not warn if a caller of a function marked with attribute
3446@code{warn_unused_result} (@pxref{Variable Attributes}) does not use
3447its return value. The default is @option{-Wunused-result}.
3448
078721e1 3449@item -Wunused-variable
cd3bb277 3450@opindex Wunused-variable
ccd4e386 3451@opindex Wno-unused-variable
078721e1 3452Warn whenever a local variable or non-constant static variable is unused
bc49e371 3453aside from its declaration.
69cdf050 3454This warning is enabled by @option{-Wall}.
078721e1
AC
3455
3456To suppress this warning use the @samp{unused} attribute
74291a4b
MM
3457(@pxref{Variable Attributes}).
3458
078721e1 3459@item -Wunused-value
cd3bb277 3460@opindex Wunused-value
ccd4e386 3461@opindex Wno-unused-value
27f33b15
MLI
3462Warn whenever a statement computes a result that is explicitly not
3463used. To suppress this warning cast the unused expression to
3464@samp{void}. This includes an expression-statement or the left-hand
3465side of a comma expression that contains no side effects. For example,
3466an expression such as @samp{x[i,j]} will cause a warning, while
3467@samp{x[(void)i,j]} will not.
078721e1 3468
27f33b15 3469This warning is enabled by @option{-Wall}.
078721e1
AC
3470
3471@item -Wunused
cd3bb277 3472@opindex Wunused
ccd4e386 3473@opindex Wno-unused
d3075b6c 3474All the above @option{-Wunused} options combined.
078721e1
AC
3475
3476In order to get a warning about an unused function parameter, you must
65ca2d60
PE
3477either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3478@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
078721e1 3479
74291a4b 3480@item -Wuninitialized
cd3bb277 3481@opindex Wuninitialized
ccd4e386 3482@opindex Wno-uninitialized
c73d5dd9
MLI
3483Warn if an automatic variable is used without first being initialized
3484or if a variable may be clobbered by a @code{setjmp} call. In C++,
3485warn if a non-static reference or non-static @samp{const} member
3486appears in a class without constructors.
74291a4b 3487
3390f9c9
AP
3488If you want to warn about code which uses the uninitialized value of the
3489variable in its own initializer, use the @option{-Winit-self} option.
3490
8ceac9f8
JM
3491These warnings occur for individual uninitialized or clobbered
3492elements of structure, union or array variables as well as for
3493variables which are uninitialized or clobbered as a whole. They do
3494not occur for variables or elements declared @code{volatile}. Because
3495these warnings depend on optimization, the exact variables or elements
3496for which there are warnings will depend on the precise optimization
3497options and version of GCC used.
74291a4b
MM
3498
3499Note that there may be no warning about a variable that is used only
3500to compute a value that itself is never used, because such
3501computations may be deleted by data flow analysis before the warnings
3502are printed.
3503
0c2d1a2a 3504These warnings are made optional because GCC is not smart
74291a4b
MM
3505enough to see all the reasons why the code might be correct
3506despite appearing to have an error. Here is one example of how
3507this can happen:
3508
3509@smallexample
aee96fe9 3510@group
74291a4b
MM
3511@{
3512 int x;
3513 switch (y)
3514 @{
3515 case 1: x = 1;
3516 break;
3517 case 2: x = 4;
3518 break;
3519 case 3: x = 5;
3520 @}
3521 foo (x);
3522@}
aee96fe9 3523@end group
74291a4b
MM
3524@end smallexample
3525
3526@noindent
3527If the value of @code{y} is always 1, 2 or 3, then @code{x} is
0c2d1a2a 3528always initialized, but GCC doesn't know this. Here is
74291a4b
MM
3529another common case:
3530
3531@smallexample
3532@{
3533 int save_y;
3534 if (change_y) save_y = y, y = new_y;
3535 @dots{}
3536 if (change_y) y = save_y;
3537@}
3538@end smallexample
3539
3540@noindent
3541This has no bug because @code{save_y} is used only if it is set.
3542
20300b05 3543@cindex @code{longjmp} warnings
b192711e 3544This option also warns when a non-volatile automatic variable might be
c5c76735
JL
3545changed by a call to @code{longjmp}. These warnings as well are possible
3546only in optimizing compilation.
20300b05
GK
3547
3548The compiler sees only the calls to @code{setjmp}. It cannot know
3549where @code{longjmp} will be called; in fact, a signal handler could
3550call it at any point in the code. As a result, you may get a warning
3551even when there is in fact no problem because @code{longjmp} cannot
3552in fact be called at the place which would cause a problem.
3553
74291a4b
MM
3554Some spurious warnings can be avoided if you declare all the functions
3555you use that never return as @code{noreturn}. @xref{Function
3556Attributes}.
3557
2dc74010 3558This warning is enabled by @option{-Wall} or @option{-Wextra}.
69cdf050 3559
d300e551 3560@item -Wunknown-pragmas
cd3bb277 3561@opindex Wunknown-pragmas
ccd4e386 3562@opindex Wno-unknown-pragmas
d300e551
NC
3563@cindex warning for unknown pragmas
3564@cindex unknown pragmas, warning
3565@cindex pragmas, warning of unknown
3566Warn when a #pragma directive is encountered which is not understood by
161d7b59 3567GCC@. If this command line option is used, warnings will even be issued
d300e551 3568for unknown pragmas in system header files. This is not the case if
630d3d5a 3569the warnings were only enabled by the @option{-Wall} command line option.
d300e551 3570
b9b8dde3
DD
3571@item -Wno-pragmas
3572@opindex Wno-pragmas
3573@opindex Wpragmas
3574Do not warn about misuses of pragmas, such as incorrect parameters,
3575invalid syntax, or conflicts between pragmas. See also
3576@samp{-Wunknown-pragmas}.
3577
bf52f899
NS
3578@item -Wstrict-aliasing
3579@opindex Wstrict-aliasing
ccd4e386 3580@opindex Wno-strict-aliasing
bf52f899
NS
3581This option is only active when @option{-fstrict-aliasing} is active.
3582It warns about code which might break the strict aliasing rules that the
8a36672b
JM
3583compiler is using for optimization. The warning does not catch all
3584cases, but does attempt to catch the more common pitfalls. It is
bf52f899 3585included in @option{-Wall}.
60df726b 3586It is equivalent to @option{-Wstrict-aliasing=3}
bf52f899 3587
79bedddc
SR
3588@item -Wstrict-aliasing=n
3589@opindex Wstrict-aliasing=n
ccd4e386 3590@opindex Wno-strict-aliasing=n
5399d643 3591This option is only active when @option{-fstrict-aliasing} is active.
66f33c03 3592It warns about code which might break the strict aliasing rules that the
79bedddc
SR
3593compiler is using for optimization.
3594Higher levels correspond to higher accuracy (fewer false positives).
3595Higher levels also correspond to more effort, similar to the way -O works.
3596@option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3597with n=3.
3598
3599Level 1: Most aggressive, quick, least accurate.
3600Possibly useful when higher levels
7a61cf6f 3601do not warn but -fstrict-aliasing still breaks the code, as it has very few
79bedddc 3602false negatives. However, it has many false positives.
7a61cf6f 3603Warns for all pointer conversions between possibly incompatible types,
79bedddc
SR
3604even if never dereferenced. Runs in the frontend only.
3605
3606Level 2: Aggressive, quick, not too precise.
3607May still have many false positives (not as many as level 1 though),
3608and few false negatives (but possibly more than level 1).
3609Unlike level 1, it only warns when an address is taken. Warns about
3610incomplete types. Runs in the frontend only.
3611
7a61cf6f
NC
3612Level 3 (default for @option{-Wstrict-aliasing}):
3613Should have very few false positives and few false
79bedddc 3614negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
02a9370c 3615Takes care of the common pun+dereference pattern in the frontend:
79bedddc 3616@code{*(int*)&some_float}.
7a61cf6f 3617If optimization is enabled, it also runs in the backend, where it deals
79bedddc
SR
3618with multiple statement cases using flow-sensitive points-to information.
3619Only warns when the converted pointer is dereferenced.
3620Does not warn about incomplete types.
5399d643 3621
6ac01510 3622@item -Wstrict-overflow
b29bb640 3623@itemx -Wstrict-overflow=@var{n}
edc5f63b 3624@opindex Wstrict-overflow
ccd4e386 3625@opindex Wno-strict-overflow
6ac01510
ILT
3626This option is only active when @option{-fstrict-overflow} is active.
3627It warns about cases where the compiler optimizes based on the
3628assumption that signed overflow does not occur. Note that it does not
3629warn about all cases where the code might overflow: it only warns
3630about cases where the compiler implements some optimization. Thus
3631this warning depends on the optimization level.
3632
3633An optimization which assumes that signed overflow does not occur is
3634perfectly safe if the values of the variables involved are such that
3635overflow never does, in fact, occur. Therefore this warning can
3636easily give a false positive: a warning about code which is not
3637actually a problem. To help focus on important issues, several
4df28528
ILT
3638warning levels are defined. No warnings are issued for the use of
3639undefined signed overflow when estimating how many iterations a loop
3640will require, in particular when determining whether a loop will be
3641executed at all.
6ac01510 3642
f85138bc 3643@table @gcctabopt
6ac01510
ILT
3644@item -Wstrict-overflow=1
3645Warn about cases which are both questionable and easy to avoid. For
3646example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
4d4362c8
ILT
3647compiler will simplify this to @code{1}. This level of
3648@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3649are not, and must be explicitly requested.
6ac01510
ILT
3650
3651@item -Wstrict-overflow=2
3652Also warn about other cases where a comparison is simplified to a
3653constant. For example: @code{abs (x) >= 0}. This can only be
3654simplified when @option{-fstrict-overflow} is in effect, because
3655@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4d4362c8
ILT
3656zero. @option{-Wstrict-overflow} (with no level) is the same as
3657@option{-Wstrict-overflow=2}.
6ac01510
ILT
3658
3659@item -Wstrict-overflow=3
3660Also warn about other cases where a comparison is simplified. For
3661example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3662
3663@item -Wstrict-overflow=4
3664Also warn about other simplifications not covered by the above cases.
3665For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3666
3667@item -Wstrict-overflow=5
3668Also warn about cases where the compiler reduces the magnitude of a
3669constant involved in a comparison. For example: @code{x + 2 > y} will
3670be simplified to @code{x + 1 >= y}. This is reported only at the
3671highest warning level because this simplification applies to many
3672comparisons, so this warning level will give a very large number of
3673false positives.
3674@end table
3675
212580ff 3676@item -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]}
5dc16b19
MLI
3677@opindex Wsuggest-attribute=
3678@opindex Wno-suggest-attribute=
3679Warn for cases where adding an attribute may be beneficial. The
3680attributes currently supported are listed below.
3681
3682@table @gcctabopt
3683@item -Wsuggest-attribute=pure
3684@itemx -Wsuggest-attribute=const
212580ff 3685@itemx -Wsuggest-attribute=noreturn
5dc16b19
MLI
3686@opindex Wsuggest-attribute=pure
3687@opindex Wno-suggest-attribute=pure
3688@opindex Wsuggest-attribute=const
3689@opindex Wno-suggest-attribute=const
7ea6b6cf
JH
3690@opindex Wsuggest-attribute=noreturn
3691@opindex Wno-suggest-attribute=noreturn
5dc16b19
MLI
3692
3693Warn about functions which might be candidates for attributes
7ea6b6cf
JH
3694@code{pure}, @code{const} or @code{noreturn}. The compiler only warns for
3695functions visible in other compilation units or (in the case of @code{pure} and
3696@code{const}) if it cannot prove that the function returns normally. A function
3697returns normally if it doesn't contain an infinite loop nor returns abnormally
3698by throwing, calling @code{abort()} or trapping. This analysis requires option
3699@option{-fipa-pure-const}, which is enabled by default at @option{-O} and
3700higher. Higher optimization levels improve the accuracy of the analysis.
5dc16b19
MLI
3701@end table
3702
590b1f2d
DM
3703@item -Warray-bounds
3704@opindex Wno-array-bounds
3705@opindex Warray-bounds
e4d35515 3706This option is only active when @option{-ftree-vrp} is active
5dc16b19 3707(default for @option{-O2} and above). It warns about subscripts to arrays
e4d35515 3708that are always out of bounds. This warning is enabled by @option{-Wall}.
590b1f2d 3709
75227a33
GK
3710@item -Wno-div-by-zero
3711@opindex Wno-div-by-zero
3712@opindex Wdiv-by-zero
3713Do not warn about compile-time integer division by zero. Floating point
3714division by zero is not warned about, as it can be a legitimate way of
3715obtaining infinities and NaNs.
3716
3717@item -Wsystem-headers
3718@opindex Wsystem-headers
ccd4e386 3719@opindex Wno-system-headers
75227a33
GK
3720@cindex warnings from system headers
3721@cindex system headers, warnings from
3722Print warning messages for constructs found in system header files.
3723Warnings from system headers are normally suppressed, on the assumption
3724that they usually do not indicate real problems and would only make the
3725compiler output harder to read. Using this command line option tells
3726GCC to emit warnings from system headers as if they occurred in user
3727code. However, note that using @option{-Wall} in conjunction with this
3728option will @emph{not} warn about unknown pragmas in system
3729headers---for that, @option{-Wunknown-pragmas} must also be used.
3730
8ffadef9
MG
3731@item -Wtrampolines
3732@opindex Wtrampolines
3733@opindex Wno-trampolines
3734 Warn about trampolines generated for pointers to nested functions.
3735
3736 A trampoline is a small piece of data or code that is created at run
3737 time on the stack when the address of a nested function is taken, and
3738 is used to call the nested function indirectly. For some targets, it
3739 is made up of data only and thus requires no special treatment. But,
3740 for most targets, it is made up of code and thus requires the stack
3741 to be made executable in order for the program to work properly.
3742
f793a95e 3743@item -Wfloat-equal
cd3bb277 3744@opindex Wfloat-equal
ccd4e386 3745@opindex Wno-float-equal
f793a95e
JL
3746Warn if floating point values are used in equality comparisons.
3747
488d3985
GK
3748The idea behind this is that sometimes it is convenient (for the
3749programmer) to consider floating-point values as approximations to
3750infinitely precise real numbers. If you are doing this, then you need
c0478a66 3751to compute (by analyzing the code, or in some other way) the maximum or
488d3985
GK
3752likely maximum error that the computation introduces, and allow for it
3753when performing comparisons (and when producing output, but that's a
3754different problem). In particular, instead of testing for equality, you
3755would check to see whether the two values have ranges that overlap; and
3756this is done with the relational operators, so equality comparisons are
3757probably mistaken.
3758
670b0231 3759@item -Wtraditional @r{(C and Objective-C only)}
cd3bb277 3760@opindex Wtraditional
ccd4e386 3761@opindex Wno-traditional
74291a4b 3762Warn about certain constructs that behave differently in traditional and
161d7b59 3763ISO C@. Also warn about ISO C constructs that have no traditional C
c8abc684 3764equivalent, and/or problematic constructs which should be avoided.
74291a4b
MM
3765
3766@itemize @bullet
3767@item
da312b55
NB
3768Macro parameters that appear within string literals in the macro body.
3769In traditional C macro replacement takes place within string literals,
161d7b59 3770but does not in ISO C@.
da312b55
NB
3771
3772@item
3773In traditional C, some preprocessor directives did not exist.
3774Traditional preprocessors would only consider a line to be a directive
3775if the @samp{#} appeared in column 1 on the line. Therefore
630d3d5a 3776@option{-Wtraditional} warns about directives that traditional C
da312b55
NB
3777understands but would ignore because the @samp{#} does not appear as the
3778first character on the line. It also suggests you hide directives like
3779@samp{#pragma} not understood by traditional C by indenting them. Some
c21cd8b1 3780traditional implementations would not recognize @samp{#elif}, so it
da312b55
NB
3781suggests avoiding it altogether.
3782
3783@item
3784A function-like macro that appears without arguments.
3785
3786@item
3787The unary plus operator.
3788
3789@item
c771326b
JM
3790The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3791constant suffixes. (Traditional C does support the @samp{L} suffix on integer
da312b55 3792constants.) Note, these suffixes appear in macros defined in the system
e979f9e8 3793headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
c8abc684 3794Use of these macros in user code might normally lead to spurious
2dd76960 3795warnings, however GCC's integrated preprocessor has enough context to
c8abc684 3796avoid warning in these cases.
74291a4b
MM
3797
3798@item
3799A function declared external in one block and then used after the end of
3800the block.
3801
3802@item
3803A @code{switch} statement has an operand of type @code{long}.
db838bb8
KG
3804
3805@item
3806A non-@code{static} function declaration follows a @code{static} one.
3807This construct is not accepted by some traditional C compilers.
48776cde
KG
3808
3809@item
c1030c7c 3810The ISO type of an integer constant has a different width or
48776cde 3811signedness from its traditional type. This warning is only issued if
e979f9e8 3812the base of the constant is ten. I.e.@: hexadecimal or octal values, which
48776cde 3813typically represent bit patterns, are not warned about.
bb66adca
KG
3814
3815@item
c1030c7c 3816Usage of ISO string concatenation is detected.
7f094a94 3817
895ea614
KG
3818@item
3819Initialization of automatic aggregates.
3820
3821@item
3822Identifier conflicts with labels. Traditional C lacks a separate
3823namespace for labels.
253b6b82
KG
3824
3825@item
3826Initialization of unions. If the initializer is zero, the warning is
3827omitted. This is done under the assumption that the zero initializer in
e979f9e8 3828user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
253b6b82
KG
3829initializer warnings and relies on default initialization to zero in the
3830traditional C case.
03829ad2
KG
3831
3832@item
3ed56f8a
KG
3833Conversions by prototypes between fixed/floating point values and vice
3834versa. The absence of these prototypes when compiling with traditional
3835C would cause serious problems. This is a subset of the possible
05170031 3836conversion warnings, for the full set use @option{-Wtraditional-conversion}.
622d3731
KG
3837
3838@item
3839Use of ISO C style function definitions. This warning intentionally is
3840@emph{not} issued for prototype declarations or variadic functions
3841because these ISO C features will appear in your code when using
3842libiberty's traditional C compatibility macros, @code{PARAMS} and
3843@code{VPARAMS}. This warning is also bypassed for nested functions
2dd76960 3844because that feature is already a GCC extension and thus not relevant to
622d3731 3845traditional C compatibility.
74291a4b
MM
3846@end itemize
3847
670b0231 3848@item -Wtraditional-conversion @r{(C and Objective-C only)}
05170031 3849@opindex Wtraditional-conversion
ccd4e386 3850@opindex Wno-traditional-conversion
05170031
MLI
3851Warn if a prototype causes a type conversion that is different from what
3852would happen to the same argument in the absence of a prototype. This
3853includes conversions of fixed point to floating and vice versa, and
3854conversions changing the width or signedness of a fixed point argument
3855except when the same as the default promotion.
3856
670b0231 3857@item -Wdeclaration-after-statement @r{(C and Objective-C only)}
85617eba 3858@opindex Wdeclaration-after-statement
ccd4e386 3859@opindex Wno-declaration-after-statement
85617eba
HPN
3860Warn when a declaration is found after a statement in a block. This
3861construct, known from C++, was introduced with ISO C99 and is by default
3862allowed in GCC@. It is not supported by ISO C90 and was not supported by
3863GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3864
861bb6c1 3865@item -Wundef
cd3bb277 3866@opindex Wundef
ccd4e386 3867@opindex Wno-undef
861bb6c1
JL
3868Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3869
90689ae1
JM
3870@item -Wno-endif-labels
3871@opindex Wno-endif-labels
909de5da 3872@opindex Wendif-labels
90689ae1 3873Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
909de5da 3874
74291a4b 3875@item -Wshadow
cd3bb277 3876@opindex Wshadow
ccd4e386 3877@opindex Wno-shadow
3f59fa1c
LCW
3878Warn whenever a local variable or type declaration shadows another variable,
3879parameter, type, or class member (in C++), or whenever a built-in function
3880is shadowed. Note that in C++, the compiler will not warn if a local variable
3881shadows a struct/class/enum, but will warn if it shadows an explicit typedef.
74291a4b 3882
e8fc888d
MLI
3883@item -Wlarger-than=@var{len}
3884@opindex Wlarger-than=@var{len}
ccd4e386 3885@opindex Wlarger-than-@var{len}
74291a4b
MM
3886Warn whenever an object of larger than @var{len} bytes is defined.
3887
a214518f
SP
3888@item -Wframe-larger-than=@var{len}
3889@opindex Wframe-larger-than
c1a3620a
SP
3890Warn if the size of a function frame is larger than @var{len} bytes.
3891The computation done to determine the stack frame size is approximate
3892and not conservative.
3893The actual requirements may be somewhat greater than @var{len}
3894even if you do not get a warning. In addition, any space allocated
3895via @code{alloca}, variable-length arrays, or related constructs
3896is not included by the compiler when determining
3897whether or not to issue a warning.
a214518f 3898
f9cc1a70
PB
3899@item -Wunsafe-loop-optimizations
3900@opindex Wunsafe-loop-optimizations
ccd4e386 3901@opindex Wno-unsafe-loop-optimizations
f9cc1a70
PB
3902Warn if the loop cannot be optimized because the compiler could not
3903assume anything on the bounds of the loop indices. With
3904@option{-funsafe-loop-optimizations} warn if the compiler made
3905such assumptions.
3906
a072f1cf 3907@item -Wno-pedantic-ms-format @r{(MinGW targets only)}
94564826
KT
3908@opindex Wno-pedantic-ms-format
3909@opindex Wpedantic-ms-format
3910Disables the warnings about non-ISO @code{printf} / @code{scanf} format
3911width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
3912depending on the MS runtime, when you are using the options @option{-Wformat}
3913and @option{-pedantic} without gnu-extensions.
3914
74291a4b 3915@item -Wpointer-arith
cd3bb277 3916@opindex Wpointer-arith
ccd4e386 3917@opindex Wno-pointer-arith
74291a4b
MM
3918Warn about anything that depends on the ``size of'' a function type or
3919of @code{void}. GNU C assigns these types a size of 1, for
3920convenience in calculations with @code{void *} pointers and pointers
b9edb4b1
MLI
3921to functions. In C++, warn also when an arithmetic operation involves
3922@code{NULL}. This warning is also enabled by @option{-pedantic}.
74291a4b 3923
f6aa72dd
MLI
3924@item -Wtype-limits
3925@opindex Wtype-limits
3926@opindex Wno-type-limits
3927Warn if a comparison is always true or always false due to the limited
3928range of the data type, but do not warn for constant expressions. For
3929example, warn if an unsigned variable is compared against zero with
3930@samp{<} or @samp{>=}. This warning is also enabled by
3931@option{-Wextra}.
3932
670b0231 3933@item -Wbad-function-cast @r{(C and Objective-C only)}
cd3bb277 3934@opindex Wbad-function-cast
ccd4e386 3935@opindex Wno-bad-function-cast
74291a4b
MM
3936Warn whenever a function call is cast to a non-matching type.
3937For example, warn if @code{int malloc()} is cast to @code{anything *}.
3938
670b0231 3939@item -Wc++-compat @r{(C and Objective-C only)}
b7e20b53
GDR
3940Warn about ISO C constructs that are outside of the common subset of
3941ISO C and ISO C++, e.g.@: request for implicit conversion from
3942@code{void *} to a pointer to non-@code{void} type.
3943
e1f1ee86
DG
3944@item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3945Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
cb7ad97b 3946ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
e1f1ee86
DG
3947in ISO C++ 200x. This warning is enabled by @option{-Wall}.
3948
74291a4b 3949@item -Wcast-qual
cd3bb277 3950@opindex Wcast-qual
ccd4e386 3951@opindex Wno-cast-qual
74291a4b
MM
3952Warn whenever a pointer is cast so as to remove a type qualifier from
3953the target type. For example, warn if a @code{const char *} is cast
3954to an ordinary @code{char *}.
3955
67165eb3
ILT
3956Also warn when making a cast which introduces a type qualifier in an
3957unsafe way. For example, casting @code{char **} to @code{const char **}
3958is unsafe, as in this example:
3959
3960@smallexample
3961 /* p is char ** value. */
3962 const char **q = (const char **) p;
3963 /* Assignment of readonly string to const char * is OK. */
3964 *q = "string";
3965 /* Now char** pointer points to read-only memory. */
3966 **p = 'b';
3967@end smallexample
3968
74291a4b 3969@item -Wcast-align
cd3bb277 3970@opindex Wcast-align
ccd4e386 3971@opindex Wno-cast-align
74291a4b
MM
3972Warn whenever a pointer is cast such that the required alignment of the
3973target is increased. For example, warn if a @code{char *} is cast to
3974an @code{int *} on machines where integers can only be accessed at
3975two- or four-byte boundaries.
3976
3977@item -Wwrite-strings
cd3bb277 3978@opindex Wwrite-strings
ccd4e386 3979@opindex Wno-write-strings
aee96fe9 3980When compiling C, give string constants the type @code{const
f4185118
MLI
3981char[@var{length}]} so that copying the address of one into a
3982non-@code{const} @code{char *} pointer will get a warning. These
3983warnings will help you find at compile time code that can try to write
3984into a string constant, but only if you have been very careful about
3985using @code{const} in declarations and prototypes. Otherwise, it will
3986just be a nuisance. This is why we did not make @option{-Wall} request
3987these warnings.
3988
3989When compiling C++, warn about the deprecated conversion from string
3990literals to @code{char *}. This warning is enabled by default for C++
3991programs.
74291a4b 3992
2b001724
MLI
3993@item -Wclobbered
3994@opindex Wclobbered
ccd4e386 3995@opindex Wno-clobbered
2b001724
MLI
3996Warn for variables that might be changed by @samp{longjmp} or
3997@samp{vfork}. This warning is also enabled by @option{-Wextra}.
3998
74291a4b 3999@item -Wconversion
cd3bb277 4000@opindex Wconversion
7060db96 4001@opindex Wno-conversion
422c3a54
MLI
4002Warn for implicit conversions that may alter a value. This includes
4003conversions between real and integer, like @code{abs (x)} when
4004@code{x} is @code{double}; conversions between signed and unsigned,
4005like @code{unsigned ui = -1}; and conversions to smaller types, like
4006@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
4007((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
7060db96
MLI
4008changed by the conversion like in @code{abs (2.0)}. Warnings about
4009conversions between signed and unsigned integers can be disabled by
4010using @option{-Wno-sign-conversion}.
74291a4b 4011
17251338
MLI
4012For C++, also warn for confusing overload resolution for user-defined
4013conversions; and conversions that will never use a type conversion
4014operator: conversions to @code{void}, the same type, a base class or a
4015reference to them. Warnings about conversions between signed and
4016unsigned integers are disabled by default in C++ unless
7060db96 4017@option{-Wsign-conversion} is explicitly enabled.
07231d4f 4018
02a9370c 4019@item -Wno-conversion-null @r{(C++ and Objective-C++ only)}
17251338
MLI
4020@opindex Wconversion-null
4021@opindex Wno-conversion-null
4022Do not warn for conversions between @code{NULL} and non-pointer
4023types. @option{-Wconversion-null} is enabled by default.
4024
b3b433c5
MLI
4025@item -Wempty-body
4026@opindex Wempty-body
ccd4e386 4027@opindex Wno-empty-body
841cc7da 4028Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
084eb830 4029while} statement. This warning is also enabled by @option{-Wextra}.
b3b433c5 4030
6866c6e8 4031@item -Wenum-compare
a3299096
MM
4032@opindex Wenum-compare
4033@opindex Wno-enum-compare
6866c6e8
ILT
4034Warn about a comparison between values of different enum types. In C++
4035this warning is enabled by default. In C this warning is enabled by
4036@option{-Wall}.
a3299096 4037
13ebf17b
ILT
4038@item -Wjump-misses-init @r{(C, Objective-C only)}
4039@opindex Wjump-misses-init
4040@opindex Wno-jump-misses-init
4041Warn if a @code{goto} statement or a @code{switch} statement jumps
4042forward across the initialization of a variable, or jumps backward to a
4043label after the variable has been initialized. This only warns about
4044variables which are initialized when they are declared. This warning is
4045only supported for C and Objective C; in C++ this sort of branch is an
4046error in any case.
4047
4048@option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
4049can be disabled with the @option{-Wno-jump-misses-init} option.
4050
e9a25f70 4051@item -Wsign-compare
cd3bb277 4052@opindex Wsign-compare
ccd4e386 4053@opindex Wno-sign-compare
e9a25f70
JL
4054@cindex warning for comparison of signed and unsigned values
4055@cindex comparison of signed and unsigned values, warning
4056@cindex signed and unsigned values, comparison warning
4057Warn when a comparison between signed and unsigned values could produce
4058an incorrect result when the signed value is converted to unsigned.
65ca2d60
PE
4059This warning is also enabled by @option{-Wextra}; to get the other warnings
4060of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
e9a25f70 4061
7060db96
MLI
4062@item -Wsign-conversion
4063@opindex Wsign-conversion
4064@opindex Wno-sign-conversion
4065Warn for implicit conversions that may change the sign of an integer
4066value, like assigning a signed integer expression to an unsigned
4067integer variable. An explicit cast silences the warning. In C, this
4068option is enabled also by @option{-Wconversion}.
4069
c116cd05
MLI
4070@item -Waddress
4071@opindex Waddress
4072@opindex Wno-address
4073Warn about suspicious uses of memory addresses. These include using
4074the address of a function in a conditional expression, such as
4075@code{void func(void); if (func)}, and comparisons against the memory
4076address of a string literal, such as @code{if (x == "abc")}. Such
4077uses typically indicate a programmer error: the address of a function
4078always evaluates to true, so their use in a conditional usually
4079indicate that the programmer forgot the parentheses in a function
4080call; and comparisons against string literals result in unspecified
4081behavior and are not portable in C, so they usually indicate that the
4082programmer intended to use @code{strcmp}. This warning is enabled by
4083@option{-Wall}.
4084
63a08740
DM
4085@item -Wlogical-op
4086@opindex Wlogical-op
4087@opindex Wno-logical-op
4088Warn about suspicious uses of logical operators in expressions.
4089This includes using logical operators in contexts where a
7bb27074 4090bit-wise operator is likely to be expected.
63a08740 4091
74291a4b 4092@item -Waggregate-return
cd3bb277 4093@opindex Waggregate-return
ccd4e386 4094@opindex Wno-aggregate-return
74291a4b
MM
4095Warn if any functions that return structures or unions are defined or
4096called. (In languages where you can return an array, this also elicits
4097a warning.)
4098
5c498b10
DD
4099@item -Wno-attributes
4100@opindex Wno-attributes
4101@opindex Wattributes
4102Do not warn if an unexpected @code{__attribute__} is used, such as
4103unrecognized attributes, function attributes applied to variables,
4104etc. This will not stop errors for incorrect use of supported
4105attributes.
4106
c047ce93
SB
4107@item -Wno-builtin-macro-redefined
4108@opindex Wno-builtin-macro-redefined
4109@opindex Wbuiltin-macro-redefined
4110Do not warn if certain built-in macros are redefined. This suppresses
4111warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
4112@code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
4113
670b0231 4114@item -Wstrict-prototypes @r{(C and Objective-C only)}
cd3bb277 4115@opindex Wstrict-prototypes
ccd4e386 4116@opindex Wno-strict-prototypes
74291a4b
MM
4117Warn if a function is declared or defined without specifying the
4118argument types. (An old-style function definition is permitted without
4119a warning if preceded by a declaration which specifies the argument
4120types.)
4121
670b0231 4122@item -Wold-style-declaration @r{(C and Objective-C only)}
b1ed4cb4 4123@opindex Wold-style-declaration
ccd4e386 4124@opindex Wno-old-style-declaration
b1ed4cb4
MLI
4125Warn for obsolescent usages, according to the C Standard, in a
4126declaration. For example, warn if storage-class specifiers like
4127@code{static} are not the first things in a declaration. This warning
4128is also enabled by @option{-Wextra}.
4129
670b0231 4130@item -Wold-style-definition @r{(C and Objective-C only)}
c034f121 4131@opindex Wold-style-definition
ccd4e386 4132@opindex Wno-old-style-definition
c034f121
AJ
4133Warn if an old-style function definition is used. A warning is given
4134even if there is a previous prototype.
4135
670b0231 4136@item -Wmissing-parameter-type @r{(C and Objective-C only)}
cb4af25a 4137@opindex Wmissing-parameter-type
ccd4e386 4138@opindex Wno-missing-parameter-type
cb4af25a
MLI
4139A function parameter is declared without a type specifier in K&R-style
4140functions:
4141
4142@smallexample
4143void foo(bar) @{ @}
4144@end smallexample
4145
4146This warning is also enabled by @option{-Wextra}.
4147
670b0231 4148@item -Wmissing-prototypes @r{(C and Objective-C only)}
cd3bb277 4149@opindex Wmissing-prototypes
ccd4e386 4150@opindex Wno-missing-prototypes
74291a4b
MM
4151Warn if a global function is defined without a previous prototype
4152declaration. This warning is issued even if the definition itself
4153provides a prototype. The aim is to detect global functions that fail
4154to be declared in header files.
4155
670b0231 4156@item -Wmissing-declarations
cd3bb277 4157@opindex Wmissing-declarations
ccd4e386 4158@opindex Wno-missing-declarations
74291a4b
MM
4159Warn if a global function is defined without a previous declaration.
4160Do so even if the definition itself provides a prototype.
4161Use this option to detect global functions that are not declared in
dfdec7a7
ILT
4162header files. In C++, no warnings are issued for function templates,
4163or for inline functions, or for functions in anonymous namespaces.
74291a4b 4164
eaac4679
RS
4165@item -Wmissing-field-initializers
4166@opindex Wmissing-field-initializers
ccd4e386 4167@opindex Wno-missing-field-initializers
eaac4679
RS
4168@opindex W
4169@opindex Wextra
ccd4e386 4170@opindex Wno-extra
eaac4679
RS
4171Warn if a structure's initializer has some fields missing. For
4172example, the following code would cause such a warning, because
4173@code{x.h} is implicitly zero:
4174
4175@smallexample
4176struct s @{ int f, g, h; @};
4177struct s x = @{ 3, 4 @};
4178@end smallexample
4179
4180This option does not warn about designated initializers, so the following
4181modification would not trigger a warning:
4182
4183@smallexample
4184struct s @{ int f, g, h; @};
4185struct s x = @{ .f = 3, .g = 4 @};
4186@end smallexample
4187
4188This warning is included in @option{-Wextra}. To get other @option{-Wextra}
4189warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
4190
74ff4629 4191@item -Wmissing-format-attribute
cd3bb277 4192@opindex Wmissing-format-attribute
ccd4e386 4193@opindex Wno-missing-format-attribute
cd3bb277 4194@opindex Wformat
ccd4e386 4195@opindex Wno-format
7876a414
KG
4196Warn about function pointers which might be candidates for @code{format}
4197attributes. Note these are only possible candidates, not absolute ones.
4198GCC will guess that function pointers with @code{format} attributes that
4199are used in assignment, initialization, parameter passing or return
4200statements should have a corresponding @code{format} attribute in the
4201resulting type. I.e.@: the left-hand side of the assignment or
4202initialization, the type of the parameter variable, or the return type
4203of the containing function respectively should also have a @code{format}
4204attribute to avoid the warning.
4205
4206GCC will also warn about function definitions which might be
4207candidates for @code{format} attributes. Again, these are only
4208possible candidates. GCC will guess that @code{format} attributes
4209might be appropriate for any function that calls a function like
4210@code{vprintf} or @code{vscanf}, but this might not always be the
74ff4629 4211case, and some functions for which @code{format} attributes are
7876a414 4212appropriate may not be detected.
74ff4629 4213
75227a33
GK
4214@item -Wno-multichar
4215@opindex Wno-multichar
4216@opindex Wmultichar
4217Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4218Usually they indicate a typo in the user's code, as they have
4219implementation-defined values, and should not be used in portable code.
4220
50668cf6 4221@item -Wnormalized=<none|id|nfc|nfkc>
ccd4e386 4222@opindex Wnormalized=
50668cf6
GK
4223@cindex NFC
4224@cindex NFKC
4225@cindex character set, input normalization
4226In ISO C and ISO C++, two identifiers are different if they are
4227different sequences of characters. However, sometimes when characters
4228outside the basic ASCII character set are used, you can have two
4229different character sequences that look the same. To avoid confusion,
4230the ISO 10646 standard sets out some @dfn{normalization rules} which
4231when applied ensure that two sequences that look the same are turned into
4232the same sequence. GCC can warn you if you are using identifiers which
4233have not been normalized; this option controls that warning.
4234
4235There are four levels of warning that GCC supports. The default is
4236@option{-Wnormalized=nfc}, which warns about any identifier which is
4237not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4238recommended form for most uses.
4239
4240Unfortunately, there are some characters which ISO C and ISO C++ allow
4241in identifiers that when turned into NFC aren't allowable as
4242identifiers. That is, there's no way to use these symbols in portable
0ee2ea09 4243ISO C or C++ and have all your identifiers in NFC@.
50668cf6
GK
4244@option{-Wnormalized=id} suppresses the warning for these characters.
4245It is hoped that future versions of the standards involved will correct
4246this, which is why this option is not the default.
4247
4248You can switch the warning off for all characters by writing
4249@option{-Wnormalized=none}. You would only want to do this if you
4250were using some other normalization scheme (like ``D''), because
4251otherwise you can easily create bugs that are literally impossible to see.
4252
4253Some characters in ISO 10646 have distinct meanings but look identical
4254in some fonts or display methodologies, especially once formatting has
4255been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4256LETTER N'', will display just like a regular @code{n} which has been
4257placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6fc0bb99 4258normalization scheme to convert all these into a standard form as
50668cf6
GK
4259well, and GCC will warn if your code is not in NFKC if you use
4260@option{-Wnormalized=nfkc}. This warning is comparable to warning
4261about every identifier that contains the letter O because it might be
4262confused with the digit 0, and so is not the default, but may be
4263useful as a local coding convention if the programming environment is
4264unable to be fixed to display these characters distinctly.
4265
899015a0
TT
4266@item -Wno-deprecated
4267@opindex Wno-deprecated
4268@opindex Wdeprecated
4269Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4270
e23bd218
IR
4271@item -Wno-deprecated-declarations
4272@opindex Wno-deprecated-declarations
ccd4e386 4273@opindex Wdeprecated-declarations
e8c96d09
MS
4274Do not warn about uses of functions (@pxref{Function Attributes}),
4275variables (@pxref{Variable Attributes}), and types (@pxref{Type
4276Attributes}) marked as deprecated by using the @code{deprecated}
4277attribute.
e23bd218 4278
71834ad3
RS
4279@item -Wno-overflow
4280@opindex Wno-overflow
ccd4e386 4281@opindex Woverflow
71834ad3
RS
4282Do not warn about compile-time overflow in constant expressions.
4283
670b0231 4284@item -Woverride-init @r{(C and Objective-C only)}
7ed322d7 4285@opindex Woverride-init
ccd4e386 4286@opindex Wno-override-init
7ed322d7
JM
4287@opindex W
4288@opindex Wextra
ccd4e386 4289@opindex Wno-extra
7ed322d7
JM
4290Warn if an initialized field without side effects is overridden when
4291using designated initializers (@pxref{Designated Inits, , Designated
4292Initializers}).
4293
4294This warning is included in @option{-Wextra}. To get other
4295@option{-Wextra} warnings without this one, use @samp{-Wextra
4296-Wno-override-init}.
4297
3c12fcc2 4298@item -Wpacked
cd3bb277 4299@opindex Wpacked
ccd4e386 4300@opindex Wno-packed
3c12fcc2 4301Warn if a structure is given the packed attribute, but the packed
02f52e19 4302attribute has no effect on the layout or size of the structure.
3c12fcc2
GM
4303Such structures may be mis-aligned for little benefit. For
4304instance, in this code, the variable @code{f.x} in @code{struct bar}
4305will be misaligned even though @code{struct bar} does not itself
4306have the packed attribute:
4307
4308@smallexample
4309@group
4310struct foo @{
4311 int x;
4312 char a, b, c, d;
4313@} __attribute__((packed));
4314struct bar @{
4315 char z;
4316 struct foo f;
4317@};
4318@end group
4319@end smallexample
4320
2cd36c22
AN
4321@item -Wpacked-bitfield-compat
4322@opindex Wpacked-bitfield-compat
4323@opindex Wno-packed-bitfield-compat
4324The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4325on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
4326the change can lead to differences in the structure layout. GCC
4327informs you when the offset of such a field has changed in GCC 4.4.
4328For example there is no longer a 4-bit padding between field @code{a}
4329and @code{b} in this structure:
4330
4331@smallexample
4332struct foo
4333@{
4334 char a:4;
4335 char b:8;
4336@} __attribute__ ((packed));
4337@end smallexample
4338
4339This warning is enabled by default. Use
4340@option{-Wno-packed-bitfield-compat} to disable this warning.
4341
3c12fcc2 4342@item -Wpadded
cd3bb277 4343@opindex Wpadded
ccd4e386 4344@opindex Wno-padded
3c12fcc2
GM
4345Warn if padding is included in a structure, either to align an element
4346of the structure or to align the whole structure. Sometimes when this
4347happens it is possible to rearrange the fields of the structure to
4348reduce the padding and so make the structure smaller.
4349
74291a4b 4350@item -Wredundant-decls
cd3bb277 4351@opindex Wredundant-decls
ccd4e386 4352@opindex Wno-redundant-decls
74291a4b
MM
4353Warn if anything is declared more than once in the same scope, even in
4354cases where multiple declaration is valid and changes nothing.
4355
670b0231 4356@item -Wnested-externs @r{(C and Objective-C only)}
cd3bb277 4357@opindex Wnested-externs
ccd4e386 4358@opindex Wno-nested-externs
252215a7 4359Warn if an @code{extern} declaration is encountered within a function.
74291a4b
MM
4360
4361@item -Winline
cd3bb277 4362@opindex Winline
ccd4e386 4363@opindex Wno-inline
c5c76735 4364Warn if a function can not be inlined and it was declared as inline.
ae4a7155 4365Even with this option, the compiler will not warn about failures to
daf2f129 4366inline functions declared in system headers.
ae4a7155
MM
4367
4368The compiler uses a variety of heuristics to determine whether or not
4369to inline a function. For example, the compiler takes into account
0bdcd332 4370the size of the function being inlined and the amount of inlining
ae4a7155
MM
4371that has already been done in the current function. Therefore,
4372seemingly insignificant changes in the source program can cause the
4373warnings produced by @option{-Winline} to appear or disappear.
74291a4b 4374
670b0231 4375@item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
a01fff59 4376@opindex Wno-invalid-offsetof
ccd4e386 4377@opindex Winvalid-offsetof
a01fff59
MA
4378Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4379type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
4380to a non-POD type is undefined. In existing C++ implementations,
4381however, @samp{offsetof} typically gives meaningful results even when
4382applied to certain kinds of non-POD types. (Such as a simple
4383@samp{struct} that fails to be a POD type only by virtue of having a
4384constructor.) This flag is for users who are aware that they are
4385writing nonportable code and who have deliberately chosen to ignore the
4386warning about it.
4387
4388The restrictions on @samp{offsetof} may be relaxed in a future version
4389of the C++ standard.
4390
dc8d2739 4391@item -Wno-int-to-pointer-cast
53a2494e 4392@opindex Wno-int-to-pointer-cast
ccd4e386 4393@opindex Wint-to-pointer-cast
53a2494e 4394Suppress warnings from casts to pointer type of an integer of a
dc8d2739
MLI
4395different size. In C++, casting to a pointer type of smaller size is
4396an error. @option{Wint-to-pointer-cast} is enabled by default.
4397
53a2494e 4398
670b0231 4399@item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
53a2494e 4400@opindex Wno-pointer-to-int-cast
ccd4e386 4401@opindex Wpointer-to-int-cast
53a2494e
JM
4402Suppress warnings from casts from a pointer to an integer type of a
4403different size.
4404
17211ab5
GK
4405@item -Winvalid-pch
4406@opindex Winvalid-pch
ccd4e386 4407@opindex Wno-invalid-pch
17211ab5
GK
4408Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4409the search path but can't be used.
4410
795add94 4411@item -Wlong-long
cd3bb277
JM
4412@opindex Wlong-long
4413@opindex Wno-long-long
9c650d90
MLI
4414Warn if @samp{long long} type is used. This is enabled by either
4415@option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4416modes. To inhibit the warning messages, use @option{-Wno-long-long}.
795add94 4417
7c4d376d
RH
4418@item -Wvariadic-macros
4419@opindex Wvariadic-macros
4420@opindex Wno-variadic-macros
4421Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4422alternate syntax when in pedantic ISO C99 mode. This is default.
4423To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4424
50d50fc7
SP
4425@item -Wvla
4426@opindex Wvla
4427@opindex Wno-vla
4428Warn if variable length array is used in the code.
4429@option{-Wno-vla} will prevent the @option{-pedantic} warning of
4430the variable length array.
4431
d35a40fc
DE
4432@item -Wvolatile-register-var
4433@opindex Wvolatile-register-var
4434@opindex Wno-volatile-register-var
4435Warn if a register variable is declared volatile. The volatile
4436modifier does not inhibit all optimizations that may eliminate reads
16302daf
MLI
4437and/or writes to register variables. This warning is enabled by
4438@option{-Wall}.
d35a40fc 4439
18424ae1 4440@item -Wdisabled-optimization
cd3bb277 4441@opindex Wdisabled-optimization
ccd4e386 4442@opindex Wno-disabled-optimization
18424ae1
BL
4443Warn if a requested optimization pass is disabled. This warning does
4444not generally indicate that there is anything wrong with your code; it
4445merely indicates that GCC's optimizers were unable to handle the code
4446effectively. Often, the problem is that your code is too big or too
4447complex; GCC will refuse to optimize programs when the optimization
4448itself is likely to take inordinate amounts of time.
4449
670b0231 4450@item -Wpointer-sign @r{(C and Objective-C only)}
f4e9414e 4451@opindex Wpointer-sign
f2fd3821 4452@opindex Wno-pointer-sign
f4e9414e
AO
4453Warn for pointer argument passing or assignment with different signedness.
4454This option is only supported for C and Objective-C@. It is implied by
4455@option{-Wall} and by @option{-pedantic}, which can be disabled with
4456@option{-Wno-pointer-sign}.
f2fd3821 4457
0aca9021 4458@item -Wstack-protector
d77314ec 4459@opindex Wstack-protector
ccd4e386 4460@opindex Wno-stack-protector
0aca9021
JW
4461This option is only active when @option{-fstack-protector} is active. It
4462warns about functions that will not be protected against stack smashing.
4463
7621f5d5
VR
4464@item -Wno-mudflap
4465@opindex Wno-mudflap
4466Suppress warnings about constructs that cannot be instrumented by
4467@option{-fmudflap}.
4468
89a42ac8
ZW
4469@item -Woverlength-strings
4470@opindex Woverlength-strings
ccd4e386 4471@opindex Wno-overlength-strings
89a42ac8
ZW
4472Warn about string constants which are longer than the ``minimum
4473maximum'' length specified in the C standard. Modern compilers
4474generally allow string constants which are much longer than the
4475standard's minimum limit, but very portable programs should avoid
4476using longer strings.
4477
4478The limit applies @emph{after} string constant concatenation, and does
7e1542b9 4479not count the trailing NUL@. In C90, the limit was 509 characters; in
89a42ac8
ZW
4480C99, it was raised to 4095. C++98 does not specify a normative
4481minimum maximum, so we do not diagnose overlength strings in C++@.
4482
4483This option is implied by @option{-pedantic}, and can be disabled with
4484@option{-Wno-overlength-strings}.
6ec637a4 4485
da667743 4486@item -Wunsuffixed-float-constants @r{(C and Objective-C only)}
6ec637a4
JJ
4487@opindex Wunsuffixed-float-constants
4488
4489GCC will issue a warning for any floating constant that does not have
4490a suffix. When used together with @option{-Wsystem-headers} it will
4491warn about such constants in system header files. This can be useful
4492when preparing code to use with the @code{FLOAT_CONST_DECIMAL64} pragma
4493from the decimal floating-point extension to C99.
74291a4b
MM
4494@end table
4495
4496@node Debugging Options
0c2d1a2a 4497@section Options for Debugging Your Program or GCC
74291a4b
MM
4498@cindex options, debugging
4499@cindex debugging information options
4500
0c2d1a2a 4501GCC has various special options that are used for debugging
74291a4b
MM
4502either your program or GCC:
4503
2642624b 4504@table @gcctabopt
74291a4b 4505@item -g
cd3bb277 4506@opindex g
74291a4b 4507Produce debugging information in the operating system's native format
f8ca7e49 4508(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
74291a4b
MM
4509information.
4510
630d3d5a 4511On most systems that use stabs format, @option{-g} enables use of extra
74291a4b
MM
4512debugging information that only GDB can use; this extra information
4513makes debugging work better in GDB but will probably make other debuggers
4514crash or
4515refuse to read the program. If you want to control for certain whether
630d3d5a 4516to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
def66b10 4517@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
74291a4b 4518
f8ca7e49 4519GCC allows you to use @option{-g} with
630d3d5a 4520@option{-O}. The shortcuts taken by optimized code may occasionally
74291a4b
MM
4521produce surprising results: some variables you declared may not exist
4522at all; flow of control may briefly move where you did not expect it;
4523some statements may not be executed because they compute constant
4524results or their values were already at hand; some statements may
4525execute in different places because they were moved out of loops.
4526
4527Nevertheless it proves possible to debug optimized output. This makes
4528it reasonable to use the optimizer for programs that might have bugs.
4529
0c2d1a2a 4530The following options are useful when GCC is generated with the
74291a4b
MM
4531capability for more than one debugging format.
4532
4533@item -ggdb
cd3bb277 4534@opindex ggdb
161d7b59 4535Produce debugging information for use by GDB@. This means to use the
861bb6c1
JL
4536most expressive format available (DWARF 2, stabs, or the native format
4537if neither of those are supported), including GDB extensions if at all
4538possible.
74291a4b
MM
4539
4540@item -gstabs
cd3bb277 4541@opindex gstabs
74291a4b
MM
4542Produce debugging information in stabs format (if that is supported),
4543without GDB extensions. This is the format used by DBX on most BSD
4544systems. On MIPS, Alpha and System V Release 4 systems this option
161d7b59 4545produces stabs debugging output which is not understood by DBX or SDB@.
74291a4b
MM
4546On System V Release 4 systems this option requires the GNU assembler.
4547
6a08f7b3
DP
4548@item -feliminate-unused-debug-symbols
4549@opindex feliminate-unused-debug-symbols
4550Produce debugging information in stabs format (if that is supported),
c0cbdbd9 4551for only symbols that are actually used.
6a08f7b3 4552
e713adf6
CD
4553@item -femit-class-debug-always
4554Instead of emitting debugging information for a C++ class in only one
4555object file, emit it in all object files using the class. This option
4556should be used only with debuggers that are unable to handle the way GCC
4557normally emits debugging information for classes because using this
4558option will increase the size of debugging information by as much as a
4559factor of two.
4560
74291a4b 4561@item -gstabs+
cd3bb277 4562@opindex gstabs+
74291a4b 4563Produce debugging information in stabs format (if that is supported),
161d7b59 4564using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
4565use of these extensions is likely to make other debuggers crash or
4566refuse to read the program.
4567
4568@item -gcoff
cd3bb277 4569@opindex gcoff
74291a4b
MM
4570Produce debugging information in COFF format (if that is supported).
4571This is the format used by SDB on most System V systems prior to
4572System V Release 4.
4573
4574@item -gxcoff
cd3bb277 4575@opindex gxcoff
74291a4b
MM
4576Produce debugging information in XCOFF format (if that is supported).
4577This is the format used by the DBX debugger on IBM RS/6000 systems.
4578
4579@item -gxcoff+
cd3bb277 4580@opindex gxcoff+
74291a4b 4581Produce debugging information in XCOFF format (if that is supported),
161d7b59 4582using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
4583use of these extensions is likely to make other debuggers crash or
4584refuse to read the program, and may cause assemblers other than the GNU
4585assembler (GAS) to fail with an error.
4586
53b2323e
RH
4587@item -gdwarf-@var{version}
4588@opindex gdwarf-@var{version}
4589Produce debugging information in DWARF format (if that is
4590supported). This is the format used by DBX on IRIX 6. The value
b5b8b0ac 4591of @var{version} may be either 2, 3 or 4; the default version is 2.
53b2323e
RH
4592
4593Note that with DWARF version 2 some ports require, and will always
4594use, some non-conflicting DWARF 3 extensions in the unwind tables.
74291a4b 4595
b5b8b0ac
AO
4596Version 4 may require GDB 7.0 and @option{-fvar-tracking-assignments}
4597for maximum benefit.
4598
dc67413d
JJ
4599@item -gstrict-dwarf
4600@opindex gstrict-dwarf
4601Disallow using extensions of later DWARF standard version than selected
4602with @option{-gdwarf-@var{version}}. On most targets using non-conflicting
4603DWARF extensions from later standard versions is allowed.
4604
4605@item -gno-strict-dwarf
4606@opindex gno-strict-dwarf
4607Allow using extensions of later DWARF standard version than selected with
4608@option{-gdwarf-@var{version}}.
4609
5f98259a
RK
4610@item -gvms
4611@opindex gvms
4612Produce debugging information in VMS debug format (if that is
4613supported). This is the format used by DEBUG on VMS systems.
4614
74291a4b
MM
4615@item -g@var{level}
4616@itemx -ggdb@var{level}
4617@itemx -gstabs@var{level}
4618@itemx -gcoff@var{level}
4619@itemx -gxcoff@var{level}
5f98259a 4620@itemx -gvms@var{level}
74291a4b
MM
4621Request debugging information and also use @var{level} to specify how
4622much information. The default level is 2.
4623
ec75a430
GK
4624Level 0 produces no debug information at all. Thus, @option{-g0} negates
4625@option{-g}.
4626
74291a4b
MM
4627Level 1 produces minimal information, enough for making backtraces in
4628parts of the program that you don't plan to debug. This includes
4629descriptions of functions and external variables, but no information
4630about local variables and no line numbers.
4631
4632Level 3 includes extra information, such as all the macro definitions
4633present in the program. Some debuggers support macro expansion when
630d3d5a 4634you use @option{-g3}.
74291a4b 4635
f8ca7e49
ZW
4636@option{-gdwarf-2} does not accept a concatenated debug level, because
4637GCC used to support an option @option{-gdwarf} that meant to generate
4638debug information in version 1 of the DWARF format (which is very
4639different from version 2), and it would have been too confusing. That
4640debug format is long obsolete, but the option cannot be changed now.
4641Instead use an additional @option{-g@var{level}} option to change the
53b2323e 4642debug level for DWARF.
eb7715a4 4643
2153915d
AO
4644@item -gtoggle
4645@opindex gtoggle
4646Turn off generation of debug info, if leaving out this option would have
4647generated it, or turn it on at level 2 otherwise. The position of this
4648argument in the command line does not matter, it takes effect after all
4649other options are processed, and it does so only once, no matter how
4650many times it is given. This is mainly intended to be used with
4651@option{-fcompare-debug}.
4652
b5b8b0ac
AO
4653@item -fdump-final-insns@r{[}=@var{file}@r{]}
4654@opindex fdump-final-insns
4655Dump the final internal representation (RTL) to @var{file}. If the
4656optional argument is omitted (or if @var{file} is @code{.}), the name
4657of the dump file will be determined by appending @code{.gkd} to the
4658compilation output file name.
2153915d
AO
4659
4660@item -fcompare-debug@r{[}=@var{opts}@r{]}
4661@opindex fcompare-debug
4662@opindex fno-compare-debug
4663If no error occurs during compilation, run the compiler a second time,
4664adding @var{opts} and @option{-fcompare-debug-second} to the arguments
4665passed to the second compilation. Dump the final internal
4666representation in both compilations, and print an error if they differ.
4667
4668If the equal sign is omitted, the default @option{-gtoggle} is used.
4669
4670The environment variable @env{GCC_COMPARE_DEBUG}, if defined, non-empty
4671and nonzero, implicitly enables @option{-fcompare-debug}. If
4672@env{GCC_COMPARE_DEBUG} is defined to a string starting with a dash,
4673then it is used for @var{opts}, otherwise the default @option{-gtoggle}
4674is used.
4675
4676@option{-fcompare-debug=}, with the equal sign but without @var{opts},
4677is equivalent to @option{-fno-compare-debug}, which disables the dumping
4678of the final representation and the second compilation, preventing even
4679@env{GCC_COMPARE_DEBUG} from taking effect.
4680
4681To verify full coverage during @option{-fcompare-debug} testing, set
4682@env{GCC_COMPARE_DEBUG} to say @samp{-fcompare-debug-not-overridden},
4683which GCC will reject as an invalid option in any actual compilation
4684(rather than preprocessing, assembly or linking). To get just a
4685warning, setting @env{GCC_COMPARE_DEBUG} to @samp{-w%n-fcompare-debug
4686not overridden} will do.
4687
4688@item -fcompare-debug-second
4689@opindex fcompare-debug-second
4690This option is implicitly passed to the compiler for the second
4691compilation requested by @option{-fcompare-debug}, along with options to
4692silence warnings, and omitting other options that would cause
4693side-effect compiler outputs to files or to the standard output. Dump
4694files and preserved temporary files are renamed so as to contain the
4695@code{.gk} additional extension during the second compilation, to avoid
4696overwriting those generated by the first.
4697
4698When this option is passed to the compiler driver, it causes the
4699@emph{first} compilation to be skipped, which makes it useful for little
4700other than debugging the compiler proper.
4701
e03b7153
RS
4702@item -feliminate-dwarf2-dups
4703@opindex feliminate-dwarf2-dups
4704Compress DWARF2 debugging information by eliminating duplicated
4705information about each symbol. This option only makes sense when
4706generating DWARF2 debugging information with @option{-gdwarf-2}.
4707
39ef6592
LC
4708@item -femit-struct-debug-baseonly
4709Emit debug information for struct-like types
4710only when the base name of the compilation source file
4711matches the base name of file in which the struct was defined.
4712
4713This option substantially reduces the size of debugging information,
4714but at significant potential loss in type information to the debugger.
4715See @option{-femit-struct-debug-reduced} for a less aggressive option.
4716See @option{-femit-struct-debug-detailed} for more detailed control.
4717
4718This option works only with DWARF 2.
4719
4720@item -femit-struct-debug-reduced
4721Emit debug information for struct-like types
4722only when the base name of the compilation source file
4723matches the base name of file in which the type was defined,
4724unless the struct is a template or defined in a system header.
4725
4726This option significantly reduces the size of debugging information,
4727with some potential loss in type information to the debugger.
4728See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4729See @option{-femit-struct-debug-detailed} for more detailed control.
4730
4731This option works only with DWARF 2.
4732
4733@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4734Specify the struct-like types
4735for which the compiler will generate debug information.
4736The intent is to reduce duplicate struct debug information
4737between different object files within the same program.
4738
4739This option is a detailed version of
4740@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4741which will serve for most needs.
4742
ab940b73 4743A specification has the syntax@*
39ef6592
LC
4744[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4745
4746The optional first word limits the specification to
4747structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4748A struct type is used directly when it is the type of a variable, member.
4749Indirect uses arise through pointers to structs.
4750That is, when use of an incomplete struct would be legal, the use is indirect.
4751An example is
4752@samp{struct one direct; struct two * indirect;}.
4753
4754The optional second word limits the specification to
4755ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4756Generic structs are a bit complicated to explain.
4757For C++, these are non-explicit specializations of template classes,
4758or non-template classes within the above.
4759Other programming languages have generics,
4760but @samp{-femit-struct-debug-detailed} does not yet implement them.
4761
4762The third word specifies the source files for those
4763structs for which the compiler will emit debug information.
4764The values @samp{none} and @samp{any} have the normal meaning.
4765The value @samp{base} means that
4766the base of name of the file in which the type declaration appears
4767must match the base of the name of the main compilation file.
4768In practice, this means that
4769types declared in @file{foo.c} and @file{foo.h} will have debug information,
4770but types declared in other header will not.
4771The value @samp{sys} means those types satisfying @samp{base}
4772or declared in system or compiler headers.
4773
4774You may need to experiment to determine the best settings for your application.
4775
4776The default is @samp{-femit-struct-debug-detailed=all}.
4777
4778This option works only with DWARF 2.
4779
77831620
CC
4780@item -fenable-icf-debug
4781@opindex fenable-icf-debug
4782Generate additional debug information to support identical code folding (ICF).
4783This option only works with DWARF version 2 or higher.
4784
987b399a 4785@item -fno-merge-debug-strings
28a08168 4786@opindex fmerge-debug-strings
987b399a 4787@opindex fno-merge-debug-strings
44ab0f0e
RW
4788Direct the linker to not merge together strings in the debugging
4789information which are identical in different object files. Merging is
4790not supported by all assemblers or linkers. Merging decreases the size
4791of the debug information in the output file at the cost of increasing
4792link processing time. Merging is enabled by default.
28a08168 4793
c8aea42c
PB
4794@item -fdebug-prefix-map=@var{old}=@var{new}
4795@opindex fdebug-prefix-map
4796When compiling files in directory @file{@var{old}}, record debugging
4797information describing them as in @file{@var{new}} instead.
4798
8f57ac5a
JJ
4799@item -fno-dwarf2-cfi-asm
4800@opindex fdwarf2-cfi-asm
4801@opindex fno-dwarf2-cfi-asm
4802Emit DWARF 2 unwind info as compiler generated @code{.eh_frame} section
4803instead of using GAS @code{.cfi_*} directives.
4804
05739753 4805@cindex @command{prof}
74291a4b 4806@item -p
cd3bb277 4807@opindex p
74291a4b 4808Generate extra code to write profile information suitable for the
05739753 4809analysis program @command{prof}. You must use this option when compiling
74291a4b
MM
4810the source files you want data about, and you must also use it when
4811linking.
4812
05739753 4813@cindex @command{gprof}
74291a4b 4814@item -pg
cd3bb277 4815@opindex pg
74291a4b 4816Generate extra code to write profile information suitable for the
05739753 4817analysis program @command{gprof}. You must use this option when compiling
74291a4b
MM
4818the source files you want data about, and you must also use it when
4819linking.
4820
898f531b 4821@item -Q
cd3bb277 4822@opindex Q
898f531b
JL
4823Makes the compiler print out each function name as it is compiled, and
4824print some statistics about each pass when it finishes.
4825
1f0c3120 4826@item -ftime-report
cd3bb277 4827@opindex ftime-report
1f0c3120
JM
4828Makes the compiler print some statistics about the time consumed by each
4829pass when it finishes.
4830
4831@item -fmem-report
cd3bb277 4832@opindex fmem-report
1f0c3120
JM
4833Makes the compiler print some statistics about permanent memory
4834allocation when it finishes.
4835
a5573239
JH
4836@item -fpre-ipa-mem-report
4837@opindex fpre-ipa-mem-report
4838@item -fpost-ipa-mem-report
4839@opindex fpost-ipa-mem-report
4840Makes the compiler print some statistics about permanent memory
4841allocation before or after interprocedural optimization.
4842
d3c12306
EB
4843@item -fstack-usage
4844@opindex fstack-usage
4845Makes the compiler output stack usage information for the program, on a
4846per-function basis. The filename for the dump is made by appending
4847@file{.su} to the AUXNAME. AUXNAME is generated from the name of
4848the output file, if explicitly specified and it is not an executable,
4849otherwise it is the basename of the source file. An entry is made up
4850of three fields:
4851
4852@itemize
4853@item
4854The name of the function.
4855@item
4856A number of bytes.
4857@item
4858One or more qualifiers: @code{static}, @code{dynamic}, @code{bounded}.
4859@end itemize
4860
4861The qualifier @code{static} means that the function manipulates the stack
4862statically: a fixed number of bytes are allocated for the frame on function
4863entry and released on function exit; no stack adjustments are otherwise made
4864in the function. The second field is this fixed number of bytes.
4865
4866The qualifier @code{dynamic} means that the function manipulates the stack
4867dynamically: in addition to the static allocation described above, stack
4868adjustments are made in the body of the function, for example to push/pop
4869arguments around function calls. If the qualifier @code{bounded} is also
4870present, the amount of these adjustments is bounded at compile-time and
4871the second field is an upper bound of the total amount of stack used by
4872the function. If it is not present, the amount of these adjustments is
4873not bounded at compile-time and the second field only represents the
4874bounded part.
4875
861bb6c1 4876@item -fprofile-arcs
cd3bb277 4877@opindex fprofile-arcs
23af32e6
NS
4878Add code so that program flow @dfn{arcs} are instrumented. During
4879execution the program records how many times each branch and call is
4880executed and how many times it is taken or returns. When the compiled
4881program exits it saves this data to a file called
8a36672b 4882@file{@var{auxname}.gcda} for each source file. The data may be used for
23af32e6 4883profile-directed optimizations (@option{-fbranch-probabilities}), or for
8a36672b 4884test coverage analysis (@option{-ftest-coverage}). Each object file's
23af32e6
NS
4885@var{auxname} is generated from the name of the output file, if
4886explicitly specified and it is not the final executable, otherwise it is
8a36672b 4887the basename of the source file. In both cases any suffix is removed
431ae0bf 4888(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
a4878735 4889@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
992f396f 4890@xref{Cross-profiling}.
23af32e6 4891
ee4c708e
BE
4892@cindex @command{gcov}
4893@item --coverage
4894@opindex coverage
4895
4896This option is used to compile and link code instrumented for coverage
4897analysis. The option is a synonym for @option{-fprofile-arcs}
4898@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4899linking). See the documentation for those options for more details.
4900
23af32e6
NS
4901@itemize
4902
4903@item
4904Compile the source files with @option{-fprofile-arcs} plus optimization
8a36672b
JM
4905and code generation options. For test coverage analysis, use the
4906additional @option{-ftest-coverage} option. You do not need to profile
23af32e6
NS
4907every source file in a program.
4908
4909@item
8555daff
NS
4910Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4911(the latter implies the former).
23af32e6
NS
4912
4913@item
4914Run the program on a representative workload to generate the arc profile
8a36672b 4915information. This may be repeated any number of times. You can run
8555daff 4916concurrent instances of your program, and provided that the file system
8a36672b 4917supports locking, the data files will be correctly updated. Also
8555daff
NS
4918@code{fork} calls are detected and correctly handled (double counting
4919will not happen).
23af32e6
NS
4920
4921@item
4922For profile-directed optimizations, compile the source files again with
4923the same optimization and code generation options plus
630d3d5a 4924@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3de87bf2
JJ
4925Control Optimization}).
4926
23af32e6
NS
4927@item
4928For test coverage analysis, use @command{gcov} to produce human readable
8a36672b 4929information from the @file{.gcno} and @file{.gcda} files. Refer to the
23af32e6
NS
4930@command{gcov} documentation for further information.
4931
4932@end itemize
3de87bf2
JJ
4933
4934With @option{-fprofile-arcs}, for each function of your program GCC
4935creates a program flow graph, then finds a spanning tree for the graph.
4936Only arcs that are not on the spanning tree have to be instrumented: the
4937compiler adds code to count the number of times that these arcs are
4938executed. When an arc is the only exit or only entrance to a block, the
4939instrumentation code can be added to the block; otherwise, a new basic
4940block must be created to hold the instrumentation code.
4941
861bb6c1
JL
4942@need 2000
4943@item -ftest-coverage
cd3bb277 4944@opindex ftest-coverage
a4878735 4945Produce a notes file that the @command{gcov} code-coverage utility
23af32e6 4946(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
8a36672b
JM
4947show program coverage. Each source file's note file is called
4948@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
23af32e6 4949above for a description of @var{auxname} and instructions on how to
8a36672b 4950generate test coverage data. Coverage data will match the source files
23af32e6 4951more closely, if you do not optimize.
3de87bf2 4952
0a090f42
SP
4953@item -fdbg-cnt-list
4954@opindex fdbg-cnt-list
4955Print the name and the counter upperbound for all debug counters.
4956
4957@item -fdbg-cnt=@var{counter-value-list}
4958@opindex fdbg-cnt
7a61cf6f 4959Set the internal debug counter upperbound. @var{counter-value-list}
0a090f42
SP
4960is a comma-separated list of @var{name}:@var{value} pairs
4961which sets the upperbound of each debug counter @var{name} to @var{value}.
4962All debug counters have the initial upperbound of @var{UINT_MAX},
4963thus dbg_cnt() returns true always unless the upperbound is set by this option.
4964e.g. With -fdbg-cnt=dce:10,tail_call:0
4965dbg_cnt(dce) will return true only for first 10 invocations
4966and dbg_cnt(tail_call) will return false always.
4967
74291a4b 4968@item -d@var{letters}
33558d94 4969@itemx -fdump-rtl-@var{pass}
cd3bb277 4970@opindex d
74291a4b 4971Says to make debugging dumps during compilation at times specified by
e71da632
MH
4972@var{letters}. This is used for debugging the RTL-based passes of the
4973compiler. The file names for most of the dumps are made by appending
4974a pass number and a word to the @var{dumpname}, and the files are
ae758cb2
BS
4975created in the directory of the output file. Note that the pass
4976number is computed statically as passes get registered into the pass
4977manager. Thus the numbering is not related to the dynamic order of
4978execution of passes. In particular, a pass installed by a plugin
4979could have a number over 200 even if it executed quite early.
4980@var{dumpname} is generated from the name of the output file, if
4981explicitly specified and it is not an executable, otherwise it is the
4982basename of the source file. These switches may have different effects
4983when @option{-E} is used for preprocessing.
74291a4b 4984
cb7c15f8
JH
4985Debug dumps can be enabled with a @option{-fdump-rtl} switch or some
4986@option{-d} option @var{letters}. Here are the possible
00b251a0 4987letters for use in @var{pass} and @var{letters}, and their meanings:
9f8628ba
PB
4988
4989@table @gcctabopt
00b251a0
KZ
4990
4991@item -fdump-rtl-alignments
4992@opindex fdump-rtl-alignments
4993Dump after branch alignments have been computed.
4994
4995@item -fdump-rtl-asmcons
4996@opindex fdump-rtl-asmcons
4997Dump after fixing rtl statements that have unsatisfied in/out constraints.
4998
4999@item -fdump-rtl-auto_inc_dec
5000@opindex fdump-rtl-auto_inc_dec
5001Dump after auto-inc-dec discovery. This pass is only run on
5002architectures that have auto inc or auto dec instructions.
5003
5004@item -fdump-rtl-barriers
5005@opindex fdump-rtl-barriers
5006Dump after cleaning up the barrier instructions.
5007
5008@item -fdump-rtl-bbpart
5009@opindex fdump-rtl-bbpart
5010Dump after partitioning hot and cold basic blocks.
9f8628ba 5011
33558d94 5012@item -fdump-rtl-bbro
9f8628ba 5013@opindex fdump-rtl-bbro
00b251a0
KZ
5014Dump after block reordering.
5015
5016@item -fdump-rtl-btl1
5017@itemx -fdump-rtl-btl2
5018@opindex fdump-rtl-btl2
5019@opindex fdump-rtl-btl2
5020@option{-fdump-rtl-btl1} and @option{-fdump-rtl-btl2} enable dumping
5021after the two branch
5022target load optimization passes.
5023
5024@item -fdump-rtl-bypass
5025@opindex fdump-rtl-bypass
5026Dump after jump bypassing and control flow optimizations.
9f8628ba 5027
33558d94 5028@item -fdump-rtl-combine
9f8628ba 5029@opindex fdump-rtl-combine
00b251a0
KZ
5030Dump after the RTL instruction combination pass.
5031
5032@item -fdump-rtl-compgotos
5033@opindex fdump-rtl-compgotos
048fd785 5034Dump after duplicating the computed gotos.
9f8628ba 5035
33558d94 5036@item -fdump-rtl-ce1
9f8628ba 5037@itemx -fdump-rtl-ce2
00b251a0 5038@itemx -fdump-rtl-ce3
9f8628ba
PB
5039@opindex fdump-rtl-ce1
5040@opindex fdump-rtl-ce2
00b251a0
KZ
5041@opindex fdump-rtl-ce3
5042@option{-fdump-rtl-ce1}, @option{-fdump-rtl-ce2}, and
5043@option{-fdump-rtl-ce3} enable dumping after the three
7a61cf6f 5044if conversion passes.
00b251a0
KZ
5045
5046@itemx -fdump-rtl-cprop_hardreg
5047@opindex fdump-rtl-cprop_hardreg
5048Dump after hard register copy propagation.
5049
5050@itemx -fdump-rtl-csa
5051@opindex fdump-rtl-csa
5052Dump after combining stack adjustments.
5053
5054@item -fdump-rtl-cse1
5055@itemx -fdump-rtl-cse2
5056@opindex fdump-rtl-cse1
5057@opindex fdump-rtl-cse2
5058@option{-fdump-rtl-cse1} and @option{-fdump-rtl-cse2} enable dumping after
5059the two common sub-expression elimination passes.
5060
5061@itemx -fdump-rtl-dce
5062@opindex fdump-rtl-dce
5063Dump after the standalone dead code elimination passes.
9f8628ba 5064
9f8628ba 5065@itemx -fdump-rtl-dbr
9f8628ba 5066@opindex fdump-rtl-dbr
00b251a0 5067Dump after delayed branch scheduling.
9f8628ba 5068
00b251a0
KZ
5069@item -fdump-rtl-dce1
5070@itemx -fdump-rtl-dce2
5071@opindex fdump-rtl-dce1
5072@opindex fdump-rtl-dce2
5073@option{-fdump-rtl-dce1} and @option{-fdump-rtl-dce2} enable dumping after
5074the two dead store elimination passes.
9f8628ba 5075
33558d94 5076@item -fdump-rtl-eh
9f8628ba 5077@opindex fdump-rtl-eh
00b251a0 5078Dump after finalization of EH handling code.
9f8628ba 5079
00b251a0
KZ
5080@item -fdump-rtl-eh_ranges
5081@opindex fdump-rtl-eh_ranges
5082Dump after conversion of EH handling range regions.
5083
5084@item -fdump-rtl-expand
5085@opindex fdump-rtl-expand
5086Dump after RTL generation.
5087
5088@item -fdump-rtl-fwprop1
5089@itemx -fdump-rtl-fwprop2
5090@opindex fdump-rtl-fwprop1
5091@opindex fdump-rtl-fwprop2
5092@option{-fdump-rtl-fwprop1} and @option{-fdump-rtl-fwprop2} enable
5093dumping after the two forward propagation passes.
5094
5095@item -fdump-rtl-gcse1
5096@itemx -fdump-rtl-gcse2
5097@opindex fdump-rtl-gcse1
5098@opindex fdump-rtl-gcse2
5099@option{-fdump-rtl-gcse1} and @option{-fdump-rtl-gcse2} enable dumping
5100after global common subexpression elimination.
5101
5102@item -fdump-rtl-init-regs
5103@opindex fdump-rtl-init-regs
5104Dump after the initialization of the registers.
5105
5106@item -fdump-rtl-initvals
5107@opindex fdump-rtl-initvals
5108Dump after the computation of the initial value sets.
5109
5110@itemx -fdump-rtl-into_cfglayout
5111@opindex fdump-rtl-into_cfglayout
5112Dump after converting to cfglayout mode.
5113
5114@item -fdump-rtl-ira
5115@opindex fdump-rtl-ira
5116Dump after iterated register allocation.
9f8628ba 5117
33558d94 5118@item -fdump-rtl-jump
9f8628ba 5119@opindex fdump-rtl-jump
00b251a0 5120Dump after the second jump optimization.
9f8628ba 5121
33558d94 5122@item -fdump-rtl-loop2
9f8628ba 5123@opindex fdump-rtl-loop2
00b251a0
KZ
5124@option{-fdump-rtl-loop2} enables dumping after the rtl
5125loop optimization passes.
9f8628ba 5126
33558d94 5127@item -fdump-rtl-mach
9f8628ba 5128@opindex fdump-rtl-mach
00b251a0
KZ
5129Dump after performing the machine dependent reorganization pass, if that
5130pass exists.
5131
5132@item -fdump-rtl-mode_sw
5133@opindex fdump-rtl-mode_sw
5134Dump after removing redundant mode switches.
9f8628ba 5135
33558d94 5136@item -fdump-rtl-rnreg
9f8628ba 5137@opindex fdump-rtl-rnreg
00b251a0 5138Dump after register renumbering.
9f8628ba 5139
00b251a0
KZ
5140@itemx -fdump-rtl-outof_cfglayout
5141@opindex fdump-rtl-outof_cfglayout
5142Dump after converting from cfglayout mode.
5143
5144@item -fdump-rtl-peephole2
5145@opindex fdump-rtl-peephole2
5146Dump after the peephole pass.
9f8628ba 5147
33558d94 5148@item -fdump-rtl-postreload
9f8628ba 5149@opindex fdump-rtl-postreload
00b251a0 5150Dump after post-reload optimizations.
9f8628ba 5151
00b251a0
KZ
5152@itemx -fdump-rtl-pro_and_epilogue
5153@opindex fdump-rtl-pro_and_epilogue
5154Dump after generating the function pro and epilogues.
9f8628ba 5155
00b251a0
KZ
5156@item -fdump-rtl-regmove
5157@opindex fdump-rtl-regmove
5158Dump after the register move pass.
9f8628ba 5159
33558d94 5160@item -fdump-rtl-sched1
00b251a0 5161@itemx -fdump-rtl-sched2
5c9ab0a6 5162@opindex fdump-rtl-sched1
00b251a0
KZ
5163@opindex fdump-rtl-sched2
5164@option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2} enable dumping
5165after the basic block scheduling passes.
9f8628ba 5166
00b251a0
KZ
5167@item -fdump-rtl-see
5168@opindex fdump-rtl-see
5169Dump after sign extension elimination.
9f8628ba 5170
00b251a0
KZ
5171@item -fdump-rtl-seqabstr
5172@opindex fdump-rtl-seqabstr
7a61cf6f 5173Dump after common sequence discovery.
9f8628ba 5174
00b251a0
KZ
5175@item -fdump-rtl-shorten
5176@opindex fdump-rtl-shorten
5177Dump after shortening branches.
9f8628ba 5178
00b251a0
KZ
5179@item -fdump-rtl-sibling
5180@opindex fdump-rtl-sibling
5181Dump after sibling call optimizations.
5182
5183@item -fdump-rtl-split1
5184@itemx -fdump-rtl-split2
5185@itemx -fdump-rtl-split3
5186@itemx -fdump-rtl-split4
5187@itemx -fdump-rtl-split5
5188@opindex fdump-rtl-split1
5189@opindex fdump-rtl-split2
5190@opindex fdump-rtl-split3
5191@opindex fdump-rtl-split4
5192@opindex fdump-rtl-split5
5193@option{-fdump-rtl-split1}, @option{-fdump-rtl-split2},
5194@option{-fdump-rtl-split3}, @option{-fdump-rtl-split4} and
5195@option{-fdump-rtl-split5} enable dumping after five rounds of
5196instruction splitting.
9f8628ba 5197
00b251a0
KZ
5198@item -fdump-rtl-sms
5199@opindex fdump-rtl-sms
5200Dump after modulo scheduling. This pass is only run on some
5201architectures.
5202
5203@item -fdump-rtl-stack
5204@opindex fdump-rtl-stack
5205Dump after conversion from GCC's "flat register file" registers to the
5206x87's stack-like registers. This pass is only run on x86 variants.
5207
5208@item -fdump-rtl-subreg1
5209@itemx -fdump-rtl-subreg2
5210@opindex fdump-rtl-subreg1
5211@opindex fdump-rtl-subreg2
5212@option{-fdump-rtl-subreg1} and @option{-fdump-rtl-subreg2} enable dumping after
5213the two subreg expansion passes.
5214
5215@item -fdump-rtl-unshare
5216@opindex fdump-rtl-unshare
5217Dump after all rtl has been unshared.
5218
5219@item -fdump-rtl-vartrack
5220@opindex fdump-rtl-vartrack
5221Dump after variable tracking.
5222
5223@item -fdump-rtl-vregs
5224@opindex fdump-rtl-vregs
5225Dump after converting virtual registers to hard registers.
9f8628ba 5226
33558d94 5227@item -fdump-rtl-web
9f8628ba 5228@opindex fdump-rtl-web
00b251a0
KZ
5229Dump after live range splitting.
5230
5231@item -fdump-rtl-regclass
5232@itemx -fdump-rtl-subregs_of_mode_init
5233@itemx -fdump-rtl-subregs_of_mode_finish
5234@itemx -fdump-rtl-dfinit
5235@itemx -fdump-rtl-dfinish
5236@opindex fdump-rtl-regclass
5237@opindex fdump-rtl-subregs_of_mode_init
5238@opindex fdump-rtl-subregs_of_mode_finish
5239@opindex fdump-rtl-dfinit
5240@opindex fdump-rtl-dfinish
5241These dumps are defined but always produce empty files.
9f8628ba 5242
33558d94 5243@item -fdump-rtl-all
9f8628ba 5244@opindex fdump-rtl-all
74291a4b 5245Produce all the dumps listed above.
9f8628ba 5246
00b251a0
KZ
5247@item -dA
5248@opindex dA
5249Annotate the assembler output with miscellaneous debugging information.
5250
5251@item -dD
5252@opindex dD
5253Dump all macro definitions, at the end of preprocessing, in addition to
5254normal output.
5255
9f8628ba 5256@item -dH
886e0865
GK
5257@opindex dH
5258Produce a core dump whenever an error occurs.
9f8628ba
PB
5259
5260@item -dm
cd3bb277 5261@opindex dm
74291a4b
MM
5262Print statistics on memory usage, at the end of the run, to
5263standard error.
9f8628ba
PB
5264
5265@item -dp
cd3bb277 5266@opindex dp
74291a4b 5267Annotate the assembler output with a comment indicating which
f20b5577
MM
5268pattern and alternative was used. The length of each instruction is
5269also printed.
9f8628ba
PB
5270
5271@item -dP
cd3bb277 5272@opindex dP
2856c3e3 5273Dump the RTL in the assembler output as a comment before each instruction.
630d3d5a 5274Also turns on @option{-dp} annotation.
9f8628ba
PB
5275
5276@item -dv
cd3bb277 5277@opindex dv
cb7c15f8
JH
5278For each of the other indicated dump files (@option{-fdump-rtl-@var{pass}}),
5279dump a representation of the control flow graph suitable for viewing with VCG
5280to @file{@var{file}.@var{pass}.vcg}.
9f8628ba
PB
5281
5282@item -dx
cd3bb277 5283@opindex dx
62a1403d 5284Just generate RTL for a function instead of compiling it. Usually used
cb7c15f8 5285with @option{-fdump-rtl-expand}.
74291a4b
MM
5286@end table
5287
24a7799e
R
5288@item -fdump-noaddr
5289@opindex fdump-noaddr
cb7c15f8
JH
5290When doing debugging dumps, suppress address output. This makes it more
5291feasible to use diff on debugging dumps for compiler invocations with
5292different compiler binaries and/or different
5293text / bss / data / heap / stack / dso start locations.
24a7799e 5294
b707b450 5295@item -fdump-unnumbered
cd3bb277 5296@opindex fdump-unnumbered
cb7c15f8
JH
5297When doing debugging dumps, suppress instruction numbers and address output.
5298This makes it more feasible to use diff on debugging dumps for compiler
5299invocations with different options, in particular with and without
5300@option{-g}.
b707b450 5301
2aa7c49b
AO
5302@item -fdump-unnumbered-links
5303@opindex fdump-unnumbered-links
5304When doing debugging dumps (see @option{-d} option above), suppress
5305instruction numbers for the links to the previous and next instructions
5306in a sequence.
5307
223dcf1c
AN
5308@item -fdump-translation-unit @r{(C++ only)}
5309@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
f70a54cb
CR
5310@opindex fdump-translation-unit
5311Dump a representation of the tree structure for the entire translation
5312unit to a file. The file name is made by appending @file{.tu} to the
e71da632
MH
5313source file name, and the file is created in the same directory as the
5314output file. If the @samp{-@var{options}} form is used, @var{options}
f70a54cb
CR
5315controls the details of the dump as described for the
5316@option{-fdump-tree} options.
5317
aee96fe9 5318@item -fdump-class-hierarchy @r{(C++ only)}
22367161 5319@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
cd3bb277 5320@opindex fdump-class-hierarchy
e76b4820 5321Dump a representation of each class's hierarchy and virtual function
e71da632
MH
5322table layout to a file. The file name is made by appending
5323@file{.class} to the source file name, and the file is created in the
5324same directory as the output file. If the @samp{-@var{options}} form
5325is used, @var{options} controls the details of the dump as described
5326for the @option{-fdump-tree} options.
22367161 5327
9b3e897d
PB
5328@item -fdump-ipa-@var{switch}
5329@opindex fdump-ipa
83c99486 5330Control the dumping at various stages of inter-procedural analysis
e71da632
MH
5331language tree to a file. The file name is generated by appending a
5332switch specific suffix to the source file name, and the file is created
5333in the same directory as the output file. The following dumps are
5334possible:
9b3e897d
PB
5335
5336@table @samp
5337@item all
fed39e22 5338Enables all inter-procedural analysis dumps.
9b3e897d
PB
5339
5340@item cgraph
5341Dumps information about call-graph optimization, unused function removal,
5342and inlining decisions.
fed39e22
MLI
5343
5344@item inline
5345Dump after function inlining.
5346
9b3e897d
PB
5347@end table
5348
9fe0cb7d 5349@item -fdump-statistics-@var{option}
d376d545 5350@opindex fdump-statistics
9fe0cb7d 5351Enable and control dumping of pass statistics in a separate file. The
e71da632
MH
5352file name is generated by appending a suffix ending in
5353@samp{.statistics} to the source file name, and the file is created in
5354the same directory as the output file. If the @samp{-@var{option}}
5355form is used, @samp{-stats} will cause counters to be summed over the
5356whole compilation unit while @samp{-details} will dump every event as
5357the passes generate them. The default with no option is to sum
5358counters for each function compiled.
9fe0cb7d 5359
0c8c236b
JJ
5360@item -fdump-tree-@var{switch}
5361@itemx -fdump-tree-@var{switch}-@var{options}
22367161
NS
5362@opindex fdump-tree
5363Control the dumping at various stages of processing the intermediate
e71da632
MH
5364language tree to a file. The file name is generated by appending a
5365switch specific suffix to the source file name, and the file is
5366created in the same directory as the output file. If the
5367@samp{-@var{options}} form is used, @var{options} is a list of
5368@samp{-} separated options that control the details of the dump. Not
5369all options are applicable to all dumps, those which are not
5370meaningful will be ignored. The following options are available
f71f87f9 5371
e76b4820 5372@table @samp
22367161 5373@item address
767094dd 5374Print the address of each node. Usually this is not meaningful as it
8a36672b 5375changes according to the environment and source file. Its primary use
22367161 5376is for tying up a dump file with a debug environment.
394bd84d
RH
5377@item asmname
5378If @code{DECL_ASSEMBLER_NAME} has been set for a given decl, use that
5379in the dump instead of @code{DECL_NAME}. Its primary use is ease of
5380use working backward from mangled names in the assembly file.
22367161
NS
5381@item slim
5382Inhibit dumping of members of a scope or body of a function merely
6de9cd9a
DN
5383because that scope has been reached. Only dump such items when they
5384are directly reachable by some other path. When dumping pretty-printed
5385trees, this option inhibits dumping the bodies of control structures.
5386@item raw
5387Print a raw representation of the tree. By default, trees are
5388pretty-printed into a C-like representation.
5389@item details
5390Enable more detailed dumps (not honored by every dump option).
5391@item stats
5392Enable dumping various statistics about the pass (not honored by every dump
5393option).
5394@item blocks
5395Enable showing basic block boundaries (disabled in raw dumps).
5396@item vops
5397Enable showing virtual operands for every statement.
5398@item lineno
5399Enable showing line numbers for statements.
5400@item uid
5401Enable showing the unique ID (@code{DECL_UID}) for each variable.
3e894af1
KZ
5402@item verbose
5403Enable showing the tree dump for each statement.
cae63f88
DN
5404@item eh
5405Enable showing the EH region number holding each statement.
22367161 5406@item all
3e894af1
KZ
5407Turn on all options, except @option{raw}, @option{slim}, @option{verbose}
5408and @option{lineno}.
e76b4820
NS
5409@end table
5410
5411The following tree dumps are possible:
5412@table @samp
6de9cd9a 5413
e76b4820 5414@item original
d376d545 5415@opindex fdump-tree-original
e76b4820 5416Dump before any tree based optimization, to @file{@var{file}.original}.
6de9cd9a 5417
e76b4820 5418@item optimized
d376d545 5419@opindex fdump-tree-optimized
e76b4820 5420Dump after all tree based optimization, to @file{@var{file}.optimized}.
6de9cd9a 5421
6de9cd9a
DN
5422@item gimple
5423@opindex fdump-tree-gimple
5424Dump each function before and after the gimplification pass to a file. The
5425file name is made by appending @file{.gimple} to the source file name.
5426
5427@item cfg
5428@opindex fdump-tree-cfg
5429Dump the control flow graph of each function to a file. The file name is
5430made by appending @file{.cfg} to the source file name.
5431
5432@item vcg
5433@opindex fdump-tree-vcg
5434Dump the control flow graph of each function to a file in VCG format. The
5435file name is made by appending @file{.vcg} to the source file name. Note
5436that if the file contains more than one function, the generated file cannot
8a36672b 5437be used directly by VCG@. You will need to cut and paste each function's
6de9cd9a
DN
5438graph into its own separate file first.
5439
5440@item ch
5441@opindex fdump-tree-ch
5442Dump each function after copying loop headers. The file name is made by
5443appending @file{.ch} to the source file name.
5444
5445@item ssa
5446@opindex fdump-tree-ssa
5447Dump SSA related information to a file. The file name is made by appending
5448@file{.ssa} to the source file name.
5449
5450@item alias
5451@opindex fdump-tree-alias
5452Dump aliasing information for each function. The file name is made by
5453appending @file{.alias} to the source file name.
5454
5455@item ccp
5456@opindex fdump-tree-ccp
8a36672b 5457Dump each function after CCP@. The file name is made by appending
6de9cd9a
DN
5458@file{.ccp} to the source file name.
5459
0bca51f0
DN
5460@item storeccp
5461@opindex fdump-tree-storeccp
0ee2ea09 5462Dump each function after STORE-CCP@. The file name is made by appending
0bca51f0
DN
5463@file{.storeccp} to the source file name.
5464
6de9cd9a
DN
5465@item pre
5466@opindex fdump-tree-pre
5467Dump trees after partial redundancy elimination. The file name is made
5468by appending @file{.pre} to the source file name.
5469
ff2ad0f7
DN
5470@item fre
5471@opindex fdump-tree-fre
5472Dump trees after full redundancy elimination. The file name is made
5473by appending @file{.fre} to the source file name.
5474
0bca51f0
DN
5475@item copyprop
5476@opindex fdump-tree-copyprop
5477Dump trees after copy propagation. The file name is made
5478by appending @file{.copyprop} to the source file name.
5479
5480@item store_copyprop
5481@opindex fdump-tree-store_copyprop
5482Dump trees after store copy-propagation. The file name is made
5483by appending @file{.store_copyprop} to the source file name.
5484
6de9cd9a
DN
5485@item dce
5486@opindex fdump-tree-dce
5487Dump each function after dead code elimination. The file name is made by
5488appending @file{.dce} to the source file name.
5489
5490@item mudflap
5491@opindex fdump-tree-mudflap
5492Dump each function after adding mudflap instrumentation. The file name is
5493made by appending @file{.mudflap} to the source file name.
5494
5495@item sra
5496@opindex fdump-tree-sra
5497Dump each function after performing scalar replacement of aggregates. The
5498file name is made by appending @file{.sra} to the source file name.
5499
fa555252
DB
5500@item sink
5501@opindex fdump-tree-sink
5502Dump each function after performing code sinking. The file name is made
cb7ad97b 5503by appending @file{.sink} to the source file name.
fa555252 5504
6de9cd9a
DN
5505@item dom
5506@opindex fdump-tree-dom
5507Dump each function after applying dominator tree optimizations. The file
5508name is made by appending @file{.dom} to the source file name.
5509
5510@item dse
5511@opindex fdump-tree-dse
5512Dump each function after applying dead store elimination. The file
5513name is made by appending @file{.dse} to the source file name.
5514
5515@item phiopt
5516@opindex fdump-tree-phiopt
5517Dump each function after optimizing PHI nodes into straightline code. The file
5518name is made by appending @file{.phiopt} to the source file name.
5519
5520@item forwprop
5521@opindex fdump-tree-forwprop
5522Dump each function after forward propagating single use variables. The file
5523name is made by appending @file{.forwprop} to the source file name.
5524
5525@item copyrename
5526@opindex fdump-tree-copyrename
5527Dump each function after applying the copy rename optimization. The file
5528name is made by appending @file{.copyrename} to the source file name.
5529
5530@item nrv
5531@opindex fdump-tree-nrv
5532Dump each function after applying the named return value optimization on
5533generic trees. The file name is made by appending @file{.nrv} to the source
5534file name.
5535
79fe1b3b
DN
5536@item vect
5537@opindex fdump-tree-vect
f0eb93a8 5538Dump each function after applying vectorization of loops. The file name is
79fe1b3b
DN
5539made by appending @file{.vect} to the source file name.
5540
ca0b0bf8
IR
5541@item slp
5542@opindex fdump-tree-slp
5543Dump each function after applying vectorization of basic blocks. The file name
5544is made by appending @file{.slp} to the source file name.
5545
08873e96
DN
5546@item vrp
5547@opindex fdump-tree-vrp
5548Dump each function after Value Range Propagation (VRP). The file name
5549is made by appending @file{.vrp} to the source file name.
5550
6de9cd9a
DN
5551@item all
5552@opindex fdump-tree-all
5553Enable all the available tree dumps with the flags provided in this option.
e76b4820 5554@end table
9965d119 5555
c866976a
LB
5556@item -ftree-vectorizer-verbose=@var{n}
5557@opindex ftree-vectorizer-verbose
5558This option controls the amount of debugging output the vectorizer prints.
cb7ad97b
EC
5559This information is written to standard error, unless
5560@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
7ffe0f0d
DN
5561in which case it is output to the usual dump listing file, @file{.vect}.
5562For @var{n}=0 no diagnostic information is reported.
cb7ad97b 5563If @var{n}=1 the vectorizer reports each loop that got vectorized,
7ffe0f0d 5564and the total number of loops that got vectorized.
cb7ad97b 5565If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
021efafc 5566the first analysis phase (vect_analyze_loop_form) - i.e.@: countable,
cb7ad97b 5567inner-most, single-bb, single-entry/exit loops. This is the same verbosity
7ffe0f0d 5568level that @option{-fdump-tree-vect-stats} uses.
cb7ad97b 5569Higher verbosity levels mean either more information dumped for each
7ffe0f0d 5570reported loop, or same amount of information reported for more loops:
ca0b0bf8
IR
5571if @var{n}=3, vectorizer cost model information is reported.
5572If @var{n}=4, alignment related information is added to the reports.
5573If @var{n}=5, data-references related information (e.g.@: memory dependences,
7ffe0f0d 5574memory access-patterns) is added to the reports.
ca0b0bf8 5575If @var{n}=6, the vectorizer reports also non-vectorized inner-most loops
021efafc 5576that did not pass the first analysis phase (i.e., may not be countable, or
7ffe0f0d 5577may have complicated control-flow).
ca0b0bf8
IR
5578If @var{n}=7, the vectorizer reports also non-vectorized nested loops.
5579If @var{n}=8, SLP related information is added to the reports.
5580For @var{n}=9, all the information the vectorizer generates during its
7ffe0f0d
DN
5581analysis and transformation is reported. This is the same verbosity level
5582that @option{-fdump-tree-vect-details} uses.
c866976a 5583
a37db56b 5584@item -frandom-seed=@var{string}
d376d545 5585@opindex frandom-seed
a37db56b 5586This option provides a seed that GCC uses when it would otherwise use
e61a2eb7 5587random numbers. It is used to generate certain symbol names
8a36672b 5588that have to be different in every compiled file. It is also used to
e61a2eb7 5589place unique stamps in coverage data files and the object files that
8a36672b 5590produce them. You can use the @option{-frandom-seed} option to produce
e61a2eb7 5591reproducibly identical object files.
a37db56b
GK
5592
5593The @var{string} should be different for every file you compile.
5594
e03b7153
RS
5595@item -fsched-verbose=@var{n}
5596@opindex fsched-verbose
5597On targets that use instruction scheduling, this option controls the
5598amount of debugging output the scheduler prints. This information is
cb7c15f8
JH
5599written to standard error, unless @option{-fdump-rtl-sched1} or
5600@option{-fdump-rtl-sched2} is specified, in which case it is output
4cad6dba 5601to the usual dump listing file, @file{.sched1} or @file{.sched2}
cb7c15f8
JH
5602respectively. However for @var{n} greater than nine, the output is
5603always printed to standard error.
e03b7153
RS
5604
5605For @var{n} greater than zero, @option{-fsched-verbose} outputs the
cb7c15f8
JH
5606same information as @option{-fdump-rtl-sched1} and @option{-fdump-rtl-sched2}.
5607For @var{n} greater than one, it also output basic block probabilities,
5608detailed ready list information and unit/insn info. For @var{n} greater
5609than two, it includes RTL at abort point, control-flow and regions info.
5610And for @var{n} over four, @option{-fsched-verbose} also includes
5611dependence info.
e03b7153 5612
74291a4b 5613@item -save-temps
14fdc613 5614@itemx -save-temps=cwd
cd3bb277 5615@opindex save-temps
74291a4b
MM
5616Store the usual ``temporary'' intermediate files permanently; place them
5617in the current directory and name them based on the source file. Thus,
5618compiling @file{foo.c} with @samp{-c -save-temps} would produce files
f2ecb02d
JM
5619@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
5620preprocessed @file{foo.i} output file even though the compiler now
5621normally uses an integrated preprocessor.
74291a4b 5622
1f7edb8b
RS
5623When used in combination with the @option{-x} command line option,
5624@option{-save-temps} is sensible enough to avoid over writing an
5625input source file with the same extension as an intermediate file.
5626The corresponding intermediate file may be obtained by renaming the
5627source file before using @option{-save-temps}.
5628
14fdc613
MM
5629If you invoke GCC in parallel, compiling several different source
5630files that share a common base name in different subdirectories or the
5631same source file compiled for multiple output destinations, it is
5632likely that the different parallel compilers will interfere with each
5633other, and overwrite the temporary files. For instance:
5634
5635@smallexample
5636gcc -save-temps -o outdir1/foo.o indir1/foo.c&
5637gcc -save-temps -o outdir2/foo.o indir2/foo.c&
5638@end smallexample
5639
5640may result in @file{foo.i} and @file{foo.o} being written to
5641simultaneously by both compilers.
5642
5643@item -save-temps=obj
5644@opindex save-temps=obj
5645Store the usual ``temporary'' intermediate files permanently. If the
5646@option{-o} option is used, the temporary files are based on the
5647object file. If the @option{-o} option is not used, the
5648@option{-save-temps=obj} switch behaves like @option{-save-temps}.
5649
5650For example:
5651
5652@smallexample
5653gcc -save-temps=obj -c foo.c
5654gcc -save-temps=obj -c bar.c -o dir/xbar.o
5655gcc -save-temps=obj foobar.c -o dir2/yfoobar
5656@end smallexample
5657
5658would create @file{foo.i}, @file{foo.s}, @file{dir/xbar.i},
5659@file{dir/xbar.s}, @file{dir2/yfoobar.i}, @file{dir2/yfoobar.s}, and
5660@file{dir2/yfoobar.o}.
5661
bdde878c 5662@item -time@r{[}=@var{file}@r{]}
cd3bb277 5663@opindex time
03c41c05 5664Report the CPU time taken by each subprocess in the compilation
f2ecb02d 5665sequence. For C source files, this is the compiler proper and assembler
bdde878c
AO
5666(plus the linker if linking is done).
5667
5668Without the specification of an output file, the output looks like this:
03c41c05
ZW
5669
5670@smallexample
03c41c05
ZW
5671# cc1 0.12 0.01
5672# as 0.00 0.01
5673@end smallexample
5674
d78aa55c
JM
5675The first number on each line is the ``user time'', that is time spent
5676executing the program itself. The second number is ``system time'',
03c41c05
ZW
5677time spent executing operating system routines on behalf of the program.
5678Both numbers are in seconds.
5679
bdde878c
AO
5680With the specification of an output file, the output is appended to the
5681named file, and it looks like this:
5682
5683@smallexample
56840.12 0.01 cc1 @var{options}
56850.00 0.01 as @var{options}
5686@end smallexample
5687
5688The ``user time'' and the ``system time'' are moved before the program
5689name, and the options passed to the program are displayed, so that one
5690can later tell what file was being compiled, and with which options.
5691
014a1138
JZ
5692@item -fvar-tracking
5693@opindex fvar-tracking
8a36672b
JM
5694Run variable tracking pass. It computes where variables are stored at each
5695position in code. Better debugging information is then generated
014a1138
JZ
5696(if the debugging information format supports this information).
5697
5698It is enabled by default when compiling with optimization (@option{-Os},
923158be 5699@option{-O}, @option{-O2}, @dots{}), debugging information (@option{-g}) and
014a1138
JZ
5700the debug info format supports it.
5701
b5b8b0ac
AO
5702@item -fvar-tracking-assignments
5703@opindex fvar-tracking-assignments
5704@opindex fno-var-tracking-assignments
5705Annotate assignments to user variables early in the compilation and
5706attempt to carry the annotations over throughout the compilation all the
5707way to the end, in an attempt to improve debug information while
5708optimizing. Use of @option{-gdwarf-4} is recommended along with it.
5709
5710It can be enabled even if var-tracking is disabled, in which case
5711annotations will be created and maintained, but discarded at the end.
5712
5713@item -fvar-tracking-assignments-toggle
5714@opindex fvar-tracking-assignments-toggle
5715@opindex fno-var-tracking-assignments-toggle
5716Toggle @option{-fvar-tracking-assignments}, in the same way that
5717@option{-gtoggle} toggles @option{-g}.
5718
74291a4b 5719@item -print-file-name=@var{library}
cd3bb277 5720@opindex print-file-name
74291a4b
MM
5721Print the full absolute name of the library file @var{library} that
5722would be used when linking---and don't do anything else. With this
0c2d1a2a 5723option, GCC does not compile or link anything; it just prints the
74291a4b
MM
5724file name.
5725
b1018de6
AO
5726@item -print-multi-directory
5727@opindex print-multi-directory
5728Print the directory name corresponding to the multilib selected by any
5729other switches present in the command line. This directory is supposed
5730to exist in @env{GCC_EXEC_PREFIX}.
5731
5732@item -print-multi-lib
5733@opindex print-multi-lib
5734Print the mapping from multilib directory names to compiler switches
5735that enable them. The directory name is separated from the switches by
5736@samp{;}, and each switch starts with an @samp{@@} instead of the
5737@samp{-}, without spaces between multiple switches. This is supposed to
5738ease shell-processing.
5739
de55f03a
JJ
5740@item -print-multi-os-directory
5741@opindex print-multi-os-directory
5742Print the path to OS libraries for the selected
5743multilib, relative to some @file{lib} subdirectory. If OS libraries are
5744present in the @file{lib} subdirectory and no multilibs are used, this is
5745usually just @file{.}, if OS libraries are present in @file{lib@var{suffix}}
5746sibling directories this prints e.g.@: @file{../lib64}, @file{../lib} or
5747@file{../lib32}, or if OS libraries are present in @file{lib/@var{subdir}}
5748subdirectories it prints e.g.@: @file{amd64}, @file{sparcv9} or @file{ev6}.
5749
74291a4b 5750@item -print-prog-name=@var{program}
cd3bb277 5751@opindex print-prog-name
630d3d5a 5752Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
74291a4b
MM
5753
5754@item -print-libgcc-file-name
cd3bb277 5755@opindex print-libgcc-file-name
630d3d5a 5756Same as @option{-print-file-name=libgcc.a}.
74291a4b 5757
630d3d5a 5758This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
74291a4b
MM
5759but you do want to link with @file{libgcc.a}. You can do
5760
3ab51846 5761@smallexample
74291a4b 5762gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3ab51846 5763@end smallexample
74291a4b
MM
5764
5765@item -print-search-dirs
cd3bb277 5766@opindex print-search-dirs
74291a4b 5767Print the name of the configured installation directory and a list of
2dd76960 5768program and library directories @command{gcc} will search---and don't do anything else.
74291a4b 5769
2dd76960 5770This is useful when @command{gcc} prints the error message
3c0b7970
JM
5771@samp{installation problem, cannot exec cpp0: No such file or directory}.
5772To resolve this you either need to put @file{cpp0} and the other compiler
2dd76960 5773components where @command{gcc} expects to find them, or you can set the environment
bedc7537 5774variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
78466c0e 5775Don't forget the trailing @samp{/}.
74291a4b 5776@xref{Environment Variables}.
1f0c3120 5777
3def1397
VP
5778@item -print-sysroot
5779@opindex print-sysroot
5780Print the target sysroot directory that will be used during
5781compilation. This is the target sysroot specified either at configure
d1facce0 5782time or using the @option{--sysroot} option, possibly with an extra
3def1397
VP
5783suffix that depends on compilation options. If no target sysroot is
5784specified, the option prints nothing.
5785
14da6073
JM
5786@item -print-sysroot-headers-suffix
5787@opindex print-sysroot-headers-suffix
5788Print the suffix added to the target sysroot when searching for
5789headers, or give an error if the compiler is not configured with such
5790a suffix---and don't do anything else.
5791
1f0c3120 5792@item -dumpmachine
cd3bb277 5793@opindex dumpmachine
1f0c3120
JM
5794Print the compiler's target machine (for example,
5795@samp{i686-pc-linux-gnu})---and don't do anything else.
5796
5797@item -dumpversion
cd3bb277 5798@opindex dumpversion
1f0c3120
JM
5799Print the compiler version (for example, @samp{3.0})---and don't do
5800anything else.
5801
5802@item -dumpspecs
cd3bb277 5803@opindex dumpspecs
1f0c3120
JM
5804Print the compiler's built-in specs---and don't do anything else. (This
5805is used when GCC itself is being built.) @xref{Spec Files}.
73c68f61
SS
5806
5807@item -feliminate-unused-debug-types
5808@opindex feliminate-unused-debug-types
5809Normally, when producing DWARF2 output, GCC will emit debugging
5810information for all types declared in a compilation
5811unit, regardless of whether or not they are actually used
5812in that compilation unit. Sometimes this is useful, such as
5813if, in the debugger, you want to cast a value to a type that is
5814not actually used in your program (but is declared). More often,
5815however, this results in a significant amount of wasted space.
5816With this option, GCC will avoid producing debug symbol output
5817for types that are nowhere used in the source file being compiled.
74291a4b
MM
5818@end table
5819
5820@node Optimize Options
5821@section Options That Control Optimization
5822@cindex optimize options
5823@cindex options, optimization
5824
147d1cd3
JQ
5825These options control various sorts of optimizations.
5826
5827Without any optimization option, the compiler's goal is to reduce the
5828cost of compilation and to make debugging produce the expected
5829results. Statements are independent: if you stop the program with a
5830breakpoint between statements, you can then assign a new value to any
5831variable or change the program counter to any other statement in the
5832function and get exactly the results you would expect from the source
5833code.
5834
5835Turning on optimization flags makes the compiler attempt to improve
5836the performance and/or code size at the expense of compilation time
5837and possibly the ability to debug the program.
5838
d6cc6ec9
JH
5839The compiler performs optimization based on the knowledge it has of the
5840program. Compiling multiple files at once to a single output file mode allows
5841the compiler to use information gained from all of the files when compiling
5842each of them.
d1bd0ded 5843
147d1cd3 5844Not all optimizations are controlled directly by a flag. Only
8c70d28b
SL
5845optimizations that have a flag are listed in this section.
5846
711a778c
GP
5847Most optimizations are only enabled if an @option{-O} level is set on
5848the command line. Otherwise they are disabled, even if individual
5849optimization flags are specified.
83bb5ce3 5850
7a61cf6f
NC
5851Depending on the target and how GCC was configured, a slightly different
5852set of optimizations may be enabled at each @option{-O} level than
5853those listed here. You can invoke GCC with @samp{-Q --help=optimizers}
8c70d28b
SL
5854to find out the exact set of optimizations that are enabled at each level.
5855@xref{Overall Options}, for examples.
74291a4b 5856
2642624b 5857@table @gcctabopt
74291a4b
MM
5858@item -O
5859@itemx -O1
cd3bb277
JM
5860@opindex O
5861@opindex O1
74291a4b
MM
5862Optimize. Optimizing compilation takes somewhat more time, and a lot
5863more memory for a large function.
5864
630d3d5a 5865With @option{-O}, the compiler tries to reduce code size and execution
9c34dbbf
ZW
5866time, without performing any optimizations that take a great deal of
5867compilation time.
74291a4b 5868
daf2f129 5869@option{-O} turns on the following optimization flags:
71733172
KZ
5870@gccoptlist{
5871-fauto-inc-dec @gol
08711fdf 5872-fcprop-registers @gol
0c166d0f 5873-fdce @gol
71733172
KZ
5874-fdefer-pop @gol
5875-fdelayed-branch @gol
0c166d0f 5876-fdse @gol
71733172 5877-fguess-branch-probability @gol
9a94f7f3 5878-fif-conversion2 @gol
71733172 5879-fif-conversion @gol
71733172 5880-fipa-pure-const @gol
e65bb9be 5881-fipa-profile @gol
71733172
KZ
5882-fipa-reference @gol
5883-fmerge-constants
e53a16e7 5884-fsplit-wide-types @gol
0b4b14ac 5885-ftree-bit-ccp @gol
c2699190 5886-ftree-builtin-call-dce @gol
08711fdf 5887-ftree-ccp @gol
71733172
KZ
5888-ftree-ch @gol
5889-ftree-copyrename @gol
08711fdf 5890-ftree-dce @gol
ec7dea0a 5891-ftree-dominator-opts @gol
08711fdf 5892-ftree-dse @gol
248fc9f3 5893-ftree-forwprop @gol
08711fdf 5894-ftree-fre @gol
248fc9f3 5895-ftree-phiprop @gol
71733172 5896-ftree-sra @gol
248fc9f3 5897-ftree-pta @gol
71733172
KZ
5898-ftree-ter @gol
5899-funit-at-a-time}
fad893da
JQ
5900
5901@option{-O} also turns on @option{-fomit-frame-pointer} on machines
5902where doing so does not interfere with debugging.
5903
74291a4b 5904@item -O2
cd3bb277 5905@opindex O2
0c2d1a2a 5906Optimize even more. GCC performs nearly all supported optimizations
28c11eb3 5907that do not involve a space-speed tradeoff.
630d3d5a 5908As compared to @option{-O}, this option increases both compilation time
74291a4b
MM
5909and the performance of the generated code.
5910
fad893da
JQ
5911@option{-O2} turns on all optimization flags specified by @option{-O}. It
5912also turns on the following optimization flags:
08711fdf 5913@gccoptlist{-fthread-jumps @gol
71733172
KZ
5914-falign-functions -falign-jumps @gol
5915-falign-loops -falign-labels @gol
5916-fcaller-saves @gol
08711fdf 5917-fcrossjumping @gol
9a94f7f3 5918-fcse-follow-jumps -fcse-skip-blocks @gol
71733172 5919-fdelete-null-pointer-checks @gol
9a94f7f3 5920-fexpensive-optimizations @gol
71733172 5921-fgcse -fgcse-lm @gol
95da10ea 5922-finline-small-functions @gol
3e293154 5923-findirect-inlining @gol
07ffa034 5924-fipa-sra @gol
71733172 5925-foptimize-sibling-calls @gol
3e485f62 5926-fpartial-inlining @gol
9a94f7f3 5927-fpeephole2 @gol
08711fdf 5928-fregmove @gol
08711fdf 5929-freorder-blocks -freorder-functions @gol
71733172
KZ
5930-frerun-cse-after-loop @gol
5931-fsched-interblock -fsched-spec @gol
5932-fschedule-insns -fschedule-insns2 @gol
5933-fstrict-aliasing -fstrict-overflow @gol
b6e99746 5934-ftree-switch-conversion @gol
71733172
KZ
5935-ftree-pre @gol
5936-ftree-vrp}
74291a4b 5937
081ca317
BL
5938Please note the warning under @option{-fgcse} about
5939invoking @option{-O2} on programs that use computed gotos.
5940
74291a4b 5941@item -O3
cd3bb277 5942@opindex O3
3e293154
MJ
5943Optimize yet more. @option{-O3} turns on all optimizations specified
5944by @option{-O2} and also turns on the @option{-finline-functions},
4e359692 5945@option{-funswitch-loops}, @option{-fpredictive-commoning},
da1cc2e4
MJ
5946@option{-fgcse-after-reload}, @option{-ftree-vectorize} and
5947@option{-fipa-cp-clone} options.
74291a4b
MM
5948
5949@item -O0
cd3bb277 5950@opindex O0
e0f7e748
GK
5951Reduce compilation time and make debugging produce the expected
5952results. This is the default.
74291a4b 5953
c6aded7c 5954@item -Os
cd3bb277 5955@opindex Os
630d3d5a 5956Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
c6aded7c
AG
5957do not typically increase code size. It also performs further
5958optimizations designed to reduce code size.
5959
fad893da 5960@option{-Os} disables the following optimization flags:
9a94f7f3 5961@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
c12cc930
KB
5962-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
5963-fprefetch-loop-arrays -ftree-vect-loop-version}
fad893da 5964
be6d3f0e
RG
5965@item -Ofast
5966@opindex Ofast
5967Disregard strict standards compliance. @option{-Ofast} enables all
5968@option{-O3} optimizations. It also enables optimizations that are not
5969valid for all standard compliant programs.
5970It turns on @option{-ffast-math}.
5971
630d3d5a 5972If you use multiple @option{-O} options, with or without level numbers,
74291a4b
MM
5973the last such option is the one that is effective.
5974@end table
5975
630d3d5a 5976Options of the form @option{-f@var{flag}} specify machine-independent
74291a4b 5977flags. Most flags have both positive and negative forms; the negative
147d1cd3
JQ
5978form of @option{-ffoo} would be @option{-fno-foo}. In the table
5979below, only one of the forms is listed---the one you typically will
5980use. You can figure out the other form by either removing @samp{no-}
5981or adding it.
5982
5983The following options control specific optimizations. They are either
5984activated by @option{-O} options or are related to ones that are. You
5985can use the following flags in the rare cases when ``fine-tuning'' of
5986optimizations to be performed is desired.
74291a4b 5987
2642624b 5988@table @gcctabopt
74291a4b 5989@item -fno-default-inline
cd3bb277 5990@opindex fno-default-inline
74291a4b
MM
5991Do not make member functions inline by default merely because they are
5992defined inside the class scope (C++ only). Otherwise, when you specify
630d3d5a 5993@w{@option{-O}}, member functions defined inside class scope are compiled
74291a4b
MM
5994inline by default; i.e., you don't need to add @samp{inline} in front of
5995the member function name.
5996
5997@item -fno-defer-pop
cd3bb277 5998@opindex fno-defer-pop
74291a4b
MM
5999Always pop the arguments to each function call as soon as that function
6000returns. For machines which must pop arguments after a function call,
6001the compiler normally lets arguments accumulate on the stack for several
6002function calls and pops them all at once.
6003
38df970e
JQ
6004Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6005
a52b023a
PB
6006@item -fforward-propagate
6007@opindex fforward-propagate
0ee2ea09 6008Perform a forward propagation pass on RTL@. The pass tries to combine two
a52b023a
PB
6009instructions and checks if the result can be simplified. If loop unrolling
6010is active, two passes are performed and the second is scheduled after
6011loop unrolling.
6012
00952e97
PB
6013This option is enabled by default at optimization levels @option{-O},
6014@option{-O2}, @option{-O3}, @option{-Os}.
a52b023a 6015
16949072
RG
6016@item -ffp-contract=@var{style}
6017@opindex ffp-contract
6018@option{-ffp-contract=off} disables floating-point expression contraction.
6019@option{-ffp-contract=fast} enables floating-point expression contraction
6020such as forming of fused multiply-add operations if the target has
6021native support for them.
6022@option{-ffp-contract=on} enables floating-point expression contraction
6023if allowed by the language standard. This is currently not implemented
6024and treated equal to @option{-ffp-contract=off}.
6025
6026The default is @option{-ffp-contract=fast}.
6027
74291a4b 6028@item -fomit-frame-pointer
cd3bb277 6029@opindex fomit-frame-pointer
74291a4b
MM
6030Don't keep the frame pointer in a register for functions that
6031don't need one. This avoids the instructions to save, set up and
6032restore frame pointers; it also makes an extra register available
6033in many functions. @strong{It also makes debugging impossible on
6034some machines.}
6035
8aeea6e6 6036On some machines, such as the VAX, this flag has no effect, because
74291a4b
MM
6037the standard calling sequence automatically handles the frame pointer
6038and nothing is saved by pretending it doesn't exist. The
6039machine-description macro @code{FRAME_POINTER_REQUIRED} controls
6040whether a target machine supports this flag. @xref{Registers,,Register
b11cc610 6041Usage, gccint, GNU Compiler Collection (GCC) Internals}.
74291a4b 6042
ef7e0035
UB
6043Starting with GCC version 4.6, the default setting (when not optimizing for
6044size) for 32-bit Linux x86 and 32-bit Darwin x86 targets has been changed to
6045@option{-fomit-frame-pointer}. The default can be reverted to
6046@option{-fno-omit-frame-pointer} by configuring GCC with the
6047@option{--enable-frame-pointer} configure option.
6048
38df970e
JQ
6049Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6050
1aaef9c1 6051@item -foptimize-sibling-calls
cd3bb277 6052@opindex foptimize-sibling-calls
1aaef9c1
JH
6053Optimize sibling and tail recursive calls.
6054
38df970e
JQ
6055Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6056
74291a4b 6057@item -fno-inline
cd3bb277 6058@opindex fno-inline
74291a4b
MM
6059Don't pay attention to the @code{inline} keyword. Normally this option
6060is used to keep the compiler from expanding any functions inline.
6061Note that if you are not optimizing, no functions can be expanded inline.
6062
4d4b8cb9
JH
6063@item -finline-small-functions
6064@opindex finline-small-functions
6065Integrate functions into their callers when their body is smaller than expected
6066function call code (so overall size of program gets smaller). The compiler
6067heuristically decides which functions are simple enough to be worth integrating
6068in this way.
6069
6070Enabled at level @option{-O2}.
6071
3e293154
MJ
6072@item -findirect-inlining
6073@opindex findirect-inlining
6074Inline also indirect calls that are discovered to be known at compile
6075time thanks to previous inlining. This option has any effect only
6076when inlining itself is turned on by the @option{-finline-functions}
6077or @option{-finline-small-functions} options.
6078
6079Enabled at level @option{-O2}.
6080
74291a4b 6081@item -finline-functions
cd3bb277 6082@opindex finline-functions
74291a4b
MM
6083Integrate all simple functions into their callers. The compiler
6084heuristically decides which functions are simple enough to be worth
6085integrating in this way.
6086
6087If all calls to a given function are integrated, and the function is
6088declared @code{static}, then the function is normally not output as
6089assembler code in its own right.
6090
38df970e 6091Enabled at level @option{-O3}.
355866de
RG
6092
6093@item -finline-functions-called-once
6094@opindex finline-functions-called-once
6095Consider all @code{static} functions called once for inlining into their
6096caller even if they are not marked @code{inline}. If a call to a given
6097function is integrated, then the function is not output as assembler code
6098in its own right.
6099
d6cc6ec9 6100Enabled at levels @option{-O1}, @option{-O2}, @option{-O3} and @option{-Os}.
38df970e 6101
d63db217
JH
6102@item -fearly-inlining
6103@opindex fearly-inlining
6104Inline functions marked by @code{always_inline} and functions whose body seems
6105smaller than the function call overhead early before doing
6106@option{-fprofile-generate} instrumentation and real inlining pass. Doing so
6107makes profiling significantly cheaper and usually inlining faster on programs
6108having large chains of nested wrapper functions.
6109
6110Enabled by default.
6111
07ffa034
MJ
6112@item -fipa-sra
6113@opindex fipa-sra
6114Perform interprocedural scalar replacement of aggregates, removal of
6115unused parameters and replacement of parameters passed by reference
6116by parameters passed by value.
6117
6118Enabled at levels @option{-O2}, @option{-O3} and @option{-Os}.
6119
efa3896a 6120@item -finline-limit=@var{n}
cd3bb277 6121@opindex finline-limit
2dd76960 6122By default, GCC limits the size of functions that can be inlined. This flag
7c9c2f2a
RG
6123allows coarse control of this limit. @var{n} is the size of functions that
6124can be inlined in number of pseudo instructions.
f9e814f1 6125
bc522472
KG
6126Inlining is actually controlled by a number of parameters, which may be
6127specified individually by using @option{--param @var{name}=@var{value}}.
daf2f129 6128The @option{-finline-limit=@var{n}} option sets some of these parameters
bc522472
KG
6129as follows:
6130
6131@table @gcctabopt
dc5abe77 6132@item max-inline-insns-single
6ccde948 6133is set to @var{n}/2.
dc5abe77 6134@item max-inline-insns-auto
6ccde948 6135is set to @var{n}/2.
bc522472
KG
6136@end table
6137
f7a01847 6138See below for a documentation of the individual
7c9c2f2a
RG
6139parameters controlling inlining and for the defaults of these parameters.
6140
6141@emph{Note:} there may be no value to @option{-finline-limit} that results
6142in default behavior.
bc522472 6143
f9e814f1 6144@emph{Note:} pseudo instruction represents, in this particular context, an
0fa2e4df 6145abstract measurement of function's size. In no way does it represent a count
f9e814f1
TP
6146of assembly instructions and as such its exact meaning might change from one
6147release to an another.
6148
74291a4b 6149@item -fkeep-inline-functions
cd3bb277 6150@opindex fkeep-inline-functions
1a10290c
MM
6151In C, emit @code{static} functions that are declared @code{inline}
6152into the object file, even if the function has been inlined into all
6153of its callers. This switch does not affect functions using the
7e1542b9 6154@code{extern inline} extension in GNU C90@. In C++, emit any and all
1a10290c 6155inline functions into the object file.
74291a4b
MM
6156
6157@item -fkeep-static-consts
cd3bb277 6158@opindex fkeep-static-consts
74291a4b
MM
6159Emit variables declared @code{static const} when optimization isn't turned
6160on, even if the variables aren't referenced.
6161
0c2d1a2a 6162GCC enables this option by default. If you want to force the compiler to
74291a4b 6163check if the variable was referenced, regardless of whether or not
630d3d5a 6164optimization is turned on, use the @option{-fno-keep-static-consts} option.
74291a4b 6165
201556f0 6166@item -fmerge-constants
7d95b692 6167@opindex fmerge-constants
201556f0 6168Attempt to merge identical constants (string constants and floating point
3364c33b 6169constants) across compilation units.
201556f0 6170
3364c33b
JQ
6171This option is the default for optimized compilation if the assembler and
6172linker support it. Use @option{-fno-merge-constants} to inhibit this
6173behavior.
201556f0 6174
38df970e
JQ
6175Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6176
201556f0 6177@item -fmerge-all-constants
7d95b692 6178@opindex fmerge-all-constants
201556f0
JJ
6179Attempt to merge identical constants and identical variables.
6180
6181This option implies @option{-fmerge-constants}. In addition to
431ae0bf 6182@option{-fmerge-constants} this considers e.g.@: even constant initialized
201556f0 6183arrays or initialized constant variables with integral or floating point
403066cf
SE
6184types. Languages like C or C++ require each variable, including multiple
6185instances of the same variable in recursive calls, to have distinct locations,
6186so using this option will result in non-conforming
c21cd8b1 6187behavior.
201556f0 6188
e5626198
AZ
6189@item -fmodulo-sched
6190@opindex fmodulo-sched
6191Perform swing modulo scheduling immediately before the first scheduling
6192pass. This pass looks at innermost loops and reorders their
6193instructions by overlapping different iterations.
6194
517d76fa
VY
6195@item -fmodulo-sched-allow-regmoves
6196@opindex fmodulo-sched-allow-regmoves
6197Perform more aggressive SMS based modulo scheduling with register moves
6198allowed. By setting this flag certain anti-dependences edges will be
6199deleted which will trigger the generation of reg-moves based on the
12749440
RE
6200life-range analysis. This option is effective only with
6201@option{-fmodulo-sched} enabled.
517d76fa 6202
e03b7153
RS
6203@item -fno-branch-count-reg
6204@opindex fno-branch-count-reg
6205Do not use ``decrement and branch'' instructions on a count register,
6206but instead generate a sequence of instructions that decrement a
6207register, compare it against zero, then branch based upon the result.
6208This option is only meaningful on architectures that support such
6209instructions, which include x86, PowerPC, IA-64 and S/390.
6210
efa1cdf0 6211The default is @option{-fbranch-count-reg}.
38df970e 6212
74291a4b 6213@item -fno-function-cse
cd3bb277 6214@opindex fno-function-cse
74291a4b
MM
6215Do not put function addresses in registers; make each instruction that
6216calls a constant function contain the function's address explicitly.
6217
6218This option results in less efficient code, but some strange hacks
6219that alter the assembler output may be confused by the optimizations
6220performed when this option is not used.
6221
38df970e
JQ
6222The default is @option{-ffunction-cse}
6223
27b41650
KG
6224@item -fno-zero-initialized-in-bss
6225@opindex fno-zero-initialized-in-bss
6226If the target supports a BSS section, GCC by default puts variables that
6227are initialized to zero into BSS@. This can save space in the resulting
6228code.
6229
6230This option turns off this behavior because some programs explicitly
6231rely on variables going to the data section. E.g., so that the
6232resulting executable can find the beginning of that section and/or make
6233assumptions based on that.
6234
6235The default is @option{-fzero-initialized-in-bss}.
e03b7153 6236
6de9cd9a
DN
6237@item -fmudflap -fmudflapth -fmudflapir
6238@opindex fmudflap
6239@opindex fmudflapth
6240@opindex fmudflapir
6241@cindex bounds checking
6242@cindex mudflap
6243For front-ends that support it (C and C++), instrument all risky
6244pointer/array dereferencing operations, some standard library
6245string/heap functions, and some other associated constructs with
6246range/validity tests. Modules so instrumented should be immune to
6247buffer overflows, invalid heap use, and some other classes of C/C++
6248programming errors. The instrumentation relies on a separate runtime
6249library (@file{libmudflap}), which will be linked into a program if
6250@option{-fmudflap} is given at link time. Run-time behavior of the
6251instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
6252environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
6253for its options.
6254
6255Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
6256link if your program is multi-threaded. Use @option{-fmudflapir}, in
6257addition to @option{-fmudflap} or @option{-fmudflapth}, if
6258instrumentation should ignore pointer reads. This produces less
6259instrumentation (and therefore faster execution) and still provides
6260some protection against outright memory corrupting writes, but allows
6261erroneously read data to propagate within a program.
6262
74291a4b 6263@item -fthread-jumps
cd3bb277 6264@opindex fthread-jumps
74291a4b
MM
6265Perform optimizations where we check to see if a jump branches to a
6266location where another comparison subsumed by the first is found. If
6267so, the first branch is redirected to either the destination of the
6268second branch or a point immediately following it, depending on whether
6269the condition is known to be true or false.
6270
08711fdf 6271Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
38df970e 6272
e53a16e7 6273@item -fsplit-wide-types
edc5f63b 6274@opindex fsplit-wide-types
e53a16e7
ILT
6275When using a type that occupies multiple registers, such as @code{long
6276long} on a 32-bit system, split the registers apart and allocate them
6277independently. This normally generates better code for those types,
6278but may make debugging more difficult.
6279
6280Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
6281@option{-Os}.
6282
74291a4b 6283@item -fcse-follow-jumps
cd3bb277 6284@opindex fcse-follow-jumps
d6a64b9d 6285In common subexpression elimination (CSE), scan through jump instructions
74291a4b
MM
6286when the target of the jump is not reached by any other path. For
6287example, when CSE encounters an @code{if} statement with an
6288@code{else} clause, CSE will follow the jump when the condition
6289tested is false.
6290
38df970e
JQ
6291Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6292
74291a4b 6293@item -fcse-skip-blocks
cd3bb277 6294@opindex fcse-skip-blocks
630d3d5a 6295This is similar to @option{-fcse-follow-jumps}, but causes CSE to
74291a4b
MM
6296follow jumps which conditionally skip over blocks. When CSE
6297encounters a simple @code{if} statement with no else clause,
630d3d5a 6298@option{-fcse-skip-blocks} causes CSE to follow the jump around the
74291a4b
MM
6299body of the @code{if}.
6300
38df970e
JQ
6301Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6302
74291a4b 6303@item -frerun-cse-after-loop
cd3bb277 6304@opindex frerun-cse-after-loop
74291a4b
MM
6305Re-run common subexpression elimination after loop optimizations has been
6306performed.
6307
38df970e
JQ
6308Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6309
7506f491 6310@item -fgcse
cd3bb277 6311@opindex fgcse
7506f491
DE
6312Perform a global common subexpression elimination pass.
6313This pass also performs global constant and copy propagation.
6314
081ca317
BL
6315@emph{Note:} When compiling a program using computed gotos, a GCC
6316extension, you may get better runtime performance if you disable
3364c33b 6317the global common subexpression elimination pass by adding
081ca317
BL
6318@option{-fno-gcse} to the command line.
6319
38df970e
JQ
6320Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6321
a13d4ebf 6322@item -fgcse-lm
cd3bb277 6323@opindex fgcse-lm
695ac33f 6324When @option{-fgcse-lm} is enabled, global common subexpression elimination will
767094dd 6325attempt to move loads which are only killed by stores into themselves. This
a13d4ebf 6326allows a loop containing a load/store sequence to be changed to a load outside
02f52e19 6327the loop, and a copy/store within the loop.
a13d4ebf 6328
38df970e
JQ
6329Enabled by default when gcse is enabled.
6330
a13d4ebf 6331@item -fgcse-sm
cd3bb277 6332@opindex fgcse-sm
f5f2e3cd
MH
6333When @option{-fgcse-sm} is enabled, a store motion pass is run after
6334global common subexpression elimination. This pass will attempt to move
6335stores out of loops. When used in conjunction with @option{-fgcse-lm},
6336loops containing a load/store sequence can be changed to a load before
6337the loop and a store after the loop.
6338
08711fdf 6339Not enabled at any optimization level.
f5f2e3cd
MH
6340
6341@item -fgcse-las
6342@opindex fgcse-las
6343When @option{-fgcse-las} is enabled, the global common subexpression
6344elimination pass eliminates redundant loads that come after stores to the
2206e783 6345same memory location (both partial and full redundancies).
a13d4ebf 6346
08711fdf 6347Not enabled at any optimization level.
38df970e 6348
db643b91
SH
6349@item -fgcse-after-reload
6350@opindex fgcse-after-reload
6351When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8a36672b 6352pass is performed after reload. The purpose of this pass is to cleanup
db643b91
SH
6353redundant spilling.
6354
f9cc1a70
PB
6355@item -funsafe-loop-optimizations
6356@opindex funsafe-loop-optimizations
6357If given, the loop optimizer will assume that loop indices do not
6358overflow, and that the loops with nontrivial exit condition are not
6359infinite. This enables a wider range of loop optimizations even if
6360the loop optimizer itself cannot prove that these assumptions are valid.
6361Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
6362if it finds this kind of loop.
6363
96327cdc 6364@item -fcrossjumping
7d95b692 6365@opindex fcrossjumping
8a36672b 6366Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
96327cdc
JH
6367resulting code may or may not perform better than without cross-jumping.
6368
53071270 6369Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
38df970e 6370
71733172
KZ
6371@item -fauto-inc-dec
6372@opindex fauto-inc-dec
6373Combine increments or decrements of addresses with memory accesses.
6374This pass is always skipped on architectures that do not have
6375instructions to support this. Enabled by default at @option{-O} and
6376higher on architectures that support this.
6377
0c166d0f
JJ
6378@item -fdce
6379@opindex fdce
0ee2ea09 6380Perform dead code elimination (DCE) on RTL@.
0c166d0f
JJ
6381Enabled by default at @option{-O} and higher.
6382
6383@item -fdse
6384@opindex fdse
0ee2ea09 6385Perform dead store elimination (DSE) on RTL@.
0c166d0f
JJ
6386Enabled by default at @option{-O} and higher.
6387
2c4b77f3 6388@item -fif-conversion
7d95b692 6389@opindex fif-conversion
2c4b77f3
JH
6390Attempt to transform conditional jumps into branch-less equivalents. This
6391include use of conditional moves, min, max, set flags and abs instructions, and
6392some tricks doable by standard arithmetics. The use of conditional execution
6393on chips where it is available is controlled by @code{if-conversion2}.
6394
38df970e
JQ
6395Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6396
2c4b77f3 6397@item -fif-conversion2
7d95b692 6398@opindex fif-conversion2
2c4b77f3
JH
6399Use conditional execution (where available) to transform conditional jumps into
6400branch-less equivalents.
6401
38df970e
JQ
6402Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6403
b6d24183 6404@item -fdelete-null-pointer-checks
cd3bb277 6405@opindex fdelete-null-pointer-checks
567a90f5
PB
6406Assume that programs cannot safely dereference null pointers, and that
6407no code or data element resides there. This enables simple constant
6408folding optimizations at all optimization levels. In addition, other
6409optimization passes in GCC use this flag to control global dataflow
6410analyses that eliminate useless checks for null pointers; these assume
6411that if a pointer is checked after it has already been dereferenced,
6412it cannot be null.
6413
6414Note however that in some environments this assumption is not true.
6415Use @option{-fno-delete-null-pointer-checks} to disable this optimization
9c34dbbf 6416for programs which depend on that behavior.
b6d24183 6417
567a90f5
PB
6418Some targets, especially embedded ones, disable this option at all levels.
6419Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
6420@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
6421are enabled independently at different optimization levels.
38df970e 6422
74291a4b 6423@item -fexpensive-optimizations
cd3bb277 6424@opindex fexpensive-optimizations
74291a4b
MM
6425Perform a number of minor optimizations that are relatively expensive.
6426
38df970e
JQ
6427Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6428
639726ba 6429@item -foptimize-register-move
59d40964 6430@itemx -fregmove
cd3bb277
JM
6431@opindex foptimize-register-move
6432@opindex fregmove
9ec36da5
JL
6433Attempt to reassign register numbers in move instructions and as
6434operands of other simple instructions in order to maximize the amount of
56159047 6435register tying. This is especially helpful on machines with two-operand
38df970e 6436instructions.
9ec36da5 6437
bedc7537 6438Note @option{-fregmove} and @option{-foptimize-register-move} are the same
9ec36da5
JL
6439optimization.
6440
38df970e
JQ
6441Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6442
058e97ec 6443@item -fira-algorithm=@var{algorithm}
7db7ed3c
VM
6444Use specified coloring algorithm for the integrated register
6445allocator. The @var{algorithm} argument should be @code{priority} or
6446@code{CB}. The first algorithm specifies Chow's priority coloring,
6447the second one specifies Chaitin-Briggs coloring. The second
6448algorithm can be unimplemented for some architectures. If it is
6449implemented, it is the default because Chaitin-Briggs coloring as a
6450rule generates a better code.
6451
6452@item -fira-region=@var{region}
6453Use specified regions for the integrated register allocator. The
6454@var{region} argument should be one of @code{all}, @code{mixed}, or
6455@code{one}. The first value means using all loops as register
6456allocation regions, the second value which is the default means using
6457all loops except for loops with small register pressure as the
6458regions, and third one means using all function as a single region.
6459The first value can give best result for machines with small size and
6460irregular register set, the third one results in faster and generates
6461decent code and the smallest size code, and the default value usually
6462give the best results in most cases and for most architectures.
058e97ec 6463
1833192f
VM
6464@item -fira-loop-pressure
6465@opindex fira-loop-pressure
6466Use IRA to evaluate register pressure in loops for decision to move
6467loop invariants. Usage of this option usually results in generation
7e1e7d4c
VM
6468of faster and smaller code on machines with big register files (>= 32
6469registers) but it can slow compiler down.
1833192f 6470
7e1e7d4c 6471This option is enabled at level @option{-O3} for some targets.
1833192f 6472
058e97ec
VM
6473@item -fno-ira-share-save-slots
6474@opindex fno-ira-share-save-slots
6475Switch off sharing stack slots used for saving call used hard
6476registers living through a call. Each hard register will get a
6477separate stack slot and as a result function stack frame will be
6478bigger.
6479
6480@item -fno-ira-share-spill-slots
6481@opindex fno-ira-share-spill-slots
6482Switch off sharing stack slots allocated for pseudo-registers. Each
6483pseudo-register which did not get a hard register will get a separate
6484stack slot and as a result function stack frame will be bigger.
6485
6486@item -fira-verbose=@var{n}
6487@opindex fira-verbose
6488Set up how verbose dump file for the integrated register allocator
6489will be. Default value is 5. If the value is greater or equal to 10,
6490the dump file will be stderr as if the value were @var{n} minus 10.
6491
74291a4b 6492@item -fdelayed-branch
cd3bb277 6493@opindex fdelayed-branch
74291a4b
MM
6494If supported for the target machine, attempt to reorder instructions
6495to exploit instruction slots available after delayed branch
6496instructions.
6497
38df970e
JQ
6498Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
6499
74291a4b 6500@item -fschedule-insns
cd3bb277 6501@opindex fschedule-insns
74291a4b
MM
6502If supported for the target machine, attempt to reorder instructions to
6503eliminate execution stalls due to required data being unavailable. This
6504helps machines that have slow floating point or memory load instructions
6505by allowing other instructions to be issued until the result of the load
6506or floating point instruction is required.
6507
4de29d8f 6508Enabled at levels @option{-O2}, @option{-O3}.
38df970e 6509
74291a4b 6510@item -fschedule-insns2
cd3bb277 6511@opindex fschedule-insns2
630d3d5a 6512Similar to @option{-fschedule-insns}, but requests an additional pass of
74291a4b
MM
6513instruction scheduling after register allocation has been done. This is
6514especially useful on machines with a relatively small number of
6515registers and where memory load instructions take more than one cycle.
6516
38df970e
JQ
6517Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
6518
e03b7153
RS
6519@item -fno-sched-interblock
6520@opindex fno-sched-interblock
6521Don't schedule instructions across basic blocks. This is normally
6522enabled by default when scheduling before register allocation, i.e.@:
6523with @option{-fschedule-insns} or at @option{-O2} or higher.
6524
6525@item -fno-sched-spec
6526@opindex fno-sched-spec
6527Don't allow speculative motion of non-load instructions. This is normally
6528enabled by default when scheduling before register allocation, i.e.@:
6529with @option{-fschedule-insns} or at @option{-O2} or higher.
6530
ce18efcb
VM
6531@item -fsched-pressure
6532@opindex fsched-pressure
6533Enable register pressure sensitive insn scheduling before the register
6534allocation. This only makes sense when scheduling before register
6535allocation is enabled, i.e.@: with @option{-fschedule-insns} or at
6536@option{-O2} or higher. Usage of this option can improve the
6537generated code and decrease its size by preventing register pressure
6538increase above the number of available hard registers and as a
6539consequence register spills in the register allocation.
6540
e03b7153
RS
6541@item -fsched-spec-load
6542@opindex fsched-spec-load
6543Allow speculative motion of some load instructions. This only makes
6544sense when scheduling before register allocation, i.e.@: with
6545@option{-fschedule-insns} or at @option{-O2} or higher.
6546
6547@item -fsched-spec-load-dangerous
6548@opindex fsched-spec-load-dangerous
6549Allow speculative motion of more load instructions. This only makes
6550sense when scheduling before register allocation, i.e.@: with
6551@option{-fschedule-insns} or at @option{-O2} or higher.
6552
7d95b692
JJ
6553@item -fsched-stalled-insns
6554@itemx -fsched-stalled-insns=@var{n}
569fa502
DN
6555@opindex fsched-stalled-insns
6556Define how many insns (if any) can be moved prematurely from the queue
6557of stalled insns into the ready list, during the second scheduling pass.
b423089e
JJ
6558@option{-fno-sched-stalled-insns} means that no insns will be moved
6559prematurely, @option{-fsched-stalled-insns=0} means there is no limit
6560on how many queued insns can be moved prematurely.
6561@option{-fsched-stalled-insns} without a value is equivalent to
6562@option{-fsched-stalled-insns=1}.
569fa502 6563
7d95b692
JJ
6564@item -fsched-stalled-insns-dep
6565@itemx -fsched-stalled-insns-dep=@var{n}
569fa502 6566@opindex fsched-stalled-insns-dep
daf2f129
JM
6567Define how many insn groups (cycles) will be examined for a dependency
6568on a stalled insn that is candidate for premature removal from the queue
7d95b692 6569of stalled insns. This has an effect only during the second scheduling pass,
b423089e 6570and only if @option{-fsched-stalled-insns} is used.
7d95b692
JJ
6571@option{-fno-sched-stalled-insns-dep} is equivalent to
6572@option{-fsched-stalled-insns-dep=0}.
6573@option{-fsched-stalled-insns-dep} without a value is equivalent to
6574@option{-fsched-stalled-insns-dep=1}.
569fa502 6575
b9422b69
JH
6576@item -fsched2-use-superblocks
6577@opindex fsched2-use-superblocks
61aeb06f 6578When scheduling after register allocation, do use superblock scheduling
62b9c42c 6579algorithm. Superblock scheduling allows motion across basic block boundaries
b9422b69 6580resulting on faster schedules. This option is experimental, as not all machine
62b9c42c 6581descriptions used by GCC model the CPU closely enough to avoid unreliable
daf2f129 6582results from the algorithm.
b9422b69
JH
6583
6584This only makes sense when scheduling after register allocation, i.e.@: with
6585@option{-fschedule-insns2} or at @option{-O2} or higher.
6586
ee4764a8
GS
6587@item -fsched-group-heuristic
6588@opindex fsched-group-heuristic
96809b41
GS
6589Enable the group heuristic in the scheduler. This heuristic favors
6590the instruction that belongs to a schedule group. This is enabled
6591by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns}
ee4764a8
GS
6592or @option{-fschedule-insns2} or at @option{-O2} or higher.
6593
6594@item -fsched-critical-path-heuristic
6595@opindex fsched-critical-path-heuristic
96809b41
GS
6596Enable the critical-path heuristic in the scheduler. This heuristic favors
6597instructions on the critical path. This is enabled by default when
6598scheduling is enabled, i.e.@: with @option{-fschedule-insns}
ee4764a8
GS
6599or @option{-fschedule-insns2} or at @option{-O2} or higher.
6600
6601@item -fsched-spec-insn-heuristic
6602@opindex fsched-spec-insn-heuristic
96809b41
GS
6603Enable the speculative instruction heuristic in the scheduler. This
6604heuristic favors speculative instructions with greater dependency weakness.
6605This is enabled by default when scheduling is enabled, i.e.@:
6606with @option{-fschedule-insns} or @option{-fschedule-insns2}
6607or at @option{-O2} or higher.
ee4764a8 6608
ee4764a8
GS
6609@item -fsched-rank-heuristic
6610@opindex fsched-rank-heuristic
96809b41
GS
6611Enable the rank heuristic in the scheduler. This heuristic favors
6612the instruction belonging to a basic block with greater size or frequency.
6613This is enabled by default when scheduling is enabled, i.e.@:
6614with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6615at @option{-O2} or higher.
ee4764a8
GS
6616
6617@item -fsched-last-insn-heuristic
6618@opindex fsched-last-insn-heuristic
96809b41
GS
6619Enable the last-instruction heuristic in the scheduler. This heuristic
6620favors the instruction that is less dependent on the last instruction
6621scheduled. This is enabled by default when scheduling is enabled,
6622i.e.@: with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6623at @option{-O2} or higher.
ee4764a8
GS
6624
6625@item -fsched-dep-count-heuristic
6626@opindex fsched-dep-count-heuristic
96809b41
GS
6627Enable the dependent-count heuristic in the scheduler. This heuristic
6628favors the instruction that has more instructions depending on it.
6629This is enabled by default when scheduling is enabled, i.e.@:
6630with @option{-fschedule-insns} or @option{-fschedule-insns2} or
6631at @option{-O2} or higher.
ee4764a8 6632
d72372e4 6633@item -freschedule-modulo-scheduled-loops
7d95b692 6634@opindex freschedule-modulo-scheduled-loops
13c59415
UB
6635The modulo scheduling comes before the traditional scheduling, if a loop
6636was modulo scheduled we may want to prevent the later scheduling passes
6637from changing its schedule, we use this option to control that.
d72372e4 6638
e855c69d
AB
6639@item -fselective-scheduling
6640@opindex fselective-scheduling
6641Schedule instructions using selective scheduling algorithm. Selective
6642scheduling runs instead of the first scheduler pass.
6643
6644@item -fselective-scheduling2
6645@opindex fselective-scheduling2
6646Schedule instructions using selective scheduling algorithm. Selective
6647scheduling runs instead of the second scheduler pass.
6648
6649@item -fsel-sched-pipelining
6650@opindex fsel-sched-pipelining
7a61cf6f
NC
6651Enable software pipelining of innermost loops during selective scheduling.
6652This option has no effect until one of @option{-fselective-scheduling} or
e855c69d
AB
6653@option{-fselective-scheduling2} is turned on.
6654
6655@item -fsel-sched-pipelining-outer-loops
6656@opindex fsel-sched-pipelining-outer-loops
6657When pipelining loops during selective scheduling, also pipeline outer loops.
6658This option has no effect until @option{-fsel-sched-pipelining} is turned on.
6659
74291a4b 6660@item -fcaller-saves
cd3bb277 6661@opindex fcaller-saves
74291a4b
MM
6662Enable values to be allocated in registers that will be clobbered by
6663function calls, by emitting extra instructions to save and restore the
6664registers around such calls. Such allocation is done only when it
6665seems to result in better code than would otherwise be produced.
6666
81610a0d
HPN
6667This option is always enabled by default on certain machines, usually
6668those which have no call-preserved registers to use instead.
6669
38df970e 6670Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
74291a4b 6671
ccaeeafe
NC
6672@item -fcombine-stack-adjustments
6673@opindex fcombine-stack-adjustments
6674Tracks stack adjustments (pushes and pops) and stack memory references
6675and then tries to find ways to combine them.
6676
6677Enabled by default at @option{-O1} and higher.
6678
6a78eaa3
JH
6679@item -fconserve-stack
6680@opindex fconserve-stack
6681Attempt to minimize stack usage. The compiler will attempt to use less
6682stack space, even if that makes the program slower. This option
6683implies setting the @option{large-stack-frame} parameter to 100
6684and the @option{large-stack-frame-growth} parameter to 400.
6685
13c59415 6686@item -ftree-reassoc
7d95b692 6687@opindex ftree-reassoc
d6a64b9d 6688Perform reassociation on trees. This flag is enabled by default
13c59415
UB
6689at @option{-O} and higher.
6690
6de9cd9a 6691@item -ftree-pre
7d95b692 6692@opindex ftree-pre
d6a64b9d 6693Perform partial redundancy elimination (PRE) on trees. This flag is
08711fdf 6694enabled by default at @option{-O2} and @option{-O3}.
ff2ad0f7 6695
248fc9f3
RG
6696@item -ftree-forwprop
6697@opindex ftree-forwprop
6698Perform forward propagation on trees. This flag is enabled by default
6699at @option{-O} and higher.
6700
ff2ad0f7 6701@item -ftree-fre
7d95b692 6702@opindex ftree-fre
d6a64b9d 6703Perform full redundancy elimination (FRE) on trees. The difference
ff2ad0f7
DN
6704between FRE and PRE is that FRE only considers expressions
6705that are computed on all paths leading to the redundant computation.
06e2b6a0 6706This analysis is faster than PRE, though it exposes fewer redundancies.
4ec7afd7 6707This flag is enabled by default at @option{-O} and higher.
6de9cd9a 6708
248fc9f3
RG
6709@item -ftree-phiprop
6710@opindex ftree-phiprop
6711Perform hoisting of loads from conditional pointers on trees. This
6712pass is enabled by default at @option{-O} and higher.
6713
0bca51f0 6714@item -ftree-copy-prop
7d95b692 6715@opindex ftree-copy-prop
0bca51f0
DN
6716Perform copy propagation on trees. This pass eliminates unnecessary
6717copy operations. This flag is enabled by default at @option{-O} and
6718higher.
6719
71733172
KZ
6720@item -fipa-pure-const
6721@opindex fipa-pure-const
6722Discover which functions are pure or constant.
6723Enabled by default at @option{-O} and higher.
6724
6725@item -fipa-reference
6726@opindex fipa-reference
6727Discover which static variables do not escape cannot escape the
6728compilation unit.
6729Enabled by default at @option{-O} and higher.
6730
5bb06e18
GO
6731@item -fipa-struct-reorg
6732@opindex fipa-struct-reorg
7a61cf6f
NC
6733Perform structure reorganization optimization, that change C-like structures
6734layout in order to better utilize spatial locality. This transformation is
6735affective for programs containing arrays of structures. Available in two
5bb06e18 6736compilation modes: profile-based (enabled with @option{-fprofile-generate})
6b87d1b4 6737or static (which uses built-in heuristics). It works only in whole program
c3224d6f 6738mode, so it requires @option{-fwhole-program} to be
5bb06e18
GO
6739enabled. Structures considered @samp{cold} by this transformation are not
6740affected (see @option{--param struct-reorg-cold-struct-ratio=@var{value}}).
6741
6742With this flag, the program debug info reflects a new structure layout.
6743
4cf4d6a3 6744@item -fipa-pta
7d95b692 6745@opindex fipa-pta
25a6a873
RG
6746Perform interprocedural pointer analysis and interprocedural modification
6747and reference analysis. This option can cause excessive memory and
6748compile-time usage on large compilation units. It is not enabled by
6749default at any optimization level.
4cf4d6a3 6750
e65bb9be
JH
6751@item -fipa-profile
6752@opindex fipa-profile
6753Perform interprocedural profile propagation. The functions called only from
6754cold functions are marked as cold. Also functions executed once (such as
6755@code{cold}, @code{noreturn}, static constructors or destructors) are identified. Cold
6756functions and loop less parts of functions executed once are then optimized for
6757size.
6758Enabled by default at @option{-O} and higher.
6759
aa1a4968
RL
6760@item -fipa-cp
6761@opindex fipa-cp
6762Perform interprocedural constant propagation.
6763This optimization analyzes the program to determine when values passed
7a61cf6f 6764to functions are constants and then optimizes accordingly.
aa1a4968 6765This optimization can substantially increase performance
5e45130d 6766if the application has constants passed to functions.
fcbe056b 6767This flag is enabled by default at @option{-O2}, @option{-Os} and @option{-O3}.
5e45130d
JH
6768
6769@item -fipa-cp-clone
6770@opindex fipa-cp-clone
6771Perform function cloning to make interprocedural constant propagation stronger.
6772When enabled, interprocedural constant propagation will perform function cloning
6773when externally visible function can be called with constant arguments.
6774Because this optimization can create multiple copies of functions,
6775it may significantly increase code size
6776(see @option{--param ipcp-unit-growth=@var{value}}).
fcbe056b 6777This flag is enabled by default at @option{-O3}.
aa1a4968
RL
6778
6779@item -fipa-matrix-reorg
6780@opindex fipa-matrix-reorg
6781Perform matrix flattening and transposing.
e4ae5e77
RW
6782Matrix flattening tries to replace an @math{m}-dimensional matrix
6783with its equivalent @math{n}-dimensional matrix, where @math{n < m}.
aa1a4968
RL
6784This reduces the level of indirection needed for accessing the elements
6785of the matrix. The second optimization is matrix transposing that
048fd785 6786attempts to change the order of the matrix's dimensions in order to
aa1a4968 6787improve cache locality.
7a61cf6f 6788Both optimizations need the @option{-fwhole-program} flag.
1df48f5c 6789Transposing is enabled only if profiling information is available.
aa1a4968 6790
fa555252 6791@item -ftree-sink
7d95b692 6792@opindex ftree-sink
fa555252
DB
6793Perform forward store motion on trees. This flag is
6794enabled by default at @option{-O} and higher.
6795
0b4b14ac
RG
6796@item -ftree-bit-ccp
6797@opindex ftree-bit-ccp
6798Perform sparse conditional bit constant propagation on trees and propagate
6799pointer alignment information.
6800This pass only operates on local scalar variables and is enabled by default
6801at @option{-O} and higher. It requires that @option{-ftree-ccp} is enabled.
6802
6de9cd9a 6803@item -ftree-ccp
7d95b692 6804@opindex ftree-ccp
0bca51f0
DN
6805Perform sparse conditional constant propagation (CCP) on trees. This
6806pass only operates on local scalar variables and is enabled by default
6807at @option{-O} and higher.
6808
b6e99746
MJ
6809@item -ftree-switch-conversion
6810Perform conversion of simple initializations in a switch to
6811initializations from a scalar array. This flag is enabled by default
6812at @option{-O2} and higher.
6813
6de9cd9a 6814@item -ftree-dce
7d95b692 6815@opindex ftree-dce
6de9cd9a 6816Perform dead code elimination (DCE) on trees. This flag is enabled by
4ec7afd7 6817default at @option{-O} and higher.
6de9cd9a 6818
c2699190
XDL
6819@item -ftree-builtin-call-dce
6820@opindex ftree-builtin-call-dce
7a61cf6f
NC
6821Perform conditional dead code elimination (DCE) for calls to builtin functions
6822that may set @code{errno} but are otherwise side-effect free. This flag is
6823enabled by default at @option{-O2} and higher if @option{-Os} is not also
c2699190
XDL
6824specified.
6825
6de9cd9a 6826@item -ftree-dominator-opts
7d95b692 6827@opindex ftree-dominator-opts
5c1c631e
DN
6828Perform a variety of simple scalar cleanups (constant/copy
6829propagation, redundancy elimination, range propagation and expression
6830simplification) based on a dominator tree traversal. This also
6831performs jump threading (to reduce jumps to jumps). This flag is
6832enabled by default at @option{-O} and higher.
6de9cd9a 6833
e3d66ec3
RIL
6834@item -ftree-dse
6835@opindex ftree-dse
6836Perform dead store elimination (DSE) on trees. A dead store is a store into
6837a memory location which will later be overwritten by another store without
6838any intervening loads. In this case the earlier store can be deleted. This
6839flag is enabled by default at @option{-O} and higher.
6840
6de9cd9a 6841@item -ftree-ch
7d95b692 6842@opindex ftree-ch
6de9cd9a 6843Perform loop header copying on trees. This is beneficial since it increases
83c99486 6844effectiveness of code motion optimizations. It also saves one jump. This flag
4ec7afd7
KH
6845is enabled by default at @option{-O} and higher. It is not enabled
6846for @option{-Os}, since it usually increases code size.
6de9cd9a 6847
c66b6c66 6848@item -ftree-loop-optimize
7d95b692 6849@opindex ftree-loop-optimize
4ec7afd7
KH
6850Perform loop optimizations on trees. This flag is enabled by default
6851at @option{-O} and higher.
c66b6c66 6852
599eabdb 6853@item -ftree-loop-linear
7d95b692 6854@opindex ftree-loop-linear
8a36672b 6855Perform linear loop transformations on tree. This flag can improve cache
599eabdb
DB
6856performance and allow further loop optimizations to take place.
6857
f8bf9252 6858@item -floop-interchange
98af4c9f 6859@opindex floop-interchange
f8bf9252
SP
6860Perform loop interchange transformations on loops. Interchanging two
6861nested loops switches the inner and outer loops. For example, given a
6862loop like:
6863@smallexample
6864DO J = 1, M
6865 DO I = 1, N
6866 A(J, I) = A(J, I) * C
6867 ENDDO
6868ENDDO
6869@end smallexample
6870loop interchange will transform the loop as if the user had written:
6871@smallexample
6872DO I = 1, N
6873 DO J = 1, M
6874 A(J, I) = A(J, I) * C
6875 ENDDO
6876ENDDO
6877@end smallexample
6878which can be beneficial when @code{N} is larger than the caches,
6879because in Fortran, the elements of an array are stored in memory
6880contiguously by column, and the original loop iterates over rows,
6881potentially creating at each access a cache miss. This optimization
6882applies to all the languages supported by GCC and is not limited to
a9a7a9a2
SP
6883Fortran. To use this code transformation, GCC has to be configured
6884with @option{--with-ppl} and @option{--with-cloog} to enable the
6885Graphite loop transformation infrastructure.
f8bf9252
SP
6886
6887@item -floop-strip-mine
98af4c9f 6888@opindex floop-strip-mine
f8bf9252 6889Perform loop strip mining transformations on loops. Strip mining
7a61cf6f
NC
6890splits a loop into two nested loops. The outer loop has strides
6891equal to the strip size and the inner loop has strides of the
9d198913
SP
6892original loop within a strip. The strip length can be changed
6893using the @option{loop-block-tile-size} parameter. For example,
6894given a loop like:
f8bf9252
SP
6895@smallexample
6896DO I = 1, N
6897 A(I) = A(I) + C
6898ENDDO
6899@end smallexample
6900loop strip mining will transform the loop as if the user had written:
6901@smallexample
9d198913
SP
6902DO II = 1, N, 51
6903 DO I = II, min (II + 50, N)
f8bf9252
SP
6904 A(I) = A(I) + C
6905 ENDDO
6906ENDDO
6907@end smallexample
6908This optimization applies to all the languages supported by GCC and is
a9a7a9a2
SP
6909not limited to Fortran. To use this code transformation, GCC has to
6910be configured with @option{--with-ppl} and @option{--with-cloog} to
6911enable the Graphite loop transformation infrastructure.
f8bf9252
SP
6912
6913@item -floop-block
98af4c9f 6914@opindex floop-block
f8bf9252
SP
6915Perform loop blocking transformations on loops. Blocking strip mines
6916each loop in the loop nest such that the memory accesses of the
9d198913
SP
6917element loops fit inside caches. The strip length can be changed
6918using the @option{loop-block-tile-size} parameter. For example, given
6919a loop like:
f8bf9252
SP
6920@smallexample
6921DO I = 1, N
6922 DO J = 1, M
6923 A(J, I) = B(I) + C(J)
6924 ENDDO
6925ENDDO
6926@end smallexample
6927loop blocking will transform the loop as if the user had written:
6928@smallexample
9d198913
SP
6929DO II = 1, N, 51
6930 DO JJ = 1, M, 51
6931 DO I = II, min (II + 50, N)
6932 DO J = JJ, min (JJ + 50, M)
f8bf9252
SP
6933 A(J, I) = B(I) + C(J)
6934 ENDDO
6935 ENDDO
6936 ENDDO
6937ENDDO
6938@end smallexample
6939which can be beneficial when @code{M} is larger than the caches,
6940because the innermost loop will iterate over a smaller amount of data
6941that can be kept in the caches. This optimization applies to all the
a9a7a9a2
SP
6942languages supported by GCC and is not limited to Fortran. To use this
6943code transformation, GCC has to be configured with @option{--with-ppl}
6944and @option{--with-cloog} to enable the Graphite loop transformation
6945infrastructure.
f8bf9252 6946
66a7961b
SP
6947@item -fgraphite-identity
6948@opindex fgraphite-identity
6949Enable the identity transformation for graphite. For every SCoP we generate
6950the polyhedral representation and transform it back to gimple. Using
6951@option{-fgraphite-identity} we can check the costs or benefits of the
6952GIMPLE -> GRAPHITE -> GIMPLE transformation. Some minimal optimizations
6953are also performed by the code generator CLooG, like index splitting and
6954dead code elimination in loops.
6955
98af4c9f
SP
6956@item -floop-flatten
6957@opindex floop-flatten
6958Removes the loop nesting structure: transforms the loop nest into a
6959single loop. This transformation can be useful to vectorize all the
6960levels of the loop nest.
6961
3cf0e270 6962@item -floop-parallelize-all
98af4c9f 6963@opindex floop-parallelize-all
109e0d57
SP
6964Use the Graphite data dependence analysis to identify loops that can
6965be parallelized. Parallelize all the loops that can be analyzed to
6966not contain loop carried dependences without checking that it is
6967profitable to parallelize the loops.
6968
3d8864c0 6969@item -fcheck-data-deps
7d95b692 6970@opindex fcheck-data-deps
3d8864c0
SP
6971Compare the results of several data dependence analyzers. This option
6972is used for debugging the data dependence analyzers.
6973
384a5197
SP
6974@item -ftree-loop-if-convert
6975Attempt to transform conditional jumps in the innermost loops to
6976branch-less equivalents. The intent is to remove control-flow from
6977the innermost loops in order to improve the ability of the
6978vectorization pass to handle these loops. This is enabled by default
6979if vectorization is enabled.
6980
bd544141
SP
6981@item -ftree-loop-if-convert-stores
6982Attempt to also if-convert conditional jumps containing memory writes.
6983This transformation can be unsafe for multi-threaded programs as it
6984transforms conditional memory writes into unconditional memory writes.
6985For example,
6986@smallexample
6987for (i = 0; i < N; i++)
6988 if (cond)
6989 A[i] = expr;
6990@end smallexample
6991would be transformed to
6992@smallexample
6993for (i = 0; i < N; i++)
6994 A[i] = cond ? expr : A[i];
6995@end smallexample
6996potentially producing data races.
6997
dea61d92
SP
6998@item -ftree-loop-distribution
6999Perform loop distribution. This flag can improve cache performance on
7000big loop bodies and allow further loop optimizations, like
9886a872
SP
7001parallelization or vectorization, to take place. For example, the loop
7002@smallexample
7003DO I = 1, N
7004 A(I) = B(I) + C
7005 D(I) = E(I) * F
7006ENDDO
7007@end smallexample
7008is transformed to
7009@smallexample
7010DO I = 1, N
7011 A(I) = B(I) + C
7012ENDDO
7013DO I = 1, N
7014 D(I) = E(I) * F
7015ENDDO
7016@end smallexample
dea61d92 7017
20769d5e
SP
7018@item -ftree-loop-distribute-patterns
7019Perform loop distribution of patterns that can be code generated with
7020calls to a library. This flag is enabled by default at @option{-O3}.
7021
7022This pass distributes the initialization loops and generates a call to
7023memset zero. For example, the loop
7024@smallexample
7025DO I = 1, N
7026 A(I) = 0
7027 B(I) = A(I) + I
7028ENDDO
7029@end smallexample
7030is transformed to
7031@smallexample
7032DO I = 1, N
7033 A(I) = 0
7034ENDDO
7035DO I = 1, N
7036 B(I) = A(I) + I
7037ENDDO
7038@end smallexample
7039and the initialization loop is transformed into a call to memset zero.
7040
3450cbc4 7041@item -ftree-loop-im
7d95b692 7042@opindex ftree-loop-im
3450cbc4 7043Perform loop invariant motion on trees. This pass moves only invariants that
ec7dea0a 7044would be hard to handle at RTL level (function calls, operations that expand to
a7e5372d
ZD
7045nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
7046operands of conditions that are invariant out of the loop, so that we can use
7047just trivial invariantness analysis in loop unswitching. The pass also includes
7048store motion.
7049
3450cbc4 7050@item -ftree-loop-ivcanon
7d95b692 7051@opindex ftree-loop-ivcanon
82b85a85
ZD
7052Create a canonical counter for number of iterations in the loop for that
7053determining number of iterations requires complicated analysis. Later
7054optimizations then may determine the number easily. Useful especially
7055in connection with unrolling.
7056
8b11a64c 7057@item -fivopts
7d95b692 7058@opindex fivopts
8b11a64c
ZD
7059Perform induction variable optimizations (strength reduction, induction
7060variable merging and induction variable elimination) on trees.
7061
5f40b3cb 7062@item -ftree-parallelize-loops=n
d228aace 7063@opindex ftree-parallelize-loops
5f40b3cb
ZD
7064Parallelize loops, i.e., split their iteration space to run in n threads.
7065This is only possible for loops whose iterations are independent
7066and can be arbitrarily reordered. The optimization is only
7067profitable on multiprocessor machines, for loops that are CPU-intensive,
021efafc 7068rather than constrained e.g.@: by memory bandwidth. This option
01a550c2
SP
7069implies @option{-pthread}, and thus is only supported on targets
7070that have support for @option{-pthread}.
5f40b3cb 7071
248fc9f3
RG
7072@item -ftree-pta
7073@opindex ftree-pta
7074Perform function-local points-to analysis on trees. This flag is
7075enabled by default at @option{-O} and higher.
7076
6de9cd9a 7077@item -ftree-sra
7d95b692 7078@opindex ftree-sra
6de9cd9a
DN
7079Perform scalar replacement of aggregates. This pass replaces structure
7080references with scalars to prevent committing structures to memory too
4ec7afd7 7081early. This flag is enabled by default at @option{-O} and higher.
6de9cd9a
DN
7082
7083@item -ftree-copyrename
7d95b692 7084@opindex ftree-copyrename
f26c1794
EC
7085Perform copy renaming on trees. This pass attempts to rename compiler
7086temporaries to other variables at copy locations, usually resulting in
7087variable names which more closely resemble the original variables. This flag
4ec7afd7 7088is enabled by default at @option{-O} and higher.
6de9cd9a
DN
7089
7090@item -ftree-ter
7d95b692 7091@opindex ftree-ter
6de9cd9a 7092Perform temporary expression replacement during the SSA->normal phase. Single
f26c1794
EC
7093use/single def temporaries are replaced at their use location with their
7094defining expression. This results in non-GIMPLE code, but gives the expanders
6de9cd9a 7095much more complex trees to work on resulting in better RTL generation. This is
4ec7afd7 7096enabled by default at @option{-O} and higher.
6de9cd9a 7097
79fe1b3b 7098@item -ftree-vectorize
7d95b692 7099@opindex ftree-vectorize
4e359692
IR
7100Perform loop vectorization on trees. This flag is enabled by default at
7101@option{-O3}.
79fe1b3b 7102
ca0b0bf8
IR
7103@item -ftree-slp-vectorize
7104@opindex ftree-slp-vectorize
7105Perform basic block vectorization on trees. This flag is enabled by default at
7106@option{-O3} and when @option{-ftree-vectorize} is enabled.
7107
c12cc930
KB
7108@item -ftree-vect-loop-version
7109@opindex ftree-vect-loop-version
7110Perform loop versioning when doing loop vectorization on trees. When a loop
7111appears to be vectorizable except that data alignment or data dependence cannot
7112be determined at compile time then vectorized and non-vectorized versions of
7113the loop are generated along with runtime checks for alignment or dependence
7114to control which version is executed. This option is enabled by default
7115except at level @option{-Os} where it is disabled.
7116
792ed98b 7117@item -fvect-cost-model
7d95b692 7118@opindex fvect-cost-model
792ed98b
HJ
7119Enable cost model for vectorization.
7120
08873e96 7121@item -ftree-vrp
7d95b692 7122@opindex ftree-vrp
08873e96
DN
7123Perform Value Range Propagation on trees. This is similar to the
7124constant propagation pass, but instead of values, ranges of values are
7125propagated. This allows the optimizers to remove unnecessary range
7126checks like array bound checks and null pointer checks. This is
7127enabled by default at @option{-O2} and higher. Null pointer check
7128elimination is only done if @option{-fdelete-null-pointer-checks} is
7129enabled.
7130
6de9cd9a
DN
7131@item -ftracer
7132@opindex ftracer
8a36672b 7133Perform tail duplication to enlarge superblock size. This transformation
6de9cd9a
DN
7134simplifies the control flow of the function allowing other optimizations to do
7135better job.
7136
7137@item -funroll-loops
7138@opindex funroll-loops
7139Unroll loops whose number of iterations can be determined at compile
efa1cdf0
ZD
7140time or upon entry to the loop. @option{-funroll-loops} implies
7141@option{-frerun-cse-after-loop}. This option makes code larger,
7142and may or may not make it run faster.
6de9cd9a
DN
7143
7144@item -funroll-all-loops
7145@opindex funroll-all-loops
7146Unroll all loops, even if their number of iterations is uncertain when
7147the loop is entered. This usually makes programs run more slowly.
7148@option{-funroll-all-loops} implies the same options as
7149@option{-funroll-loops},
7150
113d659a 7151@item -fsplit-ivs-in-unroller
edc5f63b 7152@opindex fsplit-ivs-in-unroller
113d659a
ZD
7153Enables expressing of values of induction variables in later iterations
7154of the unrolled loop using the value in the first iteration. This breaks
7869fe47 7155long dependency chains, thus improving efficiency of the scheduling passes.
113d659a
ZD
7156
7157Combination of @option{-fweb} and CSE is often sufficient to obtain the
8a36672b 7158same effect. However in cases the loop body is more complicated than
113d659a
ZD
7159a single basic block, this is not reliable. It also does not work at all
7160on some of the architectures due to restrictions in the CSE pass.
7161
7162This optimization is enabled by default.
7163
f37a4f14 7164@item -fvariable-expansion-in-unroller
edc5f63b 7165@opindex fvariable-expansion-in-unroller
f0eb93a8 7166With this option, the compiler will create multiple copies of some
f37a4f14
RE
7167local variables when unrolling a loop which can result in superior code.
7168
3e485f62
JH
7169@item -fpartial-inlining
7170@opindex fpartial-inlining
7171Inline parts of functions. This option has any effect only
7172when inlining itself is turned on by the @option{-finline-functions}
7173or @option{-finline-small-functions} options.
7174
7175Enabled at level @option{-O2}.
7176
bbc8a8dc
ZD
7177@item -fpredictive-commoning
7178@opindex fpredictive-commoning
7179Perform predictive commoning optimization, i.e., reusing computations
7180(especially memory loads and stores) performed in previous
7181iterations of loops.
7182
7183This option is enabled at level @option{-O3}.
7184
6de9cd9a
DN
7185@item -fprefetch-loop-arrays
7186@opindex fprefetch-loop-arrays
7187If supported by the target machine, generate instructions to prefetch
7188memory to improve the performance of loops that access large arrays.
7189
efa1cdf0 7190This option may generate better or worse code; results are highly
e5eb27e5
JL
7191dependent on the structure of loops within the source code.
7192
efa1cdf0
ZD
7193Disabled at level @option{-Os}.
7194
74291a4b 7195@item -fno-peephole
6cfc0341 7196@itemx -fno-peephole2
cd3bb277 7197@opindex fno-peephole
6cfc0341
RH
7198@opindex fno-peephole2
7199Disable any machine-specific peephole optimizations. The difference
630d3d5a 7200between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6cfc0341
RH
7201are implemented in the compiler; some targets use one, some use the
7202other, a few use both.
861bb6c1 7203
38df970e
JQ
7204@option{-fpeephole} is enabled by default.
7205@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7206
454d0cc7 7207@item -fno-guess-branch-probability
cd3bb277 7208@opindex fno-guess-branch-probability
ddd8e3ca
JW
7209Do not guess branch probabilities using heuristics.
7210
7211GCC will use heuristics to guess branch probabilities if they are
7212not provided by profiling feedback (@option{-fprofile-arcs}). These
7213heuristics are based on the control flow graph. If some branch probabilities
7214are specified by @samp{__builtin_expect}, then the heuristics will be
7215used to guess branch probabilities for the rest of the control flow graph,
7216taking the @samp{__builtin_expect} info into account. The interactions
7217between the heuristics and @samp{__builtin_expect} can be complex, and in
7218some cases, it may be useful to disable the heuristics so that the effects
7219of @samp{__builtin_expect} are easier to understand.
454d0cc7 7220
38df970e
JQ
7221The default is @option{-fguess-branch-probability} at levels
7222@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7223
194734e9
JH
7224@item -freorder-blocks
7225@opindex freorder-blocks
7226Reorder basic blocks in the compiled function in order to reduce number of
7227taken branches and improve code locality.
7228
3f8b659d 7229Enabled at levels @option{-O2}, @option{-O3}.
38df970e 7230
750054a2
CT
7231@item -freorder-blocks-and-partition
7232@opindex freorder-blocks-and-partition
7233In addition to reordering basic blocks in the compiled function, in order
7234to reduce number of taken branches, partitions hot and cold basic blocks
7235into separate sections of the assembly and .o files, to improve
7236paging and cache locality performance.
7237
8e8d5162
CT
7238This optimization is automatically turned off in the presence of
7239exception handling, for linkonce sections, for functions with a user-defined
7240section attribute and on any architecture that does not support named
7241sections.
7242
194734e9
JH
7243@item -freorder-functions
7244@opindex freorder-functions
3e8cb558
JM
7245Reorder functions in the object file in order to
7246improve code locality. This is implemented by using special
3a4bdd05
RH
7247subsections @code{.text.hot} for most frequently executed functions and
7248@code{.text.unlikely} for unlikely executed functions. Reordering is done by
194734e9 7249the linker so object file format must support named sections and linker must
3364c33b 7250place them in a reasonable way.
194734e9
JH
7251
7252Also profile feedback must be available in to make this option effective. See
7253@option{-fprofile-arcs} for details.
7254
38df970e
JQ
7255Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
7256
41472af8 7257@item -fstrict-aliasing
cd3bb277 7258@opindex fstrict-aliasing
460ba396 7259Allow the compiler to assume the strictest aliasing rules applicable to
41472af8
MM
7260the language being compiled. For C (and C++), this activates
7261optimizations based on the type of expressions. In particular, an
7262object of one type is assumed never to reside at the same address as an
7263object of a different type, unless the types are almost the same. For
7264example, an @code{unsigned int} can alias an @code{int}, but not a
7265@code{void*} or a @code{double}. A character type may alias any other
02f52e19 7266type.
41472af8 7267
917db97b 7268@anchor{Type-punning}Pay special attention to code like this:
3ab51846 7269@smallexample
02f52e19 7270union a_union @{
41472af8
MM
7271 int i;
7272 double d;
7273@};
7274
7275int f() @{
460ba396 7276 union a_union t;
41472af8
MM
7277 t.d = 3.0;
7278 return t.i;
7279@}
3ab51846 7280@end smallexample
41472af8
MM
7281The practice of reading from a different union member than the one most
7282recently written to (called ``type-punning'') is common. Even with
630d3d5a 7283@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
41472af8 7284is accessed through the union type. So, the code above will work as
917db97b
HPN
7285expected. @xref{Structures unions enumerations and bit-fields
7286implementation}. However, this code might not:
3ab51846 7287@smallexample
02f52e19 7288int f() @{
460ba396 7289 union a_union t;
41472af8
MM
7290 int* ip;
7291 t.d = 3.0;
7292 ip = &t.i;
7293 return *ip;
7294@}
3ab51846 7295@end smallexample
41472af8 7296
917db97b
HPN
7297Similarly, access by taking the address, casting the resulting pointer
7298and dereferencing the result has undefined behavior, even if the cast
7299uses a union type, e.g.:
7300@smallexample
7301int f() @{
7302 double d = 3.0;
7303 return ((union a_union *) &d)->i;
7304@}
7305@end smallexample
7306
7307The @option{-fstrict-aliasing} option is enabled at levels
7308@option{-O2}, @option{-O3}, @option{-Os}.
852b81bb 7309
eeef0e45
ILT
7310@item -fstrict-overflow
7311@opindex fstrict-overflow
7312Allow the compiler to assume strict signed overflow rules, depending
7313on the language being compiled. For C (and C++) this means that
7314overflow when doing arithmetic with signed numbers is undefined, which
7315means that the compiler may assume that it will not happen. This
7316permits various optimizations. For example, the compiler will assume
7317that an expression like @code{i + 10 > i} will always be true for
7318signed @code{i}. This assumption is only valid if signed overflow is
7319undefined, as the expression is false if @code{i + 10} overflows when
7320using twos complement arithmetic. When this option is in effect any
7321attempt to determine whether an operation on signed numbers will
7322overflow must be written carefully to not actually involve overflow.
7323
4c9db6e0
ILT
7324This option also allows the compiler to assume strict pointer
7325semantics: given a pointer to an object, if adding an offset to that
7326pointer does not produce a pointer to the same object, the addition is
7327undefined. This permits the compiler to conclude that @code{p + u >
7328p} is always true for a pointer @code{p} and unsigned integer
7329@code{u}. This assumption is only valid because pointer wraparound is
7330undefined, as the expression is false if @code{p + u} overflows using
7331twos complement arithmetic.
7332
eeef0e45 7333See also the @option{-fwrapv} option. Using @option{-fwrapv} means
4c9db6e0 7334that integer signed overflow is fully defined: it wraps. When
eeef0e45 7335@option{-fwrapv} is used, there is no difference between
4c9db6e0
ILT
7336@option{-fstrict-overflow} and @option{-fno-strict-overflow} for
7337integers. With @option{-fwrapv} certain types of overflow are
7338permitted. For example, if the compiler gets an overflow when doing
7339arithmetic on constants, the overflowed value can still be used with
eeef0e45
ILT
7340@option{-fwrapv}, but not otherwise.
7341
7342The @option{-fstrict-overflow} option is enabled at levels
7343@option{-O2}, @option{-O3}, @option{-Os}.
7344
efa3896a
GK
7345@item -falign-functions
7346@itemx -falign-functions=@var{n}
cd3bb277 7347@opindex falign-functions
efa3896a
GK
7348Align the start of functions to the next power-of-two greater than
7349@var{n}, skipping up to @var{n} bytes. For instance,
630d3d5a
JM
7350@option{-falign-functions=32} aligns functions to the next 32-byte
7351boundary, but @option{-falign-functions=24} would align to the next
efa3896a
GK
735232-byte boundary only if this can be done by skipping 23 bytes or less.
7353
630d3d5a 7354@option{-fno-align-functions} and @option{-falign-functions=1} are
efa3896a
GK
7355equivalent and mean that functions will not be aligned.
7356
7357Some assemblers only support this flag when @var{n} is a power of two;
7358in that case, it is rounded up.
7359
561913cb 7360If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 7361
38df970e
JQ
7362Enabled at levels @option{-O2}, @option{-O3}.
7363
efa3896a
GK
7364@item -falign-labels
7365@itemx -falign-labels=@var{n}
cd3bb277 7366@opindex falign-labels
efa3896a 7367Align all branch targets to a power-of-two boundary, skipping up to
630d3d5a 7368@var{n} bytes like @option{-falign-functions}. This option can easily
efa3896a
GK
7369make code slower, because it must insert dummy operations for when the
7370branch target is reached in the usual flow of the code.
7371
561913cb
AP
7372@option{-fno-align-labels} and @option{-falign-labels=1} are
7373equivalent and mean that labels will not be aligned.
7374
630d3d5a 7375If @option{-falign-loops} or @option{-falign-jumps} are applicable and
efa3896a
GK
7376are greater than this value, then their values are used instead.
7377
561913cb
AP
7378If @var{n} is not specified or is zero, use a machine-dependent default
7379which is very likely to be @samp{1}, meaning no alignment.
efa3896a 7380
38df970e
JQ
7381Enabled at levels @option{-O2}, @option{-O3}.
7382
efa3896a
GK
7383@item -falign-loops
7384@itemx -falign-loops=@var{n}
cd3bb277 7385@opindex falign-loops
efa3896a 7386Align loops to a power-of-two boundary, skipping up to @var{n} bytes
630d3d5a 7387like @option{-falign-functions}. The hope is that the loop will be
efa3896a
GK
7388executed many times, which will make up for any execution of the dummy
7389operations.
7390
561913cb
AP
7391@option{-fno-align-loops} and @option{-falign-loops=1} are
7392equivalent and mean that loops will not be aligned.
7393
7394If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 7395
38df970e
JQ
7396Enabled at levels @option{-O2}, @option{-O3}.
7397
efa3896a
GK
7398@item -falign-jumps
7399@itemx -falign-jumps=@var{n}
cd3bb277 7400@opindex falign-jumps
efa3896a
GK
7401Align branch targets to a power-of-two boundary, for branch targets
7402where the targets can only be reached by jumping, skipping up to @var{n}
630d3d5a 7403bytes like @option{-falign-functions}. In this case, no dummy operations
efa3896a
GK
7404need be executed.
7405
561913cb
AP
7406@option{-fno-align-jumps} and @option{-falign-jumps=1} are
7407equivalent and mean that loops will not be aligned.
7408
7409If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 7410
38df970e
JQ
7411Enabled at levels @option{-O2}, @option{-O3}.
7412
7797ff53
PB
7413@item -funit-at-a-time
7414@opindex funit-at-a-time
d6cc6ec9
JH
7415This option is left for compatibility reasons. @option{-funit-at-a-time}
7416has no effect, while @option{-fno-unit-at-a-time} implies
7417@option{-fno-toplevel-reorder} and @option{-fno-section-anchors}.
7797ff53 7418
d6cc6ec9 7419Enabled by default.
7797ff53 7420
474eccc6 7421@item -fno-toplevel-reorder
e0d91975 7422@opindex fno-toplevel-reorder
474eccc6
ILT
7423Do not reorder top-level functions, variables, and @code{asm}
7424statements. Output them in the same order that they appear in the
7425input file. When this option is used, unreferenced static variables
7426will not be removed. This option is intended to support existing code
7427which relies on a particular ordering. For new code, it is better to
7428use attributes.
7429
d6cc6ec9
JH
7430Enabled at level @option{-O0}. When disabled explicitly, it also imply
7431@option{-fno-section-anchors} that is otherwise enabled at @option{-O0} on some
7432targets.
7433
7260e9a0
JH
7434@item -fweb
7435@opindex fweb
7436Constructs webs as commonly used for register allocation purposes and assign
962e6e00 7437each web individual pseudo register. This allows the register allocation pass
7260e9a0
JH
7438to operate on pseudos directly, but also strengthens several other optimization
7439passes, such as CSE, loop optimizer and trivial dead code remover. It can,
7440however, make debugging impossible, since variables will no longer stay in a
7441``home register''.
7442
7869fe47 7443Enabled by default with @option{-funroll-loops}.
d4463dfc 7444
ce91e74c
JH
7445@item -fwhole-program
7446@opindex fwhole-program
e4ae5e77 7447Assume that the current compilation unit represents the whole program being
ce91e74c 7448compiled. All public functions and variables with the exception of @code{main}
f341de7b 7449and those merged by attribute @code{externally_visible} become static functions
6d41cd02 7450and in effect are optimized more aggressively by interprocedural optimizers. If @command{gold} is used as the linker plugin, @code{externally_visible} attributes are automatically added to functions (not variable yet due to a current @command{gold} issue) that are accessed outside of LTO objects according to resolution file produced by @command{gold}. For other linkers that cannot generate resolution file, explicit @code{externally_visible} attributes are still necessary.
e4ae5e77
RW
7451While this option is equivalent to proper use of the @code{static} keyword for
7452programs consisting of a single file, in combination with option
014d92e1 7453@option{-flto} this flag can be used to
05927e0d
TB
7454compile many smaller scale programs since the functions and variables become
7455local for the whole combined compilation unit, not for the single source file
7456itself.
ce91e74c 7457
ebaa6ea7 7458This option implies @option{-fwhole-file} for Fortran programs.
ce91e74c 7459
014d92e1 7460@item -flto[=@var{n}]
d7f09764
DN
7461@opindex flto
7462This option runs the standard link-time optimizer. When invoked
7463with source code, it generates GIMPLE (one of GCC's internal
7464representations) and writes it to special ELF sections in the object
7465file. When the object files are linked together, all the function
7466bodies are read from these ELF sections and instantiated as if they
7467had been part of the same translation unit.
7468
7469To use the link-timer optimizer, @option{-flto} needs to be specified at
7470compile time and during the final link. For example,
7471
7472@smallexample
7473gcc -c -O2 -flto foo.c
7474gcc -c -O2 -flto bar.c
7475gcc -o myprog -flto -O2 foo.o bar.o
7476@end smallexample
7477
7478The first two invocations to GCC will save a bytecode representation
7479of GIMPLE into special ELF sections inside @file{foo.o} and
7480@file{bar.o}. The final invocation will read the GIMPLE bytecode from
7481@file{foo.o} and @file{bar.o}, merge the two files into a single
7482internal image, and compile the result as usual. Since both
7483@file{foo.o} and @file{bar.o} are merged into a single image, this
7484causes all the inter-procedural analyses and optimizations in GCC to
7485work across the two files as if they were a single one. This means,
7486for example, that the inliner will be able to inline functions in
7487@file{bar.o} into functions in @file{foo.o} and vice-versa.
7488
7489Another (simpler) way to enable link-time optimization is,
7490
7491@smallexample
7492gcc -o myprog -flto -O2 foo.c bar.c
7493@end smallexample
7494
7495The above will generate bytecode for @file{foo.c} and @file{bar.c},
7496merge them together into a single GIMPLE representation and optimize
7497them as usual to produce @file{myprog}.
7498
7499The only important thing to keep in mind is that to enable link-time
7500optimizations the @option{-flto} flag needs to be passed to both the
7501compile and the link commands.
7502
3abe8cab
JH
7503To make whole program optimization effective, it is necesary to make
7504certain whole program assumptions. The compiler needs to know
7505what functions and variables can be accessed by libraries and runtime
7506outside of the link time optimized unit. When supported by the linker,
7507the linker plugin (see @option{-fuse-linker-plugin}) passes to the
7508compiler information about used and externally visible symbols. When
7509the linker plugin is not available, @option{-fwhole-program} should be
7510used to allow the compiler to make these assumptions, which will lead
7511to more aggressive optimization decisions.
7512
d7f09764
DN
7513Note that when a file is compiled with @option{-flto}, the generated
7514object file will be larger than a regular object file because it will
7515contain GIMPLE bytecodes and the usual final code. This means that
7516object files with LTO information can be linked as a normal object
7517file. So, in the previous example, if the final link is done with
7518
7519@smallexample
7520gcc -o myprog foo.o bar.o
7521@end smallexample
7522
7523The only difference will be that no inter-procedural optimizations
7524will be applied to produce @file{myprog}. The two object files
7525@file{foo.o} and @file{bar.o} will be simply sent to the regular
7526linker.
7527
7528Additionally, the optimization flags used to compile individual files
7529are not necessarily related to those used at link-time. For instance,
7530
7531@smallexample
7532gcc -c -O0 -flto foo.c
7533gcc -c -O0 -flto bar.c
7534gcc -o myprog -flto -O3 foo.o bar.o
7535@end smallexample
7536
7537This will produce individual object files with unoptimized assembler
7538code, but the resulting binary @file{myprog} will be optimized at
7539@option{-O3}. Now, if the final binary is generated without
7540@option{-flto}, then @file{myprog} will not be optimized.
7541
7542When producing the final binary with @option{-flto}, GCC will only
7543apply link-time optimizations to those files that contain bytecode.
7544Therefore, you can mix and match object files and libraries with
7545GIMPLE bytecodes and final object code. GCC will automatically select
7546which files to optimize in LTO mode and which files to link without
7547further processing.
7548
7549There are some code generation flags that GCC will preserve when
7550generating bytecodes, as they need to be used during the final link
7551stage. Currently, the following options are saved into the GIMPLE
7552bytecode files: @option{-fPIC}, @option{-fcommon} and all the
7553@option{-m} target flags.
7554
7555At link time, these options are read-in and reapplied. Note that the
7556current implementation makes no attempt at recognizing conflicting
7557values for these options. If two or more files have a conflicting
7558value (e.g., one file is compiled with @option{-fPIC} and another
7559isn't), the compiler will simply use the last value read from the
7560bytecode files. It is recommended, then, that all the files
7561participating in the same link be compiled with the same options.
7562
7563Another feature of LTO is that it is possible to apply interprocedural
7564optimizations on files written in different languages. This requires
7565some support in the language front end. Currently, the C, C++ and
7566Fortran front ends are capable of emitting GIMPLE bytecodes, so
7567something like this should work
7568
7569@smallexample
7570gcc -c -flto foo.c
7571g++ -c -flto bar.cc
7572gfortran -c -flto baz.f90
7573g++ -o myprog -flto -O3 foo.o bar.o baz.o -lgfortran
7574@end smallexample
7575
7576Notice that the final link is done with @command{g++} to get the C++
7577runtime libraries and @option{-lgfortran} is added to get the Fortran
7578runtime libraries. In general, when mixing languages in LTO mode, you
7579should use the same link command used when mixing languages in a
7580regular (non-LTO) compilation. This means that if your build process
7581was mixing languages before, all you need to add is @option{-flto} to
7582all the compile and link commands.
7583
53b79425
RW
7584If LTO encounters objects with C linkage declared with incompatible
7585types in separate translation units to be linked together (undefined
7586behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
7587issued. The behavior is still undefined at runtime.
7588
d7f09764
DN
7589If object files containing GIMPLE bytecode are stored in a library
7590archive, say @file{libfoo.a}, it is possible to extract and use them
7591in an LTO link if you are using @command{gold} as the linker (which,
7592in turn requires GCC to be configured with @option{--enable-gold}).
180a2539 7593To enable this feature, use the flag @option{-fuse-linker-plugin} at
d7f09764
DN
7594link-time:
7595
7596@smallexample
180a2539 7597gcc -o myprog -O2 -flto -fuse-linker-plugin a.o b.o -lfoo
d7f09764
DN
7598@end smallexample
7599
7600With the linker plugin enabled, @command{gold} will extract the needed
7601GIMPLE files from @file{libfoo.a} and pass them on to the running GCC
7602to make them part of the aggregated GIMPLE image to be optimized.
7603
7604If you are not using @command{gold} and/or do not specify
180a2539 7605@option{-fuse-linker-plugin} then the objects inside @file{libfoo.a}
d7f09764
DN
7606will be extracted and linked as usual, but they will not participate
7607in the LTO optimization process.
7608
014d92e1
JH
7609Link time optimizations do not require the presence of the whole program to
7610operate. If the program does not require any symbols to be exported, it is
7611possible to combine @option{-flto} and with @option{-fwhole-program} to allow
7612the interprocedural optimizers to use more aggressive assumptions which may
7613lead to improved optimization opportunities.
7614Use of @option{-fwhole-program} is not needed when linker plugin is
7615active (see @option{-fuse-linker-plugin}).
05927e0d 7616
d7f09764
DN
7617Regarding portability: the current implementation of LTO makes no
7618attempt at generating bytecode that can be ported between different
7619types of hosts. The bytecode files are versioned and there is a
7620strict version check, so bytecode files generated in one version of
7621GCC will not work with an older/newer version of GCC.
7622
2a71eb48 7623Link time optimization does not play well with generating debugging
014d92e1 7624information. Combining @option{-flto} with
3abe8cab
JH
7625@option{-g} is currently experimental and expected to produce wrong
7626results.
2a71eb48 7627
3abe8cab
JH
7628If you specify the optional @var{n}, the optimization and code
7629generation done at link time is executed in parallel using @var{n}
7630parallel jobs by utilizing an installed @command{make} program. The
7631environment variable @env{MAKE} may be used to override the program
7632used. The default value for @var{n} is 1.
c04b6b38 7633
3abe8cab 7634You can also specify @option{-flto=jobserver} to use GNU make's
a478ffff 7635job server mode to determine the number of parallel jobs. This
3abe8cab 7636is useful when the Makefile calling GCC is already executing in parallel.
a478ffff
AK
7637The parent Makefile will need a @samp{+} prepended to the command recipe
7638for this to work. This will likely only work if @env{MAKE} is
7639GNU make.
7640
014d92e1 7641This option is disabled by default.
d7f09764 7642
852e4bd2
JH
7643@item -flto-partition=@var{alg}
7644@opindex flto-partition
3abe8cab
JH
7645Specify the partitioning algorithm used by the link time optimizer.
7646The value is either @code{1to1} to specify a partitioning mirroring
7647the original source files or @code{balanced} to specify partitioning
7648into equally sized chunks (whenever possible). Specifying @code{none}
7649as an algorithm disables partitioning and streaming completely. The
7650default value is @code{balanced}.
d7f09764
DN
7651
7652@item -flto-compression-level=@var{n}
7653This option specifies the level of compression used for intermediate
7654language written to LTO object files, and is only meaningful in
3abe8cab 7655conjunction with LTO mode (@option{-flto}). Valid
d7f09764
DN
7656values are 0 (no compression) to 9 (maximum compression). Values
7657outside this range are clamped to either 0 or 9. If the option is not
7658given, a default balanced compression setting is used.
7659
7660@item -flto-report
7661Prints a report with internal details on the workings of the link-time
7662optimizer. The contents of this report vary from version to version,
7663it is meant to be useful to GCC developers when processing object
3abe8cab 7664files in LTO mode (via @option{-flto}).
d7f09764
DN
7665
7666Disabled by default.
7667
180a2539 7668@item -fuse-linker-plugin
d7f09764
DN
7669Enables the extraction of objects with GIMPLE bytecode information
7670from library archives. This option relies on features available only
7671in @command{gold}, so to use this you must configure GCC with
7672@option{--enable-gold}. See @option{-flto} for a description on the
7673effect of this flag and how to use it.
7674
7675Disabled by default.
7676
d228aace
JJ
7677@item -fcprop-registers
7678@opindex fcprop-registers
d4463dfc
JQ
7679After register allocation and post-register allocation instruction splitting,
7680we perform a copy-propagation pass to try to reduce scheduling dependencies
7681and occasionally eliminate the copy.
7682
d228aace 7683Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
d4463dfc 7684
52c76998
PY
7685@item -fprofile-correction
7686@opindex fprofile-correction
7687Profiles collected using an instrumented binary for multi-threaded programs may
7688be inconsistent due to missed counter updates. When this option is specified,
7689GCC will use heuristics to correct or smooth out such inconsistencies. By
7690default, GCC will emit an error message when an inconsistent profile is detected.
7691
2f908293
SP
7692@item -fprofile-dir=@var{path}
7693@opindex fprofile-dir
7694
7695Set the directory to search the profile data files in to @var{path}.
7696This option affects only the profile data generated by
7697@option{-fprofile-generate}, @option{-ftest-coverage}, @option{-fprofile-arcs}
7a61cf6f 7698and used by @option{-fprofile-use} and @option{-fbranch-probabilities}
2f908293
SP
7699and its related options.
7700By default, GCC will use the current directory as @var{path}
7701thus the profile data file will appear in the same directory as the object file.
7702
a8a5f53a 7703@item -fprofile-generate
2f908293 7704@itemx -fprofile-generate=@var{path}
a8a5f53a 7705@opindex fprofile-generate
a8a5f53a 7706
33adcb6c
MM
7707Enable options usually used for instrumenting application to produce
7708profile useful for later recompilation with profile feedback based
4ec7afd7 7709optimization. You must use @option{-fprofile-generate} both when
33adcb6c
MM
7710compiling and when linking your program.
7711
7712The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
a8a5f53a 7713
2f908293 7714If @var{path} is specified, GCC will look at the @var{path} to find
a640c13b 7715the profile feedback data files. See @option{-fprofile-dir}.
2f908293 7716
a8a5f53a 7717@item -fprofile-use
2f908293 7718@itemx -fprofile-use=@var{path}
a8a5f53a
JH
7719@opindex fprofile-use
7720Enable profile feedback directed optimizations, and optimizations
7721generally profitable only with profile feedback available.
7722
8a76829c 7723The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
37818e7c 7724@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
a8a5f53a 7725
16c1c158
RG
7726By default, GCC emits an error message if the feedback profiles do not
7727match the source code. This error can be turned into a warning by using
7728@option{-Wcoverage-mismatch}. Note this may result in poorly optimized
7729code.
2f908293
SP
7730
7731If @var{path} is specified, GCC will look at the @var{path} to find
7732the profile feedback data files. See @option{-fprofile-dir}.
d4463dfc
JQ
7733@end table
7734
7735The following options control compiler behavior regarding floating
7736point arithmetic. These options trade off between speed and
7737correctness. All must be specifically enabled.
7738
7739@table @gcctabopt
7740@item -ffloat-store
7741@opindex ffloat-store
7742Do not store floating point variables in registers, and inhibit other
7743options that might change whether a floating point value is taken from a
7744register or memory.
7745
7746@cindex floating point precision
7747This option prevents undesirable excess precision on machines such as
7748the 68000 where the floating registers (of the 68881) keep more
7749precision than a @code{double} is supposed to have. Similarly for the
7750x86 architecture. For most programs, the excess precision does only
7751good, but a few programs rely on the precise definition of IEEE floating
7752point. Use @option{-ffloat-store} for such programs, after modifying
7753them to store all pertinent intermediate computations into variables.
7754
8ce94e44
JM
7755@item -fexcess-precision=@var{style}
7756@opindex fexcess-precision
7757This option allows further control over excess precision on machines
7758where floating-point registers have more precision than the IEEE
7759@code{float} and @code{double} types and the processor does not
7760support operations rounding to those types. By default,
7761@option{-fexcess-precision=fast} is in effect; this means that
7762operations are carried out in the precision of the registers and that
7763it is unpredictable when rounding to the types specified in the source
7764code takes place. When compiling C, if
7765@option{-fexcess-precision=standard} is specified then excess
7766precision will follow the rules specified in ISO C99; in particular,
7767both casts and assignments cause values to be rounded to their
7768semantic types (whereas @option{-ffloat-store} only affects
7769assignments). This option is enabled by default for C if a strict
7770conformance option such as @option{-std=c99} is used.
7771
7772@opindex mfpmath
7773@option{-fexcess-precision=standard} is not implemented for languages
7774other than C, and has no effect if
7775@option{-funsafe-math-optimizations} or @option{-ffast-math} is
7776specified. On the x86, it also has no effect if @option{-mfpmath=sse}
7777or @option{-mfpmath=sse+387} is specified; in the former case, IEEE
7778semantics apply without excess precision, and in the latter, rounding
7779is unpredictable.
7780
d4463dfc
JQ
7781@item -ffast-math
7782@opindex ffast-math
4aba7b11
EB
7783Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
7784@option{-ffinite-math-only}, @option{-fno-rounding-math},
7785@option{-fno-signaling-nans} and @option{-fcx-limited-range}.
d4463dfc
JQ
7786
7787This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
7788
c9516c38 7789This option is not turned on by any @option{-O} option since
d4463dfc
JQ
7790it can result in incorrect output for programs which depend on
7791an exact implementation of IEEE or ISO rules/specifications for
c9516c38
WB
7792math functions. It may, however, yield faster code for programs
7793that do not require the guarantees of these specifications.
d4463dfc
JQ
7794
7795@item -fno-math-errno
7796@opindex fno-math-errno
7797Do not set ERRNO after calling math functions that are executed
7798with a single instruction, e.g., sqrt. A program that relies on
7799IEEE exceptions for math error handling may want to use this flag
7800for speed while maintaining IEEE arithmetic compatibility.
7801
c9516c38 7802This option is not turned on by any @option{-O} option since
d4463dfc
JQ
7803it can result in incorrect output for programs which depend on
7804an exact implementation of IEEE or ISO rules/specifications for
c9516c38
WB
7805math functions. It may, however, yield faster code for programs
7806that do not require the guarantees of these specifications.
d4463dfc
JQ
7807
7808The default is @option{-fmath-errno}.
7809
db02da79
RS
7810On Darwin systems, the math library never sets @code{errno}. There is
7811therefore no reason for the compiler to consider the possibility that
7812it might, and @option{-fno-math-errno} is the default.
2e3f0db6 7813
d4463dfc
JQ
7814@item -funsafe-math-optimizations
7815@opindex funsafe-math-optimizations
a1a82611 7816
d4463dfc
JQ
7817Allow optimizations for floating-point arithmetic that (a) assume
7818that arguments and results are valid and (b) may violate IEEE or
7819ANSI standards. When used at link-time, it may include libraries
7820or startup files that change the default FPU control word or other
7821similar optimizations.
7822
c9516c38 7823This option is not turned on by any @option{-O} option since
d4463dfc
JQ
7824it can result in incorrect output for programs which depend on
7825an exact implementation of IEEE or ISO rules/specifications for
c9516c38
WB
7826math functions. It may, however, yield faster code for programs
7827that do not require the guarantees of these specifications.
c5edab65
EB
7828Enables @option{-fno-signed-zeros}, @option{-fno-trapping-math},
7829@option{-fassociative-math} and @option{-freciprocal-math}.
d4463dfc
JQ
7830
7831The default is @option{-fno-unsafe-math-optimizations}.
7832
a1a82611 7833@item -fassociative-math
7d95b692 7834@opindex fassociative-math
a1a82611
RE
7835
7836Allow re-association of operands in series of floating-point operations.
7837This violates the ISO C and C++ language standard by possibly changing
7838computation result. NOTE: re-ordering may change the sign of zero as
7839well as ignore NaNs and inhibit or create underflow or overflow (and
7840thus cannot be used on a code which relies on rounding behavior like
7841@code{(x + 2**52) - 2**52)}. May also reorder floating-point comparisons
7842and thus may not be used when ordered comparisons are required.
c5edab65
EB
7843This option requires that both @option{-fno-signed-zeros} and
7844@option{-fno-trapping-math} be in effect. Moreover, it doesn't make
72bd130e
TB
7845much sense with @option{-frounding-math}. For Fortran the option
7846is automatically enabled when both @option{-fno-signed-zeros} and
7847@option{-fno-trapping-math} are in effect.
a1a82611
RE
7848
7849The default is @option{-fno-associative-math}.
7850
7851@item -freciprocal-math
7d95b692 7852@opindex freciprocal-math
a1a82611
RE
7853
7854Allow the reciprocal of a value to be used instead of dividing by
7855the value if this enables optimizations. For example @code{x / y}
7856can be replaced with @code{x * (1/y)} which is useful if @code{(1/y)}
7857is subject to common subexpression elimination. Note that this loses
7858precision and increases the number of flops operating on the value.
7859
7860The default is @option{-fno-reciprocal-math}.
7861
d4463dfc
JQ
7862@item -ffinite-math-only
7863@opindex ffinite-math-only
7864Allow optimizations for floating-point arithmetic that assume
7865that arguments and results are not NaNs or +-Infs.
7866
c9516c38 7867This option is not turned on by any @option{-O} option since
d4463dfc 7868it can result in incorrect output for programs which depend on
c9516c38
WB
7869an exact implementation of IEEE or ISO rules/specifications for
7870math functions. It may, however, yield faster code for programs
7871that do not require the guarantees of these specifications.
d4463dfc
JQ
7872
7873The default is @option{-fno-finite-math-only}.
7874
db02da79
RS
7875@item -fno-signed-zeros
7876@opindex fno-signed-zeros
7877Allow optimizations for floating point arithmetic that ignore the
7878signedness of zero. IEEE arithmetic specifies the behavior of
78681dbd
RS
7879distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
7880of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
db02da79
RS
7881This option implies that the sign of a zero result isn't significant.
7882
7883The default is @option{-fsigned-zeros}.
7884
d4463dfc
JQ
7885@item -fno-trapping-math
7886@opindex fno-trapping-math
7887Compile code assuming that floating-point operations cannot generate
7888user-visible traps. These traps include division by zero, overflow,
c5edab65
EB
7889underflow, inexact result and invalid operation. This option requires
7890that @option{-fno-signaling-nans} be in effect. Setting this option may
7891allow faster code if one relies on ``non-stop'' IEEE arithmetic, for example.
d4463dfc
JQ
7892
7893This option should never be turned on by any @option{-O} option since
7894it can result in incorrect output for programs which depend on
7895an exact implementation of IEEE or ISO rules/specifications for
7896math functions.
7897
7898The default is @option{-ftrapping-math}.
7899
039c3d42
RS
7900@item -frounding-math
7901@opindex frounding-math
7902Disable transformations and optimizations that assume default floating
7903point rounding behavior. This is round-to-zero for all floating point
7904to integer conversions, and round-to-nearest for all other arithmetic
7905truncations. This option should be specified for programs that change
7906the FP rounding mode dynamically, or that may be executed with a
7907non-default rounding mode. This option disables constant folding of
7908floating point expressions at compile-time (which may be affected by
7909rounding mode) and arithmetic transformations that are unsafe in the
7910presence of sign-dependent rounding modes.
7911
7912The default is @option{-fno-rounding-math}.
7913
7914This option is experimental and does not currently guarantee to
7915disable all GCC optimizations that are affected by rounding mode.
2dd76960 7916Future versions of GCC may provide finer control of this setting
039c3d42
RS
7917using C99's @code{FENV_ACCESS} pragma. This command line option
7918will be used to specify the default state for @code{FENV_ACCESS}.
7919
d4463dfc
JQ
7920@item -fsignaling-nans
7921@opindex fsignaling-nans
7922Compile code assuming that IEEE signaling NaNs may generate user-visible
7923traps during floating-point operations. Setting this option disables
7924optimizations that may change the number of exceptions visible with
7925signaling NaNs. This option implies @option{-ftrapping-math}.
7926
7927This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
7928be defined.
7929
7930The default is @option{-fno-signaling-nans}.
7931
7932This option is experimental and does not currently guarantee to
7933disable all GCC optimizations that affect signaling NaN behavior.
7934
7935@item -fsingle-precision-constant
7936@opindex fsingle-precision-constant
7937Treat floating point constant as single precision constant instead of
7938implicitly converting it to double precision constant.
7939
c7463669 7940@item -fcx-limited-range
c7463669 7941@opindex fcx-limited-range
c7463669 7942When enabled, this option states that a range reduction step is not
8cc6d3e0
JB
7943needed when performing complex division. Also, there is no checking
7944whether the result of a complex multiplication or division is @code{NaN
7945+ I*NaN}, with an attempt to rescue the situation in that case. The
7946default is @option{-fno-cx-limited-range}, but is enabled by
7947@option{-ffast-math}.
c7463669 7948
cb7ad97b 7949This option controls the default setting of the ISO C99
c7463669
RH
7950@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
7951all languages.
d4463dfc 7952
35085f76
JB
7953@item -fcx-fortran-rules
7954@opindex fcx-fortran-rules
7955Complex multiplication and division follow Fortran rules. Range
7956reduction is done as part of complex division, but there is no checking
7957whether the result of a complex multiplication or division is @code{NaN
7958+ I*NaN}, with an attempt to rescue the situation in that case.
7959
7960The default is @option{-fno-cx-fortran-rules}.
7961
d4463dfc
JQ
7962@end table
7963
7964The following options control optimizations that may improve
7965performance, but are not enabled by any @option{-O} options. This
7966section includes experimental options that may produce broken code.
7967
7968@table @gcctabopt
7969@item -fbranch-probabilities
7970@opindex fbranch-probabilities
7971After running a program compiled with @option{-fprofile-arcs}
7972(@pxref{Debugging Options,, Options for Debugging Your Program or
7973@command{gcc}}), you can compile it a second time using
7974@option{-fbranch-probabilities}, to improve optimizations based on
7975the number of times each branch was taken. When the program
7976compiled with @option{-fprofile-arcs} exits it saves arc execution
a4878735 7977counts to a file called @file{@var{sourcename}.gcda} for each source
bbd29fdc 7978file. The information in this data file is very dependent on the
d4463dfc
JQ
7979structure of the generated code, so you must use the same source code
7980and the same optimization options for both compilations.
7981
daf2f129 7982With @option{-fbranch-probabilities}, GCC puts a
d4463dfc
JQ
7983@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
7984These can be used to improve optimization. Currently, they are only
7985used in one place: in @file{reorg.c}, instead of guessing which path a
7986branch is mostly to take, the @samp{REG_BR_PROB} values are used to
7987exactly determine which path is taken more often.
7988
fc5eb4a1
ZD
7989@item -fprofile-values
7990@opindex fprofile-values
7991If combined with @option{-fprofile-arcs}, it adds code so that some
7992data about values of expressions in the program is gathered.
7993
6e885ee3
ZD
7994With @option{-fbranch-probabilities}, it reads back the data gathered
7995from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
7996notes to instructions for their later usage in optimizations.
7997
7797ff53 7998Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8d3b3fb7 7999
fca9dc00
ZD
8000@item -fvpt
8001@opindex fvpt
8002If combined with @option{-fprofile-arcs}, it instructs the compiler to add
8003a code to gather information about values of expressions.
8004
8005With @option{-fbranch-probabilities}, it reads back the data gathered
8006and actually performs the optimizations based on them.
8007Currently the optimizations include specialization of division operation
8008using the knowledge about the value of the denominator.
8009
a7b1dc36
PB
8010@item -frename-registers
8011@opindex frename-registers
8012Attempt to avoid false dependencies in scheduled code by making use
8013of registers left over after register allocation. This optimization
8014will most benefit processors with lots of registers. Depending on the
8015debug information format adopted by the target, however, it can
8016make debugging impossible, since variables will no longer stay in
8017a ``home register''.
8018
37740cd3 8019Enabled by default with @option{-funroll-loops} and @option{-fpeel-loops}.
a7b1dc36 8020
d4463dfc
JQ
8021@item -ftracer
8022@opindex ftracer
8a36672b 8023Perform tail duplication to enlarge superblock size. This transformation
d4463dfc
JQ
8024simplifies the control flow of the function allowing other optimizations to do
8025better job.
8026
7797ff53 8027Enabled with @option{-fprofile-use}.
8d3b3fb7 8028
d4463dfc
JQ
8029@item -funroll-loops
8030@opindex funroll-loops
b17d5d7c
ZD
8031Unroll loops whose number of iterations can be determined at compile time or
8032upon entry to the loop. @option{-funroll-loops} implies
cb7ad97b 8033@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
7869fe47
ZD
8034It also turns on complete loop peeling (i.e.@: complete removal of loops with
8035small constant number of iterations). This option makes code larger, and may
8036or may not make it run faster.
d4463dfc 8037
7797ff53 8038Enabled with @option{-fprofile-use}.
8d3b3fb7 8039
d4463dfc
JQ
8040@item -funroll-all-loops
8041@opindex funroll-all-loops
8042Unroll all loops, even if their number of iterations is uncertain when
8043the loop is entered. This usually makes programs run more slowly.
8044@option{-funroll-all-loops} implies the same options as
b17d5d7c
ZD
8045@option{-funroll-loops}.
8046
8047@item -fpeel-loops
8048@opindex fpeel-loops
8049Peels the loops for that there is enough information that they do not
8050roll much (from profile feedback). It also turns on complete loop peeling
431ae0bf 8051(i.e.@: complete removal of loops with small constant number of iterations).
b17d5d7c 8052
7797ff53 8053Enabled with @option{-fprofile-use}.
8d3b3fb7 8054
5e962776
ZD
8055@item -fmove-loop-invariants
8056@opindex fmove-loop-invariants
37818e7c 8057Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
5e962776
ZD
8058at level @option{-O1}
8059
b17d5d7c
ZD
8060@item -funswitch-loops
8061@opindex funswitch-loops
8062Move branches with loop invariant conditions out of the loop, with duplicates
8063of the loop on both branches (modified according to result of the condition).
8064
d4463dfc
JQ
8065@item -ffunction-sections
8066@itemx -fdata-sections
8067@opindex ffunction-sections
8068@opindex fdata-sections
8069Place each function or data item into its own section in the output
8070file if the target supports arbitrary sections. The name of the
8071function or the name of the data item determines the section's name
8072in the output file.
8073
8074Use these options on systems where the linker can perform optimizations
f401d0f5
JDA
8075to improve locality of reference in the instruction space. Most systems
8076using the ELF object format and SPARC processors running Solaris 2 have
8077linkers with such optimizations. AIX may have these optimizations in
8078the future.
d4463dfc
JQ
8079
8080Only use these options when there are significant benefits from doing
8081so. When you specify these options, the assembler and linker will
8082create larger object and executable files and will also be slower.
8083You will not be able to use @code{gprof} on all systems if you
8084specify this option and you may have problems with debugging if
8085you specify both this option and @option{-g}.
8086
fe3ad572
SC
8087@item -fbranch-target-load-optimize
8088@opindex fbranch-target-load-optimize
8089Perform branch target register load optimization before prologue / epilogue
8090threading.
8091The use of target registers can typically be exposed only during reload,
8092thus hoisting loads out of loops and doing inter-block scheduling needs
8093a separate optimization pass.
8094
8095@item -fbranch-target-load-optimize2
8096@opindex fbranch-target-load-optimize2
8097Perform branch target register load optimization after prologue / epilogue
8098threading.
8099
1194fc79
R
8100@item -fbtr-bb-exclusive
8101@opindex fbtr-bb-exclusive
8d3b3fb7 8102When performing branch target register load optimization, don't reuse
1194fc79
R
8103branch target registers in within any basic block.
8104
0aca9021 8105@item -fstack-protector
d228aace 8106@opindex fstack-protector
0aca9021
JW
8107Emit extra code to check for buffer overflows, such as stack smashing
8108attacks. This is done by adding a guard variable to functions with
8109vulnerable objects. This includes functions that call alloca, and
8110functions with buffers larger than 8 bytes. The guards are initialized
8111when a function is entered and then checked when the function exits.
8112If a guard check fails, an error message is printed and the program exits.
8113
8114@item -fstack-protector-all
d228aace 8115@opindex fstack-protector-all
0aca9021
JW
8116Like @option{-fstack-protector} except that all functions are protected.
8117
aacd3885
RS
8118@item -fsection-anchors
8119@opindex fsection-anchors
8120Try to reduce the number of symbolic address calculations by using
8121shared ``anchor'' symbols to address nearby objects. This transformation
8122can help to reduce the number of GOT entries and GOT accesses on some
8123targets.
8124
8125For example, the implementation of the following function @code{foo}:
8126
8127@smallexample
8128static int a, b, c;
8129int foo (void) @{ return a + b + c; @}
8130@end smallexample
8131
8132would usually calculate the addresses of all three variables, but if you
8133compile it with @option{-fsection-anchors}, it will access the variables
8134from a common anchor point instead. The effect is similar to the
8135following pseudocode (which isn't valid C):
8136
8137@smallexample
8138int foo (void)
8139@{
8140 register int *xr = &x;
8141 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
8142@}
8143@end smallexample
8144
8145Not all targets support this option.
8146
3af64fd6 8147@item --param @var{name}=@var{value}
cd3bb277 8148@opindex param
3af64fd6
MM
8149In some places, GCC uses various constants to control the amount of
8150optimization that is done. For example, GCC will not inline functions
8151that contain more that a certain number of instructions. You can
8152control some of these constants on the command-line using the
630d3d5a 8153@option{--param} option.
3af64fd6 8154
b00567b0
ILT
8155The names of specific parameters, and the meaning of the values, are
8156tied to the internals of the compiler, and are subject to change
8157without notice in future releases.
8158
4fe9b91c 8159In each case, the @var{value} is an integer. The allowable choices for
3af64fd6
MM
8160@var{name} are given in the following table:
8161
8162@table @gcctabopt
5bb06e18
GO
8163@item struct-reorg-cold-struct-ratio
8164The threshold ratio (as a percentage) between a structure frequency
8165and the frequency of the hottest structure in the program. This parameter
8166is used by struct-reorg optimization enabled by @option{-fipa-struct-reorg}.
7a61cf6f
NC
8167We say that if the ratio of a structure frequency, calculated by profiling,
8168to the hottest structure frequency in the program is less than this
5bb06e18
GO
8169parameter, then structure reorganization is not applied to this structure.
8170The default is 10.
8171
67018619 8172@item predictable-branch-outcome
3a4fd356
JH
8173When branch is predicted to be taken with probability lower than this threshold
8174(in percent), then it is considered well predictable. The default is 10.
8175
5f24e0dc
RH
8176@item max-crossjump-edges
8177The maximum number of incoming edges to consider for crossjumping.
d203738b 8178The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5f24e0dc
RH
8179the number of edges incoming to each block. Increasing values mean
8180more aggressive optimization, making the compile time increase with
8181probably small improvement in executable size.
8182
12183e0f
PH
8183@item min-crossjump-insns
8184The minimum number of instructions which must be matched at the end
8185of two blocks before crossjumping will be performed on them. This
8186value is ignored in the case where all instructions in the block being
8187crossjumped from are matched. The default value is 5.
8188
f935b9e0
DE
8189@item max-grow-copy-bb-insns
8190The maximum code size expansion factor when copying basic blocks
8191instead of jumping. The expansion is relative to a jump instruction.
8192The default value is 8.
8193
bbcb0c05
SB
8194@item max-goto-duplication-insns
8195The maximum number of instructions to duplicate to a block that jumps
8196to a computed goto. To avoid @math{O(N^2)} behavior in a number of
8197passes, GCC factors computed gotos early in the compilation process,
8198and unfactors them as late as possible. Only computed jumps at the
8199end of a basic blocks with no more than max-goto-duplication-insns are
8200unfactored. The default value is 8.
8201
1c4c47db
JO
8202@item max-delay-slot-insn-search
8203The maximum number of instructions to consider when looking for an
8204instruction to fill a delay slot. If more than this arbitrary number of
8205instructions is searched, the time savings from filling the delay slot
8206will be minimal so stop searching. Increasing values mean more
8207aggressive optimization, making the compile time increase with probably
8208small improvement in executable run time.
8209
8210@item max-delay-slot-live-search
8211When trying to fill delay slots, the maximum number of instructions to
8212consider when searching for a block with valid live register
8213information. Increasing this arbitrarily chosen value means more
8214aggressive optimization, increasing the compile time. This parameter
8215should be removed when the delay slot code is rewritten to maintain the
8216control-flow graph.
33d3b05b
MM
8217
8218@item max-gcse-memory
8219The approximate maximum amount of memory that will be allocated in
8220order to perform the global common subexpression elimination
8221optimization. If more memory than specified is required, the
8222optimization will not be done.
3af64fd6 8223
4a121cc3 8224@item max-pending-list-length
0c688a7d 8225The maximum number of pending dependencies scheduling will allow
4a121cc3
AM
8226before flushing the current state and starting over. Large functions
8227with few branches or calls can create excessively large lists which
8228needlessly consume memory and resources.
8229
bc522472
KG
8230@item max-inline-insns-single
8231Several parameters control the tree inliner used in gcc.
2dd76960 8232This number sets the maximum number of instructions (counted in GCC's
daf2f129 8233internal representation) in a single function that the tree inliner
bc522472
KG
8234will consider for inlining. This only affects functions declared
8235inline and methods implemented in a class declaration (C++).
125cae84 8236The default value is 300.
bc522472
KG
8237
8238@item max-inline-insns-auto
8239When you use @option{-finline-functions} (included in @option{-O3}),
8240a lot of functions that would otherwise not be considered for inlining
8241by the compiler will be investigated. To those functions, a different
8242(more restrictive) limit compared to functions declared inline can
8243be applied.
7802ca7c 8244The default value is 40.
bc522472 8245
b58b1157 8246@item large-function-insns
74515a0a 8247The limit specifying really large functions. For functions larger than this
d1facce0 8248limit after inlining, inlining is constrained by
74515a0a
RG
8249@option{--param large-function-growth}. This parameter is useful primarily
8250to avoid extreme compilation time caused by non-linear algorithms used by the
8251backend.
e5c4f28a 8252The default value is 2700.
b58b1157
JH
8253
8254@item large-function-growth
e53e0c56 8255Specifies maximal growth of large function caused by inlining in percents.
74515a0a
RG
8256The default value is 100 which limits large function growth to 2.0 times
8257the original size.
b58b1157 8258
b4f32d07
JH
8259@item large-unit-insns
8260The limit specifying large translation unit. Growth caused by inlining of
8261units larger than this limit is limited by @option{--param inline-unit-growth}.
8262For small units this might be too tight (consider unit consisting of function A
8263that is inline and B that just calls A three time. If B is small relative to
8264A, the growth of unit is 300\% and yet such inlining is very sane. For very
a31cfd58 8265large units consisting of small inlineable functions however the overall unit
b4f32d07
JH
8266growth limit is needed to avoid exponential explosion of code size. Thus for
8267smaller units, the size is increased to @option{--param large-unit-insns}
6416ae7f 8268before applying @option{--param inline-unit-growth}. The default is 10000
b4f32d07 8269
b58b1157
JH
8270@item inline-unit-growth
8271Specifies maximal overall growth of the compilation unit caused by inlining.
d562c668 8272The default value is 30 which limits unit growth to 1.3 times the original
74515a0a 8273size.
b58b1157 8274
5e45130d
JH
8275@item ipcp-unit-growth
8276Specifies maximal overall growth of the compilation unit caused by
8277interprocedural constant propagation. The default value is 10 which limits
8278unit growth to 1.1 times the original size.
8279
ff28a94d
JH
8280@item large-stack-frame
8281The limit specifying large stack frames. While inlining the algorithm is trying
8282to not grow past this limit too much. Default value is 256 bytes.
8283
8284@item large-stack-frame-growth
8285Specifies maximal growth of large stack frames caused by inlining in percents.
8286The default value is 1000 which limits large stack frame growth to 11 times
8287the original size.
8288
6de9cd9a
DN
8289@item max-inline-insns-recursive
8290@itemx max-inline-insns-recursive-auto
8291Specifies maximum number of instructions out-of-line copy of self recursive inline
8292function can grow into by performing recursive inlining.
8293
8294For functions declared inline @option{--param max-inline-insns-recursive} is
37470119 8295taken into account. For function not declared inline, recursive inlining
6de9cd9a
DN
8296happens only when @option{-finline-functions} (included in @option{-O3}) is
8297enabled and @option{--param max-inline-insns-recursive-auto} is used. The
e5c4f28a 8298default value is 450.
6de9cd9a
DN
8299
8300@item max-inline-recursive-depth
8301@itemx max-inline-recursive-depth-auto
8302Specifies maximum recursion depth used by the recursive inlining.
8303
8304For functions declared inline @option{--param max-inline-recursive-depth} is
37470119 8305taken into account. For function not declared inline, recursive inlining
6de9cd9a
DN
8306happens only when @option{-finline-functions} (included in @option{-O3}) is
8307enabled and @option{--param max-inline-recursive-depth-auto} is used. The
a60b56a4 8308default value is 8.
e5c4f28a 8309
c5a4444c
JH
8310@item min-inline-recursive-probability
8311Recursive inlining is profitable only for function having deep recursion
8312in average and can hurt for function having little recursion depth by
8313increasing the prologue size or complexity of function body to other
8314optimizers.
8315
8316When profile feedback is available (see @option{-fprofile-generate}) the actual
8317recursion depth can be guessed from probability that function will recurse via
8318given call expression. This parameter limits inlining only to call expression
8319whose probability exceeds given threshold (in percents). The default value is
832010.
8321
125cae84
JH
8322@item early-inlining-insns
8323Specify growth that early inliner can make. In effect it increases amount of
211ceaca 8324inlining for code having large abstraction penalty. The default value is 10.
6de9cd9a 8325
796bda22
JH
8326@item max-early-inliner-iterations
8327@itemx max-early-inliner-iterations
8328Limit of iterations of early inliner. This basically bounds number of nested
8329indirect calls early inliner can resolve. Deeper chains are still handled by
8330late inlining.
8331
c5d0600d
JH
8332@item comdat-sharing-probability
8333@itemx comdat-sharing-probability
8334Probability (in percent) that C++ inline function with comdat visibility
8335will be shared acroess multiple compilation units. The default value is 20.
8336
acdc40df 8337@item min-vect-loop-bound
cb7ad97b
EC
8338The minimum number of iterations under which a loop will not get vectorized
8339when @option{-ftree-vectorize} is used. The number of iterations after
acdc40df
DN
8340vectorization needs to be greater than the value specified by this option
8341to allow vectorization. The default value is 0.
8342
20160347
MK
8343@item gcse-cost-distance-ratio
8344Scaling factor in calculation of maximum distance an expression
8345can be moved by GCSE optimizations. This is currently supported only in
8346code hoisting pass. The bigger the ratio, the more agressive code hoisting
8347will be with simple expressions, i.e., the expressions which have cost
8348less than @option{gcse-unrestricted-cost}. Specifying 0 will disable
8349hoisting of simple expressions. The default value is 10.
8350
8351@item gcse-unrestricted-cost
8352Cost, roughly measured as the cost of a single typical machine
8353instruction, at which GCSE optimizations will not constrain
8354the distance an expression can travel. This is currently
8355supported only in code hoisting pass. The lesser the cost,
8356the more aggressive code hoisting will be. Specifying 0 will
8357allow all expressions to travel unrestricted distances.
8358The default value is 3.
8359
cad9aa15
MK
8360@item max-hoist-depth
8361The depth of search in the dominator tree for expressions to hoist.
8362This is used to avoid quadratic behavior in hoisting algorithm.
8363The value of 0 will avoid limiting the search, but may slow down compilation
8364of huge functions. The default value is 30.
8365
03e9dbc9
MM
8366@item max-unrolled-insns
8367The maximum number of instructions that a loop should have if that loop
8368is unrolled, and if the loop is unrolled, it determines how many times
8369the loop code is unrolled.
8370
b17d5d7c
ZD
8371@item max-average-unrolled-insns
8372The maximum number of instructions biased by probabilities of their execution
8373that a loop should have if that loop is unrolled, and if the loop is unrolled,
8374it determines how many times the loop code is unrolled.
8375
8376@item max-unroll-times
8377The maximum number of unrollings of a single loop.
8378
8379@item max-peeled-insns
8380The maximum number of instructions that a loop should have if that loop
8381is peeled, and if the loop is peeled, it determines how many times
8382the loop code is peeled.
8383
8384@item max-peel-times
8385The maximum number of peelings of a single loop.
8386
8387@item max-completely-peeled-insns
8388The maximum number of insns of a completely peeled loop.
8389
8390@item max-completely-peel-times
8391The maximum number of iterations of a loop to be suitable for complete peeling.
8392
30bc1dca
RG
8393@item max-completely-peel-loop-nest-depth
8394The maximum depth of a loop nest suitable for complete peeling.
8395
01a132bb
ZD
8396@item max-unswitch-insns
8397The maximum number of insns of an unswitched loop.
8398
8399@item max-unswitch-level
8400The maximum number of branches unswitched in a single loop.
8401
a7e5372d
ZD
8402@item lim-expensive
8403The minimum cost of an expensive expression in the loop invariant motion.
8404
8b11a64c
ZD
8405@item iv-consider-all-candidates-bound
8406Bound on number of candidates for induction variables below that
8407all candidates are considered for each use in induction variable
8408optimizations. Only the most relevant candidates are considered
8409if there are more candidates, to avoid quadratic time complexity.
8410
8411@item iv-max-considered-uses
8412The induction variable optimizations give up on loops that contain more
8413induction variable uses.
8414
36f5ada1
ZD
8415@item iv-always-prune-cand-set-bound
8416If number of candidates in the set is smaller than this value,
8417we always try to remove unnecessary ivs from the set during its
8418optimization when a new iv is added to the set.
8419
2412d35c
SP
8420@item scev-max-expr-size
8421Bound on size of expressions used in the scalar evolutions analyzer.
8422Large expressions slow the analyzer.
8423
3d8864c0
SP
8424@item omega-max-vars
8425The maximum number of variables in an Omega constraint system.
8426The default value is 128.
8427
8428@item omega-max-geqs
8429The maximum number of inequalities in an Omega constraint system.
8430The default value is 256.
8431
8432@item omega-max-eqs
8433The maximum number of equalities in an Omega constraint system.
8434The default value is 128.
8435
8436@item omega-max-wild-cards
8437The maximum number of wildcard variables that the Omega solver will
8438be able to insert. The default value is 18.
8439
8440@item omega-hash-table-size
8441The size of the hash table in the Omega solver. The default value is
8442550.
8443
8444@item omega-max-keys
8445The maximal number of keys used by the Omega solver. The default
8446value is 500.
8447
8448@item omega-eliminate-redundant-constraints
8449When set to 1, use expensive methods to eliminate all redundant
8450constraints. The default value is 0.
8451
bc1edb77
VK
8452@item vect-max-version-for-alignment-checks
8453The maximum number of runtime checks that can be performed when
8454doing loop versioning for alignment in the vectorizer. See option
8455ftree-vect-loop-version for more information.
8456
8457@item vect-max-version-for-alias-checks
8458The maximum number of runtime checks that can be performed when
8459doing loop versioning for alias in the vectorizer. See option
8460ftree-vect-loop-version for more information.
c12cc930 8461
e9eb809d
ZD
8462@item max-iterations-to-track
8463
8464The maximum number of iterations of a loop the brute force algorithm
8465for analysis of # of iterations of the loop tries to evaluate.
8466
194734e9
JH
8467@item hot-bb-count-fraction
8468Select fraction of the maximal count of repetitions of basic block in program
8469given basic block needs to have to be considered hot.
8470
8471@item hot-bb-frequency-fraction
8472Select fraction of the maximal frequency of executions of basic block in
8473function given basic block needs to have to be considered hot
5c856b23 8474
95b9a3a5
JH
8475@item max-predicted-iterations
8476The maximum number of loop iterations we predict statically. This is useful
8477in cases where function contain single loop with known bound and other loop
8478with unknown. We predict the known number of iterations correctly, while
c83eecad
KH
8479the unknown number of iterations average to roughly 10. This means that the
8480loop without bounds would appear artificially cold relative to the other one.
95b9a3a5 8481
edbed3d3
JH
8482@item align-threshold
8483
8484Select fraction of the maximal frequency of executions of basic block in
8485function given basic block will get aligned.
8486
8487@item align-loop-iterations
8488
8489A loop expected to iterate at lest the selected number of iterations will get
8490aligned.
8491
5c856b23
JH
8492@item tracer-dynamic-coverage
8493@itemx tracer-dynamic-coverage-feedback
8494
3364c33b
JQ
8495This value is used to limit superblock formation once the given percentage of
8496executed instructions is covered. This limits unnecessary code size
8497expansion.
5c856b23
JH
8498
8499The @option{tracer-dynamic-coverage-feedback} is used only when profile
8500feedback is available. The real profiles (as opposed to statically estimated
8501ones) are much less balanced allowing the threshold to be larger value.
8502
8503@item tracer-max-code-growth
8504Stop tail duplication once code growth has reached given percentage. This is
3364c33b 8505rather hokey argument, as most of the duplicates will be eliminated later in
5c856b23
JH
8506cross jumping, so it may be set to much higher values than is the desired code
8507growth.
8508
8509@item tracer-min-branch-ratio
8510
8511Stop reverse growth when the reverse probability of best edge is less than this
8512threshold (in percent).
8513
8514@item tracer-min-branch-ratio
8515@itemx tracer-min-branch-ratio-feedback
8516
8517Stop forward growth if the best edge do have probability lower than this
8518threshold.
8519
3364c33b 8520Similarly to @option{tracer-dynamic-coverage} two values are present, one for
5c856b23
JH
8521compilation for profile feedback and one for compilation without. The value
8522for compilation with profile feedback needs to be more conservative (higher) in
8523order to make tracer effective.
8524
c48ec590
ZD
8525@item max-cse-path-length
8526
8d3b3fb7 8527Maximum number of basic blocks on path that cse considers. The default is 10.
c48ec590 8528
95b9a3a5
JH
8529@item max-cse-insns
8530The maximum instructions CSE process before flushing. The default is 1000.
8531
3788cc17
ZW
8532@item ggc-min-expand
8533
8534GCC uses a garbage collector to manage its own memory allocation. This
8535parameter specifies the minimum percentage by which the garbage
8536collector's heap should be allowed to expand between collections.
8537Tuning this may improve compilation speed; it has no effect on code
8538generation.
8539
9ac121af 8540The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
8a36672b
JM
8541RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
8542the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
16226f1e
KG
8543GCC is not able to calculate RAM on a particular platform, the lower
8544bound of 30% is used. Setting this parameter and
737c38d1
GK
8545@option{ggc-min-heapsize} to zero causes a full collection to occur at
8546every opportunity. This is extremely slow, but can be useful for
8547debugging.
3788cc17
ZW
8548
8549@item ggc-min-heapsize
8550
8551Minimum size of the garbage collector's heap before it begins bothering
8552to collect garbage. The first collection occurs after the heap expands
8553by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
8554tuning this may improve compilation speed, and has no effect on code
8555generation.
8556
d37e6b50
GK
8557The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
8558tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
8559with a lower bound of 4096 (four megabytes) and an upper bound of
8560131072 (128 megabytes). If GCC is not able to calculate RAM on a
8561particular platform, the lower bound is used. Setting this parameter
8562very large effectively disables garbage collection. Setting this
8563parameter and @option{ggc-min-expand} to zero causes a full collection
8564to occur at every opportunity.
3788cc17 8565
0bcf8261
JH
8566@item max-reload-search-insns
8567The maximum number of instruction reload should look backward for equivalent
8568register. Increasing values mean more aggressive optimization, making the
8569compile time increase with probably slightly better performance. The default
8570value is 100.
8571
60ee1fe3 8572@item max-cselib-memory-locations
37470119 8573The maximum number of memory locations cselib should take into account.
c65ecebc
JH
8574Increasing values mean more aggressive optimization, making the compile time
8575increase with probably slightly better performance. The default value is 500.
8576
26f74aa3
JH
8577@item reorder-blocks-duplicate
8578@itemx reorder-blocks-duplicate-feedback
8579
65d2d764 8580Used by basic block reordering pass to decide whether to use unconditional
b222f49a 8581branch or duplicate the code on its destination. Code is duplicated when its
26f74aa3 8582estimated size is smaller than this value multiplied by the estimated size of
65d2d764 8583unconditional jump in the hot spots of the program.
26f74aa3
JH
8584
8585The @option{reorder-block-duplicate-feedback} is used only when profile
8586feedback is available and may be set to higher values than
8587@option{reorder-block-duplicate} since information about the hot spots is more
8588accurate.
f72c6b56 8589
6f8dd94b
EB
8590@item max-sched-ready-insns
8591The maximum number of instructions ready to be issued the scheduler should
8592consider at any given time during the first scheduling pass. Increasing
8593values mean more thorough searches, making the compilation time increase
8594with probably little benefit. The default value is 100.
8595
f72c6b56
DE
8596@item max-sched-region-blocks
8597The maximum number of blocks in a region to be considered for
8598interblock scheduling. The default value is 10.
8599
e855c69d
AB
8600@item max-pipeline-region-blocks
8601The maximum number of blocks in a region to be considered for
8602pipelining in the selective scheduler. The default value is 15.
8603
fbce7685 8604@item max-sched-region-insns
f72c6b56
DE
8605The maximum number of insns in a region to be considered for
8606interblock scheduling. The default value is 100.
31ebd7c8 8607
e855c69d
AB
8608@item max-pipeline-region-insns
8609The maximum number of insns in a region to be considered for
8610pipelining in the selective scheduler. The default value is 200.
8611
36968131
PS
8612@item min-spec-prob
8613The minimum probability (in percents) of reaching a source block
8614for interblock speculative scheduling. The default value is 40.
6f48c21a 8615
d08eefb9
MK
8616@item max-sched-extend-regions-iters
8617The maximum number of iterations through CFG to extend regions.
86180 - disable region extension,
8619N - do at most N iterations.
bb83aa4b 8620The default value is 0.
d08eefb9 8621
496d7bb0
MK
8622@item max-sched-insn-conflict-delay
8623The maximum conflict delay for an insn to be considered for speculative motion.
8624The default value is 3.
8625
8626@item sched-spec-prob-cutoff
8627The minimal probability of speculation success (in percents), so that
8628speculative insn will be scheduled.
8629The default value is 40.
8630
e855c69d
AB
8631@item sched-mem-true-dep-cost
8632Minimal distance (in CPU cycles) between store and load targeting same
8633memory locations. The default value is 1.
8634
8635@item selsched-max-lookahead
8636The maximum size of the lookahead window of selective scheduling. It is a
8637depth of search for available instructions.
8638The default value is 50.
49c3b9a8 8639
e855c69d 8640@item selsched-max-sched-times
7a61cf6f
NC
8641The maximum number of times that an instruction will be scheduled during
8642selective scheduling. This is the limit on the number of iterations
e855c69d
AB
8643through which the instruction may be pipelined. The default value is 2.
8644
8645@item selsched-max-insns-to-rename
8646The maximum number of best instructions in the ready list that are considered
8647for renaming in the selective scheduler. The default value is 2.
8648
8649@item max-last-value-rtl
49c3b9a8
JJ
8650The maximum size measured as number of RTLs that can be recorded in an expression
8651in combiner for a pseudo register as last known value of that register. The default
8652is 10000.
8653
31ebd7c8
NS
8654@item integer-share-limit
8655Small integer constants can use a shared data structure, reducing the
8656compiler's memory usage and increasing its speed. This sets the maximum
a31cfd58 8657value of a shared integer constant. The default value is 256.
31ebd7c8 8658
84d65814
DN
8659@item min-virtual-mappings
8660Specifies the minimum number of virtual mappings in the incremental
8661SSA updater that should be registered to trigger the virtual mappings
8662heuristic defined by virtual-mappings-ratio. The default value is
8663100.
8664
8665@item virtual-mappings-ratio
8666If the number of virtual mappings is virtual-mappings-ratio bigger
8667than the number of virtual symbols to be updated, then the incremental
8668SSA updater switches to a full update for those symbols. The default
8669ratio is 3.
8670
0aca9021 8671@item ssp-buffer-size
a31cfd58 8672The minimum size of buffers (i.e.@: arrays) that will receive stack smashing
0aca9021
JW
8673protection when @option{-fstack-protection} is used.
8674
43f31be5
JL
8675@item max-jump-thread-duplication-stmts
8676Maximum number of statements allowed in a block that needs to be
8677duplicated when threading jumps.
98035a75
DB
8678
8679@item max-fields-for-field-sensitive
8680Maximum number of fields in a structure we will treat in
0e1f4c6b
RG
8681a field sensitive manner during pointer analysis. The default is zero
8682for -O0, and -O1 and 100 for -Os, -O2, and -O3.
98035a75 8683
47eb5b32
ZD
8684@item prefetch-latency
8685Estimate on average number of instructions that are executed before
8686prefetch finishes. The distance we prefetch ahead is proportional
8687to this constant. Increasing this number may also lead to less
8688streams being prefetched (see @option{simultaneous-prefetches}).
8689
8690@item simultaneous-prefetches
8691Maximum number of prefetches that can run at the same time.
8692
8693@item l1-cache-line-size
8694The size of cache line in L1 cache, in bytes.
8695
8696@item l1-cache-size
46cb0441
ZD
8697The size of L1 cache, in kilobytes.
8698
8699@item l2-cache-size
8700The size of L2 cache, in kilobytes.
47eb5b32 8701
db34470d 8702@item min-insn-to-prefetch-ratio
7a61cf6f 8703The minimum ratio between the number of instructions and the
d3a9b459 8704number of prefetches to enable prefetching in a loop.
db34470d
GS
8705
8706@item prefetch-min-insn-to-mem-ratio
7a61cf6f 8707The minimum ratio between the number of instructions and the
db34470d
GS
8708number of memory references to enable prefetching in a loop.
8709
7313518b
DG
8710@item use-canonical-types
8711Whether the compiler should use the ``canonical'' type system. By
8712default, this should always be 1, which uses a more efficient internal
8713mechanism for comparing types in C++ and Objective-C++. However, if
8714bugs in the canonical type system are causing compilation failures,
8715set this value to 0 to disable canonical types.
06d40de8 8716
b6e99746
MJ
8717@item switch-conversion-max-branch-ratio
8718Switch initialization conversion will refuse to create arrays that are
b1ae1681 8719bigger than @option{switch-conversion-max-branch-ratio} times the number of
b6e99746
MJ
8720branches in the switch.
8721
f0ed4cfb
NC
8722@item max-partial-antic-length
8723Maximum length of the partial antic set computed during the tree
8724partial redundancy elimination optimization (@option{-ftree-pre}) when
8725optimizing at @option{-O3} and above. For some sorts of source code
8726the enhanced partial redundancy elimination optimization can run away,
8727consuming all of the memory available on the host machine. This
8728parameter sets a limit on the length of the sets that are computed,
a640c13b
KH
8729which prevents the runaway behavior. Setting a value of 0 for
8730this parameter will allow an unlimited set length.
f0ed4cfb 8731
863d2a57
RG
8732@item sccvn-max-scc-size
8733Maximum size of a strongly connected component (SCC) during SCCVN
8734processing. If this limit is hit, SCCVN processing for the whole
8735function will not be done and optimizations depending on it will
8736be disabled. The default maximum SCC size is 10000.
8737
058e97ec
VM
8738@item ira-max-loops-num
8739IRA uses a regional register allocation by default. If a function
30ea859e
VM
8740contains loops more than number given by the parameter, only at most
8741given number of the most frequently executed loops will form regions
8742for the regional register allocation. The default value of the
8743parameter is 100.
058e97ec 8744
311aab06
VM
8745@item ira-max-conflict-table-size
8746Although IRA uses a sophisticated algorithm of compression conflict
8747table, the table can be still big for huge functions. If the conflict
8748table for a function could be more than size in MB given by the
8749parameter, the conflict table is not built and faster, simpler, and
8750lower quality register allocation algorithm will be used. The
8751algorithm do not use pseudo-register conflicts. The default value of
8752the parameter is 2000.
8753
1833192f
VM
8754@item ira-loop-reserved-regs
8755IRA can be used to evaluate more accurate register pressure in loops
8756for decision to move loop invariants (see @option{-O3}). The number
8757of available registers reserved for some other purposes is described
8758by this parameter. The default value of the parameter is 2 which is
8759minimal number of registers needed for execution of typical
8760instruction. This value is the best found from numerous experiments.
8761
b1fb9f56
JJ
8762@item loop-invariant-max-bbs-in-loop
8763Loop invariant motion can be very expensive, both in compile time and
8764in amount of needed compile time memory, with very large loops. Loops
8765with more basic blocks than this parameter won't have loop invariant
8766motion optimization performed on them. The default value of the
8767parameter is 1000 for -O1 and 10000 for -O2 and above.
8768
ec8c3978
JJ
8769@item max-vartrack-size
8770Sets a maximum number of hash table slots to use during variable
8771tracking dataflow analysis of any function. If this limit is exceeded
8772with variable tracking at assignments enabled, analysis for that
8773function is retried without it, after removing all debug insns from
8774the function. If the limit is exceeded even without debug insns, var
8775tracking analysis is completely disabled for the function. Setting
8776the parameter to zero makes it unlimited.
8777
b5b8b0ac
AO
8778@item min-nondebug-insn-uid
8779Use uids starting at this parameter for nondebug insns. The range below
8780the parameter is reserved exclusively for debug insns created by
8781@option{-fvar-tracking-assignments}, but debug insns may get
8782(non-overlapping) uids above it if the reserved range is exhausted.
8783
07ffa034
MJ
8784@item ipa-sra-ptr-growth-factor
8785IPA-SRA will replace a pointer to an aggregate with one or more new
8786parameters only when their cumulative size is less or equal to
8787@option{ipa-sra-ptr-growth-factor} times the size of the original
8788pointer parameter.
8789
4e7dd376
SP
8790@item graphite-max-nb-scop-params
8791To avoid exponential effects in the Graphite loop transforms, the
d97c90ae
SP
8792number of parameters in a Static Control Part (SCoP) is bounded. The
8793default value is 10 parameters. A variable whose value is unknown at
8794compile time and defined outside a SCoP is a parameter of the SCoP.
4e7dd376 8795
b6bb0094 8796@item graphite-max-bbs-per-function
d97c90ae
SP
8797To avoid exponential effects in the detection of SCoPs, the size of
8798the functions analyzed by Graphite is bounded. The default value is
8799100 basic blocks.
b6bb0094 8800
9d198913 8801@item loop-block-tile-size
d97c90ae
SP
8802Loop blocking or strip mining transforms, enabled with
8803@option{-floop-block} or @option{-floop-strip-mine}, strip mine each
8804loop in the loop nest by a given number of iterations. The strip
8805length can be changed using the @option{loop-block-tile-size}
8806parameter. The default value is 51 iterations.
9d198913 8807
3949c4a7
MJ
8808@item devirt-type-list-size
8809IPA-CP attempts to track all possible types passed to a function's
8810parameter in order to perform devirtualization.
8811@option{devirt-type-list-size} is the maximum number of types it
8812stores per a single formal parameter of a function.
8813
852e4bd2
JH
8814@item lto-partitions
8815Specify desired nuber of partitions produced during WHOPR copmilation.
8816Number of partitions should exceed number of CPUs used for compilatoin.
8817Default value is 32.
8818
8819@item lto-minpartition
8820Size of minimal paritition for WHOPR (in estimated instructions).
8821This prevents expenses of splitting very small programs into too many
8822partitions.
8823
1c4c47db 8824@end table
74291a4b
MM
8825@end table
8826
8827@node Preprocessor Options
8828@section Options Controlling the Preprocessor
8829@cindex preprocessor options
8830@cindex options, preprocessor
8831
8832These options control the C preprocessor, which is run on each C source
8833file before actual compilation.
8834
630d3d5a
JM
8835If you use the @option{-E} option, nothing is done except preprocessing.
8836Some of these options make sense only together with @option{-E} because
74291a4b
MM
8837they cause the preprocessor output to be unsuitable for actual
8838compilation.
8839
4977bab6 8840@table @gcctabopt
98f6c600 8841@item -Wp,@var{option}
cd3bb277 8842@opindex Wp
40adaa27
NB
8843You can use @option{-Wp,@var{option}} to bypass the compiler driver
8844and pass @var{option} directly through to the preprocessor. If
8845@var{option} contains commas, it is split into multiple options at the
8846commas. However, many options are modified, translated or interpreted
8847by the compiler driver before being passed to the preprocessor, and
8848@option{-Wp} forcibly bypasses this phase. The preprocessor's direct
8849interface is undocumented and subject to change, so whenever possible
8850you should avoid using @option{-Wp} and let the driver handle the
8851options instead.
8852
4977bab6 8853@item -Xpreprocessor @var{option}
98f6c600 8854@opindex Xpreprocessor
4977bab6
ZW
8855Pass @var{option} as an option to the preprocessor. You can use this to
8856supply system-specific preprocessor options which GCC does not know how to
8857recognize.
8858
8859If you want to pass an option that takes an argument, you must use
8860@option{-Xpreprocessor} twice, once for the option and once for the argument.
8861@end table
8862
40adaa27 8863@include cppopts.texi
74291a4b
MM
8864
8865@node Assembler Options
8866@section Passing Options to the Assembler
8867
8868@c prevent bad page break with this line
8869You can pass options to the assembler.
8870
2642624b 8871@table @gcctabopt
aee96fe9 8872@item -Wa,@var{option}
cd3bb277 8873@opindex Wa
74291a4b
MM
8874Pass @var{option} as an option to the assembler. If @var{option}
8875contains commas, it is split into multiple options at the commas.
4977bab6
ZW
8876
8877@item -Xassembler @var{option}
8878@opindex Xassembler
8879Pass @var{option} as an option to the assembler. You can use this to
8880supply system-specific assembler options which GCC does not know how to
8881recognize.
8882
8883If you want to pass an option that takes an argument, you must use
8884@option{-Xassembler} twice, once for the option and once for the argument.
8885
74291a4b
MM
8886@end table
8887
8888@node Link Options
8889@section Options for Linking
8890@cindex link options
8891@cindex options, linking
8892
8893These options come into play when the compiler links object files into
8894an executable output file. They are meaningless if the compiler is
8895not doing a link step.
8896
2642624b 8897@table @gcctabopt
74291a4b
MM
8898@cindex file names
8899@item @var{object-file-name}
8900A file name that does not end in a special recognized suffix is
8901considered to name an object file or library. (Object files are
8902distinguished from libraries by the linker according to the file
8903contents.) If linking is done, these object files are used as input
8904to the linker.
8905
8906@item -c
8907@itemx -S
8908@itemx -E
cd3bb277
JM
8909@opindex c
8910@opindex S
8911@opindex E
74291a4b
MM
8912If any of these options is used, then the linker is not run, and
8913object file names should not be used as arguments. @xref{Overall
8914Options}.
8915
8916@cindex Libraries
8917@item -l@var{library}
4275c4c4 8918@itemx -l @var{library}
cd3bb277 8919@opindex l
4275c4c4
JS
8920Search the library named @var{library} when linking. (The second
8921alternative with the library as a separate argument is only for
8922POSIX compliance and is not recommended.)
74291a4b
MM
8923
8924It makes a difference where in the command you write this option; the
4275c4c4 8925linker searches and processes libraries and object files in the order they
74291a4b
MM
8926are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
8927after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
8928to functions in @samp{z}, those functions may not be loaded.
8929
8930The linker searches a standard list of directories for the library,
8931which is actually a file named @file{lib@var{library}.a}. The linker
8932then uses this file as if it had been specified precisely by name.
8933
8934The directories searched include several standard system directories
630d3d5a 8935plus any that you specify with @option{-L}.
74291a4b
MM
8936
8937Normally the files found this way are library files---archive files
8938whose members are object files. The linker handles an archive file by
8939scanning through it for members which define symbols that have so far
8940been referenced but not defined. But if the file that is found is an
8941ordinary object file, it is linked in the usual fashion. The only
630d3d5a
JM
8942difference between using an @option{-l} option and specifying a file name
8943is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
74291a4b
MM
8944and searches several directories.
8945
8946@item -lobjc
cd3bb277 8947@opindex lobjc
630d3d5a 8948You need this special case of the @option{-l} option in order to
46e34f96 8949link an Objective-C or Objective-C++ program.
74291a4b
MM
8950
8951@item -nostartfiles
cd3bb277 8952@opindex nostartfiles
74291a4b 8953Do not use the standard system startup files when linking.
bedc7537
NC
8954The standard system libraries are used normally, unless @option{-nostdlib}
8955or @option{-nodefaultlibs} is used.
74291a4b
MM
8956
8957@item -nodefaultlibs
cd3bb277 8958@opindex nodefaultlibs
74291a4b 8959Do not use the standard system libraries when linking.
5c6927bd
RW
8960Only the libraries you specify will be passed to the linker, options
8961specifying linkage of the system libraries, such as @code{-static-libgcc}
8962or @code{-shared-libgcc}, will be ignored.
bedc7537 8963The standard startup files are used normally, unless @option{-nostartfiles}
8f99553f
JM
8964is used. The compiler may generate calls to @code{memcmp},
8965@code{memset}, @code{memcpy} and @code{memmove}.
8966These entries are usually resolved by entries in
4754172c
CM
8967libc. These entry points should be supplied through some other
8968mechanism when this option is specified.
74291a4b
MM
8969
8970@item -nostdlib
cd3bb277 8971@opindex nostdlib
74291a4b
MM
8972Do not use the standard system startup files or libraries when linking.
8973No startup files and only the libraries you specify will be passed to
5c6927bd
RW
8974the linker, options specifying linkage of the system libraries, such as
8975@code{-static-libgcc} or @code{-shared-libgcc}, will be ignored.
8976The compiler may generate calls to @code{memcmp}, @code{memset},
8f99553f
JM
8977@code{memcpy} and @code{memmove}.
8978These entries are usually resolved by entries in
4754172c
CM
8979libc. These entry points should be supplied through some other
8980mechanism when this option is specified.
74291a4b 8981
630d3d5a
JM
8982@cindex @option{-lgcc}, use with @option{-nostdlib}
8983@cindex @option{-nostdlib} and unresolved references
8984@cindex unresolved references and @option{-nostdlib}
8985@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
8986@cindex @option{-nodefaultlibs} and unresolved references
8987@cindex unresolved references and @option{-nodefaultlibs}
8988One of the standard libraries bypassed by @option{-nostdlib} and
8989@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
0c2d1a2a 8990that GCC uses to overcome shortcomings of particular machines, or special
74291a4b 8991needs for some languages.
b11cc610
JM
8992(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
8993Collection (GCC) Internals},
74291a4b 8994for more discussion of @file{libgcc.a}.)
74291a4b 8995In most cases, you need @file{libgcc.a} even when you want to avoid
630d3d5a
JM
8996other standard libraries. In other words, when you specify @option{-nostdlib}
8997or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
0c2d1a2a 8998This ensures that you have no unresolved references to internal GCC
74291a4b 8999library subroutines. (For example, @samp{__main}, used to ensure C++
b11cc610
JM
9000constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
9001GNU Compiler Collection (GCC) Internals}.)
74291a4b 9002
24a4dd31
JJ
9003@item -pie
9004@opindex pie
9005Produce a position independent executable on targets which support it.
9006For predictable results, you must also specify the same set of options
9007that were used to generate code (@option{-fpie}, @option{-fPIE},
9008or model suboptions) when you specify this option.
9009
0cbc4d77
WB
9010@item -rdynamic
9011@opindex rdynamic
9012Pass the flag @option{-export-dynamic} to the ELF linker, on targets
9013that support it. This instructs the linker to add all symbols, not
9014only used ones, to the dynamic symbol table. This option is needed
9015for some uses of @code{dlopen} or to allow obtaining backtraces
9016from within a program.
9017
74291a4b 9018@item -s
cd3bb277 9019@opindex s
74291a4b
MM
9020Remove all symbol table and relocation information from the executable.
9021
9022@item -static
cd3bb277 9023@opindex static
74291a4b
MM
9024On systems that support dynamic linking, this prevents linking with the shared
9025libraries. On other systems, this option has no effect.
9026
9027@item -shared
cd3bb277 9028@opindex shared
74291a4b 9029Produce a shared object which can then be linked with other objects to
1d3b0e2c 9030form an executable. Not all systems support this option. For predictable
02f52e19 9031results, you must also specify the same set of options that were used to
630d3d5a 9032generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
2642624b 9033when you specify this option.@footnote{On some systems, @samp{gcc -shared}
767094dd 9034needs to build supplementary stub code for constructors to work. On
2642624b 9035multi-libbed systems, @samp{gcc -shared} must select the correct support
1d3b0e2c 9036libraries to link against. Failing to supply the correct flags may lead
767094dd 9037to subtle defects. Supplying them in cases where they are not necessary
1d3b0e2c 9038is innocuous.}
74291a4b 9039
9db0819e
RH
9040@item -shared-libgcc
9041@itemx -static-libgcc
cd3bb277
JM
9042@opindex shared-libgcc
9043@opindex static-libgcc
9db0819e
RH
9044On systems that provide @file{libgcc} as a shared library, these options
9045force the use of either the shared or static version respectively.
9046If no shared version of @file{libgcc} was built when the compiler was
9047configured, these options have no effect.
9048
9049There are several situations in which an application should use the
9050shared @file{libgcc} instead of the static version. The most common
9051of these is when the application wishes to throw and catch exceptions
9052across different shared libraries. In that case, each of the libraries
9053as well as the application itself should use the shared @file{libgcc}.
9054
5c181756
AO
9055Therefore, the G++ and GCJ drivers automatically add
9056@option{-shared-libgcc} whenever you build a shared library or a main
9057executable, because C++ and Java programs typically use exceptions, so
9058this is the right thing to do.
9059
9060If, instead, you use the GCC driver to create shared libraries, you may
9061find that they will not always be linked with the shared @file{libgcc}.
d3144423
EB
9062If GCC finds, at its configuration time, that you have a non-GNU linker
9063or a GNU linker that does not support option @option{--eh-frame-hdr},
9064it will link the shared version of @file{libgcc} into shared libraries
9065by default. Otherwise, it will take advantage of the linker and optimize
9066away the linking with the shared version of @file{libgcc}, linking with
9067the static version of libgcc by default. This allows exceptions to
9068propagate through such shared libraries, without incurring relocation
9069costs at library load time.
5c181756
AO
9070
9071However, if a library or main executable is supposed to throw or catch
9072exceptions, you must link it using the G++ or GCJ driver, as appropriate
9073for the languages used in the program, or using the option
9074@option{-shared-libgcc}, such that it is linked with the shared
049f6ec9 9075@file{libgcc}.
9db0819e 9076
96be7a11
ILT
9077@item -static-libstdc++
9078When the @command{g++} program is used to link a C++ program, it will
9079normally automatically link against @option{libstdc++}. If
9080@file{libstdc++} is available as a shared library, and the
9081@option{-static} option is not used, then this will link against the
9082shared version of @file{libstdc++}. That is normally fine. However, it
9083is sometimes useful to freeze the version of @file{libstdc++} used by
9084the program without going all the way to a fully static link. The
9085@option{-static-libstdc++} option directs the @command{g++} driver to
9086link @file{libstdc++} statically, without necessarily linking other
9087libraries statically.
9088
74291a4b 9089@item -symbolic
cd3bb277 9090@opindex symbolic
74291a4b
MM
9091Bind references to global symbols when building a shared object. Warn
9092about any unresolved references (unless overridden by the link editor
9093option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
9094this option.
9095
3027350e
SL
9096@item -T @var{script}
9097@opindex T
9098@cindex linker script
9099Use @var{script} as the linker script. This option is supported by most
9100systems using the GNU linker. On some targets, such as bare-board
7a61cf6f 9101targets without an operating system, the @option{-T} option may be required
3027350e
SL
9102when linking to avoid references to undefined symbols.
9103
74291a4b 9104@item -Xlinker @var{option}
cd3bb277 9105@opindex Xlinker
74291a4b 9106Pass @var{option} as an option to the linker. You can use this to
0c2d1a2a 9107supply system-specific linker options which GCC does not know how to
74291a4b
MM
9108recognize.
9109
a2fa6772 9110If you want to pass an option that takes a separate argument, you must use
630d3d5a
JM
9111@option{-Xlinker} twice, once for the option and once for the argument.
9112For example, to pass @option{-assert definitions}, you must write
74291a4b 9113@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
630d3d5a 9114@option{-Xlinker "-assert definitions"}, because this passes the entire
74291a4b
MM
9115string as a single argument, which is not what the linker expects.
9116
7a61cf6f 9117When using the GNU linker, it is usually more convenient to pass
a2fa6772
SL
9118arguments to linker options using the @option{@var{option}=@var{value}}
9119syntax than as separate arguments. For example, you can specify
9120@samp{-Xlinker -Map=output.map} rather than
9121@samp{-Xlinker -Map -Xlinker output.map}. Other linkers may not support
9122this syntax for command-line options.
9123
aee96fe9 9124@item -Wl,@var{option}
cd3bb277 9125@opindex Wl
74291a4b 9126Pass @var{option} as an option to the linker. If @var{option} contains
a2fa6772 9127commas, it is split into multiple options at the commas. You can use this
7a61cf6f 9128syntax to pass an argument to the option.
a2fa6772
SL
9129For example, @samp{-Wl,-Map,output.map} passes @samp{-Map output.map} to the
9130linker. When using the GNU linker, you can also get the same effect with
9131@samp{-Wl,-Map=output.map}.
74291a4b
MM
9132
9133@item -u @var{symbol}
cd3bb277 9134@opindex u
74291a4b 9135Pretend the symbol @var{symbol} is undefined, to force linking of
630d3d5a 9136library modules to define it. You can use @option{-u} multiple times with
74291a4b
MM
9137different symbols to force loading of additional library modules.
9138@end table
9139
9140@node Directory Options
9141@section Options for Directory Search
9142@cindex directory options
9143@cindex options, directory search
9144@cindex search path
9145
9146These options specify directories to search for header files, for
9147libraries and for parts of the compiler:
9148
2642624b 9149@table @gcctabopt
74291a4b 9150@item -I@var{dir}
cd3bb277 9151@opindex I
861bb6c1
JL
9152Add the directory @var{dir} to the head of the list of directories to be
9153searched for header files. This can be used to override a system header
9154file, substituting your own version, since these directories are
d0a5eb32
RK
9155searched before the system header file directories. However, you should
9156not use this option to add directories that contain vendor-supplied
767094dd 9157system header files (use @option{-isystem} for that). If you use more than
630d3d5a 9158one @option{-I} option, the directories are scanned in left-to-right
74291a4b
MM
9159order; the standard system directories come after.
9160
dbead49c 9161If a standard system include directory, or a directory specified with
48209ce5
JDA
9162@option{-isystem}, is also specified with @option{-I}, the @option{-I}
9163option will be ignored. The directory will still be searched but as a
9164system directory at its normal position in the system include chain.
9165This is to ensure that GCC's procedure to fix buggy system headers and
3364c33b 9166the ordering for the include_next directive are not inadvertently changed.
48209ce5
JDA
9167If you really need to change the search order for system directories,
9168use the @option{-nostdinc} and/or @option{-isystem} options.
dbead49c 9169
4adbd5dd
MK
9170@item -iplugindir=@var{dir}
9171Set the directory to search for plugins which are passed
9172by @option{-fplugin=@var{name}} instead of
9173@option{-fplugin=@var{path}/@var{name}.so}. This option is not meant
9174to be used by the user, but only passed by the driver.
9175
4bed3787
MS
9176@item -iquote@var{dir}
9177@opindex iquote
9178Add the directory @var{dir} to the head of the list of directories to
9179be searched for header files only for the case of @samp{#include
9180"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
9181otherwise just like @option{-I}.
74291a4b
MM
9182
9183@item -L@var{dir}
cd3bb277 9184@opindex L
74291a4b 9185Add directory @var{dir} to the list of directories to be searched
630d3d5a 9186for @option{-l}.
74291a4b
MM
9187
9188@item -B@var{prefix}
cd3bb277 9189@opindex B
74291a4b
MM
9190This option specifies where to find the executables, libraries,
9191include files, and data files of the compiler itself.
9192
9193The compiler driver program runs one or more of the subprograms
9194@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
9195@var{prefix} as a prefix for each program it tries to run, both with and
9196without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
9197
9198For each subprogram to be run, the compiler driver first tries the
630d3d5a 9199@option{-B} prefix, if any. If that name is not found, or if @option{-B}
74291a4b 9200was not specified, the driver tries two standard prefixes, which are
8e5f33ff 9201@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
74291a4b
MM
9202those results in a file name that is found, the unmodified program
9203name is searched for using the directories specified in your
bedc7537 9204@env{PATH} environment variable.
74291a4b 9205
07804c3b
NC
9206The compiler will check to see if the path provided by the @option{-B}
9207refers to a directory, and if necessary it will add a directory
9208separator character at the end of the path.
9209
630d3d5a 9210@option{-B} prefixes that effectively specify directory names also apply
74291a4b 9211to libraries in the linker, because the compiler translates these
630d3d5a 9212options into @option{-L} options for the linker. They also apply to
74291a4b 9213includes files in the preprocessor, because the compiler translates these
630d3d5a 9214options into @option{-isystem} options for the preprocessor. In this case,
74291a4b
MM
9215the compiler appends @samp{include} to the prefix.
9216
9217The run-time support file @file{libgcc.a} can also be searched for using
630d3d5a 9218the @option{-B} prefix, if needed. If it is not found there, the two
74291a4b
MM
9219standard prefixes above are tried, and that is all. The file is left
9220out of the link if it is not found by those means.
9221
630d3d5a 9222Another way to specify a prefix much like the @option{-B} prefix is to use
bedc7537 9223the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
74291a4b 9224Variables}.
861bb6c1 9225
07804c3b 9226As a special kludge, if the path provided by @option{-B} is
bf4eebe0
NC
9227@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
92289, then it will be replaced by @file{[dir/]include}. This is to help
7dac2f89 9229with boot-strapping the compiler.
07804c3b 9230
861bb6c1 9231@item -specs=@var{file}
cd3bb277 9232@opindex specs
861bb6c1
JL
9233Process @var{file} after the compiler reads in the standard @file{specs}
9234file, in order to override the defaults that the @file{gcc} driver
9235program uses when determining what switches to pass to @file{cc1},
9236@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
630d3d5a 9237@option{-specs=@var{file}} can be specified on the command line, and they
861bb6c1 9238are processed in order, from left to right.
4bed3787 9239
160633c6
MM
9240@item --sysroot=@var{dir}
9241@opindex sysroot
9242Use @var{dir} as the logical root directory for headers and libraries.
9243For example, if the compiler would normally search for headers in
9244@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
cb7ad97b 9245search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
160633c6
MM
9246
9247If you use both this option and the @option{-isysroot} option, then
9248the @option{--sysroot} option will apply to libraries, but the
9249@option{-isysroot} option will apply to header files.
9250
9251The GNU linker (beginning with version 2.16) has the necessary support
9252for this option. If your linker does not support this option, the
9253header file aspect of @option{--sysroot} will still work, but the
9254library aspect will not.
9255
4bed3787
MS
9256@item -I-
9257@opindex I-
9258This option has been deprecated. Please use @option{-iquote} instead for
9259@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
9260Any directories you specify with @option{-I} options before the @option{-I-}
9261option are searched only for the case of @samp{#include "@var{file}"};
9262they are not searched for @samp{#include <@var{file}>}.
9263
9264If additional directories are specified with @option{-I} options after
9265the @option{-I-}, these directories are searched for all @samp{#include}
9266directives. (Ordinarily @emph{all} @option{-I} directories are used
9267this way.)
9268
9269In addition, the @option{-I-} option inhibits the use of the current
9270directory (where the current input file came from) as the first search
9271directory for @samp{#include "@var{file}"}. There is no way to
9272override this effect of @option{-I-}. With @option{-I.} you can specify
9273searching the directory which was current when the compiler was
9274invoked. That is not exactly the same as what the preprocessor does
9275by default, but it is often satisfactory.
9276
9277@option{-I-} does not inhibit the use of the standard system directories
9278for header files. Thus, @option{-I-} and @option{-nostdinc} are
9279independent.
74291a4b
MM
9280@end table
9281
ee457005
JM
9282@c man end
9283
a743d340
NC
9284@node Spec Files
9285@section Specifying subprocesses and the switches to pass to them
9286@cindex Spec Files
d2d42a91 9287
bedc7537 9288@command{gcc} is a driver program. It performs its job by invoking a
a743d340
NC
9289sequence of other programs to do the work of compiling, assembling and
9290linking. GCC interprets its command-line parameters and uses these to
9291deduce which programs it should invoke, and which command-line options
c21cd8b1 9292it ought to place on their command lines. This behavior is controlled
a743d340
NC
9293by @dfn{spec strings}. In most cases there is one spec string for each
9294program that GCC can invoke, but a few programs have multiple spec
c21cd8b1 9295strings to control their behavior. The spec strings built into GCC can
630d3d5a 9296be overridden by using the @option{-specs=} command-line switch to specify
a743d340
NC
9297a spec file.
9298
9299@dfn{Spec files} are plaintext files that are used to construct spec
9300strings. They consist of a sequence of directives separated by blank
9301lines. The type of directive is determined by the first non-whitespace
9302character on the line and it can be one of the following:
9303
9304@table @code
9305@item %@var{command}
9306Issues a @var{command} to the spec file processor. The commands that can
02f52e19 9307appear here are:
a743d340
NC
9308
9309@table @code
9310@item %include <@var{file}>
ab940b73 9311@cindex @code{%include}
a743d340
NC
9312Search for @var{file} and insert its text at the current point in the
9313specs file.
9314
9315@item %include_noerr <@var{file}>
ab940b73 9316@cindex @code{%include_noerr}
a743d340
NC
9317Just like @samp{%include}, but do not generate an error message if the include
9318file cannot be found.
9319
9320@item %rename @var{old_name} @var{new_name}
ab940b73 9321@cindex @code{%rename}
a743d340
NC
9322Rename the spec string @var{old_name} to @var{new_name}.
9323
9324@end table
9325
9326@item *[@var{spec_name}]:
9327This tells the compiler to create, override or delete the named spec
9328string. All lines after this directive up to the next directive or
9329blank line are considered to be the text for the spec string. If this
9330results in an empty string then the spec will be deleted. (Or, if the
9331spec did not exist, then nothing will happened.) Otherwise, if the spec
9332does not currently exist a new spec will be created. If the spec does
9333exist then its contents will be overridden by the text of this
9334directive, unless the first character of that text is the @samp{+}
9335character, in which case the text will be appended to the spec.
9336
9337@item [@var{suffix}]:
9338Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
9339and up to the next directive or blank line are considered to make up the
02f52e19 9340spec string for the indicated suffix. When the compiler encounters an
a743d340
NC
9341input file with the named suffix, it will processes the spec string in
9342order to work out how to compile that file. For example:
9343
9344@smallexample
9345.ZZ:
9346z-compile -input %i
9347@end smallexample
9348
9349This says that any input file whose name ends in @samp{.ZZ} should be
9350passed to the program @samp{z-compile}, which should be invoked with the
630d3d5a 9351command-line switch @option{-input} and with the result of performing the
a743d340
NC
9352@samp{%i} substitution. (See below.)
9353
9354As an alternative to providing a spec string, the text that follows a
9355suffix directive can be one of the following:
9356
9357@table @code
9358@item @@@var{language}
9359This says that the suffix is an alias for a known @var{language}. This is
bedc7537 9360similar to using the @option{-x} command-line switch to GCC to specify a
a743d340
NC
9361language explicitly. For example:
9362
9363@smallexample
9364.ZZ:
9365@@c++
9366@end smallexample
9367
9368Says that .ZZ files are, in fact, C++ source files.
9369
9370@item #@var{name}
9371This causes an error messages saying:
9372
9373@smallexample
9374@var{name} compiler not installed on this system.
9375@end smallexample
9376@end table
9377
9378GCC already has an extensive list of suffixes built into it.
9379This directive will add an entry to the end of the list of suffixes, but
9380since the list is searched from the end backwards, it is effectively
9381possible to override earlier entries using this technique.
9382
9383@end table
9384
9385GCC has the following spec strings built into it. Spec files can
9386override these strings or create their own. Note that individual
02f52e19 9387targets can also add their own spec strings to this list.
a743d340
NC
9388
9389@smallexample
9390asm Options to pass to the assembler
9391asm_final Options to pass to the assembler post-processor
9392cpp Options to pass to the C preprocessor
9393cc1 Options to pass to the C compiler
9394cc1plus Options to pass to the C++ compiler
9395endfile Object files to include at the end of the link
9396link Options to pass to the linker
9397lib Libraries to include on the command line to the linker
9398libgcc Decides which GCC support library to pass to the linker
9399linker Sets the name of the linker
9400predefines Defines to be passed to the C preprocessor
310668e8
JM
9401signed_char Defines to pass to CPP to say whether @code{char} is signed
9402 by default
a743d340
NC
9403startfile Object files to include at the start of the link
9404@end smallexample
9405
9406Here is a small example of a spec file:
9407
9408@smallexample
9409%rename lib old_lib
9410
9411*lib:
9412--start-group -lgcc -lc -leval1 --end-group %(old_lib)
9413@end smallexample
9414
9415This example renames the spec called @samp{lib} to @samp{old_lib} and
9416then overrides the previous definition of @samp{lib} with a new one.
9417The new definition adds in some extra command-line options before
9418including the text of the old definition.
9419
9420@dfn{Spec strings} are a list of command-line options to be passed to their
9421corresponding program. In addition, the spec strings can contain
9422@samp{%}-prefixed sequences to substitute variable text or to
9423conditionally insert text into the command line. Using these constructs
9424it is possible to generate quite complex command lines.
9425
9426Here is a table of all defined @samp{%}-sequences for spec
9427strings. Note that spaces are not generated automatically around the
9428results of expanding these sequences. Therefore you can concatenate them
02f52e19 9429together or combine them with constant text in a single argument.
a743d340
NC
9430
9431@table @code
9432@item %%
9433Substitute one @samp{%} into the program name or argument.
9434
9435@item %i
9436Substitute the name of the input file being processed.
9437
9438@item %b
9439Substitute the basename of the input file being processed.
9440This is the substring up to (and not including) the last period
9441and not including the directory.
9442
371e300b
NC
9443@item %B
9444This is the same as @samp{%b}, but include the file suffix (text after
9445the last period).
9446
a743d340
NC
9447@item %d
9448Marks the argument containing or following the @samp{%d} as a
9449temporary file name, so that that file will be deleted if GCC exits
9450successfully. Unlike @samp{%g}, this contributes no text to the
02f52e19 9451argument.
a743d340
NC
9452
9453@item %g@var{suffix}
9454Substitute a file name that has suffix @var{suffix} and is chosen
9455once per compilation, and mark the argument in the same way as
9456@samp{%d}. To reduce exposure to denial-of-service attacks, the file
02f52e19 9457name is now chosen in a way that is hard to predict even when previously
695ac33f 9458chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
a743d340
NC
9459might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
9460the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
9461treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
9462was simply substituted with a file name chosen once per compilation,
9463without regard to any appended suffix (which was therefore treated
9464just like ordinary text), making such attacks more likely to succeed.
9465
9466@item %u@var{suffix}
9467Like @samp{%g}, but generates a new temporary file name even if
9468@samp{%u@var{suffix}} was already seen.
9469
9470@item %U@var{suffix}
9471Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
9472new one if there is no such last file name. In the absence of any
9473@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
695ac33f 9474the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
a743d340
NC
9475would involve the generation of two distinct file names, one
9476for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
9477simply substituted with a file name chosen for the previous @samp{%u},
9478without regard to any appended suffix.
9479
4977bab6 9480@item %j@var{suffix}
aee96fe9 9481Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
371e300b
NC
9482writable, and if save-temps is off; otherwise, substitute the name
9483of a temporary file, just like @samp{%u}. This temporary file is not
9484meant for communication between processes, but rather as a junk
9485disposal mechanism.
9486
4977bab6
ZW
9487@item %|@var{suffix}
9488@itemx %m@var{suffix}
9489Like @samp{%g}, except if @option{-pipe} is in effect. In that case
9490@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
9491all. These are the two most common ways to instruct a program that it
9492should read from standard input or write to standard output. If you
9493need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
9494construct: see for example @file{f/lang-specs.h}.
9495
371e300b
NC
9496@item %.@var{SUFFIX}
9497Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
767094dd 9498when it is subsequently output with @samp{%*}. @var{SUFFIX} is
371e300b
NC
9499terminated by the next space or %.
9500
a743d340
NC
9501@item %w
9502Marks the argument containing or following the @samp{%w} as the
9503designated output file of this compilation. This puts the argument
9504into the sequence of arguments that @samp{%o} will substitute later.
9505
9506@item %o
9507Substitutes the names of all the output files, with spaces
9508automatically placed around them. You should write spaces
9509around the @samp{%o} as well or the results are undefined.
9510@samp{%o} is for use in the specs for running the linker.
9511Input files whose names have no recognized suffix are not compiled
9512at all, but they are included among the output files, so they will
9513be linked.
9514
9515@item %O
9516Substitutes the suffix for object files. Note that this is
9517handled specially when it immediately follows @samp{%g, %u, or %U},
9518because of the need for those to form complete file names. The
9519handling is such that @samp{%O} is treated exactly as if it had already
9520been substituted, except that @samp{%g, %u, and %U} do not currently
9521support additional @var{suffix} characters following @samp{%O} as they would
9522following, for example, @samp{.o}.
9523
9524@item %p
9525Substitutes the standard macro predefinitions for the
9526current target machine. Use this when running @code{cpp}.
9527
9528@item %P
9529Like @samp{%p}, but puts @samp{__} before and after the name of each
9530predefined macro, except for macros that start with @samp{__} or with
c1030c7c 9531@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
161d7b59 9532C@.
a743d340
NC
9533
9534@item %I
047d636f 9535Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
2b6dd222 9536@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
047d636f 9537@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
2b6dd222 9538and @option{-imultilib} as necessary.
a743d340
NC
9539
9540@item %s
9541Current argument is the name of a library or startup file of some sort.
9542Search for that file in a standard list of directories and substitute
3beb864c
NC
9543the full name found. The current working directory is included in the
9544list of directories scanned.
9545
9546@item %T
9547Current argument is the name of a linker script. Search for that file
9548in the current list of directories to scan for libraries. If the file
9549is located insert a @option{--script} option into the command line
9550followed by the full path name found. If the file is not found then
9551generate an error message. Note: the current working directory is not
9552searched.
a743d340
NC
9553
9554@item %e@var{str}
9555Print @var{str} as an error message. @var{str} is terminated by a newline.
9556Use this when inconsistent options are detected.
9557
a743d340
NC
9558@item %(@var{name})
9559Substitute the contents of spec string @var{name} at this point.
9560
9561@item %[@var{name}]
630d3d5a 9562Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
a743d340
NC
9563
9564@item %x@{@var{option}@}
9565Accumulate an option for @samp{%X}.
9566
9567@item %X
630d3d5a 9568Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
a743d340
NC
9569spec string.
9570
9571@item %Y
630d3d5a 9572Output the accumulated assembler options specified by @option{-Wa}.
a743d340
NC
9573
9574@item %Z
630d3d5a 9575Output the accumulated preprocessor options specified by @option{-Wp}.
a743d340 9576
a743d340
NC
9577@item %a
9578Process the @code{asm} spec. This is used to compute the
9579switches to be passed to the assembler.
9580
9581@item %A
9582Process the @code{asm_final} spec. This is a spec string for
9583passing switches to an assembler post-processor, if such a program is
9584needed.
9585
9586@item %l
9587Process the @code{link} spec. This is the spec for computing the
9588command line passed to the linker. Typically it will make use of the
9589@samp{%L %G %S %D and %E} sequences.
9590
9591@item %D
630d3d5a 9592Dump out a @option{-L} option for each directory that GCC believes might
a743d340 9593contain startup files. If the target supports multilibs then the
02f52e19 9594current multilib directory will be prepended to each of these paths.
a743d340
NC
9595
9596@item %L
9597Process the @code{lib} spec. This is a spec string for deciding which
02f52e19 9598libraries should be included on the command line to the linker.
a743d340
NC
9599
9600@item %G
9601Process the @code{libgcc} spec. This is a spec string for deciding
02f52e19 9602which GCC support library should be included on the command line to the linker.
a743d340
NC
9603
9604@item %S
9605Process the @code{startfile} spec. This is a spec for deciding which
9606object files should be the first ones passed to the linker. Typically
02f52e19 9607this might be a file named @file{crt0.o}.
a743d340
NC
9608
9609@item %E
9610Process the @code{endfile} spec. This is a spec string that specifies
02f52e19 9611the last object files that will be passed to the linker.
a743d340
NC
9612
9613@item %C
9614Process the @code{cpp} spec. This is used to construct the arguments
9615to be passed to the C preprocessor.
9616
a743d340
NC
9617@item %1
9618Process the @code{cc1} spec. This is used to construct the options to be
9619passed to the actual C compiler (@samp{cc1}).
9620
9621@item %2
9622Process the @code{cc1plus} spec. This is used to construct the options to be
9623passed to the actual C++ compiler (@samp{cc1plus}).
9624
9625@item %*
9626Substitute the variable part of a matched option. See below.
9627Note that each comma in the substituted string is replaced by
9628a single space.
9629
4977bab6
ZW
9630@item %<@code{S}
9631Remove all occurrences of @code{-S} from the command line. Note---this
9632command is position dependent. @samp{%} commands in the spec string
9633before this one will see @code{-S}, @samp{%} commands in the spec string
9634after this one will not.
9635
f3226a90
JT
9636@item %:@var{function}(@var{args})
9637Call the named function @var{function}, passing it @var{args}.
9638@var{args} is first processed as a nested spec string, then split
9639into an argument vector in the usual fashion. The function returns
9640a string which is processed as if it had appeared literally as part
9641of the current spec.
9642
9643The following built-in spec functions are provided:
9644
9645@table @code
03d12b64
MM
9646@item @code{getenv}
9647The @code{getenv} spec function takes two arguments: an environment
9648variable name and a string. If the environment variable is not
9649defined, a fatal error is issued. Otherwise, the return value is the
9650value of the environment variable concatenated with the string. For
9651example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
9652
9653@smallexample
9654%:getenv(TOPDIR /include)
9655@end smallexample
9656
9657expands to @file{/path/to/top/include}.
9658
f3226a90
JT
9659@item @code{if-exists}
9660The @code{if-exists} spec function takes one argument, an absolute
9661pathname to a file. If the file exists, @code{if-exists} returns the
9662pathname. Here is a small example of its usage:
9663
9664@smallexample
9665*startfile:
9666crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
9667@end smallexample
152a5a9c
JT
9668
9669@item @code{if-exists-else}
9670The @code{if-exists-else} spec function is similar to the @code{if-exists}
9671spec function, except that it takes two arguments. The first argument is
9672an absolute pathname to a file. If the file exists, @code{if-exists-else}
9673returns the pathname. If it does not exist, it returns the second argument.
9674This way, @code{if-exists-else} can be used to select one file or another,
9675based on the existence of the first. Here is a small example of its usage:
9676
daf2f129 9677@smallexample
152a5a9c 9678*startfile:
f5034c5e
JM
9679crt0%O%s %:if-exists(crti%O%s) \
9680%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
152a5a9c 9681@end smallexample
3dd53121
AP
9682
9683@item @code{replace-outfile}
9684The @code{replace-outfile} spec function takes two arguments. It looks for the
9685first argument in the outfiles array and replaces it with the second argument. Here
9686is a small example of its usage:
9687
9688@smallexample
9689%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
9690@end smallexample
9691
2642f659
JH
9692@item @code{remove-outfile}
9693The @code{remove-outfile} spec function takes one argument. It looks for the
9694first argument in the outfiles array and removes it. Here is a small example
9695its usage:
9696
9697@smallexample
9698%:remove-outfile(-lm)
9699@end smallexample
9700
9a37bc07
DK
9701@item @code{pass-through-libs}
9702The @code{pass-through-libs} spec function takes any number of arguments. It
9703finds any @option{-l} options and any non-options ending in ".a" (which it
9704assumes are the names of linker input library archive files) and returns a
9705result containing all the found arguments each prepended by
9706@option{-plugin-opt=-pass-through=} and joined by spaces. This list is
9707intended to be passed to the LTO linker plugin.
9708
9709@smallexample
9710%:pass-through-libs(%G %L %G)
9711@end smallexample
9712
a0f87454
RS
9713@item @code{print-asm-header}
9714The @code{print-asm-header} function takes no arguments and simply
9715prints a banner like:
9716
9717@smallexample
c80b4100
KH
9718Assembler options
9719=================
a0f87454
RS
9720
9721Use "-Wa,OPTION" to pass "OPTION" to the assembler.
9722@end smallexample
9723
9724It is used to separate compiler options from assembler options
9725in the @option{--target-help} output.
daf2f129 9726@end table
f3226a90 9727
a743d340 9728@item %@{@code{S}@}
161d7b59 9729Substitutes the @code{-S} switch, if that switch was given to GCC@.
a743d340
NC
9730If that switch was not specified, this substitutes nothing. Note that
9731the leading dash is omitted when specifying this option, and it is
9732automatically inserted if the substitution is performed. Thus the spec
630d3d5a
JM
9733string @samp{%@{foo@}} would match the command-line option @option{-foo}
9734and would output the command line option @option{-foo}.
a743d340
NC
9735
9736@item %W@{@code{S}@}
9737Like %@{@code{S}@} but mark last argument supplied within as a file to be
02f52e19 9738deleted on failure.
a743d340
NC
9739
9740@item %@{@code{S}*@}
9741Substitutes all the switches specified to GCC whose names start
9742with @code{-S}, but which also take an argument. This is used for
695ac33f 9743switches like @option{-o}, @option{-D}, @option{-I}, etc.
630d3d5a 9744GCC considers @option{-o foo} as being
a743d340 9745one switch whose names starts with @samp{o}. %@{o*@} would substitute this
02f52e19 9746text, including the space. Thus two arguments would be generated.
a743d340 9747
371e300b
NC
9748@item %@{@code{S}*&@code{T}*@}
9749Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
9750(the order of @code{S} and @code{T} in the spec is not significant).
9751There can be any number of ampersand-separated variables; for each the
9752wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
9753
a743d340 9754@item %@{@code{S}:@code{X}@}
4977bab6 9755Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
a743d340
NC
9756
9757@item %@{!@code{S}:@code{X}@}
4977bab6 9758Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
a743d340 9759
4977bab6
ZW
9760@item %@{@code{S}*:@code{X}@}
9761Substitutes @code{X} if one or more switches whose names start with
9762@code{-S} are specified to GCC@. Normally @code{X} is substituted only
9763once, no matter how many such switches appeared. However, if @code{%*}
9764appears somewhere in @code{X}, then @code{X} will be substituted once
9765for each matching switch, with the @code{%*} replaced by the part of
9766that switch that matched the @code{*}.
a743d340
NC
9767
9768@item %@{.@code{S}:@code{X}@}
4977bab6 9769Substitutes @code{X}, if processing a file with suffix @code{S}.
a743d340
NC
9770
9771@item %@{!.@code{S}:@code{X}@}
4977bab6 9772Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
a743d340 9773
98312a9b
GK
9774@item %@{,@code{S}:@code{X}@}
9775Substitutes @code{X}, if processing a file for language @code{S}.
9776
9777@item %@{!,@code{S}:@code{X}@}
9778Substitutes @code{X}, if not processing a file for language @code{S}.
9779
a743d340 9780@item %@{@code{S}|@code{P}:@code{X}@}
98312a9b
GK
9781Substitutes @code{X} if either @code{-S} or @code{-P} was given to
9782GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
9783@code{*} sequences as well, although they have a stronger binding than
9784the @samp{|}. If @code{%*} appears in @code{X}, all of the
9785alternatives must be starred, and only the first matching alternative
9786is substituted.
4977bab6
ZW
9787
9788For example, a spec string like this:
a743d340
NC
9789
9790@smallexample
9791%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
9792@end smallexample
9793
9794will output the following command-line options from the following input
9795command-line options:
9796
9797@smallexample
9798fred.c -foo -baz
9799jim.d -bar -boggle
9800-d fred.c -foo -baz -boggle
9801-d jim.d -bar -baz -boggle
9802@end smallexample
9803
4977bab6
ZW
9804@item %@{S:X; T:Y; :D@}
9805
c0cbdbd9
KH
9806If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
9807given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
daf2f129 9808be as many clauses as you need. This may be combined with @code{.},
98312a9b 9809@code{,}, @code{!}, @code{|}, and @code{*} as needed.
4977bab6
ZW
9810
9811
a743d340
NC
9812@end table
9813
4977bab6
ZW
9814The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
9815construct may contain other nested @samp{%} constructs or spaces, or
9816even newlines. They are processed as usual, as described above.
9817Trailing white space in @code{X} is ignored. White space may also
9818appear anywhere on the left side of the colon in these constructs,
9819except between @code{.} or @code{*} and the corresponding word.
a743d340 9820
4977bab6
ZW
9821The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
9822handled specifically in these constructs. If another value of
9823@option{-O} or the negated form of a @option{-f}, @option{-m}, or
9824@option{-W} switch is found later in the command line, the earlier
9825switch value is ignored, except with @{@code{S}*@} where @code{S} is
9826just one letter, which passes all matching options.
a743d340 9827
4977bab6
ZW
9828The character @samp{|} at the beginning of the predicate text is used to
9829indicate that a command should be piped to the following command, but
9830only if @option{-pipe} is specified.
a743d340
NC
9831
9832It is built into GCC which switches take arguments and which do not.
9833(You might think it would be useful to generalize this to allow each
9834compiler's spec to say which switches take arguments. But this cannot
9835be done in a consistent fashion. GCC cannot even decide which input
9836files have been specified without knowing which switches take arguments,
9837and it must know which input files to compile in order to tell which
02f52e19 9838compilers to run).
a743d340 9839
630d3d5a 9840GCC also knows implicitly that arguments starting in @option{-l} are to be
a743d340
NC
9841treated as compiler output files, and passed to the linker in their
9842proper position among the other output files.
9843
ee457005
JM
9844@c man begin OPTIONS
9845
74291a4b
MM
9846@node Target Options
9847@section Specifying Target Machine and Compiler Version
9848@cindex target options
9849@cindex cross compiling
9850@cindex specifying machine version
9851@cindex specifying compiler version and target machine
9852@cindex compiler version, specifying
9853@cindex target machine, specifying
9854
37a4aa31
GK
9855The usual way to run GCC is to run the executable called @file{gcc}, or
9856@file{<machine>-gcc} when cross-compiling, or
9857@file{<machine>-gcc-<version>} to run a version other than the one that
1401cf37 9858was installed last.
74291a4b
MM
9859
9860@node Submodel Options
9861@section Hardware Models and Configurations
9862@cindex submodel options
9863@cindex specifying hardware config
9864@cindex hardware models and configurations, specifying
9865@cindex machine dependent options
9866
1401cf37 9867Each target machine types can have its own
74291a4b
MM
9868special options, starting with @samp{-m}, to choose among various
9869hardware models or configurations---for example, 68010 vs 68020,
9870floating coprocessor or none. A single installed version of the
9871compiler can compile for any model or configuration, according to the
9872options specified.
9873
9874Some configurations of the compiler also support additional special
9875options, usually for compatibility with other compilers on the same
9876platform.
9877
39bc1876
NS
9878@c This list is ordered alphanumerically by subsection name.
9879@c It should be the same order and spelling as these options are listed
9880@c in Machine Dependent Options
9881
74291a4b 9882@menu
39bc1876 9883* ARC Options::
74291a4b 9884* ARM Options::
39bc1876 9885* AVR Options::
0d4a78eb 9886* Blackfin Options::
39bc1876 9887* CRIS Options::
53054e77 9888* CRX Options::
48aec0bc 9889* Darwin Options::
74291a4b 9890* DEC Alpha Options::
d7c23cdc 9891* DEC Alpha/VMS Options::
18a3bdcb 9892* FR30 Options::
39bc1876 9893* FRV Options::
464aea98 9894* GNU/Linux Options::
74291a4b 9895* H8/300 Options::
39bc1876
NS
9896* HPPA Options::
9897* i386 and x86-64 Options::
46994828 9898* i386 and x86-64 Windows Options::
39bc1876 9899* IA-64 Options::
dcad28fd 9900* IA-64/VMS Options::
aa4945c1 9901* LM32 Options::
38b2d076 9902* M32C Options::
39bc1876
NS
9903* M32R/D Options::
9904* M680x0 Options::
9905* M68hc1x Options::
9906* MCore Options::
e2491744 9907* MeP Options::
80920132 9908* MicroBlaze Options::
39bc1876
NS
9909* MIPS Options::
9910* MMIX Options::
9911* MN10300 Options::
39bc1876 9912* PDP-11 Options::
358da97e 9913* picoChip Options::
39bc1876
NS
9914* PowerPC Options::
9915* RS/6000 and PowerPC Options::
65a324b4 9916* RX Options::
39bc1876 9917* S/390 and zSeries Options::
93ef7c1f 9918* Score Options::
74291a4b 9919* SH Options::
c28aa982 9920* Solaris 2 Options::
39bc1876 9921* SPARC Options::
85d9c13c 9922* SPU Options::
74291a4b 9923* System V Options::
f84271d9 9924* V850 Options::
39bc1876 9925* VAX Options::
cd773ac4 9926* VxWorks Options::
39bc1876 9927* x86-64 Options::
69a0611f 9928* Xstormy16 Options::
03984308 9929* Xtensa Options::
39bc1876 9930* zSeries Options::
74291a4b
MM
9931@end menu
9932
39bc1876
NS
9933@node ARC Options
9934@subsection ARC Options
9935@cindex ARC Options
74291a4b 9936
39bc1876 9937These options are defined for ARC implementations:
74291a4b 9938
2642624b 9939@table @gcctabopt
39bc1876
NS
9940@item -EL
9941@opindex EL
9942Compile code for little endian mode. This is the default.
74cf1c6d 9943
39bc1876
NS
9944@item -EB
9945@opindex EB
9946Compile code for big endian mode.
74291a4b 9947
39bc1876
NS
9948@item -mmangle-cpu
9949@opindex mmangle-cpu
9950Prepend the name of the cpu to all public symbol names.
9951In multiple-processor systems, there are many ARC variants with different
9952instruction and register set characteristics. This flag prevents code
9953compiled for one cpu to be linked with code compiled for another.
9954No facility exists for handling variants that are ``almost identical''.
9955This is an all or nothing option.
74291a4b 9956
39bc1876
NS
9957@item -mcpu=@var{cpu}
9958@opindex mcpu
9959Compile code for ARC variant @var{cpu}.
9960Which variants are supported depend on the configuration.
9961All variants support @option{-mcpu=base}, this is the default.
74291a4b 9962
39bc1876
NS
9963@item -mtext=@var{text-section}
9964@itemx -mdata=@var{data-section}
9965@itemx -mrodata=@var{readonly-data-section}
9966@opindex mtext
9967@opindex mdata
9968@opindex mrodata
9969Put functions, data, and readonly data in @var{text-section},
9970@var{data-section}, and @var{readonly-data-section} respectively
9971by default. This can be overridden with the @code{section} attribute.
9972@xref{Variable Attributes}.
74291a4b 9973
39bc1876 9974@end table
74291a4b 9975
39bc1876
NS
9976@node ARM Options
9977@subsection ARM Options
9978@cindex ARM options
74291a4b 9979
39bc1876
NS
9980These @samp{-m} options are defined for Advanced RISC Machines (ARM)
9981architectures:
74cf1c6d 9982
39bc1876
NS
9983@table @gcctabopt
9984@item -mabi=@var{name}
9985@opindex mabi
8a36672b 9986Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
077fc835 9987@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
74cf1c6d 9988
39bc1876
NS
9989@item -mapcs-frame
9990@opindex mapcs-frame
9991Generate a stack frame that is compliant with the ARM Procedure Call
9992Standard for all functions, even if this is not strictly necessary for
9993correct execution of the code. Specifying @option{-fomit-frame-pointer}
9994with this option will cause the stack frames not to be generated for
9995leaf functions. The default is @option{-mno-apcs-frame}.
74291a4b 9996
39bc1876
NS
9997@item -mapcs
9998@opindex mapcs
9999This is a synonym for @option{-mapcs-frame}.
74291a4b 10000
39bc1876
NS
10001@ignore
10002@c not currently implemented
10003@item -mapcs-stack-check
10004@opindex mapcs-stack-check
10005Generate code to check the amount of stack space available upon entry to
10006every function (that actually uses some stack space). If there is
10007insufficient space available then either the function
10008@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
10009called, depending upon the amount of stack space required. The run time
10010system is required to provide these functions. The default is
10011@option{-mno-apcs-stack-check}, since this produces smaller code.
74cf1c6d 10012
39bc1876
NS
10013@c not currently implemented
10014@item -mapcs-float
10015@opindex mapcs-float
10016Pass floating point arguments using the float point registers. This is
10017one of the variants of the APCS@. This option is recommended if the
10018target hardware has a floating point unit or if a lot of floating point
10019arithmetic is going to be performed by the code. The default is
10020@option{-mno-apcs-float}, since integer only code is slightly increased in
10021size if @option{-mapcs-float} is used.
74291a4b 10022
39bc1876
NS
10023@c not currently implemented
10024@item -mapcs-reentrant
10025@opindex mapcs-reentrant
10026Generate reentrant, position independent code. The default is
10027@option{-mno-apcs-reentrant}.
10028@end ignore
74291a4b 10029
39bc1876
NS
10030@item -mthumb-interwork
10031@opindex mthumb-interwork
10032Generate code which supports calling between the ARM and Thumb
10033instruction sets. Without this option the two instruction sets cannot
10034be reliably used inside one program. The default is
10035@option{-mno-thumb-interwork}, since slightly larger code is generated
10036when @option{-mthumb-interwork} is specified.
10037
10038@item -mno-sched-prolog
10039@opindex mno-sched-prolog
10040Prevent the reordering of instructions in the function prolog, or the
10041merging of those instruction with the instructions in the function's
10042body. This means that all functions will start with a recognizable set
10043of instructions (or in fact one of a choice from a small set of
10044different function prologues), and this information can be used to
10045locate the start if functions inside an executable piece of code. The
10046default is @option{-msched-prolog}.
10047
26cd0fcc
SL
10048@item -mfloat-abi=@var{name}
10049@opindex mfloat-abi
10050Specifies which floating-point ABI to use. Permissible values
10051are: @samp{soft}, @samp{softfp} and @samp{hard}.
10052
7a61cf6f 10053Specifying @samp{soft} causes GCC to generate output containing
26cd0fcc 10054library calls for floating-point operations.
7a61cf6f
NC
10055@samp{softfp} allows the generation of code using hardware floating-point
10056instructions, but still uses the soft-float calling conventions.
10057@samp{hard} allows generation of floating-point instructions
26cd0fcc
SL
10058and uses FPU-specific calling conventions.
10059
26cd0fcc
SL
10060The default depends on the specific target configuration. Note that
10061the hard-float and soft-float ABIs are not link-compatible; you must
10062compile your entire program with the same ABI, and link with a
10063compatible set of libraries.
10064
39bc1876
NS
10065@item -mhard-float
10066@opindex mhard-float
26cd0fcc 10067Equivalent to @option{-mfloat-abi=hard}.
861bb6c1 10068
74291a4b 10069@item -msoft-float
cd3bb277 10070@opindex msoft-float
26cd0fcc 10071Equivalent to @option{-mfloat-abi=soft}.
74291a4b 10072
39bc1876
NS
10073@item -mlittle-endian
10074@opindex mlittle-endian
10075Generate code for a processor running in little-endian mode. This is
10076the default for all standard configurations.
74291a4b 10077
39bc1876
NS
10078@item -mbig-endian
10079@opindex mbig-endian
10080Generate code for a processor running in big-endian mode; the default is
10081to compile code for a little-endian processor.
74291a4b 10082
39bc1876
NS
10083@item -mwords-little-endian
10084@opindex mwords-little-endian
10085This option only applies when generating code for big-endian processors.
10086Generate code for a little-endian word order but a big-endian byte
10087order. That is, a byte order of the form @samp{32107654}. Note: this
10088option should only be used if you require compatibility with code for
10089big-endian ARM processors generated by versions of the compiler prior to
100902.8.
74291a4b 10091
39bc1876
NS
10092@item -mcpu=@var{name}
10093@opindex mcpu
10094This specifies the name of the target ARM processor. GCC uses this name
10095to determine what kind of instructions it can emit when generating
10096assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
10097@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
10098@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
10099@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
10100@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
7ab23fd0 10101@samp{arm720},
d98a72fd 10102@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
7ab23fd0
JM
10103@samp{arm710t}, @samp{arm720t}, @samp{arm740t},
10104@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
10105@samp{strongarm1110},
39bc1876 10106@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
d98a72fd
RE
10107@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
10108@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
10109@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
f9e8581a 10110@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
fa91adc6 10111@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
ead204d9 10112@samp{arm1156t2-s}, @samp{arm1156t2f-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
508371fe 10113@samp{cortex-a5}, @samp{cortex-a8}, @samp{cortex-a9}, @samp{cortex-a15},
f6e47b26 10114@samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m4}, @samp{cortex-m3},
302c3d8e 10115@samp{cortex-m1},
9833720d 10116@samp{cortex-m0},
442dc742 10117@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
74291a4b 10118
33558d94 10119@item -mtune=@var{name}
39bc1876
NS
10120@opindex mtune
10121This option is very similar to the @option{-mcpu=} option, except that
10122instead of specifying the actual target processor type, and hence
10123restricting which instructions can be used, it specifies that GCC should
10124tune the performance of the code as if the target were of the type
10125specified in this option, but still choosing the instructions that it
10126will generate based on the cpu specified by a @option{-mcpu=} option.
10127For some ARM implementations better performance can be obtained by using
10128this option.
861bb6c1 10129
39bc1876
NS
10130@item -march=@var{name}
10131@opindex march
10132This specifies the name of the target ARM architecture. GCC uses this
10133name to determine what kind of instructions it can emit when generating
10134assembly code. This option can be used in conjunction with or instead
10135of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
10136@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
7ab23fd0
JM
10137@samp{armv5}, @samp{armv5t}, @samp{armv5e}, @samp{armv5te},
10138@samp{armv6}, @samp{armv6j},
bf98ec6c
PB
10139@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv6-m},
10140@samp{armv7}, @samp{armv7-a}, @samp{armv7-r}, @samp{armv7-m},
442dc742 10141@samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
861bb6c1 10142
39bc1876
NS
10143@item -mfpu=@var{name}
10144@itemx -mfpe=@var{number}
10145@itemx -mfp=@var{number}
10146@opindex mfpu
10147@opindex mfpe
10148@opindex mfp
10149This specifies what floating point hardware (or hardware emulation) is
10150available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
e0dc3601
PB
10151@samp{fpe3}, @samp{maverick}, @samp{vfp}, @samp{vfpv3}, @samp{vfpv3-fp16},
10152@samp{vfpv3-d16}, @samp{vfpv3-d16-fp16}, @samp{vfpv3xd}, @samp{vfpv3xd-fp16},
1abed66b
PB
10153@samp{neon}, @samp{neon-fp16}, @samp{vfpv4}, @samp{vfpv4-d16},
10154@samp{fpv4-sp-d16} and @samp{neon-vfpv4}.
e0dc3601
PB
10155@option{-mfp} and @option{-mfpe} are synonyms for
10156@option{-mfpu}=@samp{fpe}@var{number}, for compatibility with older versions
10157of GCC@.
861bb6c1 10158
39bc1876
NS
10159If @option{-msoft-float} is specified this specifies the format of
10160floating point values.
fb868474 10161
400cfcf5
JB
10162If the selected floating-point hardware includes the NEON extension
10163(e.g. @option{-mfpu}=@samp{neon}), note that floating-point
10164operations will not be used by GCC's auto-vectorization pass unless
10165@option{-funsafe-math-optimizations} is also specified. This is
10166because NEON hardware does not fully implement the IEEE 754 standard for
10167floating-point arithmetic (in particular denormal values are treated as
10168zero), so the use of NEON instructions may lead to a loss of precision.
10169
0fd8c3ad
SL
10170@item -mfp16-format=@var{name}
10171@opindex mfp16-format
10172Specify the format of the @code{__fp16} half-precision floating-point type.
7a61cf6f
NC
10173Permissible names are @samp{none}, @samp{ieee}, and @samp{alternative};
10174the default is @samp{none}, in which case the @code{__fp16} type is not
0fd8c3ad
SL
10175defined. @xref{Half-Precision}, for more information.
10176
39bc1876
NS
10177@item -mstructure-size-boundary=@var{n}
10178@opindex mstructure-size-boundary
10179The size of all structures and unions will be rounded up to a multiple
10180of the number of bits set by this option. Permissible values are 8, 32
10181and 64. The default value varies for different toolchains. For the COFF
10182targeted toolchain the default value is 8. A value of 64 is only allowed
10183if the underlying ABI supports it.
b71733d5 10184
39bc1876
NS
10185Specifying the larger number can produce faster, more efficient code, but
10186can also increase the size of the program. Different values are potentially
10187incompatible. Code compiled with one value cannot necessarily expect to
10188work with code or libraries compiled with another value, if they exchange
10189information using structures or unions.
24f9c4df 10190
39bc1876
NS
10191@item -mabort-on-noreturn
10192@opindex mabort-on-noreturn
10193Generate a call to the function @code{abort} at the end of a
10194@code{noreturn} function. It will be executed if the function tries to
10195return.
24f9c4df 10196
39bc1876
NS
10197@item -mlong-calls
10198@itemx -mno-long-calls
10199@opindex mlong-calls
10200@opindex mno-long-calls
10201Tells the compiler to perform function calls by first loading the
10202address of the function into a register and then performing a subroutine
10203call on this register. This switch is needed if the target function
10204will lie outside of the 64 megabyte addressing range of the offset based
10205version of subroutine call instruction.
24f9c4df 10206
39bc1876
NS
10207Even if this switch is enabled, not all function calls will be turned
10208into long calls. The heuristic is that static functions, functions
10209which have the @samp{short-call} attribute, functions that are inside
10210the scope of a @samp{#pragma no_long_calls} directive and functions whose
10211definitions have already been compiled within the current compilation
10212unit, will not be turned into long calls. The exception to this rule is
10213that weak function definitions, functions with the @samp{long-call}
10214attribute or the @samp{section} attribute, and functions that are within
10215the scope of a @samp{#pragma long_calls} directive, will always be
10216turned into long calls.
24f9c4df 10217
39bc1876
NS
10218This feature is not enabled by default. Specifying
10219@option{-mno-long-calls} will restore the default behavior, as will
10220placing the function calls within the scope of a @samp{#pragma
10221long_calls_off} directive. Note these switches have no effect on how
10222the compiler generates code to handle function calls via function
10223pointers.
24f9c4df 10224
39bc1876
NS
10225@item -msingle-pic-base
10226@opindex msingle-pic-base
10227Treat the register used for PIC addressing as read-only, rather than
10228loading it in the prologue for each function. The run-time system is
10229responsible for initializing this register with an appropriate value
10230before execution begins.
2856c3e3 10231
39bc1876
NS
10232@item -mpic-register=@var{reg}
10233@opindex mpic-register
10234Specify the register to be used for PIC addressing. The default is R10
10235unless stack-checking is enabled, when R9 is used.
2856c3e3 10236
39bc1876
NS
10237@item -mcirrus-fix-invalid-insns
10238@opindex mcirrus-fix-invalid-insns
10239@opindex mno-cirrus-fix-invalid-insns
10240Insert NOPs into the instruction stream to in order to work around
10241problems with invalid Maverick instruction combinations. This option
10242is only valid if the @option{-mcpu=ep9312} option has been used to
10243enable generation of instructions for the Cirrus Maverick floating
10244point co-processor. This option is not enabled by default, since the
10245problem is only present in older Maverick implementations. The default
10246can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
10247switch.
2856c3e3 10248
39bc1876
NS
10249@item -mpoke-function-name
10250@opindex mpoke-function-name
10251Write the name of each function into the text section, directly
10252preceding the function prologue. The generated code is similar to this:
2856c3e3 10253
39bc1876
NS
10254@smallexample
10255 t0
10256 .ascii "arm_poke_function_name", 0
10257 .align
10258 t1
10259 .word 0xff000000 + (t1 - t0)
10260 arm_poke_function_name
10261 mov ip, sp
10262 stmfd sp!, @{fp, ip, lr, pc@}
10263 sub fp, ip, #4
10264@end smallexample
f077f169 10265
39bc1876
NS
10266When performing a stack backtrace, code can inspect the value of
10267@code{pc} stored at @code{fp + 0}. If the trace function then looks at
10268location @code{pc - 12} and the top 8 bits are set, then we know that
10269there is a function name embedded immediately preceding this location
10270and has length @code{((pc[-3]) & 0xff000000)}.
2856c3e3 10271
39bc1876
NS
10272@item -mthumb
10273@opindex mthumb
5b3e6663 10274Generate code for the Thumb instruction set. The default is to
39bc1876 10275use the 32-bit ARM instruction set.
5b3e6663
PB
10276This option automatically enables either 16-bit Thumb-1 or
10277mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
7a61cf6f 10278and @option{-march=@var{name}} options. This option is not passed to the
bebc6e07 10279assembler. If you want to force assembler files to be interpreted as Thumb code,
7a61cf6f 10280either add a @samp{.thumb} directive to the source or pass the @option{-mthumb}
bebc6e07 10281option directly to the assembler by prefixing it with @option{-Wa}.
8a0b86f5 10282
39bc1876
NS
10283@item -mtpcs-frame
10284@opindex mtpcs-frame
10285Generate a stack frame that is compliant with the Thumb Procedure Call
10286Standard for all non-leaf functions. (A leaf function is one that does
10287not call any other functions.) The default is @option{-mno-tpcs-frame}.
058edcdb 10288
39bc1876
NS
10289@item -mtpcs-leaf-frame
10290@opindex mtpcs-leaf-frame
10291Generate a stack frame that is compliant with the Thumb Procedure Call
10292Standard for all leaf functions. (A leaf function is one that does
10293not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
2856c3e3 10294
39bc1876
NS
10295@item -mcallee-super-interworking
10296@opindex mcallee-super-interworking
10297Gives all externally visible functions in the file being compiled an ARM
10298instruction set header which switches to Thumb mode before executing the
10299rest of the function. This allows these functions to be called from
7a61cf6f 10300non-interworking code. This option is not valid in AAPCS configurations
3ce14752 10301because interworking is enabled by default.
39bc1876
NS
10302
10303@item -mcaller-super-interworking
10304@opindex mcaller-super-interworking
10305Allows calls via function pointers (including virtual functions) to
10306execute correctly regardless of whether the target code has been
10307compiled for interworking or not. There is a small overhead in the cost
7a61cf6f 10308of executing a function pointer if this option is enabled. This option
3ce14752
RR
10309is not valid in AAPCS configurations because interworking is enabled
10310by default.
2856c3e3 10311
d3585b76
DJ
10312@item -mtp=@var{name}
10313@opindex mtp
10314Specify the access model for the thread local storage pointer. The valid
10315models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
10316@option{cp15}, which fetches the thread pointer from @code{cp15} directly
10317(supported in the arm6k architecture), and @option{auto}, which uses the
10318best available method for the selected processor. The default setting is
10319@option{auto}.
10320
571191af
PB
10321@item -mword-relocations
10322@opindex mword-relocations
10323Only generate absolute relocations on word sized values (i.e. R_ARM_ABS32).
10324This is enabled by default on targets (uClinux, SymbianOS) where the runtime
10325loader imposes this restriction, and when @option{-fpic} or @option{-fPIC}
a640c13b 10326is specified.
571191af 10327
fa6aeae1
MK
10328@item -mfix-cortex-m3-ldrd
10329@opindex mfix-cortex-m3-ldrd
10330Some Cortex-M3 cores can cause data corruption when @code{ldrd} instructions
10331with overlapping destination and base registers are used. This option avoids
10332generating these instructions. This option is enabled by default when
10333@option{-mcpu=cortex-m3} is specified.
10334
2856c3e3
SC
10335@end table
10336
39bc1876
NS
10337@node AVR Options
10338@subsection AVR Options
10339@cindex AVR Options
74291a4b 10340
39bc1876 10341These options are defined for AVR implementations:
74291a4b 10342
2642624b 10343@table @gcctabopt
39bc1876
NS
10344@item -mmcu=@var{mcu}
10345@opindex mmcu
10346Specify ATMEL AVR instruction set or MCU type.
74291a4b 10347
39bc1876
NS
10348Instruction set avr1 is for the minimal AVR core, not supported by the C
10349compiler, only for assembler programs (MCU types: at90s1200, attiny10,
10350attiny11, attiny12, attiny15, attiny28).
74291a4b 10351
39bc1876
NS
10352Instruction set avr2 (default) is for the classic AVR core with up to
103538K program memory space (MCU types: at90s2313, at90s2323, attiny22,
10354at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
10355at90c8534, at90s8535).
74291a4b 10356
39bc1876
NS
10357Instruction set avr3 is for the classic AVR core with up to 128K program
10358memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
74291a4b 10359
39bc1876
NS
10360Instruction set avr4 is for the enhanced AVR core with up to 8K program
10361memory space (MCU types: atmega8, atmega83, atmega85).
74291a4b 10362
39bc1876
NS
10363Instruction set avr5 is for the enhanced AVR core with up to 128K program
10364memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
10365atmega64, atmega128, at43usb355, at94k).
74291a4b 10366
39bc1876
NS
10367@item -mno-interrupts
10368@opindex mno-interrupts
10369Generated code is not compatible with hardware interrupts.
10370Code size will be smaller.
74291a4b 10371
39bc1876
NS
10372@item -mcall-prologues
10373@opindex mcall-prologues
10374Functions prologues/epilogues expanded as call to appropriate
10375subroutines. Code size will be smaller.
74291a4b 10376
39bc1876
NS
10377@item -mtiny-stack
10378@opindex mtiny-stack
10379Change only the low 8 bits of the stack pointer.
74291a4b 10380
39bc1876
NS
10381@item -mint8
10382@opindex mint8
8a36672b 10383Assume int to be 8 bit integer. This affects the sizes of all types: A
e4ae5e77 10384char will be 1 byte, an int will be 1 byte, a long will be 2 bytes
8a36672b 10385and long long will be 4 bytes. Please note that this option does not
39bc1876
NS
10386comply to the C standards, but it will provide you with smaller code
10387size.
10388@end table
74291a4b 10389
0d4a78eb
BS
10390@node Blackfin Options
10391@subsection Blackfin Options
10392@cindex Blackfin Options
10393
10394@table @gcctabopt
ea2382be 10395@item -mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]}
28f601ff 10396@opindex mcpu=
ea2382be 10397Specifies the name of the target Blackfin processor. Currently, @var{cpu}
318b3009
BS
10398can be one of @samp{bf512}, @samp{bf514}, @samp{bf516}, @samp{bf518},
10399@samp{bf522}, @samp{bf523}, @samp{bf524}, @samp{bf525}, @samp{bf526},
10400@samp{bf527}, @samp{bf531}, @samp{bf532}, @samp{bf533},
10401@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf538}, @samp{bf539},
64882649 10402@samp{bf542}, @samp{bf544}, @samp{bf547}, @samp{bf548}, @samp{bf549},
5254cd50 10403@samp{bf542m}, @samp{bf544m}, @samp{bf547m}, @samp{bf548m}, @samp{bf549m},
ea2382be
JZ
10404@samp{bf561}.
10405The optional @var{sirevision} specifies the silicon revision of the target
10406Blackfin processor. Any workarounds available for the targeted silicon revision
10407will be enabled. If @var{sirevision} is @samp{none}, no workarounds are enabled.
10408If @var{sirevision} is @samp{any}, all workarounds for the targeted processor
10409will be enabled. The @code{__SILICON_REVISION__} macro is defined to two
10410hexadecimal digits representing the major and minor numbers in the silicon
10411revision. If @var{sirevision} is @samp{none}, the @code{__SILICON_REVISION__}
10412is not defined. If @var{sirevision} is @samp{any}, the
10413@code{__SILICON_REVISION__} is defined to be @code{0xffff}.
10414If this optional @var{sirevision} is not used, GCC assumes the latest known
10415silicon revision of the targeted Blackfin processor.
10416
10417Support for @samp{bf561} is incomplete. For @samp{bf561},
10418Only the processor macro is defined.
28f601ff
JZ
10419Without this option, @samp{bf532} is used as the processor by default.
10420The corresponding predefined processor macros for @var{cpu} is to
ea2382be
JZ
10421be defined. And for @samp{bfin-elf} toolchain, this causes the hardware BSP
10422provided by libgloss to be linked in if @option{-msim} is not given.
28f601ff
JZ
10423
10424@item -msim
10425@opindex msim
10426Specifies that the program will be run on the simulator. This causes
10427the simulator BSP provided by libgloss to be linked in. This option
10428has effect only for @samp{bfin-elf} toolchain.
28bbc967
BS
10429Certain other options, such as @option{-mid-shared-library} and
10430@option{-mfdpic}, imply @option{-msim}.
28f601ff 10431
0d4a78eb
BS
10432@item -momit-leaf-frame-pointer
10433@opindex momit-leaf-frame-pointer
10434Don't keep the frame pointer in a register for leaf functions. This
10435avoids the instructions to save, set up and restore frame pointers and
10436makes an extra register available in leaf functions. The option
10437@option{-fomit-frame-pointer} removes the frame pointer for all functions
10438which might make debugging harder.
10439
3fb192d2
BS
10440@item -mspecld-anomaly
10441@opindex mspecld-anomaly
0d4a78eb 10442When enabled, the compiler will ensure that the generated code does not
ea2382be
JZ
10443contain speculative loads after jump instructions. If this option is used,
10444@code{__WORKAROUND_SPECULATIVE_LOADS} is defined.
0d4a78eb 10445
3fb192d2
BS
10446@item -mno-specld-anomaly
10447@opindex mno-specld-anomaly
0d4a78eb
BS
10448Don't generate extra code to prevent speculative loads from occurring.
10449
3fb192d2 10450@item -mcsync-anomaly
161c21b6 10451@opindex mcsync-anomaly
3fb192d2
BS
10452When enabled, the compiler will ensure that the generated code does not
10453contain CSYNC or SSYNC instructions too soon after conditional branches.
ea2382be 10454If this option is used, @code{__WORKAROUND_SPECULATIVE_SYNCS} is defined.
3fb192d2
BS
10455
10456@item -mno-csync-anomaly
161c21b6 10457@opindex mno-csync-anomaly
3fb192d2
BS
10458Don't generate extra code to prevent CSYNC or SSYNC instructions from
10459occurring too soon after a conditional branch.
10460
0d4a78eb 10461@item -mlow-64k
9821b257 10462@opindex mlow-64k
0d4a78eb
BS
10463When enabled, the compiler is free to take advantage of the knowledge that
10464the entire program fits into the low 64k of memory.
10465
10466@item -mno-low-64k
10467@opindex mno-low-64k
10468Assume that the program is arbitrarily large. This is the default.
10469
d6eb07dc
BS
10470@item -mstack-check-l1
10471@opindex mstack-check-l1
10472Do stack checking using information placed into L1 scratchpad memory by the
10473uClinux kernel.
10474
0d4a78eb
BS
10475@item -mid-shared-library
10476@opindex mid-shared-library
10477Generate code that supports shared libraries via the library ID method.
10478This allows for execute in place and shared libraries in an environment
10479without virtual memory management. This option implies @option{-fPIC}.
28bbc967 10480With a @samp{bfin-elf} target, this option implies @option{-msim}.
0d4a78eb
BS
10481
10482@item -mno-id-shared-library
10483@opindex mno-id-shared-library
10484Generate code that doesn't assume ID based shared libraries are being used.
10485This is the default.
10486
d6eb07dc
BS
10487@item -mleaf-id-shared-library
10488@opindex mleaf-id-shared-library
10489Generate code that supports shared libraries via the library ID method,
10490but assumes that this library or executable won't link against any other
10491ID shared libraries. That allows the compiler to use faster code for jumps
10492and calls.
10493
10494@item -mno-leaf-id-shared-library
10495@opindex mno-leaf-id-shared-library
10496Do not assume that the code being compiled won't link against any ID shared
10497libraries. Slower code will be generated for jump and call insns.
10498
0d4a78eb
BS
10499@item -mshared-library-id=n
10500@opindex mshared-library-id
10501Specified the identification number of the ID based shared library being
10502compiled. Specifying a value of 0 will generate more compact code, specifying
10503other values will force the allocation of that number to the current
10504library but is no more space or time efficient than omitting this option.
b6877196 10505
d6eb07dc
BS
10506@item -msep-data
10507@opindex msep-data
10508Generate code that allows the data segment to be located in a different
10509area of memory from the text segment. This allows for execute in place in
10510an environment without virtual memory management by eliminating relocations
10511against the text section.
10512
10513@item -mno-sep-data
10514@opindex mno-sep-data
10515Generate code that assumes that the data segment follows the text segment.
10516This is the default.
10517
b6877196
BS
10518@item -mlong-calls
10519@itemx -mno-long-calls
10520@opindex mlong-calls
10521@opindex mno-long-calls
10522Tells the compiler to perform function calls by first loading the
10523address of the function into a register and then performing a subroutine
10524call on this register. This switch is needed if the target function
10525will lie outside of the 24 bit addressing range of the offset based
10526version of subroutine call instruction.
10527
10528This feature is not enabled by default. Specifying
10529@option{-mno-long-calls} will restore the default behavior. Note these
10530switches have no effect on how the compiler generates code to handle
10531function calls via function pointers.
2c117a21
JZ
10532
10533@item -mfast-fp
10534@opindex mfast-fp
10535Link with the fast floating-point library. This library relaxes some of
10536the IEEE floating-point standard's rules for checking inputs against
10537Not-a-Number (NAN), in the interest of performance.
e874e49f
JZ
10538
10539@item -minline-plt
10540@opindex minline-plt
10541Enable inlining of PLT entries in function calls to functions that are
10542not known to bind locally. It has no effect without @option{-mfdpic}.
0d4a78eb 10543
16869606
BS
10544@item -mmulticore
10545@opindex mmulticore
10546Build standalone application for multicore Blackfin processor. Proper
10547start files and link scripts will be used to support multicore.
10548This option defines @code{__BFIN_MULTICORE}. It can only be used with
10549@option{-mcpu=bf561@r{[}-@var{sirevision}@r{]}}. It can be used with
10550@option{-mcorea} or @option{-mcoreb}. If it's used without
10551@option{-mcorea} or @option{-mcoreb}, single application/dual core
10552programming model is used. In this model, the main function of Core B
10553should be named as coreb_main. If it's used with @option{-mcorea} or
10554@option{-mcoreb}, one application per core programming model is used.
10555If this option is not used, single core application programming
10556model is used.
10557
10558@item -mcorea
10559@opindex mcorea
10560Build standalone application for Core A of BF561 when using
10561one application per core programming model. Proper start files
10562and link scripts will be used to support Core A. This option
10563defines @code{__BFIN_COREA}. It must be used with @option{-mmulticore}.
10564
10565@item -mcoreb
10566@opindex mcoreb
10567Build standalone application for Core B of BF561 when using
10568one application per core programming model. Proper start files
10569and link scripts will be used to support Core B. This option
10570defines @code{__BFIN_COREB}. When this option is used, coreb_main
10571should be used instead of main. It must be used with
7a61cf6f 10572@option{-mmulticore}.
16869606
BS
10573
10574@item -msdram
10575@opindex msdram
10576Build standalone application for SDRAM. Proper start files and
10577link scripts will be used to put the application into SDRAM.
10578Loader should initialize SDRAM before loading the application
10579into SDRAM. This option defines @code{__BFIN_SDRAM}.
bf85bc3d
BS
10580
10581@item -micplb
10582@opindex micplb
10583Assume that ICPLBs are enabled at runtime. This has an effect on certain
10584anomaly workarounds. For Linux targets, the default is to assume ICPLBs
10585are enabled; for standalone applications the default is off.
16869606 10586@end table
6ccde948 10587
39bc1876
NS
10588@node CRIS Options
10589@subsection CRIS Options
10590@cindex CRIS Options
74291a4b 10591
39bc1876 10592These options are defined specifically for the CRIS ports.
74291a4b 10593
39bc1876
NS
10594@table @gcctabopt
10595@item -march=@var{architecture-type}
10596@itemx -mcpu=@var{architecture-type}
10597@opindex march
10598@opindex mcpu
10599Generate code for the specified architecture. The choices for
10600@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
8a36672b 10601respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
39bc1876
NS
10602Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
10603@samp{v10}.
c219ddf7 10604
39bc1876
NS
10605@item -mtune=@var{architecture-type}
10606@opindex mtune
10607Tune to @var{architecture-type} everything applicable about the generated
10608code, except for the ABI and the set of available instructions. The
10609choices for @var{architecture-type} are the same as for
10610@option{-march=@var{architecture-type}}.
54284728 10611
39bc1876
NS
10612@item -mmax-stack-frame=@var{n}
10613@opindex mmax-stack-frame
10614Warn when the stack frame of a function exceeds @var{n} bytes.
54284728 10615
39bc1876
NS
10616@item -metrax4
10617@itemx -metrax100
10618@opindex metrax4
10619@opindex metrax100
10620The options @option{-metrax4} and @option{-metrax100} are synonyms for
10621@option{-march=v3} and @option{-march=v8} respectively.
c0498f43 10622
39bc1876
NS
10623@item -mmul-bug-workaround
10624@itemx -mno-mul-bug-workaround
10625@opindex mmul-bug-workaround
10626@opindex mno-mul-bug-workaround
10627Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
10628models where it applies. This option is active by default.
c0498f43 10629
39bc1876
NS
10630@item -mpdebug
10631@opindex mpdebug
10632Enable CRIS-specific verbose debug-related information in the assembly
10633code. This option also has the effect to turn off the @samp{#NO_APP}
10634formatted-code indicator to the assembler at the beginning of the
10635assembly file.
c0498f43 10636
39bc1876
NS
10637@item -mcc-init
10638@opindex mcc-init
10639Do not use condition-code results from previous instruction; always emit
10640compare and test instructions before use of condition codes.
74291a4b 10641
39bc1876
NS
10642@item -mno-side-effects
10643@opindex mno-side-effects
10644Do not emit instructions with side-effects in addressing modes other than
10645post-increment.
238b11b5 10646
39bc1876
NS
10647@item -mstack-align
10648@itemx -mno-stack-align
10649@itemx -mdata-align
10650@itemx -mno-data-align
10651@itemx -mconst-align
10652@itemx -mno-const-align
10653@opindex mstack-align
10654@opindex mno-stack-align
10655@opindex mdata-align
10656@opindex mno-data-align
10657@opindex mconst-align
10658@opindex mno-const-align
10659These options (no-options) arranges (eliminate arrangements) for the
10660stack-frame, individual data and constants to be aligned for the maximum
10661single data access size for the chosen CPU model. The default is to
10662arrange for 32-bit alignment. ABI details such as structure layout are
10663not affected by these options.
238b11b5 10664
39bc1876
NS
10665@item -m32-bit
10666@itemx -m16-bit
10667@itemx -m8-bit
10668@opindex m32-bit
10669@opindex m16-bit
10670@opindex m8-bit
10671Similar to the stack- data- and const-align options above, these options
10672arrange for stack-frame, writable data and constants to all be 32-bit,
1067316-bit or 8-bit aligned. The default is 32-bit alignment.
238b11b5 10674
39bc1876
NS
10675@item -mno-prologue-epilogue
10676@itemx -mprologue-epilogue
10677@opindex mno-prologue-epilogue
10678@opindex mprologue-epilogue
10679With @option{-mno-prologue-epilogue}, the normal function prologue and
10680epilogue that sets up the stack-frame are omitted and no return
10681instructions or return sequences are generated in the code. Use this
10682option only together with visual inspection of the compiled code: no
10683warnings or errors are generated when call-saved registers must be saved,
10684or storage for local variable needs to be allocated.
238b11b5 10685
39bc1876
NS
10686@item -mno-gotplt
10687@itemx -mgotplt
10688@opindex mno-gotplt
10689@opindex mgotplt
10690With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
10691instruction sequences that load addresses for functions from the PLT part
10692of the GOT rather than (traditional on other architectures) calls to the
8a36672b 10693PLT@. The default is @option{-mgotplt}.
238b11b5 10694
39bc1876
NS
10695@item -melf
10696@opindex melf
10697Legacy no-op option only recognized with the cris-axis-elf and
10698cris-axis-linux-gnu targets.
74291a4b 10699
39bc1876
NS
10700@item -mlinux
10701@opindex mlinux
10702Legacy no-op option only recognized with the cris-axis-linux-gnu target.
ded17aad 10703
39bc1876
NS
10704@item -sim
10705@opindex sim
cd985f66 10706This option, recognized for the cris-axis-elf arranges
39bc1876
NS
10707to link with input-output functions from a simulator library. Code,
10708initialized data and zero-initialized data are allocated consecutively.
74291a4b 10709
39bc1876
NS
10710@item -sim2
10711@opindex sim2
10712Like @option{-sim}, but pass linker options to locate initialized data at
107130x40000000 and zero-initialized data at 0x80000000.
74291a4b
MM
10714@end table
10715
53054e77
PW
10716@node CRX Options
10717@subsection CRX Options
10718@cindex CRX Options
10719
10720These options are defined specifically for the CRX ports.
10721
10722@table @gcctabopt
10723
10724@item -mmac
10725@opindex mmac
10726Enable the use of multiply-accumulate instructions. Disabled by default.
10727
10728@item -mpush-args
10729@opindex mpush-args
10730Push instructions will be used to pass outgoing arguments when functions
10731are called. Enabled by default.
10732@end table
10733
39bc1876
NS
10734@node Darwin Options
10735@subsection Darwin Options
10736@cindex Darwin options
74291a4b 10737
39bc1876 10738These options are defined for all architectures running the Darwin operating
965a7e90
GK
10739system.
10740
10741FSF GCC on Darwin does not create ``fat'' object files; it will create
10742an object file for the single architecture that it was built to
10743target. Apple's GCC on Darwin does create ``fat'' files if multiple
46bfe5e3
GK
10744@option{-arch} options are used; it does so by running the compiler or
10745linker multiple times and joining the results together with
10746@file{lipo}.
965a7e90 10747
46bfe5e3
GK
10748The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
10749@samp{i686}) is determined by the flags that specify the ISA
10750that GCC is targetting, like @option{-mcpu} or @option{-march}. The
965a7e90 10751@option{-force_cpusubtype_ALL} option can be used to override this.
74291a4b 10752
38b974a6 10753The Darwin tools vary in their behavior when presented with an ISA
46bfe5e3
GK
10754mismatch. The assembler, @file{as}, will only permit instructions to
10755be used that are valid for the subtype of the file it is generating,
e4ae5e77 10756so you cannot put 64-bit instructions in a @samp{ppc750} object file.
46bfe5e3
GK
10757The linker for shared libraries, @file{/usr/bin/libtool}, will fail
10758and print an error if asked to create a shared library with a less
10759restrictive subtype than its input files (for instance, trying to put
10760a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
10761for executables, @file{ld}, will quietly give the executable the most
10762restrictive subtype of any of its input files.
10763
2642624b 10764@table @gcctabopt
39bc1876
NS
10765@item -F@var{dir}
10766@opindex F
10767Add the framework directory @var{dir} to the head of the list of
10768directories to be searched for header files. These directories are
10769interleaved with those specified by @option{-I} options and are
10770scanned in a left-to-right order.
5848830f 10771
39bc1876
NS
10772A framework directory is a directory with frameworks in it. A
10773framework is a directory with a @samp{"Headers"} and/or
10774@samp{"PrivateHeaders"} directory contained directly in it that ends
10775in @samp{".framework"}. The name of a framework is the name of this
10776directory excluding the @samp{".framework"}. Headers associated with
10777the framework are found in one of those two directories, with
10778@samp{"Headers"} being searched first. A subframework is a framework
10779directory that is in a framework's @samp{"Frameworks"} directory.
10780Includes of subframework headers can only appear in a header of a
10781framework that contains the subframework, or in a sibling subframework
10782header. Two subframeworks are siblings if they occur in the same
10783framework. A subframework should not have the same name as a
10784framework, a warning will be issued if this is violated. Currently a
10785subframework cannot have subframeworks, in the future, the mechanism
10786may be extended to support this. The standard frameworks can be found
3e558e80
MS
10787in @samp{"/System/Library/Frameworks"} and
10788@samp{"/Library/Frameworks"}. An example include looks like
39bc1876
NS
10789@code{#include <Framework/header.h>}, where @samp{Framework} denotes
10790the name of the framework and header.h is found in the
10791@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
157a620e 10792
1f1d5130
MS
10793@item -iframework@var{dir}
10794@opindex iframework
10795Like @option{-F} except the directory is a treated as a system
10796directory. The main difference between this @option{-iframework} and
10797@option{-F} is that with @option{-iframework} the compiler does not
10798warn about constructs contained within header files found via
10799@var{dir}. This option is valid only for the C family of languages.
10800
7aded944 10801@item -gused
edc5f63b 10802@opindex gused
8a36672b 10803Emit debugging information for symbols that are used. For STABS
7aded944 10804debugging format, this enables @option{-feliminate-unused-debug-symbols}.
8a36672b 10805This is by default ON@.
7aded944
DP
10806
10807@item -gfull
edc5f63b 10808@opindex gfull
7aded944
DP
10809Emit debugging information for all symbols and types.
10810
ed5b9f96
GK
10811@item -mmacosx-version-min=@var{version}
10812The earliest version of MacOS X that this executable will run on
10813is @var{version}. Typical values of @var{version} include @code{10.1},
10814@code{10.2}, and @code{10.3.9}.
10815
e46b55d0
GK
10816If the compiler was built to use the system's headers by default,
10817then the default for this option is the system version on which the
10818compiler is running, otherwise the default is to make choices which
10819are compatible with as many systems and code bases as possible.
ed5b9f96 10820
57164024
MS
10821@item -mkernel
10822@opindex mkernel
b5d713b9 10823Enable kernel development mode. The @option{-mkernel} option sets
57164024
MS
10824@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
10825@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
10826@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
10827applicable. This mode also sets @option{-mno-altivec},
10828@option{-msoft-float}, @option{-fno-builtin} and
10829@option{-mlong-branch} for PowerPC targets.
10830
8f4220dc 10831@item -mone-byte-bool
edc5f63b 10832@opindex mone-byte-bool
8f4220dc 10833Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
f0eb93a8 10834By default @samp{sizeof(bool)} is @samp{4} when compiling for
8f4220dc
MA
10835Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
10836option has no effect on x86.
10837
10838@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
10839to generate code that is not binary compatible with code generated
10840without that switch. Using this switch may require recompiling all
f0eb93a8 10841other modules in a program, including system libraries. Use this
8f4220dc
MA
10842switch to conform to a non-default data model.
10843
699c914a
MS
10844@item -mfix-and-continue
10845@itemx -ffix-and-continue
10846@itemx -findirect-data
10847@opindex mfix-and-continue
10848@opindex ffix-and-continue
10849@opindex findirect-data
10850Generate code suitable for fast turn around development. Needed to
10851enable gdb to dynamically load @code{.o} files into already running
10852programs. @option{-findirect-data} and @option{-ffix-and-continue}
10853are provided for backwards compatibility.
10854
39bc1876
NS
10855@item -all_load
10856@opindex all_load
10857Loads all members of static archive libraries.
10858See man ld(1) for more information.
74291a4b 10859
39bc1876
NS
10860@item -arch_errors_fatal
10861@opindex arch_errors_fatal
10862Cause the errors having to do with files that have the wrong architecture
10863to be fatal.
157a620e 10864
39bc1876
NS
10865@item -bind_at_load
10866@opindex bind_at_load
10867Causes the output file to be marked such that the dynamic linker will
10868bind all undefined references when the file is loaded or launched.
157a620e 10869
39bc1876
NS
10870@item -bundle
10871@opindex bundle
10872Produce a Mach-o bundle format file.
10873See man ld(1) for more information.
157a620e 10874
39bc1876
NS
10875@item -bundle_loader @var{executable}
10876@opindex bundle_loader
965a7e90 10877This option specifies the @var{executable} that will be loading the build
8a36672b 10878output file being linked. See man ld(1) for more information.
157a620e 10879
965a7e90 10880@item -dynamiclib
edc5f63b 10881@opindex dynamiclib
965a7e90
GK
10882When passed this option, GCC will produce a dynamic library instead of
10883an executable when linking, using the Darwin @file{libtool} command.
157a620e 10884
965a7e90 10885@item -force_cpusubtype_ALL
edc5f63b 10886@opindex force_cpusubtype_ALL
965a7e90
GK
10887This causes GCC's output file to have the @var{ALL} subtype, instead of
10888one controlled by the @option{-mcpu} or @option{-march} option.
10889
10890@item -allowable_client @var{client_name}
39bc1876
NS
10891@itemx -client_name
10892@itemx -compatibility_version
10893@itemx -current_version
5079843a 10894@itemx -dead_strip
39bc1876
NS
10895@itemx -dependency-file
10896@itemx -dylib_file
10897@itemx -dylinker_install_name
10898@itemx -dynamic
39bc1876
NS
10899@itemx -exported_symbols_list
10900@itemx -filelist
ab940b73 10901@need 800
39bc1876 10902@itemx -flat_namespace
39bc1876
NS
10903@itemx -force_flat_namespace
10904@itemx -headerpad_max_install_names
10905@itemx -image_base
10906@itemx -init
10907@itemx -install_name
10908@itemx -keep_private_externs
10909@itemx -multi_module
10910@itemx -multiply_defined
10911@itemx -multiply_defined_unused
ab940b73 10912@need 800
39bc1876 10913@itemx -noall_load
89aa5a20 10914@itemx -no_dead_strip_inits_and_terms
39bc1876
NS
10915@itemx -nofixprebinding
10916@itemx -nomultidefs
10917@itemx -noprebind
10918@itemx -noseglinkedit
10919@itemx -pagezero_size
10920@itemx -prebind
10921@itemx -prebind_all_twolevel_modules
10922@itemx -private_bundle
ab940b73 10923@need 800
39bc1876
NS
10924@itemx -read_only_relocs
10925@itemx -sectalign
10926@itemx -sectobjectsymbols
10927@itemx -whyload
10928@itemx -seg1addr
10929@itemx -sectcreate
10930@itemx -sectobjectsymbols
10931@itemx -sectorder
5826770c
DP
10932@itemx -segaddr
10933@itemx -segs_read_only_addr
ab940b73 10934@need 800
5826770c 10935@itemx -segs_read_write_addr
39bc1876
NS
10936@itemx -seg_addr_table
10937@itemx -seg_addr_table_filename
10938@itemx -seglinkedit
10939@itemx -segprot
10940@itemx -segs_read_only_addr
10941@itemx -segs_read_write_addr
10942@itemx -single_module
10943@itemx -static
10944@itemx -sub_library
ab940b73 10945@need 800
39bc1876
NS
10946@itemx -sub_umbrella
10947@itemx -twolevel_namespace
10948@itemx -umbrella
10949@itemx -undefined
10950@itemx -unexported_symbols_list
10951@itemx -weak_reference_mismatches
10952@itemx -whatsloaded
39bc1876 10953@opindex allowable_client
39bc1876
NS
10954@opindex client_name
10955@opindex compatibility_version
10956@opindex current_version
5079843a 10957@opindex dead_strip
39bc1876
NS
10958@opindex dependency-file
10959@opindex dylib_file
10960@opindex dylinker_install_name
10961@opindex dynamic
39bc1876
NS
10962@opindex exported_symbols_list
10963@opindex filelist
10964@opindex flat_namespace
39bc1876
NS
10965@opindex force_flat_namespace
10966@opindex headerpad_max_install_names
10967@opindex image_base
10968@opindex init
10969@opindex install_name
10970@opindex keep_private_externs
10971@opindex multi_module
10972@opindex multiply_defined
10973@opindex multiply_defined_unused
10974@opindex noall_load
5079843a 10975@opindex no_dead_strip_inits_and_terms
39bc1876
NS
10976@opindex nofixprebinding
10977@opindex nomultidefs
10978@opindex noprebind
10979@opindex noseglinkedit
10980@opindex pagezero_size
10981@opindex prebind
10982@opindex prebind_all_twolevel_modules
10983@opindex private_bundle
10984@opindex read_only_relocs
10985@opindex sectalign
10986@opindex sectobjectsymbols
10987@opindex whyload
10988@opindex seg1addr
10989@opindex sectcreate
10990@opindex sectobjectsymbols
10991@opindex sectorder
5826770c
DP
10992@opindex segaddr
10993@opindex segs_read_only_addr
10994@opindex segs_read_write_addr
39bc1876
NS
10995@opindex seg_addr_table
10996@opindex seg_addr_table_filename
10997@opindex seglinkedit
10998@opindex segprot
10999@opindex segs_read_only_addr
11000@opindex segs_read_write_addr
11001@opindex single_module
11002@opindex static
11003@opindex sub_library
11004@opindex sub_umbrella
11005@opindex twolevel_namespace
11006@opindex umbrella
11007@opindex undefined
11008@opindex unexported_symbols_list
11009@opindex weak_reference_mismatches
11010@opindex whatsloaded
965a7e90 11011These options are passed to the Darwin linker. The Darwin linker man page
39bc1876
NS
11012describes them in detail.
11013@end table
11014
11015@node DEC Alpha Options
11016@subsection DEC Alpha Options
11017
11018These @samp{-m} options are defined for the DEC Alpha implementations:
11019
11020@table @gcctabopt
11021@item -mno-soft-float
11022@itemx -msoft-float
11023@opindex mno-soft-float
cd3bb277 11024@opindex msoft-float
39bc1876
NS
11025Use (do not use) the hardware floating-point instructions for
11026floating-point operations. When @option{-msoft-float} is specified,
11027functions in @file{libgcc.a} will be used to perform floating-point
11028operations. Unless they are replaced by routines that emulate the
11029floating-point operations, or compiled in such a way as to call such
11030emulations routines, these routines will issue floating-point
11031operations. If you are compiling for an Alpha without floating-point
11032operations, you must ensure that the library is built so as not to call
11033them.
74291a4b 11034
39bc1876
NS
11035Note that Alpha implementations without floating-point operations are
11036required to have floating-point registers.
74291a4b 11037
39bc1876
NS
11038@item -mfp-reg
11039@itemx -mno-fp-regs
11040@opindex mfp-reg
11041@opindex mno-fp-regs
11042Generate code that uses (does not use) the floating-point register set.
11043@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
11044register set is not used, floating point operands are passed in integer
11045registers as if they were integers and floating-point results are passed
11046in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
11047so any function with a floating-point argument or return value called by code
11048compiled with @option{-mno-fp-regs} must also be compiled with that
11049option.
9b66ebb1 11050
39bc1876
NS
11051A typical use of this option is building a kernel that does not use,
11052and hence need not save and restore, any floating-point registers.
9b66ebb1 11053
39bc1876
NS
11054@item -mieee
11055@opindex mieee
11056The Alpha architecture implements floating-point hardware optimized for
11057maximum performance. It is mostly compliant with the IEEE floating
11058point standard. However, for full compliance, software assistance is
11059required. This option generates code fully IEEE compliant code
11060@emph{except} that the @var{inexact-flag} is not maintained (see below).
11061If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
11062defined during compilation. The resulting code is less efficient but is
11063able to correctly support denormalized numbers and exceptional IEEE
11064values such as not-a-number and plus/minus infinity. Other Alpha
11065compilers call this option @option{-ieee_with_no_inexact}.
74291a4b 11066
39bc1876
NS
11067@item -mieee-with-inexact
11068@opindex mieee-with-inexact
11069This is like @option{-mieee} except the generated code also maintains
11070the IEEE @var{inexact-flag}. Turning on this option causes the
11071generated code to implement fully-compliant IEEE math. In addition to
11072@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
11073macro. On some Alpha implementations the resulting code may execute
11074significantly slower than the code generated by default. Since there is
11075very little code that depends on the @var{inexact-flag}, you should
11076normally not specify this option. Other Alpha compilers call this
11077option @option{-ieee_with_inexact}.
74291a4b 11078
39bc1876
NS
11079@item -mfp-trap-mode=@var{trap-mode}
11080@opindex mfp-trap-mode
11081This option controls what floating-point related traps are enabled.
11082Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
11083The trap mode can be set to one of four values:
74291a4b 11084
39bc1876
NS
11085@table @samp
11086@item n
11087This is the default (normal) setting. The only traps that are enabled
11088are the ones that cannot be disabled in software (e.g., division by zero
11089trap).
62b10bbc 11090
39bc1876
NS
11091@item u
11092In addition to the traps enabled by @samp{n}, underflow traps are enabled
11093as well.
157a620e 11094
39bc1876 11095@item su
90150441 11096Like @samp{u}, but the instructions are marked to be safe for software
39bc1876 11097completion (see Alpha architecture manual for details).
157a620e 11098
39bc1876
NS
11099@item sui
11100Like @samp{su}, but inexact traps are enabled as well.
11101@end table
9b66ebb1 11102
39bc1876
NS
11103@item -mfp-rounding-mode=@var{rounding-mode}
11104@opindex mfp-rounding-mode
11105Selects the IEEE rounding mode. Other Alpha compilers call this option
11106@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
11107of:
157a620e 11108
39bc1876
NS
11109@table @samp
11110@item n
11111Normal IEEE rounding mode. Floating point numbers are rounded towards
11112the nearest machine number or towards the even machine number in case
11113of a tie.
5848830f 11114
39bc1876
NS
11115@item m
11116Round towards minus infinity.
157a620e 11117
39bc1876
NS
11118@item c
11119Chopped rounding mode. Floating point numbers are rounded towards zero.
f5a1b0d2 11120
39bc1876
NS
11121@item d
11122Dynamic rounding mode. A field in the floating point control register
11123(@var{fpcr}, see Alpha architecture reference manual) controls the
11124rounding mode in effect. The C library initializes this register for
11125rounding towards plus infinity. Thus, unless your program modifies the
11126@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
11127@end table
c27ba912 11128
39bc1876
NS
11129@item -mtrap-precision=@var{trap-precision}
11130@opindex mtrap-precision
11131In the Alpha architecture, floating point traps are imprecise. This
11132means without software assistance it is impossible to recover from a
11133floating trap and program execution normally needs to be terminated.
11134GCC can generate code that can assist operating system trap handlers
11135in determining the exact location that caused a floating point trap.
11136Depending on the requirements of an application, different levels of
11137precisions can be selected:
c27ba912 11138
39bc1876
NS
11139@table @samp
11140@item p
11141Program precision. This option is the default and means a trap handler
11142can only identify which program caused a floating point exception.
c27ba912 11143
39bc1876
NS
11144@item f
11145Function precision. The trap handler can determine the function that
11146caused a floating point exception.
62b10bbc 11147
39bc1876
NS
11148@item i
11149Instruction precision. The trap handler can determine the exact
11150instruction that caused a floating point exception.
11151@end table
ed0e6530 11152
39bc1876
NS
11153Other Alpha compilers provide the equivalent options called
11154@option{-scope_safe} and @option{-resumption_safe}.
ed0e6530 11155
39bc1876
NS
11156@item -mieee-conformant
11157@opindex mieee-conformant
11158This option marks the generated code as IEEE conformant. You must not
11159use this option unless you also specify @option{-mtrap-precision=i} and either
11160@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
11161is to emit the line @samp{.eflag 48} in the function prologue of the
11162generated assembly file. Under DEC Unix, this has the effect that
11163IEEE-conformant math library routines will be linked in.
9b6b54e2 11164
39bc1876
NS
11165@item -mbuild-constants
11166@opindex mbuild-constants
11167Normally GCC examines a 32- or 64-bit integer constant to
11168see if it can construct it from smaller constants in two or three
11169instructions. If it cannot, it will output the constant as a literal and
11170generate code to load it from the data segment at runtime.
74291a4b 11171
39bc1876
NS
11172Use this option to require GCC to construct @emph{all} integer constants
11173using code, even if it takes more instructions (the maximum is six).
157a620e 11174
39bc1876
NS
11175You would typically use this option to build a shared library dynamic
11176loader. Itself a shared library, it must relocate itself in memory
11177before it can find the variables and constants in its own data segment.
11178
11179@item -malpha-as
11180@itemx -mgas
11181@opindex malpha-as
11182@opindex mgas
11183Select whether to generate code to be assembled by the vendor-supplied
11184assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
11185
11186@item -mbwx
11187@itemx -mno-bwx
11188@itemx -mcix
11189@itemx -mno-cix
11190@itemx -mfix
11191@itemx -mno-fix
11192@itemx -mmax
11193@itemx -mno-max
11194@opindex mbwx
11195@opindex mno-bwx
11196@opindex mcix
11197@opindex mno-cix
11198@opindex mfix
11199@opindex mno-fix
11200@opindex mmax
11201@opindex mno-max
11202Indicate whether GCC should generate code to use the optional BWX,
11203CIX, FIX and MAX instruction sets. The default is to use the instruction
11204sets supported by the CPU type specified via @option{-mcpu=} option or that
11205of the CPU on which GCC was built if none was specified.
157a620e 11206
39bc1876
NS
11207@item -mfloat-vax
11208@itemx -mfloat-ieee
11209@opindex mfloat-vax
11210@opindex mfloat-ieee
11211Generate code that uses (does not use) VAX F and G floating point
11212arithmetic instead of IEEE single and double precision.
157a620e 11213
39bc1876
NS
11214@item -mexplicit-relocs
11215@itemx -mno-explicit-relocs
11216@opindex mexplicit-relocs
11217@opindex mno-explicit-relocs
11218Older Alpha assemblers provided no way to generate symbol relocations
11219except via assembler macros. Use of these macros does not allow
11220optimal instruction scheduling. GNU binutils as of version 2.12
11221supports a new syntax that allows the compiler to explicitly mark
11222which relocations should apply to which instructions. This option
11223is mostly useful for debugging, as GCC detects the capabilities of
11224the assembler when it is built and sets the default accordingly.
157a620e 11225
39bc1876
NS
11226@item -msmall-data
11227@itemx -mlarge-data
11228@opindex msmall-data
11229@opindex mlarge-data
11230When @option{-mexplicit-relocs} is in effect, static data is
11231accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
11232is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
11233(the @code{.sdata} and @code{.sbss} sections) and are accessed via
1123416-bit relocations off of the @code{$gp} register. This limits the
11235size of the small data area to 64KB, but allows the variables to be
11236directly accessed via a single instruction.
62b10bbc 11237
39bc1876 11238The default is @option{-mlarge-data}. With this option the data area
8a36672b 11239is limited to just below 2GB@. Programs that require more than 2GB of
39bc1876
NS
11240data must use @code{malloc} or @code{mmap} to allocate the data in the
11241heap instead of in the program's data segment.
62b10bbc 11242
39bc1876
NS
11243When generating code for shared libraries, @option{-fpic} implies
11244@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
4bdc1ac7 11245
39bc1876
NS
11246@item -msmall-text
11247@itemx -mlarge-text
11248@opindex msmall-text
11249@opindex mlarge-text
11250When @option{-msmall-text} is used, the compiler assumes that the
11251code of the entire program (or shared library) fits in 4MB, and is
11252thus reachable with a branch instruction. When @option{-msmall-data}
11253is used, the compiler can assume that all local symbols share the
11254same @code{$gp} value, and thus reduce the number of instructions
11255required for a function call from 4 to 1.
157a620e 11256
39bc1876 11257The default is @option{-mlarge-text}.
d2d42a91 11258
39bc1876
NS
11259@item -mcpu=@var{cpu_type}
11260@opindex mcpu
11261Set the instruction set and instruction scheduling parameters for
11262machine type @var{cpu_type}. You can specify either the @samp{EV}
11263style name or the corresponding chip number. GCC supports scheduling
11264parameters for the EV4, EV5 and EV6 family of processors and will
11265choose the default values for the instruction set from the processor
11266you specify. If you do not specify a processor type, GCC will default
11267to the processor on which the compiler was built.
6d6d0fa0 11268
39bc1876 11269Supported values for @var{cpu_type} are
6d6d0fa0 11270
39bc1876
NS
11271@table @samp
11272@item ev4
11273@itemx ev45
11274@itemx 21064
11275Schedules as an EV4 and has no instruction set extensions.
ecff22ab 11276
39bc1876
NS
11277@item ev5
11278@itemx 21164
11279Schedules as an EV5 and has no instruction set extensions.
705ac34f 11280
39bc1876
NS
11281@item ev56
11282@itemx 21164a
11283Schedules as an EV5 and supports the BWX extension.
705ac34f 11284
39bc1876
NS
11285@item pca56
11286@itemx 21164pc
11287@itemx 21164PC
11288Schedules as an EV5 and supports the BWX and MAX extensions.
c474f76b 11289
39bc1876
NS
11290@item ev6
11291@itemx 21264
11292Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
ecff22ab 11293
39bc1876
NS
11294@item ev67
11295@itemx 21264a
11296Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
6d6d0fa0
JL
11297@end table
11298
d94a427e
AL
11299Native Linux/GNU toolchains also support the value @samp{native},
11300which selects the best architecture option for the host processor.
11301@option{-mcpu=native} has no effect if GCC does not recognize
11302the processor.
11303
39bc1876
NS
11304@item -mtune=@var{cpu_type}
11305@opindex mtune
11306Set only the instruction scheduling parameters for machine type
11307@var{cpu_type}. The instruction set is not changed.
ecff22ab 11308
d94a427e
AL
11309Native Linux/GNU toolchains also support the value @samp{native},
11310which selects the best architecture option for the host processor.
11311@option{-mtune=native} has no effect if GCC does not recognize
11312the processor.
11313
39bc1876
NS
11314@item -mmemory-latency=@var{time}
11315@opindex mmemory-latency
11316Sets the latency the scheduler should assume for typical memory
11317references as seen by the application. This number is highly
11318dependent on the memory access patterns used by the application
11319and the size of the external cache on the machine.
861bb6c1 11320
39bc1876 11321Valid options for @var{time} are
6975bd2c 11322
39bc1876
NS
11323@table @samp
11324@item @var{number}
11325A decimal number representing clock cycles.
98180123 11326
39bc1876
NS
11327@item L1
11328@itemx L2
11329@itemx L3
11330@itemx main
11331The compiler contains estimates of the number of clock cycles for
11332``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
11333(also called Dcache, Scache, and Bcache), as well as to main memory.
11334Note that L3 is only valid for EV5.
de41e41c 11335
39bc1876
NS
11336@end table
11337@end table
861bb6c1 11338
39bc1876
NS
11339@node DEC Alpha/VMS Options
11340@subsection DEC Alpha/VMS Options
861bb6c1 11341
39bc1876 11342These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
861bb6c1 11343
39bc1876
NS
11344@table @gcctabopt
11345@item -mvms-return-codes
11346@opindex mvms-return-codes
65a324b4 11347Return VMS condition codes from main. The default is to return POSIX
9f06d330 11348style condition (e.g.@: error) codes.
5ea8f977
DR
11349
11350@item -mdebug-main=@var{prefix}
11351@opindex mdebug-main=@var{prefix}
11352Flag the first routine whose name starts with @var{prefix} as the main
11353routine for the debugger.
5e3fef6c
DR
11354
11355@item -mmalloc64
11356@opindex mmalloc64
11357Default to 64bit memory allocation routines.
39bc1876 11358@end table
861bb6c1 11359
18a3bdcb
NC
11360@node FR30 Options
11361@subsection FR30 Options
11362@cindex FR30 Options
11363
11364These options are defined specifically for the FR30 port.
11365
11366@table @gcctabopt
11367
11368@item -msmall-model
11369@opindex msmall-model
11370Use the small address space model. This can produce smaller code, but
11371it does assume that all symbolic values and addresses will fit into a
1137220-bit range.
11373
11374@item -mno-lsim
11375@opindex mno-lsim
11376Assume that run-time support has been provided and so there is no need
11377to include the simulator library (@file{libsim.a}) on the linker
11378command line.
11379
11380@end table
11381
39bc1876
NS
11382@node FRV Options
11383@subsection FRV Options
11384@cindex FRV Options
861bb6c1 11385
39bc1876
NS
11386@table @gcctabopt
11387@item -mgpr-32
11388@opindex mgpr-32
861bb6c1 11389
39bc1876 11390Only use the first 32 general purpose registers.
861bb6c1 11391
39bc1876
NS
11392@item -mgpr-64
11393@opindex mgpr-64
861bb6c1 11394
39bc1876 11395Use all 64 general purpose registers.
861bb6c1 11396
39bc1876
NS
11397@item -mfpr-32
11398@opindex mfpr-32
861bb6c1 11399
39bc1876 11400Use only the first 32 floating point registers.
ad126521 11401
39bc1876
NS
11402@item -mfpr-64
11403@opindex mfpr-64
ad126521 11404
39bc1876 11405Use all 64 floating point registers
ad126521 11406
39bc1876
NS
11407@item -mhard-float
11408@opindex mhard-float
ad126521 11409
39bc1876 11410Use hardware instructions for floating point operations.
ad126521 11411
39bc1876
NS
11412@item -msoft-float
11413@opindex msoft-float
ad126521 11414
39bc1876 11415Use library routines for floating point operations.
ad126521 11416
39bc1876
NS
11417@item -malloc-cc
11418@opindex malloc-cc
ad126521 11419
39bc1876 11420Dynamically allocate condition code registers.
ad126521 11421
39bc1876
NS
11422@item -mfixed-cc
11423@opindex mfixed-cc
861bb6c1 11424
39bc1876
NS
11425Do not try to dynamically allocate condition code registers, only
11426use @code{icc0} and @code{fcc0}.
74291a4b 11427
39bc1876
NS
11428@item -mdword
11429@opindex mdword
74291a4b 11430
39bc1876 11431Change ABI to use double word insns.
74291a4b 11432
39bc1876
NS
11433@item -mno-dword
11434@opindex mno-dword
74291a4b 11435
39bc1876 11436Do not use double word instructions.
74291a4b 11437
39bc1876
NS
11438@item -mdouble
11439@opindex mdouble
74291a4b 11440
39bc1876 11441Use floating point double instructions.
7fe90e7b 11442
39bc1876
NS
11443@item -mno-double
11444@opindex mno-double
74291a4b 11445
39bc1876 11446Do not use floating point double instructions.
74291a4b 11447
39bc1876
NS
11448@item -mmedia
11449@opindex mmedia
74291a4b 11450
39bc1876 11451Use media instructions.
9c34dbbf 11452
39bc1876
NS
11453@item -mno-media
11454@opindex mno-media
74291a4b 11455
39bc1876 11456Do not use media instructions.
74291a4b 11457
39bc1876
NS
11458@item -mmuladd
11459@opindex mmuladd
9c34dbbf 11460
39bc1876 11461Use multiply and add/subtract instructions.
66188a7e 11462
39bc1876
NS
11463@item -mno-muladd
11464@opindex mno-muladd
74291a4b 11465
39bc1876 11466Do not use multiply and add/subtract instructions.
74291a4b 11467
d711cf67
JDA
11468@item -mfdpic
11469@opindex mfdpic
11470
11471Select the FDPIC ABI, that uses function descriptors to represent
11472pointers to functions. Without any PIC/PIE-related options, it
11473implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
11474assumes GOT entries and small data are within a 12-bit range from the
11475GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
11476are computed with 32 bits.
28bbc967 11477With a @samp{bfin-elf} target, this option implies @option{-msim}.
d711cf67
JDA
11478
11479@item -minline-plt
11480@opindex minline-plt
11481
11482Enable inlining of PLT entries in function calls to functions that are
11483not known to bind locally. It has no effect without @option{-mfdpic}.
11484It's enabled by default if optimizing for speed and compiling for
11485shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
11486optimization option such as @option{-O3} or above is present in the
11487command line.
11488
e4dd71de 11489@item -mTLS
d376d545 11490@opindex mTLS
e4dd71de
AH
11491
11492Assume a large TLS segment when generating thread-local code.
11493
11494@item -mtls
d376d545 11495@opindex mtls
e4dd71de
AH
11496
11497Do not assume a large TLS segment when generating thread-local code.
11498
d711cf67
JDA
11499@item -mgprel-ro
11500@opindex mgprel-ro
11501
11502Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
11503that is known to be in read-only sections. It's enabled by default,
11504except for @option{-fpic} or @option{-fpie}: even though it may help
11505make the global offset table smaller, it trades 1 instruction for 4.
11506With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
11507one of which may be shared by multiple symbols, and it avoids the need
11508for a GOT entry for the referenced symbol, so it's more likely to be a
11509win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
11510
11511@item -multilib-library-pic
11512@opindex multilib-library-pic
11513
11514Link with the (library, not FD) pic libraries. It's implied by
11515@option{-mlibrary-pic}, as well as by @option{-fPIC} and
11516@option{-fpic} without @option{-mfdpic}. You should never have to use
11517it explicitly.
11518
11519@item -mlinked-fp
11520@opindex mlinked-fp
11521
11522Follow the EABI requirement of always creating a frame pointer whenever
11523a stack frame is allocated. This option is enabled by default and can
11524be disabled with @option{-mno-linked-fp}.
11525
c557edf4
RS
11526@item -mlong-calls
11527@opindex mlong-calls
11528
11529Use indirect addressing to call functions outside the current
11530compilation unit. This allows the functions to be placed anywhere
11531within the 32-bit address space.
11532
11533@item -malign-labels
11534@opindex malign-labels
11535
11536Try to align labels to an 8-byte boundary by inserting nops into the
11537previous packet. This option only has an effect when VLIW packing
11538is enabled. It doesn't create new packets; it merely adds nops to
11539existing ones.
11540
39bc1876
NS
11541@item -mlibrary-pic
11542@opindex mlibrary-pic
0ac081f6 11543
39bc1876 11544Generate position-independent EABI code.
6c8875e5 11545
39bc1876
NS
11546@item -macc-4
11547@opindex macc-4
6c8875e5 11548
39bc1876 11549Use only the first four media accumulator registers.
6c8875e5 11550
39bc1876
NS
11551@item -macc-8
11552@opindex macc-8
993f19a8 11553
39bc1876 11554Use all eight media accumulator registers.
5da702b1 11555
39bc1876
NS
11556@item -mpack
11557@opindex mpack
74291a4b 11558
39bc1876 11559Pack VLIW instructions.
74291a4b 11560
39bc1876
NS
11561@item -mno-pack
11562@opindex mno-pack
74291a4b 11563
39bc1876 11564Do not pack VLIW instructions.
7fe90e7b 11565
39bc1876
NS
11566@item -mno-eflags
11567@opindex mno-eflags
74291a4b 11568
39bc1876 11569Do not mark ABI switches in e_flags.
861bb6c1 11570
39bc1876
NS
11571@item -mcond-move
11572@opindex mcond-move
6184e8a4 11573
39bc1876 11574Enable the use of conditional-move instructions (default).
74291a4b 11575
39bc1876
NS
11576This switch is mainly for debugging the compiler and will likely be removed
11577in a future version.
74291a4b 11578
39bc1876
NS
11579@item -mno-cond-move
11580@opindex mno-cond-move
74291a4b 11581
39bc1876 11582Disable the use of conditional-move instructions.
861bb6c1 11583
39bc1876
NS
11584This switch is mainly for debugging the compiler and will likely be removed
11585in a future version.
861bb6c1 11586
39bc1876
NS
11587@item -mscc
11588@opindex mscc
74291a4b 11589
39bc1876 11590Enable the use of conditional set instructions (default).
74291a4b 11591
39bc1876
NS
11592This switch is mainly for debugging the compiler and will likely be removed
11593in a future version.
74291a4b 11594
39bc1876
NS
11595@item -mno-scc
11596@opindex mno-scc
74291a4b 11597
39bc1876 11598Disable the use of conditional set instructions.
74291a4b 11599
39bc1876
NS
11600This switch is mainly for debugging the compiler and will likely be removed
11601in a future version.
74291a4b 11602
39bc1876
NS
11603@item -mcond-exec
11604@opindex mcond-exec
74291a4b 11605
39bc1876 11606Enable the use of conditional execution (default).
74291a4b 11607
39bc1876
NS
11608This switch is mainly for debugging the compiler and will likely be removed
11609in a future version.
ab82a49f 11610
39bc1876
NS
11611@item -mno-cond-exec
11612@opindex mno-cond-exec
79ae11c4 11613
39bc1876 11614Disable the use of conditional execution.
daf2f129 11615
39bc1876
NS
11616This switch is mainly for debugging the compiler and will likely be removed
11617in a future version.
cbe26ab8 11618
39bc1876
NS
11619@item -mvliw-branch
11620@opindex mvliw-branch
11621
11622Run a pass to pack branches into VLIW instructions (default).
11623
11624This switch is mainly for debugging the compiler and will likely be removed
11625in a future version.
11626
11627@item -mno-vliw-branch
11628@opindex mno-vliw-branch
11629
11630Do not run a pass to pack branches into VLIW instructions.
11631
11632This switch is mainly for debugging the compiler and will likely be removed
11633in a future version.
74291a4b 11634
39bc1876
NS
11635@item -mmulti-cond-exec
11636@opindex mmulti-cond-exec
74291a4b 11637
39bc1876
NS
11638Enable optimization of @code{&&} and @code{||} in conditional execution
11639(default).
74291a4b 11640
39bc1876
NS
11641This switch is mainly for debugging the compiler and will likely be removed
11642in a future version.
74291a4b 11643
39bc1876
NS
11644@item -mno-multi-cond-exec
11645@opindex mno-multi-cond-exec
74291a4b 11646
39bc1876 11647Disable optimization of @code{&&} and @code{||} in conditional execution.
48180d68 11648
39bc1876
NS
11649This switch is mainly for debugging the compiler and will likely be removed
11650in a future version.
edf1b3f3 11651
39bc1876
NS
11652@item -mnested-cond-exec
11653@opindex mnested-cond-exec
9904592e 11654
39bc1876 11655Enable nested conditional execution optimizations (default).
9904592e 11656
39bc1876
NS
11657This switch is mainly for debugging the compiler and will likely be removed
11658in a future version.
0ac081f6 11659
39bc1876
NS
11660@item -mno-nested-cond-exec
11661@opindex mno-nested-cond-exec
76a773f3 11662
39bc1876 11663Disable nested conditional execution optimizations.
74291a4b 11664
39bc1876
NS
11665This switch is mainly for debugging the compiler and will likely be removed
11666in a future version.
74291a4b 11667
38c28a25
AH
11668@item -moptimize-membar
11669@opindex moptimize-membar
11670
11671This switch removes redundant @code{membar} instructions from the
11672compiler generated code. It is enabled by default.
11673
11674@item -mno-optimize-membar
11675@opindex mno-optimize-membar
11676
11677This switch disables the automatic removal of redundant @code{membar}
11678instructions from the generated code.
11679
39bc1876
NS
11680@item -mtomcat-stats
11681@opindex mtomcat-stats
e9a25f70 11682
39bc1876 11683Cause gas to print out tomcat statistics.
e9a25f70 11684
39bc1876
NS
11685@item -mcpu=@var{cpu}
11686@opindex mcpu
74291a4b 11687
39bc1876 11688Select the processor type for which to generate code. Possible values are
c557edf4
RS
11689@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
11690@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
bff46771 11691
39bc1876 11692@end table
8d8269fa 11693
464aea98
JM
11694@node GNU/Linux Options
11695@subsection GNU/Linux Options
11696
11697These @samp{-m} options are defined for GNU/Linux targets:
11698
11699@table @gcctabopt
11700@item -mglibc
11701@opindex mglibc
74c70253
MK
11702Use the GNU C library. This is the default except
11703on @samp{*-*-linux-*uclibc*} and @samp{*-*-linux-*android*} targets.
464aea98
JM
11704
11705@item -muclibc
11706@opindex muclibc
74c70253 11707Use uClibc C library. This is the default on
7bd85ce0 11708@samp{*-*-linux-*uclibc*} targets.
74c70253
MK
11709
11710@item -mbionic
11711@opindex mbionic
11712Use Bionic C library. This is the default on
11713@samp{*-*-linux-*android*} targets.
51b9db92
MK
11714
11715@item -mandroid
11716@opindex mandroid
11717Compile code compatible with Android platform. This is the default on
11718@samp{*-*-linux-*android*} targets.
11719
11720When compiling, this option enables @option{-mbionic}, @option{-fPIC},
11721@option{-fno-exceptions} and @option{-fno-rtti} by default. When linking,
11722this option makes the GCC driver pass Android-specific options to the linker.
11723Finally, this option causes the preprocessor macro @code{__ANDROID__}
11724to be defined.
11725
11726@item -tno-android-cc
11727@opindex tno-android-cc
11728Disable compilation effects of @option{-mandroid}, i.e., do not enable
11729@option{-mbionic}, @option{-fPIC}, @option{-fno-exceptions} and
11730@option{-fno-rtti} by default.
11731
11732@item -tno-android-ld
11733@opindex tno-android-ld
11734Disable linking effects of @option{-mandroid}, i.e., pass standard Linux
11735linking options to the linker.
11736
464aea98
JM
11737@end table
11738
39bc1876
NS
11739@node H8/300 Options
11740@subsection H8/300 Options
74291a4b 11741
39bc1876 11742These @samp{-m} options are defined for the H8/300 implementations:
74291a4b 11743
39bc1876
NS
11744@table @gcctabopt
11745@item -mrelax
11746@opindex mrelax
11747Shorten some address references at link time, when possible; uses the
11748linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
11749ld, Using ld}, for a fuller description.
74291a4b 11750
39bc1876
NS
11751@item -mh
11752@opindex mh
11753Generate code for the H8/300H@.
74291a4b 11754
39bc1876
NS
11755@item -ms
11756@opindex ms
11757Generate code for the H8S@.
74291a4b 11758
39bc1876
NS
11759@item -mn
11760@opindex mn
11761Generate code for the H8S and H8/300H in the normal mode. This switch
4ec7afd7 11762must be used either with @option{-mh} or @option{-ms}.
74291a4b 11763
39bc1876
NS
11764@item -ms2600
11765@opindex ms2600
11766Generate code for the H8S/2600. This switch must be used with @option{-ms}.
74291a4b 11767
39bc1876
NS
11768@item -mint32
11769@opindex mint32
11770Make @code{int} data 32 bits by default.
74291a4b 11771
39bc1876
NS
11772@item -malign-300
11773@opindex malign-300
11774On the H8/300H and H8S, use the same alignment rules as for the H8/300.
11775The default for the H8/300H and H8S is to align longs and floats on 4
11776byte boundaries.
11777@option{-malign-300} causes them to be aligned on 2 byte boundaries.
11778This option has no effect on the H8/300.
11779@end table
f5a1b0d2 11780
39bc1876
NS
11781@node HPPA Options
11782@subsection HPPA Options
11783@cindex HPPA Options
a5c76ee6 11784
39bc1876 11785These @samp{-m} options are defined for the HPPA family of computers:
a5c76ee6 11786
39bc1876
NS
11787@table @gcctabopt
11788@item -march=@var{architecture-type}
11789@opindex march
11790Generate code for the specified architecture. The choices for
11791@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
117921.1, and @samp{2.0} for PA 2.0 processors. Refer to
11793@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
11794architecture option for your machine. Code compiled for lower numbered
11795architectures will run on higher numbered architectures, but not the
11796other way around.
11797
39bc1876
NS
11798@item -mpa-risc-1-0
11799@itemx -mpa-risc-1-1
11800@itemx -mpa-risc-2-0
11801@opindex mpa-risc-1-0
11802@opindex mpa-risc-1-1
11803@opindex mpa-risc-2-0
11804Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
5a26b329 11805
39bc1876
NS
11806@item -mbig-switch
11807@opindex mbig-switch
11808Generate code suitable for big switch tables. Use this option only if
11809the assembler/linker complain about out of range branches within a switch
11810table.
efdba735 11811
39bc1876
NS
11812@item -mjump-in-delay
11813@opindex mjump-in-delay
11814Fill delay slots of function calls with unconditional jump instructions
11815by modifying the return pointer for the function call to be the target
11816of the conditional jump.
a5c76ee6 11817
39bc1876
NS
11818@item -mdisable-fpregs
11819@opindex mdisable-fpregs
11820Prevent floating point registers from being used in any manner. This is
11821necessary for compiling kernels which perform lazy context switching of
11822floating point registers. If you use this option and attempt to perform
11823floating point operations, the compiler will abort.
0a379b7a 11824
39bc1876
NS
11825@item -mdisable-indexing
11826@opindex mdisable-indexing
11827Prevent the compiler from using indexing address modes. This avoids some
11828rather obscure problems when compiling MIG generated code under MACH@.
f5a1b0d2 11829
39bc1876
NS
11830@item -mno-space-regs
11831@opindex mno-space-regs
11832Generate code that assumes the target has no space registers. This allows
11833GCC to generate faster indirect calls and use unscaled index address modes.
d2d42a91 11834
39bc1876 11835Such code is suitable for level 0 PA systems and kernels.
d2d42a91 11836
39bc1876
NS
11837@item -mfast-indirect-calls
11838@opindex mfast-indirect-calls
11839Generate code that assumes calls never cross space boundaries. This
11840allows GCC to emit code which performs faster indirect calls.
f08a3544 11841
39bc1876
NS
11842This option will not work in the presence of shared libraries or nested
11843functions.
f08a3544 11844
a2017852
JDA
11845@item -mfixed-range=@var{register-range}
11846@opindex mfixed-range
11847Generate code treating the given register range as fixed registers.
11848A fixed register is one that the register allocator can not use. This is
11849useful when compiling kernel code. A register range is specified as
11850two registers separated by a dash. Multiple register ranges can be
11851specified separated by a comma.
11852
39bc1876
NS
11853@item -mlong-load-store
11854@opindex mlong-load-store
11855Generate 3-instruction load and store sequences as sometimes required by
11856the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
11857the HP compilers.
61c85ff1 11858
39bc1876
NS
11859@item -mportable-runtime
11860@opindex mportable-runtime
11861Use the portable calling conventions proposed by HP for ELF systems.
61c85ff1 11862
39bc1876
NS
11863@item -mgas
11864@opindex mgas
11865Enable the use of assembler directives only GAS understands.
61c85ff1 11866
39bc1876
NS
11867@item -mschedule=@var{cpu-type}
11868@opindex mschedule
11869Schedule code according to the constraints for the machine type
11870@var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
11871@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
11872to @file{/usr/lib/sched.models} on an HP-UX system to determine the
11873proper scheduling option for your machine. The default scheduling is
11874@samp{8000}.
61c85ff1 11875
39bc1876
NS
11876@item -mlinker-opt
11877@opindex mlinker-opt
11878Enable the optimization pass in the HP-UX linker. Note this makes symbolic
11879debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
11880linkers in which they give bogus error messages when linking some programs.
61c85ff1 11881
39bc1876
NS
11882@item -msoft-float
11883@opindex msoft-float
11884Generate output containing library calls for floating point.
11885@strong{Warning:} the requisite libraries are not available for all HPPA
11886targets. Normally the facilities of the machine's usual C compiler are
11887used, but this cannot be done directly in cross-compilation. You must make
11888your own arrangements to provide suitable library functions for
cd985f66 11889cross-compilation.
31775d31 11890
39bc1876
NS
11891@option{-msoft-float} changes the calling convention in the output file;
11892therefore, it is only useful if you compile @emph{all} of a program with
11893this option. In particular, you need to compile @file{libgcc.a}, the
11894library that comes with GCC, with @option{-msoft-float} in order for
11895this to work.
61c85ff1 11896
39bc1876
NS
11897@item -msio
11898@opindex msio
8a36672b 11899Generate the predefine, @code{_SIO}, for server IO@. The default is
39bc1876 11900@option{-mwsio}. This generates the predefines, @code{__hp9000s700},
8a36672b
JM
11901@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
11902options are available under HP-UX and HI-UX@.
39bc1876
NS
11903
11904@item -mgnu-ld
d376d545 11905@opindex mgnu-ld
39bc1876
NS
11906Use GNU ld specific options. This passes @option{-shared} to ld when
11907building a shared library. It is the default when GCC is configured,
11908explicitly or implicitly, with the GNU linker. This option does not
11909have any affect on which ld is called, it only changes what parameters
11910are passed to that ld. The ld that is called is determined by the
11911@option{--with-ld} configure option, GCC's program search path, and
11912finally by the user's @env{PATH}. The linker used by GCC can be printed
a73035ae 11913using @samp{which `gcc -print-prog-name=ld`}. This option is only available
a31cfd58 11914on the 64 bit HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
48aec0bc 11915
39bc1876 11916@item -mhp-ld
d376d545 11917@opindex mhp-ld
39bc1876
NS
11918Use HP ld specific options. This passes @option{-b} to ld when building
11919a shared library and passes @option{+Accept TypeMismatch} to ld on all
11920links. It is the default when GCC is configured, explicitly or
11921implicitly, with the HP linker. This option does not have any affect on
11922which ld is called, it only changes what parameters are passed to that
11923ld. The ld that is called is determined by the @option{--with-ld}
11924configure option, GCC's program search path, and finally by the user's
11925@env{PATH}. The linker used by GCC can be printed using @samp{which
a73035ae 11926`gcc -print-prog-name=ld`}. This option is only available on the 64 bit
a31cfd58 11927HP-UX GCC, i.e.@: configured with @samp{hppa*64*-*-hpux*}.
48aec0bc 11928
39bc1876
NS
11929@item -mlong-calls
11930@opindex mno-long-calls
11931Generate code that uses long call sequences. This ensures that a call
11932is always able to reach linker generated stubs. The default is to generate
11933long calls only when the distance from the call site to the beginning
11934of the function or translation unit, as the case may be, exceeds a
11935predefined limit set by the branch type being used. The limits for
11936normal calls are 7,600,000 and 240,000 bytes, respectively for the
11937PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
11938240,000 bytes.
a27fb29b 11939
39bc1876
NS
11940Distances are measured from the beginning of functions when using the
11941@option{-ffunction-sections} option, or when using the @option{-mgas}
11942and @option{-mno-portable-runtime} options together under HP-UX with
11943the SOM linker.
7dac2f89 11944
39bc1876
NS
11945It is normally not desirable to use this option as it will degrade
11946performance. However, it may be useful in large applications,
11947particularly when partial linking is used to build the application.
74291a4b 11948
39bc1876
NS
11949The types of long calls used depends on the capabilities of the
11950assembler and linker, and the type of code being generated. The
11951impact on systems that support long absolute calls, and long pic
11952symbol-difference or pc-relative calls should be relatively small.
11953However, an indirect call is used on 32-bit ELF systems in pic code
11954and it is quite long.
74291a4b 11955
d711cf67
JDA
11956@item -munix=@var{unix-std}
11957@opindex march
11958Generate compiler predefines and select a startfile for the specified
11959UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
11960and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
11961is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
1196211.11 and later. The default values are @samp{93} for HP-UX 10.00,
11963@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
11964and later.
11965
11966@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
11967@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
11968and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
11969@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
11970@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
11971@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
11972
11973It is @emph{important} to note that this option changes the interfaces
11974for various library routines. It also affects the operational behavior
11975of the C library. Thus, @emph{extreme} care is needed in using this
11976option.
11977
11978Library code that is intended to operate with more than one UNIX
11979standard must test, set and restore the variable @var{__xpg4_extended_mask}
11980as appropriate. Most GNU software doesn't provide this capability.
11981
39bc1876
NS
11982@item -nolibdld
11983@opindex nolibdld
11984Suppress the generation of link options to search libdld.sl when the
11985@option{-static} option is specified on HP-UX 10 and later.
11986
11987@item -static
11988@opindex static
11989The HP-UX implementation of setlocale in libc has a dependency on
11990libdld.sl. There isn't an archive version of libdld.sl. Thus,
11991when the @option{-static} option is specified, special link options
11992are needed to resolve this dependency.
11993
11994On HP-UX 10 and later, the GCC driver adds the necessary options to
11995link with libdld.sl when the @option{-static} option is specified.
11996This causes the resulting binary to be dynamic. On the 64-bit port,
11997the linkers generate dynamic binaries by default in any case. The
11998@option{-nolibdld} option can be used to prevent the GCC driver from
11999adding these link options.
12000
12001@item -threads
12002@opindex threads
12003Add support for multithreading with the @dfn{dce thread} library
8a36672b 12004under HP-UX@. This option sets flags for both the preprocessor and
39bc1876
NS
12005linker.
12006@end table
12007
12008@node i386 and x86-64 Options
12009@subsection Intel 386 and AMD x86-64 Options
12010@cindex i386 Options
12011@cindex x86-64 Options
12012@cindex Intel 386 Options
12013@cindex AMD x86-64 Options
12014
12015These @samp{-m} options are defined for the i386 and x86-64 family of
12016computers:
12017
12018@table @gcctabopt
12019@item -mtune=@var{cpu-type}
12020@opindex mtune
12021Tune to @var{cpu-type} everything applicable about the generated code, except
12022for the ABI and the set of available instructions. The choices for
12023@var{cpu-type} are:
12024@table @emph
786872fd 12025@item generic
ab940b73 12026Produce code optimized for the most common IA32/@/AMD64/@/EM64T processors.
786872fd
JH
12027If you know the CPU on which your code will run, then you should use
12028the corresponding @option{-mtune} option instead of
12029@option{-mtune=generic}. But, if you do not know exactly what CPU users
12030of your application will have, then you should use this option.
12031
12032As new processors are deployed in the marketplace, the behavior of this
12033option will change. Therefore, if you upgrade to a newer version of
12034GCC, the code generated option will change to reflect the processors
12035that were most common when that version of GCC was released.
12036
12037There is no @option{-march=generic} option because @option{-march}
12038indicates the instruction set the compiler can use, and there is no
12039generic instruction set applicable to all processors. In contrast,
12040@option{-mtune} indicates the processor (or, in this case, collection of
12041processors) for which the code is optimized.
fa959ce4
MM
12042@item native
12043This selects the CPU to tune for at compilation time by determining
12044the processor type of the compiling machine. Using @option{-mtune=native}
12045will produce code optimized for the local machine under the constraints
12046of the selected instruction set. Using @option{-march=native} will
12047enable all instruction subsets supported by the local machine (hence
12048the result might not run on different machines).
39bc1876 12049@item i386
8a36672b 12050Original Intel's i386 CPU@.
39bc1876 12051@item i486
8a36672b 12052Intel's i486 CPU@. (No scheduling is implemented for this chip.)
39bc1876
NS
12053@item i586, pentium
12054Intel Pentium CPU with no MMX support.
12055@item pentium-mmx
12056Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
786872fd 12057@item pentiumpro
8a36672b 12058Intel PentiumPro CPU@.
786872fd
JH
12059@item i686
12060Same as @code{generic}, but when used as @code{march} option, PentiumPro
917f1b7e 12061instruction set will be used, so the code will run on all i686 family chips.
39bc1876
NS
12062@item pentium2
12063Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
12064@item pentium3, pentium3m
12065Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
12066support.
12067@item pentium-m
12068Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
12069support. Used by Centrino notebooks.
12070@item pentium4, pentium4m
12071Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
12072@item prescott
12073Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
12074set support.
12075@item nocona
12076Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
12077SSE2 and SSE3 instruction set support.
05f85dbb
VM
12078@item core2
12079Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12080instruction set support.
b2b01543
BS
12081@item corei7
12082Intel Core i7 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1
12083and SSE4.2 instruction set support.
f2a758a2
L
12084@item atom
12085Intel Atom CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
12086instruction set support.
39bc1876
NS
12087@item k6
12088AMD K6 CPU with MMX instruction set support.
12089@item k6-2, k6-3
f8723eb6 12090Improved versions of AMD K6 CPU with MMX and 3DNow!@: instruction set support.
39bc1876 12091@item athlon, athlon-tbird
f8723eb6 12092AMD Athlon CPU with MMX, 3dNOW!, enhanced 3DNow!@: and SSE prefetch instructions
39bc1876
NS
12093support.
12094@item athlon-4, athlon-xp, athlon-mp
f8723eb6 12095Improved AMD Athlon CPU with MMX, 3DNow!, enhanced 3DNow!@: and full SSE
39bc1876
NS
12096instruction set support.
12097@item k8, opteron, athlon64, athlon-fx
12098AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
f8723eb6 12099MMX, SSE, SSE2, 3DNow!, enhanced 3DNow!@: and 64-bit instruction set extensions.)
ed99bffc
DR
12100@item k8-sse3, opteron-sse3, athlon64-sse3
12101Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
aafc814c 12102@item amdfam10, barcelona
d8f52b02 12103AMD Family 10h core based CPUs with x86-64 instruction set support. (This
f8723eb6 12104supersets MMX, SSE, SSE2, SSE3, SSE4A, 3DNow!, enhanced 3DNow!, ABM and 64-bit
21efb4d4 12105instruction set extensions.)
39bc1876
NS
12106@item winchip-c6
12107IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
12108set support.
12109@item winchip2
f8723eb6 12110IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3DNow!@:
39bc1876
NS
12111instruction set support.
12112@item c3
f8723eb6 12113Via C3 CPU with MMX and 3DNow!@: instruction set support. (No scheduling is
39bc1876
NS
12114implemented for this chip.)
12115@item c3-2
12116Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
12117implemented for this chip.)
cfe1b18f 12118@item geode
f8723eb6 12119Embedded AMD CPU with MMX and 3DNow!@: instruction set support.
39bc1876
NS
12120@end table
12121
12122While picking a specific @var{cpu-type} will schedule things appropriately
12123for that particular chip, the compiler will not generate any code that
12124does not run on the i386 without the @option{-march=@var{cpu-type}} option
12125being used.
12126
12127@item -march=@var{cpu-type}
12128@opindex march
12129Generate instructions for the machine type @var{cpu-type}. The choices
12130for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
12131specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
74291a4b 12132
39bc1876
NS
12133@item -mcpu=@var{cpu-type}
12134@opindex mcpu
12135A deprecated synonym for @option{-mtune}.
3398f47f 12136
39bc1876 12137@item -mfpmath=@var{unit}
8ce94e44 12138@opindex mfpmath
39bc1876
NS
12139Generate floating point arithmetics for selected unit @var{unit}. The choices
12140for @var{unit} are:
2d2a50c3 12141
39bc1876
NS
12142@table @samp
12143@item 387
12144Use the standard 387 floating point coprocessor present majority of chips and
12145emulated otherwise. Code compiled with this option will run almost everywhere.
12146The temporary results are computed in 80bit precision instead of precision
12147specified by the type resulting in slightly different results compared to most
8a36672b 12148of other chips. See @option{-ffloat-store} for more detailed description.
74291a4b 12149
39bc1876 12150This is the default choice for i386 compiler.
74291a4b 12151
39bc1876
NS
12152@item sse
12153Use scalar floating point instructions present in the SSE instruction set.
12154This instruction set is supported by Pentium3 and newer chips, in the AMD line
12155by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
12156instruction set supports only single precision arithmetics, thus the double and
12157extended precision arithmetics is still done using 387. Later version, present
12158only in Pentium4 and the future AMD x86-64 chips supports double precision
12159arithmetics too.
a27fb29b 12160
c2b43d7a
UB
12161For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
12162or @option{-msse2} switches to enable SSE extensions and make this option
12163effective. For the x86-64 compiler, these extensions are enabled by default.
3398f47f 12164
39bc1876
NS
12165The resulting code should be considerably faster in the majority of cases and avoid
12166the numerical instability problems of 387 code, but may break some existing
12167code that expects temporaries to be 80bit.
cd3f11a6 12168
39bc1876 12169This is the default choice for the x86-64 compiler.
74291a4b 12170
39bc1876 12171@item sse,387
ab442df7
MM
12172@itemx sse+387
12173@itemx both
39bc1876
NS
12174Attempt to utilize both instruction sets at once. This effectively double the
12175amount of available registers and on chips with separate execution units for
12176387 and SSE the execution resources too. Use this option with care, as it is
12177still experimental, because the GCC register allocator does not model separate
12178functional units well resulting in instable performance.
12179@end table
ee692410 12180
39bc1876
NS
12181@item -masm=@var{dialect}
12182@opindex masm=@var{dialect}
1f4c2c57
MS
12183Output asm instructions using selected @var{dialect}. Supported
12184choices are @samp{intel} or @samp{att} (the default one). Darwin does
13b3c362 12185not support @samp{intel}.
ee692410 12186
39bc1876
NS
12187@item -mieee-fp
12188@itemx -mno-ieee-fp
12189@opindex mieee-fp
12190@opindex mno-ieee-fp
12191Control whether or not the compiler uses IEEE floating point
12192comparisons. These handle correctly the case where the result of a
12193comparison is unordered.
ee692410 12194
39bc1876
NS
12195@item -msoft-float
12196@opindex msoft-float
12197Generate output containing library calls for floating point.
12198@strong{Warning:} the requisite libraries are not part of GCC@.
12199Normally the facilities of the machine's usual C compiler are used, but
12200this can't be done directly in cross-compilation. You must make your
12201own arrangements to provide suitable library functions for
12202cross-compilation.
ee692410 12203
39bc1876
NS
12204On machines where a function returns floating point results in the 80387
12205register stack, some floating point opcodes may be emitted even if
12206@option{-msoft-float} is used.
ee692410 12207
39bc1876
NS
12208@item -mno-fp-ret-in-387
12209@opindex mno-fp-ret-in-387
12210Do not use the FPU registers for return values of functions.
ee692410 12211
39bc1876
NS
12212The usual calling convention has functions return values of types
12213@code{float} and @code{double} in an FPU register, even if there
12214is no FPU@. The idea is that the operating system should emulate
12215an FPU@.
5a4b3afd 12216
39bc1876
NS
12217The option @option{-mno-fp-ret-in-387} causes such values to be returned
12218in ordinary CPU registers instead.
5a4b3afd 12219
39bc1876
NS
12220@item -mno-fancy-math-387
12221@opindex mno-fancy-math-387
12222Some 387 emulators do not support the @code{sin}, @code{cos} and
12223@code{sqrt} instructions for the 387. Specify this option to avoid
12224generating those instructions. This option is the default on FreeBSD,
12225OpenBSD and NetBSD@. This option is overridden when @option{-march}
12226indicates that the target cpu will always have an FPU and so the
12227instruction will not need emulation. As of revision 2.6.1, these
12228instructions are not generated unless you also use the
12229@option{-funsafe-math-optimizations} switch.
5a4b3afd 12230
39bc1876
NS
12231@item -malign-double
12232@itemx -mno-align-double
12233@opindex malign-double
12234@opindex mno-align-double
12235Control whether GCC aligns @code{double}, @code{long double}, and
12236@code{long long} variables on a two word boundary or a one word
12237boundary. Aligning @code{double} variables on a two word boundary will
12238produce code that runs somewhat faster on a @samp{Pentium} at the
12239expense of more memory.
5a4b3afd 12240
dc5abe77
TM
12241On x86-64, @option{-malign-double} is enabled by default.
12242
39bc1876
NS
12243@strong{Warning:} if you use the @option{-malign-double} switch,
12244structures containing the above types will be aligned differently than
12245the published application binary interface specifications for the 386
12246and will not be binary compatible with structures in code compiled
12247without that switch.
5a4b3afd 12248
39bc1876
NS
12249@item -m96bit-long-double
12250@itemx -m128bit-long-double
12251@opindex m96bit-long-double
12252@opindex m128bit-long-double
8a36672b 12253These switches control the size of @code{long double} type. The i386
39bc1876
NS
12254application binary interface specifies the size to be 96 bits,
12255so @option{-m96bit-long-double} is the default in 32 bit mode.
5a4b3afd 12256
39bc1876
NS
12257Modern architectures (Pentium and newer) would prefer @code{long double}
12258to be aligned to an 8 or 16 byte boundary. In arrays or structures
12259conforming to the ABI, this would not be possible. So specifying a
12260@option{-m128bit-long-double} will align @code{long double}
12261to a 16 byte boundary by padding the @code{long double} with an additional
1226232 bit zero.
5a4b3afd 12263
39bc1876
NS
12264In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
12265its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
5a4b3afd 12266
39bc1876
NS
12267Notice that neither of these options enable any extra precision over the x87
12268standard of 80 bits for a @code{long double}.
5a4b3afd 12269
39bc1876
NS
12270@strong{Warning:} if you override the default value for your target ABI, the
12271structures and arrays containing @code{long double} variables will change
12272their size as well as function calling convention for function taking
12273@code{long double} will be modified. Hence they will not be binary
12274compatible with arrays or structures in code compiled without that switch.
5a4b3afd 12275
e58d5f65 12276@item -mlarge-data-threshold=@var{number}
7dcbf659
JH
12277@opindex mlarge-data-threshold=@var{number}
12278When @option{-mcmodel=medium} is specified, the data greater than
12279@var{threshold} are placed in large data section. This value must be the
a4d05547 12280same across all object linked into the binary and defaults to 65535.
5a4b3afd 12281
39bc1876
NS
12282@item -mrtd
12283@opindex mrtd
12284Use a different function-calling convention, in which functions that
12285take a fixed number of arguments return with the @code{ret} @var{num}
12286instruction, which pops their arguments while returning. This saves one
12287instruction in the caller since there is no need to pop the arguments
12288there.
5a4b3afd 12289
39bc1876
NS
12290You can specify that an individual function is called with this calling
12291sequence with the function attribute @samp{stdcall}. You can also
12292override the @option{-mrtd} option by using the function attribute
12293@samp{cdecl}. @xref{Function Attributes}.
74291a4b 12294
39bc1876
NS
12295@strong{Warning:} this calling convention is incompatible with the one
12296normally used on Unix, so you cannot use it if you need to call
12297libraries compiled with the Unix compiler.
74291a4b 12298
39bc1876
NS
12299Also, you must provide function prototypes for all functions that
12300take variable numbers of arguments (including @code{printf});
12301otherwise incorrect code will be generated for calls to those
12302functions.
02f52e19 12303
39bc1876
NS
12304In addition, seriously incorrect code will result if you call a
12305function with too many arguments. (Normally, extra arguments are
12306harmlessly ignored.)
1cf959cb 12307
39bc1876
NS
12308@item -mregparm=@var{num}
12309@opindex mregparm
12310Control how many registers are used to pass integer arguments. By
12311default, no registers are used to pass arguments, and at most 3
12312registers can be used. You can control this behavior for a specific
12313function by using the function attribute @samp{regparm}.
12314@xref{Function Attributes}.
1cf959cb 12315
39bc1876
NS
12316@strong{Warning:} if you use this switch, and
12317@var{num} is nonzero, then you must build all modules with the same
12318value, including any libraries. This includes the system libraries and
12319startup modules.
5a4b3afd 12320
1f97667f
RG
12321@item -msseregparm
12322@opindex msseregparm
12323Use SSE register passing conventions for float and double arguments
12324and return values. You can control this behavior for a specific
12325function by using the function attribute @samp{sseregparm}.
12326@xref{Function Attributes}.
12327
12328@strong{Warning:} if you use this switch then you must build all
12329modules with the same value, including any libraries. This includes
12330the system libraries and startup modules.
12331
2770264a
RO
12332@item -mvect8-ret-in-mem
12333@opindex mvect8-ret-in-mem
12334Return 8-byte vectors in memory instead of MMX registers. This is the
12335default on Solaris~8 and 9 and VxWorks to match the ABI of the Sun
12336Studio compilers until version 12. Later compiler versions (starting
12337with Studio 12 Update~1) follow the ABI used by other x86 targets, which
12338is the default on Solaris~10 and later. @emph{Only} use this option if
12339you need to remain compatible with existing code produced by those
12340previous compiler versions or older versions of GCC.
12341
577565f9
UB
12342@item -mpc32
12343@itemx -mpc64
12344@itemx -mpc80
12345@opindex mpc32
12346@opindex mpc64
12347@opindex mpc80
12348
12349Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
80b9cbc9 12350is specified, the significands of results of floating-point operations are
d1facce0 12351rounded to 24 bits (single precision); @option{-mpc64} rounds the
80b9cbc9
BL
12352significands of results of floating-point operations to 53 bits (double
12353precision) and @option{-mpc80} rounds the significands of results of
12354floating-point operations to 64 bits (extended double precision), which is
12355the default. When this option is used, floating-point operations in higher
12356precisions are not available to the programmer without setting the FPU
12357control word explicitly.
12358
12359Setting the rounding of floating-point operations to less than the default
1236080 bits can speed some programs by 2% or more. Note that some mathematical
12361libraries assume that extended precision (80 bit) floating-point operations
12362are enabled by default; routines in such libraries could suffer significant
12363loss of accuracy, typically through so-called "catastrophic cancellation",
7a61cf6f 12364when this option is used to set the precision to less than extended precision.
577565f9 12365
33932946
SH
12366@item -mstackrealign
12367@opindex mstackrealign
2e3f842f
L
12368Realign the stack at entry. On the Intel x86, the @option{-mstackrealign}
12369option will generate an alternate prologue and epilogue that realigns the
12370runtime stack if necessary. This supports mixing legacy codes that keep
12371a 4-byte aligned stack with modern codes that keep a 16-byte stack for
12372SSE compatibility. See also the attribute @code{force_align_arg_pointer},
33932946
SH
12373applicable to individual functions.
12374
39bc1876
NS
12375@item -mpreferred-stack-boundary=@var{num}
12376@opindex mpreferred-stack-boundary
12377Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
12378byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
04df96dd 12379the default is 4 (16 bytes or 128 bits).
5a4b3afd 12380
2e3f842f
L
12381@item -mincoming-stack-boundary=@var{num}
12382@opindex mincoming-stack-boundary
12383Assume the incoming stack is aligned to a 2 raised to @var{num} byte
12384boundary. If @option{-mincoming-stack-boundary} is not specified,
12385the one specified by @option{-mpreferred-stack-boundary} will be used.
12386
39bc1876
NS
12387On Pentium and PentiumPro, @code{double} and @code{long double} values
12388should be aligned to an 8 byte boundary (see @option{-malign-double}) or
12389suffer significant run time performance penalties. On Pentium III, the
04df96dd
L
12390Streaming SIMD Extension (SSE) data type @code{__m128} may not work
12391properly if it is not 16 byte aligned.
5a4b3afd 12392
39bc1876
NS
12393To ensure proper alignment of this values on the stack, the stack boundary
12394must be as aligned as that required by any value stored on the stack.
12395Further, every function must be generated such that it keeps the stack
12396aligned. Thus calling a function compiled with a higher preferred
12397stack boundary from a function compiled with a lower preferred stack
12398boundary will most likely misalign the stack. It is recommended that
12399libraries that use callbacks always use the default setting.
5a4b3afd 12400
39bc1876
NS
12401This extra alignment does consume extra stack space, and generally
12402increases code size. Code that is sensitive to stack space usage, such
12403as embedded systems and operating system kernels, may want to reduce the
12404preferred alignment to @option{-mpreferred-stack-boundary=2}.
5a4b3afd 12405
39bc1876
NS
12406@item -mmmx
12407@itemx -mno-mmx
33558d94 12408@itemx -msse
39bc1876 12409@itemx -mno-sse
33558d94 12410@itemx -msse2
39bc1876 12411@itemx -mno-sse2
33558d94 12412@itemx -msse3
39bc1876 12413@itemx -mno-sse3
33558d94 12414@itemx -mssse3
b1875f52 12415@itemx -mno-ssse3
33558d94 12416@itemx -msse4.1
ab940b73 12417@need 800
9a5cee02 12418@itemx -mno-sse4.1
33558d94 12419@itemx -msse4.2
3b8dd071 12420@itemx -mno-sse4.2
33558d94 12421@itemx -msse4
3b8dd071 12422@itemx -mno-sse4
31cb596a
JY
12423@itemx -mavx
12424@itemx -mno-avx
8b96a312
L
12425@itemx -maes
12426@itemx -mno-aes
12427@itemx -mpclmul
ab940b73 12428@need 800
8b96a312 12429@itemx -mno-pclmul
4ee89d5f
L
12430@itemx -mfsgsbase
12431@itemx -mno-fsgsbase
12432@itemx -mrdrnd
12433@itemx -mno-rdrnd
12434@itemx -mf16c
12435@itemx -mno-f16c
33558d94
AS
12436@itemx -msse4a
12437@itemx -mno-sse4a
cbf2e4d4 12438@itemx -mfma4
ab940b73 12439@need 800
cbf2e4d4 12440@itemx -mno-fma4
43a8b705
HJ
12441@itemx -mxop
12442@itemx -mno-xop
3e901069
HJ
12443@itemx -mlwp
12444@itemx -mno-lwp
33558d94 12445@itemx -m3dnow
39bc1876 12446@itemx -mno-3dnow
33558d94 12447@itemx -mpopcnt
21efb4d4 12448@itemx -mno-popcnt
33558d94 12449@itemx -mabm
21efb4d4 12450@itemx -mno-abm
91afcfa3
QN
12451@itemx -mbmi
12452@itemx -mno-bmi
94d13ad1
QN
12453@itemx -mtbm
12454@itemx -mno-tbm
39bc1876
NS
12455@opindex mmmx
12456@opindex mno-mmx
12457@opindex msse
12458@opindex mno-sse
12459@opindex m3dnow
12460@opindex mno-3dnow
75576871 12461These switches enable or disable the use of instructions in the MMX,
4ee89d5f 12462SSE, SSE2, SSE3, SSSE3, SSE4.1, AVX, AES, PCLMUL, FSGSBASE, RDRND,
91afcfa3 12463F16C, SSE4A, FMA4, XOP, LWP, ABM, BMI, or 3DNow!@: extended instruction sets.
b1875f52
L
12464These extensions are also available as built-in functions: see
12465@ref{X86 Built-in Functions}, for details of the functions enabled and
12466disabled by these switches.
74291a4b 12467
39bc1876 12468To have SSE/SSE2 instructions generated automatically from floating-point
75576871
BB
12469code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
12470
31cb596a
JY
12471GCC depresses SSEx instructions when @option{-mavx} is used. Instead, it
12472generates new AVX instructions or AVX equivalence for all SSEx instructions
12473when needed.
12474
75576871
BB
12475These options will enable GCC to use these extended instructions in
12476generated code, even without @option{-mfpmath=sse}. Applications which
12477perform runtime CPU detection must compile separate files for each
12478supported architecture, using the appropriate flags. In particular,
12479the file containing the CPU detection code should be compiled without
12480these options.
74291a4b 12481
6a790a69
SP
12482@item -mfused-madd
12483@itemx -mno-fused-madd
12484@opindex mfused-madd
12485@opindex mno-fused-madd
12486Do (don't) generate code that uses the fused multiply/add or multiply/subtract
12487instructions. The default is to use these instructions.
12488
922e3e33
UB
12489@item -mcld
12490@opindex mcld
12491This option instructs GCC to emit a @code{cld} instruction in the prologue
12492of functions that use string instructions. String instructions depend on
12493the DF flag to select between autoincrement or autodecrement mode. While the
12494ABI specifies the DF flag to be cleared on function entry, some operating
12495systems violate this specification by not clearing the DF flag in their
12496exception dispatchers. The exception handler can be invoked with the DF flag
12497set which leads to wrong direction mode, when string instructions are used.
12498This option can be enabled by default on 32-bit x86 targets by configuring
12499GCC with the @option{--enable-cld} configure option. Generation of @code{cld}
12500instructions can be suppressed with the @option{-mno-cld} compiler option
12501in this case.
12502
2767a7f2
L
12503@item -mvzeroupper
12504@opindex mvzeroupper
12505This option instructs GCC to emit a @code{vzeroupper} instruction
12506before a transfer of control flow out of the function to minimize
12507AVX to SSE transition penalty as well as remove unnecessary zeroupper
12508intrinsics.
12509
5be6cb59 12510@item -mcx16
edc5f63b 12511@opindex mcx16
5be6cb59
UB
12512This option will enable GCC to use CMPXCHG16B instruction in generated code.
12513CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
12514data types. This is useful for high resolution counters that could be updated
12515by multiple processors (or cores). This instruction is generated as part of
12516atomic built-in functions: see @ref{Atomic Builtins} for details.
12517
12518@item -msahf
edc5f63b 12519@opindex msahf
8c5fd59f
UB
12520This option will enable GCC to use SAHF instruction in generated 64-bit code.
12521Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
12522by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
12523SAHF are load and store instructions, respectively, for certain status flags.
12524In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
12525or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
5be6cb59 12526
cabf85c3
L
12527@item -mmovbe
12528@opindex mmovbe
12529This option will enable GCC to use movbe instruction to implement
12530@code{__builtin_bswap32} and @code{__builtin_bswap64}.
12531
8ed0ce99
L
12532@item -mcrc32
12533@opindex mcrc32
12534This option will enable built-in functions, @code{__builtin_ia32_crc32qi},
12535@code{__builtin_ia32_crc32hi}. @code{__builtin_ia32_crc32si} and
12536@code{__builtin_ia32_crc32di} to generate the crc32 machine instruction.
12537
6b889d89
UB
12538@item -mrecip
12539@opindex mrecip
12540This option will enable GCC to use RCPSS and RSQRTSS instructions (and their
048fd785 12541vectorized variants RCPPS and RSQRTPS) with an additional Newton-Raphson step
8bce96f5
UB
12542to increase precision instead of DIVSS and SQRTSS (and their vectorized
12543variants) for single precision floating point arguments. These instructions
12544are generated only when @option{-funsafe-math-optimizations} is enabled
12545together with @option{-finite-math-only} and @option{-fno-trapping-math}.
12546Note that while the throughput of the sequence is higher than the throughput
12547of the non-reciprocal instruction, the precision of the sequence can be
b73d1527 12548decreased by up to 2 ulp (i.e. the inverse of 1.0 equals 0.99999994).
6b889d89 12549
79e22ff8
MM
12550Note that GCC implements 1.0f/sqrtf(x) in terms of RSQRTSS (or RSQRTPS)
12551already with @option{-ffast-math} (or the above option combination), and
12552doesn't need @option{-mrecip}.
12553
a5ea943c
RG
12554@item -mveclibabi=@var{type}
12555@opindex mveclibabi
12556Specifies the ABI type to use for vectorizing intrinsics using an
9aba5d22
UB
12557external library. Supported types are @code{svml} for the Intel short
12558vector math library and @code{acml} for the AMD math core library style
12559of interfacing. GCC will currently emit calls to @code{vmldExp2},
12560@code{vmldLn2}, @code{vmldLog102}, @code{vmldLog102}, @code{vmldPow2},
12561@code{vmldTanh2}, @code{vmldTan2}, @code{vmldAtan2}, @code{vmldAtanh2},
12562@code{vmldCbrt2}, @code{vmldSinh2}, @code{vmldSin2}, @code{vmldAsinh2},
12563@code{vmldAsin2}, @code{vmldCosh2}, @code{vmldCos2}, @code{vmldAcosh2},
12564@code{vmldAcos2}, @code{vmlsExp4}, @code{vmlsLn4}, @code{vmlsLog104},
12565@code{vmlsLog104}, @code{vmlsPow4}, @code{vmlsTanh4}, @code{vmlsTan4},
12566@code{vmlsAtan4}, @code{vmlsAtanh4}, @code{vmlsCbrt4}, @code{vmlsSinh4},
12567@code{vmlsSin4}, @code{vmlsAsinh4}, @code{vmlsAsin4}, @code{vmlsCosh4},
12568@code{vmlsCos4}, @code{vmlsAcosh4} and @code{vmlsAcos4} for corresponding
12569function type when @option{-mveclibabi=svml} is used and @code{__vrd2_sin},
12570@code{__vrd2_cos}, @code{__vrd2_exp}, @code{__vrd2_log}, @code{__vrd2_log2},
12571@code{__vrd2_log10}, @code{__vrs4_sinf}, @code{__vrs4_cosf},
12572@code{__vrs4_expf}, @code{__vrs4_logf}, @code{__vrs4_log2f},
12573@code{__vrs4_log10f} and @code{__vrs4_powf} for corresponding function type
12574when @option{-mveclibabi=acml} is used. Both @option{-ftree-vectorize} and
12575@option{-funsafe-math-optimizations} have to be enabled. A SVML or ACML ABI
12576compatible library will have to be specified at link time.
a5ea943c 12577
51212b32
L
12578@item -mabi=@var{name}
12579@opindex mabi
12580Generate code for the specified calling convention. Permissible values
12581are: @samp{sysv} for the ABI used on GNU/Linux and other systems and
12582@samp{ms} for the Microsoft ABI. The default is to use the Microsoft
12583ABI when targeting Windows. On all other systems, the default is the
12584SYSV ABI. You can control this behavior for a specific function by
12585using the function attribute @samp{ms_abi}/@samp{sysv_abi}.
12586@xref{Function Attributes}.
12587
39bc1876
NS
12588@item -mpush-args
12589@itemx -mno-push-args
12590@opindex mpush-args
12591@opindex mno-push-args
12592Use PUSH operations to store outgoing parameters. This method is shorter
12593and usually equally fast as method using SUB/MOV operations and is enabled
12594by default. In some cases disabling it may improve performance because of
12595improved scheduling and reduced dependencies.
74291a4b 12596
39bc1876
NS
12597@item -maccumulate-outgoing-args
12598@opindex maccumulate-outgoing-args
12599If enabled, the maximum amount of space required for outgoing arguments will be
12600computed in the function prologue. This is faster on most modern CPUs
12601because of reduced dependencies, improved scheduling and reduced stack usage
12602when preferred stack boundary is not equal to 2. The drawback is a notable
12603increase in code size. This switch implies @option{-mno-push-args}.
63357d93 12604
39bc1876
NS
12605@item -mthreads
12606@opindex mthreads
12607Support thread-safe exception handling on @samp{Mingw32}. Code that relies
12608on thread-safe exception handling must compile and link all code with the
12609@option{-mthreads} option. When compiling, @option{-mthreads} defines
12610@option{-D_MT}; when linking, it links in a special thread helper library
12611@option{-lmingwthrd} which cleans up per thread exception handling data.
5ef1a99d 12612
39bc1876
NS
12613@item -mno-align-stringops
12614@opindex mno-align-stringops
12615Do not align destination of inlined string operations. This switch reduces
12616code size and improves performance in case the destination is already aligned,
12617but GCC doesn't know about it.
46490403 12618
39bc1876
NS
12619@item -minline-all-stringops
12620@opindex minline-all-stringops
12621By default GCC inlines string operations only when destination is known to be
12622aligned at least to 4 byte boundary. This enables more inlining, increase code
12623size, but may improve performance of code that depends on fast memcpy, strlen
12624and memset for short lengths.
c235ddf2 12625
8c996513
JH
12626@item -minline-stringops-dynamically
12627@opindex minline-stringops-dynamically
12628For string operation of unknown size, inline runtime checks so for small
5681c208 12629blocks inline code is used, while for large blocks library call is used.
8c996513
JH
12630
12631@item -mstringop-strategy=@var{alg}
dbdbfff1 12632@opindex mstringop-strategy=@var{alg}
8c996513 12633Overwrite internal decision heuristic about particular algorithm to inline
5681c208 12634string operation with. The allowed values are @code{rep_byte},
8c996513 12635@code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
5db74c32
UB
12636of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
12637expanding inline loop, @code{libcall} for always expanding library call.
8c996513 12638
39bc1876
NS
12639@item -momit-leaf-frame-pointer
12640@opindex momit-leaf-frame-pointer
12641Don't keep the frame pointer in a register for leaf functions. This
12642avoids the instructions to save, set up and restore frame pointers and
12643makes an extra register available in leaf functions. The option
12644@option{-fomit-frame-pointer} removes the frame pointer for all functions
12645which might make debugging harder.
c235ddf2 12646
39bc1876
NS
12647@item -mtls-direct-seg-refs
12648@itemx -mno-tls-direct-seg-refs
12649@opindex mtls-direct-seg-refs
12650Controls whether TLS variables may be accessed with offsets from the
12651TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
12652or whether the thread base pointer must be added. Whether or not this
12653is legal depends on the operating system, and whether it maps the
12654segment to cover the entire TLS area.
beadc644 12655
39bc1876 12656For systems that use GNU libc, the default is on.
04e1d06b 12657
bd459cb6
L
12658@item -msse2avx
12659@itemx -mno-sse2avx
12660@opindex msse2avx
12661Specify that the assembler should encode SSE instructions with VEX
12662prefix. The option @option{-mavx} turns this on by default.
3c5273a9
KT
12663
12664@item -mfentry
12665@itemx -mno-fentry
12666@opindex mfentry
12667If profiling is active @option{-pg} put the profiling
12668counter call before prologue.
12669Note: On x86 architectures the attribute @code{ms_hook_prologue}
12670isn't possible at the moment for @option{-mfentry} and @option{-pg}.
26ec9308
L
12671
12672@item -m8bit-idiv
12673@itemx -mno-8bit-idiv
12674@opindex 8bit-idiv
12675On some processors, like Intel Atom, 8bit unsigned integer divide is
12676much faster than 32bit/64bit integer divide. This option will generate a
12677runt-time check. If both dividend and divisor are within range of 0
12678to 255, 8bit unsigned integer divide will be used instead of
1267932bit/64bit integer divide.
12680
39bc1876 12681@end table
af34e51e 12682
39bc1876
NS
12683These @samp{-m} switches are supported in addition to the above
12684on AMD x86-64 processors in 64-bit environments.
50d32cf6 12685
39bc1876
NS
12686@table @gcctabopt
12687@item -m32
12688@itemx -m64
12689@opindex m32
12690@opindex m64
12691Generate code for a 32-bit or 64-bit environment.
12692The 32-bit environment sets int, long and pointer to 32 bits and
12693generates code that runs on any i386 system.
12694The 64-bit environment sets int to 32 bits and long and pointer
cb7ad97b
EC
12695to 64 bits and generates code for AMD's x86-64 architecture. For
12696darwin only the -m64 option turns off the @option{-fno-pic} and
12697@option{-mdynamic-no-pic} options.
50d32cf6 12698
39bc1876 12699@item -mno-red-zone
d376d545 12700@opindex mno-red-zone
39bc1876
NS
12701Do not use a so called red zone for x86-64 code. The red zone is mandated
12702by the x86-64 ABI, it is a 128-byte area beyond the location of the
12703stack pointer that will not be modified by signal or interrupt handlers
12704and therefore can be used for temporary data without adjusting the stack
12705pointer. The flag @option{-mno-red-zone} disables this red zone.
dc884a86 12706
39bc1876
NS
12707@item -mcmodel=small
12708@opindex mcmodel=small
12709Generate code for the small code model: the program and its symbols must
12710be linked in the lower 2 GB of the address space. Pointers are 64 bits.
12711Programs can be statically or dynamically linked. This is the default
12712code model.
dc884a86 12713
39bc1876
NS
12714@item -mcmodel=kernel
12715@opindex mcmodel=kernel
12716Generate code for the kernel code model. The kernel runs in the
12717negative 2 GB of the address space.
12718This model has to be used for Linux kernel code.
12719
12720@item -mcmodel=medium
12721@opindex mcmodel=medium
12722Generate code for the medium model: The program is linked in the lower 2
3b139014 12723GB of the address space. Small symbols are also placed there. Symbols
e58d5f65
JJ
12724with sizes larger than @option{-mlarge-data-threshold} are put into
12725large data or bss sections and can be located above 2GB. Programs can
12726be statically or dynamically linked.
39bc1876
NS
12727
12728@item -mcmodel=large
12729@opindex mcmodel=large
12730Generate code for the large model: This model makes no assumptions
cb7ad97b 12731about addresses and sizes of sections.
74291a4b
MM
12732@end table
12733
39bc1876
NS
12734@node IA-64 Options
12735@subsection IA-64 Options
12736@cindex IA-64 Options
74291a4b 12737
39bc1876 12738These are the @samp{-m} options defined for the Intel IA-64 architecture.
74291a4b 12739
2642624b 12740@table @gcctabopt
39bc1876
NS
12741@item -mbig-endian
12742@opindex mbig-endian
12743Generate code for a big endian target. This is the default for HP-UX@.
6f670fde 12744
39bc1876
NS
12745@item -mlittle-endian
12746@opindex mlittle-endian
12747Generate code for a little endian target. This is the default for AIX5
12748and GNU/Linux.
a9f3e1a4 12749
39bc1876
NS
12750@item -mgnu-as
12751@itemx -mno-gnu-as
12752@opindex mgnu-as
12753@opindex mno-gnu-as
12754Generate (or don't) code for the GNU assembler. This is the default.
12755@c Also, this is the default if the configure option @option{--with-gnu-as}
12756@c is used.
9d913bbf 12757
39bc1876
NS
12758@item -mgnu-ld
12759@itemx -mno-gnu-ld
12760@opindex mgnu-ld
12761@opindex mno-gnu-ld
12762Generate (or don't) code for the GNU linker. This is the default.
12763@c Also, this is the default if the configure option @option{--with-gnu-ld}
12764@c is used.
a9f3e1a4 12765
39bc1876
NS
12766@item -mno-pic
12767@opindex mno-pic
12768Generate code that does not use a global pointer register. The result
12769is not position independent code, and violates the IA-64 ABI@.
74291a4b 12770
39bc1876
NS
12771@item -mvolatile-asm-stop
12772@itemx -mno-volatile-asm-stop
12773@opindex mvolatile-asm-stop
12774@opindex mno-volatile-asm-stop
12775Generate (or don't) a stop bit immediately before and after volatile asm
12776statements.
965f5423 12777
39bc1876
NS
12778@item -mregister-names
12779@itemx -mno-register-names
12780@opindex mregister-names
12781@opindex mno-register-names
12782Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
12783the stacked registers. This may make assembler output more readable.
965f5423 12784
39bc1876
NS
12785@item -mno-sdata
12786@itemx -msdata
12787@opindex mno-sdata
12788@opindex msdata
12789Disable (or enable) optimizations that use the small data section. This may
12790be useful for working around optimizer bugs.
12791
12792@item -mconstant-gp
12793@opindex mconstant-gp
12794Generate code that uses a single constant global pointer value. This is
12795useful when compiling kernel code.
12796
12797@item -mauto-pic
12798@opindex mauto-pic
12799Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
12800This is useful when compiling firmware code.
12801
12802@item -minline-float-divide-min-latency
12803@opindex minline-float-divide-min-latency
12804Generate code for inline divides of floating point values
12805using the minimum latency algorithm.
965f5423 12806
39bc1876
NS
12807@item -minline-float-divide-max-throughput
12808@opindex minline-float-divide-max-throughput
12809Generate code for inline divides of floating point values
12810using the maximum throughput algorithm.
965f5423 12811
bf3c6caf
SE
12812@item -mno-inline-float-divide
12813@opindex mno-inline-float-divide
12814Do not generate inline code for divides of floating point values.
12815
39bc1876
NS
12816@item -minline-int-divide-min-latency
12817@opindex minline-int-divide-min-latency
12818Generate code for inline divides of integer values
12819using the minimum latency algorithm.
965f5423 12820
39bc1876
NS
12821@item -minline-int-divide-max-throughput
12822@opindex minline-int-divide-max-throughput
12823Generate code for inline divides of integer values
12824using the maximum throughput algorithm.
965f5423 12825
29661412
NC
12826@item -mno-inline-int-divide
12827@opindex mno-inline-int-divide
bf3c6caf
SE
12828Do not generate inline code for divides of integer values.
12829
28b43def
SE
12830@item -minline-sqrt-min-latency
12831@opindex minline-sqrt-min-latency
12832Generate code for inline square roots
12833using the minimum latency algorithm.
12834
12835@item -minline-sqrt-max-throughput
12836@opindex minline-sqrt-max-throughput
12837Generate code for inline square roots
12838using the maximum throughput algorithm.
12839
bf3c6caf
SE
12840@item -mno-inline-sqrt
12841@opindex mno-inline-sqrt
12842Do not generate inline code for sqrt.
12843
12844@item -mfused-madd
12845@itemx -mno-fused-madd
12846@opindex mfused-madd
12847@opindex mno-fused-madd
12848Do (don't) generate code that uses the fused multiply/add or multiply/subtract
6a790a69 12849instructions. The default is to use these instructions.
bf3c6caf 12850
39bc1876
NS
12851@item -mno-dwarf2-asm
12852@itemx -mdwarf2-asm
12853@opindex mno-dwarf2-asm
12854@opindex mdwarf2-asm
12855Don't (or do) generate assembler code for the DWARF2 line number debugging
12856info. This may be useful when not using the GNU assembler.
965f5423 12857
28b43def
SE
12858@item -mearly-stop-bits
12859@itemx -mno-early-stop-bits
12860@opindex mearly-stop-bits
12861@opindex mno-early-stop-bits
12862Allow stop bits to be placed earlier than immediately preceding the
12863instruction that triggered the stop bit. This can improve instruction
12864scheduling, but does not always do so.
12865
39bc1876
NS
12866@item -mfixed-range=@var{register-range}
12867@opindex mfixed-range
12868Generate code treating the given register range as fixed registers.
12869A fixed register is one that the register allocator can not use. This is
12870useful when compiling kernel code. A register range is specified as
12871two registers separated by a dash. Multiple register ranges can be
12872specified separated by a comma.
04e149ab 12873
28b43def
SE
12874@item -mtls-size=@var{tls-size}
12875@opindex mtls-size
12876Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
1287764.
12878
7f9dc823
JW
12879@item -mtune=@var{cpu-type}
12880@opindex mtune
28b43def
SE
12881Tune the instruction scheduling for a particular CPU, Valid values are
12882itanium, itanium1, merced, itanium2, and mckinley.
12883
28b43def
SE
12884@item -milp32
12885@itemx -mlp64
12886@opindex milp32
12887@opindex mlp64
12888Generate code for a 32-bit or 64-bit environment.
12889The 32-bit environment sets int, long and pointer to 32 bits.
12890The 64-bit environment sets int to 32 bits and long and pointer
12891to 64 bits. These are HP-UX specific flags.
12892
048d0d36
MK
12893@item -mno-sched-br-data-spec
12894@itemx -msched-br-data-spec
edc5f63b
DF
12895@opindex mno-sched-br-data-spec
12896@opindex msched-br-data-spec
048d0d36
MK
12897(Dis/En)able data speculative scheduling before reload.
12898This will result in generation of the ld.a instructions and
12899the corresponding check instructions (ld.c / chk.a).
12900The default is 'disable'.
12901
12902@item -msched-ar-data-spec
12903@itemx -mno-sched-ar-data-spec
edc5f63b
DF
12904@opindex msched-ar-data-spec
12905@opindex mno-sched-ar-data-spec
048d0d36
MK
12906(En/Dis)able data speculative scheduling after reload.
12907This will result in generation of the ld.a instructions and
12908the corresponding check instructions (ld.c / chk.a).
12909The default is 'enable'.
12910
12911@item -mno-sched-control-spec
12912@itemx -msched-control-spec
edc5f63b
DF
12913@opindex mno-sched-control-spec
12914@opindex msched-control-spec
048d0d36 12915(Dis/En)able control speculative scheduling. This feature is
a31cfd58 12916available only during region scheduling (i.e.@: before reload).
048d0d36
MK
12917This will result in generation of the ld.s instructions and
12918the corresponding check instructions chk.s .
12919The default is 'disable'.
12920
12921@item -msched-br-in-data-spec
12922@itemx -mno-sched-br-in-data-spec
edc5f63b
DF
12923@opindex msched-br-in-data-spec
12924@opindex mno-sched-br-in-data-spec
048d0d36
MK
12925(En/Dis)able speculative scheduling of the instructions that
12926are dependent on the data speculative loads before reload.
12927This is effective only with @option{-msched-br-data-spec} enabled.
12928The default is 'enable'.
12929
12930@item -msched-ar-in-data-spec
12931@itemx -mno-sched-ar-in-data-spec
edc5f63b
DF
12932@opindex msched-ar-in-data-spec
12933@opindex mno-sched-ar-in-data-spec
048d0d36
MK
12934(En/Dis)able speculative scheduling of the instructions that
12935are dependent on the data speculative loads after reload.
12936This is effective only with @option{-msched-ar-data-spec} enabled.
12937The default is 'enable'.
12938
12939@item -msched-in-control-spec
12940@itemx -mno-sched-in-control-spec
edc5f63b
DF
12941@opindex msched-in-control-spec
12942@opindex mno-sched-in-control-spec
048d0d36
MK
12943(En/Dis)able speculative scheduling of the instructions that
12944are dependent on the control speculative loads.
12945This is effective only with @option{-msched-control-spec} enabled.
12946The default is 'enable'.
12947
048d0d36
MK
12948@item -mno-sched-prefer-non-data-spec-insns
12949@itemx -msched-prefer-non-data-spec-insns
edc5f63b
DF
12950@opindex mno-sched-prefer-non-data-spec-insns
12951@opindex msched-prefer-non-data-spec-insns
917f1b7e 12952If enabled, data speculative instructions will be chosen for schedule
048d0d36
MK
12953only if there are no other choices at the moment. This will make
12954the use of the data speculation much more conservative.
12955The default is 'disable'.
12956
12957@item -mno-sched-prefer-non-control-spec-insns
12958@itemx -msched-prefer-non-control-spec-insns
edc5f63b
DF
12959@opindex mno-sched-prefer-non-control-spec-insns
12960@opindex msched-prefer-non-control-spec-insns
917f1b7e 12961If enabled, control speculative instructions will be chosen for schedule
048d0d36
MK
12962only if there are no other choices at the moment. This will make
12963the use of the control speculation much more conservative.
12964The default is 'disable'.
12965
12966@item -mno-sched-count-spec-in-critical-path
12967@itemx -msched-count-spec-in-critical-path
edc5f63b
DF
12968@opindex mno-sched-count-spec-in-critical-path
12969@opindex msched-count-spec-in-critical-path
917f1b7e 12970If enabled, speculative dependencies will be considered during
048d0d36
MK
12971computation of the instructions priorities. This will make the use of the
12972speculation a bit more conservative.
12973The default is 'disable'.
12974
bf3c6caf
SE
12975@item -msched-spec-ldc
12976@opindex msched-spec-ldc
12977Use a simple data speculation check. This option is on by default.
12978
12979@item -msched-control-spec-ldc
12980@opindex msched-spec-ldc
12981Use a simple check for control speculation. This option is on by default.
12982
12983@item -msched-stop-bits-after-every-cycle
12984@opindex msched-stop-bits-after-every-cycle
12985Place a stop bit after every cycle when scheduling. This option is on
12986by default.
12987
12988@item -msched-fp-mem-deps-zero-cost
12989@opindex msched-fp-mem-deps-zero-cost
12990Assume that floating-point stores and loads are not likely to cause a conflict
12991when placed into the same instruction group. This option is disabled by
12992default.
12993
12994@item -msel-sched-dont-check-control-spec
12995@opindex msel-sched-dont-check-control-spec
12996Generate checks for control speculation in selective scheduling.
12997This flag is disabled by default.
12998
12999@item -msched-max-memory-insns=@var{max-insns}
13000@opindex msched-max-memory-insns
13001Limit on the number of memory insns per instruction group, giving lower
13002priority to subsequent memory insns attempting to schedule in the same
13003instruction group. Frequently useful to prevent cache bank conflicts.
13004The default value is 1.
13005
13006@item -msched-max-memory-insns-hard-limit
13007@opindex msched-max-memory-insns-hard-limit
13008Disallow more than `msched-max-memory-insns' in instruction group.
13009Otherwise, limit is `soft' meaning that we would prefer non-memory operations
13010when limit is reached but may still schedule memory operations.
13011
39bc1876 13012@end table
74291a4b 13013
dcad28fd
DR
13014@node IA-64/VMS Options
13015@subsection IA-64/VMS Options
13016
13017These @samp{-m} options are defined for the IA-64/VMS implementations:
13018
13019@table @gcctabopt
13020@item -mvms-return-codes
13021@opindex mvms-return-codes
13022Return VMS condition codes from main. The default is to return POSIX
13023style condition (e.g.@ error) codes.
13024
13025@item -mdebug-main=@var{prefix}
13026@opindex mdebug-main=@var{prefix}
13027Flag the first routine whose name starts with @var{prefix} as the main
13028routine for the debugger.
13029
13030@item -mmalloc64
13031@opindex mmalloc64
13032Default to 64bit memory allocation routines.
13033@end table
13034
aa4945c1
JB
13035@node LM32 Options
13036@subsection LM32 Options
13037@cindex LM32 options
13038
13039These @option{-m} options are defined for the Lattice Mico32 architecture:
13040
13041@table @gcctabopt
13042@item -mbarrel-shift-enabled
13043@opindex mbarrel-shift-enabled
13044Enable barrel-shift instructions.
13045
13046@item -mdivide-enabled
13047@opindex mdivide-enabled
13048Enable divide and modulus instructions.
13049
13050@item -mmultiply-enabled
13051@opindex multiply-enabled
13052Enable multiply instructions.
13053
13054@item -msign-extend-enabled
13055@opindex msign-extend-enabled
13056Enable sign extend instructions.
13057
13058@item -muser-enabled
13059@opindex muser-enabled
13060Enable user-defined instructions.
13061
13062@end table
13063
38b2d076
DD
13064@node M32C Options
13065@subsection M32C Options
13066@cindex M32C options
13067
13068@table @gcctabopt
13069@item -mcpu=@var{name}
13070@opindex mcpu=
13071Select the CPU for which code is generated. @var{name} may be one of
13072@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
13073/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
13074the M32C/80 series.
13075
13076@item -msim
13077@opindex msim
13078Specifies that the program will be run on the simulator. This causes
13079an alternate runtime library to be linked in which supports, for
0ee2ea09 13080example, file I/O@. You must not use this option when generating
38b2d076
DD
13081programs that will run on real hardware; you must provide your own
13082runtime library for whatever I/O functions are needed.
13083
13084@item -memregs=@var{number}
13085@opindex memregs=
13086Specifies the number of memory-based pseudo-registers GCC will use
13087during code generation. These pseudo-registers will be used like real
13088registers, so there is a tradeoff between GCC's ability to fit the
13089code into available registers, and the performance penalty of using
13090memory instead of registers. Note that all modules in a program must
13091be compiled with the same value for this option. Because of that, you
13092must not use this option with the default runtime libraries gcc
13093builds.
13094
13095@end table
13096
39bc1876
NS
13097@node M32R/D Options
13098@subsection M32R/D Options
13099@cindex M32R/D options
74291a4b 13100
39bc1876 13101These @option{-m} options are defined for Renesas M32R/D architectures:
74291a4b 13102
39bc1876
NS
13103@table @gcctabopt
13104@item -m32r2
13105@opindex m32r2
13106Generate code for the M32R/2@.
74291a4b 13107
39bc1876
NS
13108@item -m32rx
13109@opindex m32rx
13110Generate code for the M32R/X@.
74291a4b 13111
39bc1876
NS
13112@item -m32r
13113@opindex m32r
13114Generate code for the M32R@. This is the default.
74291a4b 13115
39bc1876
NS
13116@item -mmodel=small
13117@opindex mmodel=small
13118Assume all objects live in the lower 16MB of memory (so that their addresses
13119can be loaded with the @code{ld24} instruction), and assume all subroutines
13120are reachable with the @code{bl} instruction.
13121This is the default.
74291a4b 13122
39bc1876
NS
13123The addressability of a particular object can be set with the
13124@code{model} attribute.
74291a4b 13125
39bc1876
NS
13126@item -mmodel=medium
13127@opindex mmodel=medium
13128Assume objects may be anywhere in the 32-bit address space (the compiler
13129will generate @code{seth/add3} instructions to load their addresses), and
13130assume all subroutines are reachable with the @code{bl} instruction.
194734e9 13131
39bc1876
NS
13132@item -mmodel=large
13133@opindex mmodel=large
13134Assume objects may be anywhere in the 32-bit address space (the compiler
13135will generate @code{seth/add3} instructions to load their addresses), and
13136assume subroutines may not be reachable with the @code{bl} instruction
13137(the compiler will generate the much slower @code{seth/add3/jl}
13138instruction sequence).
a5f3dd66 13139
39bc1876
NS
13140@item -msdata=none
13141@opindex msdata=none
13142Disable use of the small data area. Variables will be put into
13143one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
13144@code{section} attribute has been specified).
13145This is the default.
a5f3dd66 13146
39bc1876
NS
13147The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
13148Objects may be explicitly put in the small data area with the
13149@code{section} attribute using one of these sections.
daf2f129 13150
39bc1876
NS
13151@item -msdata=sdata
13152@opindex msdata=sdata
13153Put small global and static data in the small data area, but do not
13154generate special code to reference them.
2b589241 13155
39bc1876
NS
13156@item -msdata=use
13157@opindex msdata=use
13158Put small global and static data in the small data area, and generate
13159special instructions to reference them.
2b589241 13160
39bc1876
NS
13161@item -G @var{num}
13162@opindex G
13163@cindex smaller data references
13164Put global and static objects less than or equal to @var{num} bytes
13165into the small data or bss sections instead of the normal data or bss
13166sections. The default value of @var{num} is 8.
13167The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
13168for this option to have any effect.
74291a4b 13169
39bc1876
NS
13170All modules should be compiled with the same @option{-G @var{num}} value.
13171Compiling with different values of @var{num} may or may not work; if it
13172doesn't the linker will give an error message---incorrect code will not be
13173generated.
74291a4b 13174
39bc1876
NS
13175@item -mdebug
13176@opindex mdebug
13177Makes the M32R specific code in the compiler display some statistics
13178that might help in debugging programs.
74291a4b 13179
39bc1876
NS
13180@item -malign-loops
13181@opindex malign-loops
13182Align all loops to a 32-byte boundary.
74291a4b 13183
39bc1876
NS
13184@item -mno-align-loops
13185@opindex mno-align-loops
13186Do not enforce a 32-byte alignment for loops. This is the default.
74291a4b 13187
39bc1876
NS
13188@item -missue-rate=@var{number}
13189@opindex missue-rate=@var{number}
13190Issue @var{number} instructions per cycle. @var{number} can only be 1
13191or 2.
74291a4b 13192
39bc1876
NS
13193@item -mbranch-cost=@var{number}
13194@opindex mbranch-cost=@var{number}
13195@var{number} can only be 1 or 2. If it is 1 then branches will be
13196preferred over conditional code, if it is 2, then the opposite will
13197apply.
74291a4b 13198
39bc1876
NS
13199@item -mflush-trap=@var{number}
13200@opindex mflush-trap=@var{number}
13201Specifies the trap number to use to flush the cache. The default is
1320212. Valid numbers are between 0 and 15 inclusive.
74291a4b 13203
39bc1876
NS
13204@item -mno-flush-trap
13205@opindex mno-flush-trap
13206Specifies that the cache cannot be flushed by using a trap.
74291a4b 13207
39bc1876
NS
13208@item -mflush-func=@var{name}
13209@opindex mflush-func=@var{name}
13210Specifies the name of the operating system function to call to flush
13211the cache. The default is @emph{_flush_cache}, but a function call
13212will only be used if a trap is not available.
3af4bd89 13213
39bc1876
NS
13214@item -mno-flush-func
13215@opindex mno-flush-func
13216Indicates that there is no OS function for flushing the cache.
3af4bd89 13217
39bc1876 13218@end table
3af4bd89 13219
39bc1876
NS
13220@node M680x0 Options
13221@subsection M680x0 Options
13222@cindex M680x0 options
f22a97d2 13223
900ec02d
JB
13224These are the @samp{-m} options defined for M680x0 and ColdFire processors.
13225The default settings depend on which architecture was selected when
13226the compiler was configured; the defaults for the most common choices
13227are given below.
1255c85c 13228
39bc1876 13229@table @gcctabopt
900ec02d
JB
13230@item -march=@var{arch}
13231@opindex march
13232Generate code for a specific M680x0 or ColdFire instruction set
13233architecture. Permissible values of @var{arch} for M680x0
13234architectures are: @samp{68000}, @samp{68010}, @samp{68020},
13235@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
13236architectures are selected according to Freescale's ISA classification
13237and the permissible values are: @samp{isaa}, @samp{isaaplus},
13238@samp{isab} and @samp{isac}.
13239
13240gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
13241code for a ColdFire target. The @var{arch} in this macro is one of the
13242@option{-march} arguments given above.
13243
13244When used together, @option{-march} and @option{-mtune} select code
13245that runs on a family of similar processors but that is optimized
13246for a particular microarchitecture.
13247
13248@item -mcpu=@var{cpu}
13249@opindex mcpu
13250Generate code for a specific M680x0 or ColdFire processor.
13251The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
13252@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
13253and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
13254below, which also classifies the CPUs into families:
13255
13256@multitable @columnfractions 0.20 0.80
1cbe999f 13257@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
c260f01f 13258@item @samp{51} @tab @samp{51} @samp{51ac} @samp{51cn} @samp{51em} @samp{51qe}
900ec02d
JB
13259@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
13260@item @samp{5206e} @tab @samp{5206e}
13261@item @samp{5208} @tab @samp{5207} @samp{5208}
13262@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
13263@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
13264@item @samp{5216} @tab @samp{5214} @samp{5216}
13265@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
13266@item @samp{5225} @tab @samp{5224} @samp{5225}
c260f01f 13267@item @samp{52259} @tab @samp{52252} @samp{52254} @samp{52255} @samp{52256} @samp{52258} @samp{52259}
900ec02d
JB
13268@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
13269@item @samp{5249} @tab @samp{5249}
13270@item @samp{5250} @tab @samp{5250}
13271@item @samp{5271} @tab @samp{5270} @samp{5271}
13272@item @samp{5272} @tab @samp{5272}
13273@item @samp{5275} @tab @samp{5274} @samp{5275}
13274@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
c260f01f 13275@item @samp{53017} @tab @samp{53011} @samp{53012} @samp{53013} @samp{53014} @samp{53015} @samp{53016} @samp{53017}
900ec02d
JB
13276@item @samp{5307} @tab @samp{5307}
13277@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
13278@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
13279@item @samp{5407} @tab @samp{5407}
13280@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}
13281@end multitable
13282
13283@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
13284@var{arch} is compatible with @var{cpu}. Other combinations of
13285@option{-mcpu} and @option{-march} are rejected.
13286
7eb4f044
NS
13287gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
13288@var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
13289where the value of @var{family} is given by the table above.
13290
900ec02d
JB
13291@item -mtune=@var{tune}
13292@opindex mtune
13293Tune the code for a particular microarchitecture, within the
13294constraints set by @option{-march} and @option{-mcpu}.
13295The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
13296@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
13297and @samp{cpu32}. The ColdFire microarchitectures
8c5c99dc 13298are: @samp{cfv1}, @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
900ec02d
JB
13299
13300You can also use @option{-mtune=68020-40} for code that needs
13301to run relatively well on 68020, 68030 and 68040 targets.
13302@option{-mtune=68020-60} is similar but includes 68060 targets
13303as well. These two options select the same tuning decisions as
13304@option{-m68020-40} and @option{-m68020-60} respectively.
13305
7eb4f044
NS
13306gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
13307when tuning for 680x0 architecture @var{arch}. It also defines
13308@samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
13309option is used. If gcc is tuning for a range of architectures,
13310as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
13311it defines the macros for every architecture in the range.
13312
13313gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
13314ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
13315of the arguments given above.
13316
39bc1876
NS
13317@item -m68000
13318@itemx -mc68000
13319@opindex m68000
13320@opindex mc68000
13321Generate output for a 68000. This is the default
13322when the compiler is configured for 68000-based systems.
900ec02d 13323It is equivalent to @option{-march=68000}.
1255c85c 13324
39bc1876
NS
13325Use this option for microcontrollers with a 68000 or EC000 core,
13326including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
7eafc329 13327
3197c489
RS
13328@item -m68010
13329@opindex m68010
13330Generate output for a 68010. This is the default
13331when the compiler is configured for 68010-based systems.
900ec02d 13332It is equivalent to @option{-march=68010}.
3197c489 13333
39bc1876
NS
13334@item -m68020
13335@itemx -mc68020
13336@opindex m68020
13337@opindex mc68020
13338Generate output for a 68020. This is the default
13339when the compiler is configured for 68020-based systems.
900ec02d 13340It is equivalent to @option{-march=68020}.
f73ad30e 13341
39bc1876
NS
13342@item -m68030
13343@opindex m68030
13344Generate output for a 68030. This is the default when the compiler is
900ec02d
JB
13345configured for 68030-based systems. It is equivalent to
13346@option{-march=68030}.
79f05c19 13347
39bc1876
NS
13348@item -m68040
13349@opindex m68040
13350Generate output for a 68040. This is the default when the compiler is
900ec02d
JB
13351configured for 68040-based systems. It is equivalent to
13352@option{-march=68040}.
79f05c19 13353
39bc1876
NS
13354This option inhibits the use of 68881/68882 instructions that have to be
13355emulated by software on the 68040. Use this option if your 68040 does not
13356have code to emulate those instructions.
762e166b 13357
39bc1876
NS
13358@item -m68060
13359@opindex m68060
13360Generate output for a 68060. This is the default when the compiler is
900ec02d
JB
13361configured for 68060-based systems. It is equivalent to
13362@option{-march=68060}.
74dc3e94 13363
39bc1876
NS
13364This option inhibits the use of 68020 and 68881/68882 instructions that
13365have to be emulated by software on the 68060. Use this option if your 68060
13366does not have code to emulate those instructions.
74dc3e94 13367
39bc1876
NS
13368@item -mcpu32
13369@opindex mcpu32
13370Generate output for a CPU32. This is the default
13371when the compiler is configured for CPU32-based systems.
900ec02d 13372It is equivalent to @option{-march=cpu32}.
3af4bd89 13373
39bc1876
NS
13374Use this option for microcontrollers with a
13375CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
1337668336, 68340, 68341, 68349 and 68360.
14f73b5a 13377
39bc1876
NS
13378@item -m5200
13379@opindex m5200
0ee2ea09 13380Generate output for a 520X ColdFire CPU@. This is the default
39bc1876 13381when the compiler is configured for 520X-based systems.
900ec02d
JB
13382It is equivalent to @option{-mcpu=5206}, and is now deprecated
13383in favor of that option.
14f73b5a 13384
39bc1876 13385Use this option for microcontroller with a 5200 core, including
900ec02d
JB
13386the MCF5202, MCF5203, MCF5204 and MCF5206.
13387
13388@item -m5206e
13389@opindex m5206e
0ee2ea09 13390Generate output for a 5206e ColdFire CPU@. The option is now
900ec02d
JB
13391deprecated in favor of the equivalent @option{-mcpu=5206e}.
13392
13393@item -m528x
13394@opindex m528x
13395Generate output for a member of the ColdFire 528X family.
13396The option is now deprecated in favor of the equivalent
13397@option{-mcpu=528x}.
13398
13399@item -m5307
13400@opindex m5307
0ee2ea09 13401Generate output for a ColdFire 5307 CPU@. The option is now deprecated
900ec02d
JB
13402in favor of the equivalent @option{-mcpu=5307}.
13403
13404@item -m5407
13405@opindex m5407
0ee2ea09 13406Generate output for a ColdFire 5407 CPU@. The option is now deprecated
900ec02d 13407in favor of the equivalent @option{-mcpu=5407}.
a7701995 13408
dcc21c4c
PB
13409@item -mcfv4e
13410@opindex mcfv4e
900ec02d 13411Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
dcc21c4c 13412This includes use of hardware floating point instructions.
900ec02d
JB
13413The option is equivalent to @option{-mcpu=547x}, and is now
13414deprecated in favor of that option.
a7701995 13415
39bc1876
NS
13416@item -m68020-40
13417@opindex m68020-40
13418Generate output for a 68040, without using any of the new instructions.
13419This results in code which can run relatively efficiently on either a
1342068020/68881 or a 68030 or a 68040. The generated code does use the
1342168881 instructions that are emulated on the 68040.
a7701995 13422
900ec02d
JB
13423The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
13424
39bc1876
NS
13425@item -m68020-60
13426@opindex m68020-60
13427Generate output for a 68060, without using any of the new instructions.
13428This results in code which can run relatively efficiently on either a
1342968020/68881 or a 68030 or a 68040. The generated code does use the
1343068881 instructions that are emulated on the 68060.
a7701995 13431
900ec02d
JB
13432The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
13433
13434@item -mhard-float
13435@itemx -m68881
13436@opindex mhard-float
13437@opindex m68881
13438Generate floating-point instructions. This is the default for 68020
0ee2ea09 13439and above, and for ColdFire devices that have an FPU@. It defines the
7eb4f044
NS
13440macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
13441on ColdFire targets.
900ec02d 13442
39bc1876
NS
13443@item -msoft-float
13444@opindex msoft-float
900ec02d
JB
13445Do not generate floating-point instructions; use library calls instead.
13446This is the default for 68000, 68010, and 68832 targets. It is also
13447the default for ColdFire devices that have no FPU.
13448
13449@item -mdiv
13450@itemx -mno-div
13451@opindex mdiv
13452@opindex mno-div
13453Generate (do not generate) ColdFire hardware divide and remainder
13454instructions. If @option{-march} is used without @option{-mcpu},
13455the default is ``on'' for ColdFire architectures and ``off'' for M680x0
13456architectures. Otherwise, the default is taken from the target CPU
13457(either the default CPU, or the one specified by @option{-mcpu}). For
13458example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
13459@option{-mcpu=5206e}.
13460
13461gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
14f73b5a 13462
39bc1876
NS
13463@item -mshort
13464@opindex mshort
13465Consider type @code{int} to be 16 bits wide, like @code{short int}.
13466Additionally, parameters passed on the stack are also aligned to a
1346716-bit boundary even on targets whose API mandates promotion to 32-bit.
74291a4b 13468
64826589 13469@item -mno-short
edc5f63b 13470@opindex mno-short
64826589
NS
13471Do not consider type @code{int} to be 16 bits wide. This is the default.
13472
39bc1876 13473@item -mnobitfield
64826589 13474@itemx -mno-bitfield
39bc1876 13475@opindex mnobitfield
64826589 13476@opindex mno-bitfield
39bc1876
NS
13477Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
13478and @option{-m5200} options imply @w{@option{-mnobitfield}}.
74291a4b 13479
39bc1876
NS
13480@item -mbitfield
13481@opindex mbitfield
13482Do use the bit-field instructions. The @option{-m68020} option implies
13483@option{-mbitfield}. This is the default if you use a configuration
13484designed for a 68020.
13485
13486@item -mrtd
13487@opindex mrtd
13488Use a different function-calling convention, in which functions
13489that take a fixed number of arguments return with the @code{rtd}
13490instruction, which pops their arguments while returning. This
13491saves one instruction in the caller since there is no need to pop
13492the arguments there.
ea3bfbfe 13493
39bc1876
NS
13494This calling convention is incompatible with the one normally
13495used on Unix, so you cannot use it if you need to call libraries
13496compiled with the Unix compiler.
74291a4b 13497
39bc1876
NS
13498Also, you must provide function prototypes for all functions that
13499take variable numbers of arguments (including @code{printf});
13500otherwise incorrect code will be generated for calls to those
13501functions.
861bb6c1 13502
39bc1876
NS
13503In addition, seriously incorrect code will result if you call a
13504function with too many arguments. (Normally, extra arguments are
13505harmlessly ignored.)
74291a4b 13506
39bc1876
NS
13507The @code{rtd} instruction is supported by the 68010, 68020, 68030,
1350868040, 68060 and CPU32 processors, but not by the 68000 or 5200.
74291a4b 13509
64826589
NS
13510@item -mno-rtd
13511@opindex mno-rtd
13512Do not use the calling conventions selected by @option{-mrtd}.
13513This is the default.
13514
39bc1876
NS
13515@item -malign-int
13516@itemx -mno-align-int
13517@opindex malign-int
13518@opindex mno-align-int
13519Control whether GCC aligns @code{int}, @code{long}, @code{long long},
13520@code{float}, @code{double}, and @code{long double} variables on a 32-bit
13521boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
13522Aligning variables on 32-bit boundaries produces code that runs somewhat
13523faster on processors with 32-bit busses at the expense of more memory.
74291a4b 13524
39bc1876
NS
13525@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
13526align structures containing the above types differently than
13527most published application binary interface specifications for the m68k.
74291a4b 13528
39bc1876
NS
13529@item -mpcrel
13530@opindex mpcrel
13531Use the pc-relative addressing mode of the 68000 directly, instead of
13532using a global offset table. At present, this option implies @option{-fpic},
13533allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
13534not presently supported with @option{-mpcrel}, though this could be supported for
1353568020 and higher processors.
74291a4b 13536
39bc1876
NS
13537@item -mno-strict-align
13538@itemx -mstrict-align
13539@opindex mno-strict-align
13540@opindex mstrict-align
13541Do not (do) assume that unaligned memory references will be handled by
13542the system.
74291a4b 13543
39bc1876
NS
13544@item -msep-data
13545Generate code that allows the data segment to be located in a different
13546area of memory from the text segment. This allows for execute in place in
4ec7afd7
KH
13547an environment without virtual memory management. This option implies
13548@option{-fPIC}.
74291a4b 13549
39bc1876
NS
13550@item -mno-sep-data
13551Generate code that assumes that the data segment follows the text segment.
13552This is the default.
74291a4b 13553
39bc1876
NS
13554@item -mid-shared-library
13555Generate code that supports shared libraries via the library ID method.
13556This allows for execute in place and shared libraries in an environment
4ec7afd7 13557without virtual memory management. This option implies @option{-fPIC}.
74291a4b 13558
39bc1876
NS
13559@item -mno-id-shared-library
13560Generate code that doesn't assume ID based shared libraries are being used.
13561This is the default.
74291a4b 13562
39bc1876
NS
13563@item -mshared-library-id=n
13564Specified the identification number of the ID based shared library being
13565compiled. Specifying a value of 0 will generate more compact code, specifying
13566other values will force the allocation of that number to the current
13567library but is no more space or time efficient than omitting this option.
74291a4b 13568
884316ff
JM
13569@item -mxgot
13570@itemx -mno-xgot
13571@opindex mxgot
13572@opindex mno-xgot
13573When generating position-independent code for ColdFire, generate code
13574that works if the GOT has more than 8192 entries. This code is
13575larger and slower than code generated without this option. On M680x0
13576processors, this option is not needed; @option{-fPIC} suffices.
13577
13578GCC normally uses a single instruction to load values from the GOT@.
13579While this is relatively efficient, it only works if the GOT
13580is smaller than about 64k. Anything larger causes the linker
13581to report an error such as:
13582
13583@cindex relocation truncated to fit (ColdFire)
13584@smallexample
13585relocation truncated to fit: R_68K_GOT16O foobar
13586@end smallexample
13587
13588If this happens, you should recompile your code with @option{-mxgot}.
13589It should then work with very large GOTs. However, code generated with
13590@option{-mxgot} is less efficient, since it takes 4 instructions to fetch
13591the value of a global symbol.
13592
13593Note that some linkers, including newer versions of the GNU linker,
13594can create multiple GOTs and sort GOT entries. If you have such a linker,
13595you should only need to use @option{-mxgot} when compiling a single
13596object file that accesses more than 8192 GOT entries. Very few do.
13597
13598These options have no effect unless GCC is generating
13599position-independent code.
13600
39bc1876 13601@end table
74291a4b 13602
39bc1876
NS
13603@node M68hc1x Options
13604@subsection M68hc1x Options
13605@cindex M68hc1x options
74291a4b 13606
39bc1876
NS
13607These are the @samp{-m} options defined for the 68hc11 and 68hc12
13608microcontrollers. The default values for these options depends on
13609which style of microcontroller was selected when the compiler was configured;
13610the defaults for the most common choices are given below.
c219e1da 13611
39bc1876
NS
13612@table @gcctabopt
13613@item -m6811
13614@itemx -m68hc11
13615@opindex m6811
13616@opindex m68hc11
13617Generate output for a 68HC11. This is the default
13618when the compiler is configured for 68HC11-based systems.
c5d3d49b 13619
39bc1876
NS
13620@item -m6812
13621@itemx -m68hc12
13622@opindex m6812
13623@opindex m68hc12
13624Generate output for a 68HC12. This is the default
13625when the compiler is configured for 68HC12-based systems.
c5d3d49b 13626
39bc1876
NS
13627@item -m68S12
13628@itemx -m68hcs12
13629@opindex m68S12
13630@opindex m68hcs12
13631Generate output for a 68HCS12.
c5d3d49b 13632
39bc1876
NS
13633@item -mauto-incdec
13634@opindex mauto-incdec
13635Enable the use of 68HC12 pre and post auto-increment and auto-decrement
13636addressing modes.
34208acf 13637
39bc1876 13638@item -minmax
d376d545 13639@itemx -mnominmax
39bc1876
NS
13640@opindex minmax
13641@opindex mnominmax
13642Enable the use of 68HC12 min and max instructions.
34208acf 13643
39bc1876
NS
13644@item -mlong-calls
13645@itemx -mno-long-calls
13646@opindex mlong-calls
13647@opindex mno-long-calls
13648Treat all calls as being far away (near). If calls are assumed to be
13649far away, the compiler will use the @code{call} instruction to
13650call a function and the @code{rtc} instruction for returning.
34208acf 13651
39bc1876
NS
13652@item -mshort
13653@opindex mshort
13654Consider type @code{int} to be 16 bits wide, like @code{short int}.
34208acf 13655
39bc1876
NS
13656@item -msoft-reg-count=@var{count}
13657@opindex msoft-reg-count
13658Specify the number of pseudo-soft registers which are used for the
13659code generation. The maximum number is 32. Using more pseudo-soft
13660register may or may not result in better code depending on the program.
13661The default is 4 for 68HC11 and 2 for 68HC12.
34208acf 13662
39bc1876 13663@end table
34208acf 13664
39bc1876
NS
13665@node MCore Options
13666@subsection MCore Options
13667@cindex MCore options
34208acf 13668
39bc1876
NS
13669These are the @samp{-m} options defined for the Motorola M*Core
13670processors.
34208acf 13671
39bc1876 13672@table @gcctabopt
34208acf 13673
39bc1876
NS
13674@item -mhardlit
13675@itemx -mno-hardlit
13676@opindex mhardlit
13677@opindex mno-hardlit
13678Inline constants into the code stream if it can be done in two
13679instructions or less.
34208acf 13680
39bc1876
NS
13681@item -mdiv
13682@itemx -mno-div
13683@opindex mdiv
13684@opindex mno-div
13685Use the divide instruction. (Enabled by default).
a02aa5b0 13686
39bc1876
NS
13687@item -mrelax-immediate
13688@itemx -mno-relax-immediate
13689@opindex mrelax-immediate
13690@opindex mno-relax-immediate
13691Allow arbitrary sized immediates in bit operations.
a02aa5b0 13692
39bc1876
NS
13693@item -mwide-bitfields
13694@itemx -mno-wide-bitfields
13695@opindex mwide-bitfields
13696@opindex mno-wide-bitfields
13697Always treat bit-fields as int-sized.
a02aa5b0 13698
39bc1876
NS
13699@item -m4byte-functions
13700@itemx -mno-4byte-functions
13701@opindex m4byte-functions
13702@opindex mno-4byte-functions
13703Force all functions to be aligned to a four byte boundary.
a02aa5b0 13704
39bc1876
NS
13705@item -mcallgraph-data
13706@itemx -mno-callgraph-data
13707@opindex mcallgraph-data
13708@opindex mno-callgraph-data
13709Emit callgraph information.
f401d0f5 13710
39bc1876
NS
13711@item -mslow-bytes
13712@itemx -mno-slow-bytes
13713@opindex mslow-bytes
13714@opindex mno-slow-bytes
13715Prefer word access when reading byte quantities.
f401d0f5 13716
39bc1876
NS
13717@item -mlittle-endian
13718@itemx -mbig-endian
13719@opindex mlittle-endian
13720@opindex mbig-endian
13721Generate code for a little endian target.
f401d0f5 13722
39bc1876
NS
13723@item -m210
13724@itemx -m340
13725@opindex m210
13726@opindex m340
13727Generate code for the 210 processor.
40190a76
NC
13728
13729@item -mno-lsim
d376d545 13730@opindex mno-lsim
40190a76
NC
13731Assume that run-time support has been provided and so omit the
13732simulator library (@file{libsim.a)} from the linker command line.
13733
13734@item -mstack-increment=@var{size}
13735@opindex mstack-increment
13736Set the maximum amount for a single stack increment operation. Large
048fd785 13737values can increase the speed of programs which contain functions
40190a76
NC
13738that need a large amount of stack space, but they can also trigger a
13739segmentation fault if the stack is extended too much. The default
13740value is 0x1000.
13741
74291a4b
MM
13742@end table
13743
e2491744
DD
13744@node MeP Options
13745@subsection MeP Options
13746@cindex MeP options
13747
13748@table @gcctabopt
13749
13750@item -mabsdiff
13751@opindex mabsdiff
13752Enables the @code{abs} instruction, which is the absolute difference
13753between two registers.
13754
13755@item -mall-opts
13756@opindex mall-opts
13757Enables all the optional instructions - average, multiply, divide, bit
13758operations, leading zero, absolute difference, min/max, clip, and
13759saturation.
13760
13761
13762@item -maverage
13763@opindex maverage
13764Enables the @code{ave} instruction, which computes the average of two
13765registers.
13766
13767@item -mbased=@var{n}
13768@opindex mbased=
13769Variables of size @var{n} bytes or smaller will be placed in the
13770@code{.based} section by default. Based variables use the @code{$tp}
13771register as a base register, and there is a 128 byte limit to the
13772@code{.based} section.
13773
13774@item -mbitops
13775@opindex mbitops
13776Enables the bit operation instructions - bit test (@code{btstm}), set
13777(@code{bsetm}), clear (@code{bclrm}), invert (@code{bnotm}), and
13778test-and-set (@code{tas}).
13779
13780@item -mc=@var{name}
13781@opindex mc=
13782Selects which section constant data will be placed in. @var{name} may
13783be @code{tiny}, @code{near}, or @code{far}.
13784
13785@item -mclip
13786@opindex mclip
13787Enables the @code{clip} instruction. Note that @code{-mclip} is not
13788useful unless you also provide @code{-mminmax}.
13789
13790@item -mconfig=@var{name}
13791@opindex mconfig=
13792Selects one of the build-in core configurations. Each MeP chip has
13793one or more modules in it; each module has a core CPU and a variety of
13794coprocessors, optional instructions, and peripherals. The
13795@code{MeP-Integrator} tool, not part of GCC, provides these
13796configurations through this option; using this option is the same as
13797using all the corresponding command line options. The default
13798configuration is @code{default}.
13799
13800@item -mcop
13801@opindex mcop
13802Enables the coprocessor instructions. By default, this is a 32-bit
13803coprocessor. Note that the coprocessor is normally enabled via the
13804@code{-mconfig=} option.
13805
13806@item -mcop32
13807@opindex mcop32
13808Enables the 32-bit coprocessor's instructions.
13809
13810@item -mcop64
13811@opindex mcop64
13812Enables the 64-bit coprocessor's instructions.
13813
13814@item -mivc2
13815@opindex mivc2
13816Enables IVC2 scheduling. IVC2 is a 64-bit VLIW coprocessor.
13817
13818@item -mdc
13819@opindex mdc
13820Causes constant variables to be placed in the @code{.near} section.
13821
13822@item -mdiv
13823@opindex mdiv
13824Enables the @code{div} and @code{divu} instructions.
13825
13826@item -meb
13827@opindex meb
13828Generate big-endian code.
13829
13830@item -mel
13831@opindex mel
13832Generate little-endian code.
13833
13834@item -mio-volatile
13835@opindex mio-volatile
13836Tells the compiler that any variable marked with the @code{io}
13837attribute is to be considered volatile.
13838
13839@item -ml
13840@opindex ml
13841Causes variables to be assigned to the @code{.far} section by default.
13842
13843@item -mleadz
13844@opindex mleadz
13845Enables the @code{leadz} (leading zero) instruction.
13846
13847@item -mm
13848@opindex mm
13849Causes variables to be assigned to the @code{.near} section by default.
13850
13851@item -mminmax
13852@opindex mminmax
13853Enables the @code{min} and @code{max} instructions.
13854
13855@item -mmult
13856@opindex mmult
13857Enables the multiplication and multiply-accumulate instructions.
13858
13859@item -mno-opts
13860@opindex mno-opts
13861Disables all the optional instructions enabled by @code{-mall-opts}.
13862
13863@item -mrepeat
13864@opindex mrepeat
13865Enables the @code{repeat} and @code{erepeat} instructions, used for
13866low-overhead looping.
13867
13868@item -ms
13869@opindex ms
13870Causes all variables to default to the @code{.tiny} section. Note
13871that there is a 65536 byte limit to this section. Accesses to these
13872variables use the @code{%gp} base register.
13873
13874@item -msatur
13875@opindex msatur
13876Enables the saturation instructions. Note that the compiler does not
13877currently generate these itself, but this option is included for
13878compatibility with other tools, like @code{as}.
13879
13880@item -msdram
13881@opindex msdram
13882Link the SDRAM-based runtime instead of the default ROM-based runtime.
13883
13884@item -msim
13885@opindex msim
13886Link the simulator runtime libraries.
13887
13888@item -msimnovec
13889@opindex msimnovec
13890Link the simulator runtime libraries, excluding built-in support
13891for reset and exception vectors and tables.
13892
13893@item -mtf
13894@opindex mtf
13895Causes all functions to default to the @code{.far} section. Without
13896this option, functions default to the @code{.near} section.
13897
13898@item -mtiny=@var{n}
13899@opindex mtiny=
13900Variables that are @var{n} bytes or smaller will be allocated to the
13901@code{.tiny} section. These variables use the @code{$gp} base
13902register. The default for this option is 4, but note that there's a
1390365536 byte limit to the @code{.tiny} section.
13904
13905@end table
13906
80920132
ME
13907@node MicroBlaze Options
13908@subsection MicroBlaze Options
13909@cindex MicroBlaze Options
13910
13911@table @gcctabopt
13912
13913@item -msoft-float
13914@opindex msoft-float
13915Use software emulation for floating point (default).
13916
13917@item -mhard-float
13918@opindex mhard-float
13919Use hardware floating point instructions.
13920
13921@item -mmemcpy
13922@opindex mmemcpy
13923Do not optimize block moves, use @code{memcpy}.
13924
13925@item -mno-clearbss
13926@opindex mno-clearbss
13927This option is deprecated. Use @option{-fno-zero-initialized-in-bss} instead.
13928
13929@item -mcpu=@var{cpu-type}
13930@opindex mcpu=
13931Use features of and schedule code for given CPU.
13932Supported values are in the format @samp{v@var{X}.@var{YY}.@var{Z}},
13933where @var{X} is a major version, @var{YY} is the minor version, and
13934@var{Z} is compatiblity code. Example values are @samp{v3.00.a},
13935@samp{v4.00.b}, @samp{v5.00.a}, @samp{v5.00.b}, @samp{v5.00.b}, @samp{v6.00.a}.
13936
13937@item -mxl-soft-mul
13938@opindex mxl-soft-mul
13939Use software multiply emulation (default).
13940
13941@item -mxl-soft-div
13942@opindex mxl-soft-div
13943Use software emulation for divides (default).
13944
13945@item -mxl-barrel-shift
13946@opindex mxl-barrel-shift
13947Use the hardware barrel shifter.
13948
13949@item -mxl-pattern-compare
13950@opindex mxl-pattern-compare
13951Use pattern compare instructions.
13952
13953@item -msmall-divides
13954@opindex msmall-divides
13955Use table lookup optimization for small signed integer divisions.
13956
13957@item -mxl-stack-check
13958@opindex mxl-stack-check
13959This option is deprecated. Use -fstack-check instead.
13960
13961@item -mxl-gp-opt
13962@opindex mxl-gp-opt
13963Use GP relative sdata/sbss sections.
13964
13965@item -mxl-multiply-high
13966@opindex mxl-multiply-high
13967Use multiply high instructions for high part of 32x32 multiply.
13968
13969@item -mxl-float-convert
13970@opindex mxl-float-convert
13971Use hardware floating point converstion instructions.
13972
13973@item -mxl-float-sqrt
13974@opindex mxl-float-sqrt
13975Use hardware floating point square root instruction.
13976
13977@item -mxl-mode-@var{app-model}
13978Select application model @var{app-model}. Valid models are
13979@table @samp
13980@item executable
13981normal executable (default), uses startup code @file{crt0.o}.
13982
13983@item xmdstub
13984for use with Xilinx Microprocessor Debugger (XMD) based
13985software intrusive debug agent called xmdstub. This uses startup file
13986@file{crt1.o} and sets the start address of the program to be 0x800.
13987
13988@item bootstrap
13989for applications that are loaded using a bootloader.
13990This model uses startup file @file{crt2.o} which does not contain a processor
13991reset vector handler. This is suitable for transferring control on a
13992processor reset to the bootloader rather than the application.
13993
13994@item novectors
13995for applications that do not require any of the
13996MicroBlaze vectors. This option may be useful for applications running
13997within a monitoring application. This model uses @file{crt3.o} as a startup file.
13998@end table
13999
14000Option @option{-xl-mode-@var{app-model}} is a deprecated alias for
14001@option{-mxl-mode-@var{app-model}}.
14002
14003@end table
14004
39bc1876
NS
14005@node MIPS Options
14006@subsection MIPS Options
14007@cindex MIPS options
74291a4b 14008
2642624b 14009@table @gcctabopt
74291a4b 14010
39bc1876
NS
14011@item -EB
14012@opindex EB
14013Generate big-endian code.
74291a4b 14014
39bc1876
NS
14015@item -EL
14016@opindex EL
14017Generate little-endian code. This is the default for @samp{mips*el-*-*}
14018configurations.
74291a4b 14019
39bc1876
NS
14020@item -march=@var{arch}
14021@opindex march
14022Generate code that will run on @var{arch}, which can be the name of a
14023generic MIPS ISA, or the name of a particular processor.
14024The ISA names are:
14025@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
f2d6ca50 14026@samp{mips32}, @samp{mips32r2}, @samp{mips64} and @samp{mips64r2}.
39bc1876 14027The processor names are:
52bcd429
SL
14028@samp{4kc}, @samp{4km}, @samp{4kp}, @samp{4ksc},
14029@samp{4kec}, @samp{4kem}, @samp{4kep}, @samp{4ksd},
79dad081
DU
14030@samp{5kc}, @samp{5kf},
14031@samp{20kc},
bdd77024
RS
14032@samp{24kc}, @samp{24kf2_1}, @samp{24kf1_1},
14033@samp{24kec}, @samp{24kef2_1}, @samp{24kef1_1},
14034@samp{34kc}, @samp{34kf2_1}, @samp{34kf1_1},
74d4d024 14035@samp{74kc}, @samp{74kf2_1}, @samp{74kf1_1}, @samp{74kf3_2},
5dce6dbd 14036@samp{1004kc}, @samp{1004kf2_1}, @samp{1004kf1_1},
98824c6f 14037@samp{loongson2e}, @samp{loongson2f}, @samp{loongson3a},
39bc1876 14038@samp{m4k},
d97e6aca 14039@samp{octeon},
39bc1876 14040@samp{orion},
79dad081
DU
14041@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
14042@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
14043@samp{rm7000}, @samp{rm9000},
7a3446ec 14044@samp{r10000}, @samp{r12000}, @samp{r14000}, @samp{r16000},
39bc1876 14045@samp{sb1},
79dad081 14046@samp{sr71000},
39bc1876 14047@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
d0ae31b0
SM
14048@samp{vr5000}, @samp{vr5400}, @samp{vr5500}
14049and @samp{xlr}.
39bc1876
NS
14050The special value @samp{from-abi} selects the
14051most compatible architecture for the selected ABI (that is,
14052@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
74291a4b 14053
900e3ae5
DJ
14054Native Linux/GNU toolchains also support the value @samp{native},
14055which selects the best architecture option for the host processor.
14056@option{-march=native} has no effect if GCC does not recognize
14057the processor.
14058
39bc1876
NS
14059In processor names, a final @samp{000} can be abbreviated as @samp{k}
14060(for example, @samp{-march=r2k}). Prefixes are optional, and
14061@samp{vr} may be written @samp{r}.
74291a4b 14062
bdd77024 14063Names of the form @samp{@var{n}f2_1} refer to processors with
74d4d024 14064FPUs clocked at half the rate of the core, names of the form
bdd77024 14065@samp{@var{n}f1_1} refer to processors with FPUs clocked at the same
74d4d024
DU
14066rate as the core, and names of the form @samp{@var{n}f3_2} refer to
14067processors with FPUs clocked a ratio of 3:2 with respect to the core.
14068For compatibility reasons, @samp{@var{n}f} is accepted as a synonym
14069for @samp{@var{n}f2_1} while @samp{@var{n}x} and @samp{@var{b}fx} are
14070accepted as synonyms for @samp{@var{n}f1_1}.
bdd77024 14071
39bc1876
NS
14072GCC defines two macros based on the value of this option. The first
14073is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
14074a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
14075where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
14076For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
14077to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
74291a4b 14078
39bc1876
NS
14079Note that the @samp{_MIPS_ARCH} macro uses the processor names given
14080above. In other words, it will have the full prefix and will not
14081abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
14082the macro names the resolved architecture (either @samp{"mips1"} or
14083@samp{"mips3"}). It names the default architecture when no
14084@option{-march} option is given.
74291a4b 14085
39bc1876
NS
14086@item -mtune=@var{arch}
14087@opindex mtune
14088Optimize for @var{arch}. Among other things, this option controls
14089the way instructions are scheduled, and the perceived cost of arithmetic
14090operations. The list of @var{arch} values is the same as for
14091@option{-march}.
74291a4b 14092
39bc1876
NS
14093When this option is not used, GCC will optimize for the processor
14094specified by @option{-march}. By using @option{-march} and
14095@option{-mtune} together, it is possible to generate code that will
14096run on a family of processors, but optimize the code for one
14097particular member of that family.
74291a4b 14098
39bc1876
NS
14099@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
14100@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
14101@samp{-march} ones described above.
74291a4b 14102
39bc1876
NS
14103@item -mips1
14104@opindex mips1
14105Equivalent to @samp{-march=mips1}.
74291a4b 14106
39bc1876
NS
14107@item -mips2
14108@opindex mips2
14109Equivalent to @samp{-march=mips2}.
74291a4b 14110
39bc1876
NS
14111@item -mips3
14112@opindex mips3
14113Equivalent to @samp{-march=mips3}.
74291a4b 14114
39bc1876
NS
14115@item -mips4
14116@opindex mips4
14117Equivalent to @samp{-march=mips4}.
14118
14119@item -mips32
14120@opindex mips32
14121Equivalent to @samp{-march=mips32}.
74291a4b 14122
39bc1876
NS
14123@item -mips32r2
14124@opindex mips32r2
14125Equivalent to @samp{-march=mips32r2}.
74291a4b 14126
39bc1876
NS
14127@item -mips64
14128@opindex mips64
14129Equivalent to @samp{-march=mips64}.
74291a4b 14130
f2d6ca50
AN
14131@item -mips64r2
14132@opindex mips64r2
14133Equivalent to @samp{-march=mips64r2}.
14134
39bc1876
NS
14135@item -mips16
14136@itemx -mno-mips16
14137@opindex mips16
14138@opindex mno-mips16
7cc63a88 14139Generate (do not generate) MIPS16 code. If GCC is targetting a
71cb39e6 14140MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
74291a4b 14141
f9e4a411 14142MIPS16 code generation can also be controlled on a per-function basis
7a61cf6f 14143by means of @code{mips16} and @code{nomips16} attributes.
f9e4a411
SL
14144@xref{Function Attributes}, for more information.
14145
14146@item -mflip-mips16
14147@opindex mflip-mips16
14148Generate MIPS16 code on alternating functions. This option is provided
14149for regression testing of mixed MIPS16/non-MIPS16 code generation, and is
14150not intended for ordinary use in compiling user code.
14151
1ec3b87b
RS
14152@item -minterlink-mips16
14153@itemx -mno-interlink-mips16
14154@opindex minterlink-mips16
14155@opindex mno-interlink-mips16
14156Require (do not require) that non-MIPS16 code be link-compatible with
14157MIPS16 code.
14158
14159For example, non-MIPS16 code cannot jump directly to MIPS16 code;
14160it must either use a call or an indirect jump. @option{-minterlink-mips16}
14161therefore disables direct jumps unless GCC knows that the target of the
14162jump is not MIPS16.
14163
39bc1876
NS
14164@item -mabi=32
14165@itemx -mabi=o64
14166@itemx -mabi=n32
14167@itemx -mabi=64
14168@itemx -mabi=eabi
14169@opindex mabi=32
14170@opindex mabi=o64
14171@opindex mabi=n32
14172@opindex mabi=64
14173@opindex mabi=eabi
14174Generate code for the given ABI@.
74291a4b 14175
39bc1876
NS
14176Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
14177generates 64-bit code when you select a 64-bit architecture, but you
14178can use @option{-mgp32} to get 32-bit code instead.
74291a4b 14179
39bc1876 14180For information about the O64 ABI, see
ab940b73 14181@uref{http://gcc.gnu.org/@/projects/@/mipso64-abi.html}.
74291a4b 14182
6f428062
DU
14183GCC supports a variant of the o32 ABI in which floating-point registers
14184are 64 rather than 32 bits wide. You can select this combination with
14185@option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
14186and @samp{mfhc1} instructions and is therefore only supported for
14187MIPS32R2 processors.
14188
14189The register assignments for arguments and return values remain the
14190same, but each scalar value is passed in a single 64-bit register
14191rather than a pair of 32-bit registers. For example, scalar
14192floating-point values are returned in @samp{$f0} only, not a
14193@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
14194remains the same, but all 64 bits are saved.
14195
39bc1876
NS
14196@item -mabicalls
14197@itemx -mno-abicalls
14198@opindex mabicalls
14199@opindex mno-abicalls
567b3b82
RS
14200Generate (do not generate) code that is suitable for SVR4-style
14201dynamic objects. @option{-mabicalls} is the default for SVR4-based
14202systems.
14203
14204@item -mshared
14205@itemx -mno-shared
bc4a3483
RS
14206Generate (do not generate) code that is fully position-independent,
14207and that can therefore be linked into shared libraries. This option
14208only affects @option{-mabicalls}.
567b3b82
RS
14209
14210All @option{-mabicalls} code has traditionally been position-independent,
14211regardless of options like @option{-fPIC} and @option{-fpic}. However,
14212as an extension, the GNU toolchain allows executables to use absolute
14213accesses for locally-binding symbols. It can also use shorter GP
14214initialization sequences and generate direct calls to locally-defined
14215functions. This mode is selected by @option{-mno-shared}.
14216
14217@option{-mno-shared} depends on binutils 2.16 or higher and generates
14218objects that can only be linked by the GNU linker. However, the option
14219does not affect the ABI of the final executable; it only affects the ABI
14220of relocatable objects. Using @option{-mno-shared} will generally make
14221executables both smaller and quicker.
14222
14223@option{-mshared} is the default.
74291a4b 14224
e21d5757
DJ
14225@item -mplt
14226@itemx -mno-plt
14227@opindex mplt
14228@opindex mno-plt
14229Assume (do not assume) that the static and dynamic linkers
14230support PLTs and copy relocations. This option only affects
14231@samp{-mno-shared -mabicalls}. For the n64 ABI, this option
14232has no effect without @samp{-msym32}.
14233
14234You can make @option{-mplt} the default by configuring
14235GCC with @option{--with-mips-plt}. The default is
14236@option{-mno-plt} otherwise.
14237
39bc1876
NS
14238@item -mxgot
14239@itemx -mno-xgot
14240@opindex mxgot
14241@opindex mno-xgot
14242Lift (do not lift) the usual restrictions on the size of the global
14243offset table.
74291a4b 14244
8a36672b 14245GCC normally uses a single instruction to load values from the GOT@.
39bc1876
NS
14246While this is relatively efficient, it will only work if the GOT
14247is smaller than about 64k. Anything larger will cause the linker
14248to report an error such as:
74291a4b 14249
39bc1876
NS
14250@cindex relocation truncated to fit (MIPS)
14251@smallexample
14252relocation truncated to fit: R_MIPS_GOT16 foobar
14253@end smallexample
74291a4b 14254
39bc1876
NS
14255If this happens, you should recompile your code with @option{-mxgot}.
14256It should then work with very large GOTs, although it will also be
14257less efficient, since it will take three instructions to fetch the
14258value of a global symbol.
956d6950 14259
39bc1876
NS
14260Note that some linkers can create multiple GOTs. If you have such a
14261linker, you should only need to use @option{-mxgot} when a single object
14262file accesses more than 64k's worth of GOT entries. Very few do.
956d6950 14263
39bc1876
NS
14264These options have no effect unless GCC is generating position
14265independent code.
956d6950 14266
39bc1876
NS
14267@item -mgp32
14268@opindex mgp32
14269Assume that general-purpose registers are 32 bits wide.
58605ba0 14270
39bc1876
NS
14271@item -mgp64
14272@opindex mgp64
14273Assume that general-purpose registers are 64 bits wide.
58605ba0 14274
39bc1876
NS
14275@item -mfp32
14276@opindex mfp32
14277Assume that floating-point registers are 32 bits wide.
58605ba0 14278
39bc1876
NS
14279@item -mfp64
14280@opindex mfp64
14281Assume that floating-point registers are 64 bits wide.
58605ba0 14282
39bc1876
NS
14283@item -mhard-float
14284@opindex mhard-float
14285Use floating-point coprocessor instructions.
58605ba0 14286
39bc1876
NS
14287@item -msoft-float
14288@opindex msoft-float
14289Do not use floating-point coprocessor instructions. Implement
14290floating-point calculations using library calls instead.
3094247f 14291
39bc1876
NS
14292@item -msingle-float
14293@opindex msingle-float
14294Assume that the floating-point coprocessor only supports single-precision
14295operations.
3094247f 14296
500fc425 14297@item -mdouble-float
39bc1876
NS
14298@opindex mdouble-float
14299Assume that the floating-point coprocessor supports double-precision
14300operations. This is the default.
956d6950 14301
66471b47
DD
14302@item -mllsc
14303@itemx -mno-llsc
14304@opindex mllsc
14305@opindex mno-llsc
14306Use (do not use) @samp{ll}, @samp{sc}, and @samp{sync} instructions to
14307implement atomic memory built-in functions. When neither option is
14308specified, GCC will use the instructions if the target architecture
14309supports them.
14310
14311@option{-mllsc} is useful if the runtime environment can emulate the
14312instructions and @option{-mno-llsc} can be useful when compiling for
14313nonstandard ISAs. You can make either option the default by
14314configuring GCC with @option{--with-llsc} and @option{--without-llsc}
14315respectively. @option{--with-llsc} is the default for some
14316configurations; see the installation documentation for details.
14317
500fc425 14318@item -mdsp
118ea793
CF
14319@itemx -mno-dsp
14320@opindex mdsp
14321@opindex mno-dsp
0ee2ea09 14322Use (do not use) revision 1 of the MIPS DSP ASE@.
da7d4908
RS
14323@xref{MIPS DSP Built-in Functions}. This option defines the
14324preprocessor macro @samp{__mips_dsp}. It also defines
14325@samp{__mips_dsp_rev} to 1.
118ea793 14326
500fc425 14327@item -mdspr2
32041385
CF
14328@itemx -mno-dspr2
14329@opindex mdspr2
14330@opindex mno-dspr2
0ee2ea09 14331Use (do not use) revision 2 of the MIPS DSP ASE@.
da7d4908
RS
14332@xref{MIPS DSP Built-in Functions}. This option defines the
14333preprocessor macros @samp{__mips_dsp} and @samp{__mips_dspr2}.
14334It also defines @samp{__mips_dsp_rev} to 2.
32041385 14335
0aa222d1
SL
14336@item -msmartmips
14337@itemx -mno-smartmips
14338@opindex msmartmips
14339@opindex mno-smartmips
14340Use (do not use) the MIPS SmartMIPS ASE.
14341
500fc425 14342@item -mpaired-single
06a4ab70
CF
14343@itemx -mno-paired-single
14344@opindex mpaired-single
14345@opindex mno-paired-single
d840bfd3 14346Use (do not use) paired-single floating-point instructions.
e5a2b69d
RS
14347@xref{MIPS Paired-Single Support}. This option requires
14348hardware floating-point support to be enabled.
06a4ab70 14349
500fc425
TS
14350@item -mdmx
14351@itemx -mno-mdmx
14352@opindex mdmx
14353@opindex mno-mdmx
14354Use (do not use) MIPS Digital Media Extension instructions.
14355This option can only be used when generating 64-bit code and requires
14356hardware floating-point support to be enabled.
14357
14358@item -mips3d
06a4ab70
CF
14359@itemx -mno-mips3d
14360@opindex mips3d
14361@opindex mno-mips3d
8a36672b 14362Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
d840bfd3 14363The option @option{-mips3d} implies @option{-mpaired-single}.
06a4ab70 14364
500fc425
TS
14365@item -mmt
14366@itemx -mno-mt
14367@opindex mmt
14368@opindex mno-mt
14369Use (do not use) MT Multithreading instructions.
14370
39bc1876
NS
14371@item -mlong64
14372@opindex mlong64
14373Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
14374an explanation of the default and the way that the pointer size is
14375determined.
956d6950 14376
39bc1876
NS
14377@item -mlong32
14378@opindex mlong32
14379Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
956d6950 14380
39bc1876
NS
14381The default size of @code{int}s, @code{long}s and pointers depends on
14382the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
14383uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
1438432-bit @code{long}s. Pointers are the same size as @code{long}s,
14385or the same size as integer registers, whichever is smaller.
956d6950 14386
acda0e26
RS
14387@item -msym32
14388@itemx -mno-sym32
14389@opindex msym32
14390@opindex mno-sym32
14391Assume (do not assume) that all symbols have 32-bit values, regardless
14392of the selected ABI@. This option is useful in combination with
14393@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
14394to generate shorter and faster references to symbolic addresses.
14395
39bc1876
NS
14396@item -G @var{num}
14397@opindex G
a318179e
RS
14398Put definitions of externally-visible data in a small data section
14399if that data is no bigger than @var{num} bytes. GCC can then access
14400the data more efficiently; see @option{-mgpopt} for details.
14401
14402The default @option{-G} option depends on the configuration.
14403
14404@item -mlocal-sdata
14405@itemx -mno-local-sdata
14406@opindex mlocal-sdata
14407@opindex mno-local-sdata
14408Extend (do not extend) the @option{-G} behavior to local data too,
0ee2ea09 14409such as to static variables in C@. @option{-mlocal-sdata} is the
a318179e
RS
14410default for all configurations.
14411
14412If the linker complains that an application is using too much small data,
14413you might want to try rebuilding the less performance-critical parts with
14414@option{-mno-local-sdata}. You might also want to build large
14415libraries with @option{-mno-local-sdata}, so that the libraries leave
14416more room for the main program.
14417
14418@item -mextern-sdata
14419@itemx -mno-extern-sdata
14420@opindex mextern-sdata
14421@opindex mno-extern-sdata
14422Assume (do not assume) that externally-defined data will be in
14423a small data section if that data is within the @option{-G} limit.
14424@option{-mextern-sdata} is the default for all configurations.
14425
14426If you compile a module @var{Mod} with @option{-mextern-sdata} @option{-G
14427@var{num}} @option{-mgpopt}, and @var{Mod} references a variable @var{Var}
14428that is no bigger than @var{num} bytes, you must make sure that @var{Var}
14429is placed in a small data section. If @var{Var} is defined by another
14430module, you must either compile that module with a high-enough
14431@option{-G} setting or attach a @code{section} attribute to @var{Var}'s
14432definition. If @var{Var} is common, you must link the application
14433with a high-enough @option{-G} setting.
14434
14435The easiest way of satisfying these restrictions is to compile
14436and link every module with the same @option{-G} option. However,
14437you may wish to build a library that supports several different
14438small data limits. You can do this by compiling the library with
14439the highest supported @option{-G} setting and additionally using
14440@option{-mno-extern-sdata} to stop the library from making assumptions
14441about externally-defined data.
14442
14443@item -mgpopt
14444@itemx -mno-gpopt
14445@opindex mgpopt
14446@opindex mno-gpopt
14447Use (do not use) GP-relative accesses for symbols that are known to be
14448in a small data section; see @option{-G}, @option{-mlocal-sdata} and
14449@option{-mextern-sdata}. @option{-mgpopt} is the default for all
14450configurations.
14451
14452@option{-mno-gpopt} is useful for cases where the @code{$gp} register
14453might not hold the value of @code{_gp}. For example, if the code is
14454part of a library that might be used in a boot monitor, programs that
14455call boot monitor routines will pass an unknown value in @code{$gp}.
14456(In such situations, the boot monitor itself would usually be compiled
14457with @option{-G0}.)
14458
14459@option{-mno-gpopt} implies @option{-mno-local-sdata} and
14460@option{-mno-extern-sdata}.
956d6950 14461
39bc1876
NS
14462@item -membedded-data
14463@itemx -mno-embedded-data
14464@opindex membedded-data
14465@opindex mno-embedded-data
14466Allocate variables to the read-only data section first if possible, then
14467next in the small data section if possible, otherwise in data. This gives
14468slightly slower code than the default, but reduces the amount of RAM required
14469when executing, and thus may be preferred for some embedded systems.
58605ba0 14470
39bc1876
NS
14471@item -muninit-const-in-rodata
14472@itemx -mno-uninit-const-in-rodata
14473@opindex muninit-const-in-rodata
14474@opindex mno-uninit-const-in-rodata
14475Put uninitialized @code{const} variables in the read-only data section.
14476This option is only meaningful in conjunction with @option{-membedded-data}.
4f69985c 14477
c93c5160
RS
14478@item -mcode-readable=@var{setting}
14479@opindex mcode-readable
14480Specify whether GCC may generate code that reads from executable sections.
14481There are three possible settings:
14482
14483@table @gcctabopt
14484@item -mcode-readable=yes
14485Instructions may freely access executable sections. This is the
14486default setting.
14487
14488@item -mcode-readable=pcrel
14489MIPS16 PC-relative load instructions can access executable sections,
14490but other instructions must not do so. This option is useful on 4KSc
14491and 4KSd processors when the code TLBs have the Read Inhibit bit set.
14492It is also useful on processors that can be configured to have a dual
14493instruction/data SRAM interface and that, like the M4K, automatically
14494redirect PC-relative loads to the instruction RAM.
14495
14496@item -mcode-readable=no
14497Instructions must not access executable sections. This option can be
14498useful on targets that are configured to have a dual instruction/data
14499SRAM interface but that (unlike the M4K) do not automatically redirect
14500PC-relative loads to the instruction RAM.
14501@end table
14502
39bc1876
NS
14503@item -msplit-addresses
14504@itemx -mno-split-addresses
14505@opindex msplit-addresses
14506@opindex mno-split-addresses
14507Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
38b974a6 14508relocation operators. This option has been superseded by
39bc1876 14509@option{-mexplicit-relocs} but is retained for backwards compatibility.
58605ba0 14510
39bc1876
NS
14511@item -mexplicit-relocs
14512@itemx -mno-explicit-relocs
14513@opindex mexplicit-relocs
14514@opindex mno-explicit-relocs
14515Use (do not use) assembler relocation operators when dealing with symbolic
14516addresses. The alternative, selected by @option{-mno-explicit-relocs},
14517is to use assembler macros instead.
4f69985c 14518
12e4afe4
RS
14519@option{-mexplicit-relocs} is the default if GCC was configured
14520to use an assembler that supports relocation operators.
4f69985c 14521
39bc1876
NS
14522@item -mcheck-zero-division
14523@itemx -mno-check-zero-division
14524@opindex mcheck-zero-division
14525@opindex mno-check-zero-division
78681dbd
RS
14526Trap (do not trap) on integer division by zero.
14527
14528The default is @option{-mcheck-zero-division}.
4f69985c 14529
9f0df97a
DD
14530@item -mdivide-traps
14531@itemx -mdivide-breaks
14532@opindex mdivide-traps
14533@opindex mdivide-breaks
14534MIPS systems check for division by zero by generating either a
14535conditional trap or a break instruction. Using traps results in
14536smaller code, but is only supported on MIPS II and later. Also, some
14537versions of the Linux kernel have a bug that prevents trap from
8a36672b 14538generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
9f0df97a
DD
14539allow conditional traps on architectures that support them and
14540@option{-mdivide-breaks} to force the use of breaks.
14541
14542The default is usually @option{-mdivide-traps}, but this can be
14543overridden at configure time using @option{--with-divide=breaks}.
14544Divide-by-zero checks can be completely disabled using
14545@option{-mno-check-zero-division}.
14546
39bc1876
NS
14547@item -mmemcpy
14548@itemx -mno-memcpy
14549@opindex mmemcpy
14550@opindex mno-memcpy
14551Force (do not force) the use of @code{memcpy()} for non-trivial block
14552moves. The default is @option{-mno-memcpy}, which allows GCC to inline
14553most constant-sized copies.
74291a4b 14554
39bc1876
NS
14555@item -mlong-calls
14556@itemx -mno-long-calls
14557@opindex mlong-calls
14558@opindex mno-long-calls
14559Disable (do not disable) use of the @code{jal} instruction. Calling
14560functions using @code{jal} is more efficient but requires the caller
14561and callee to be in the same 256 megabyte segment.
d7c23cdc 14562
39bc1876
NS
14563This option has no effect on abicalls code. The default is
14564@option{-mno-long-calls}.
d7c23cdc 14565
39bc1876
NS
14566@item -mmad
14567@itemx -mno-mad
14568@opindex mmad
14569@opindex mno-mad
14570Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
8a36672b 14571instructions, as provided by the R4650 ISA@.
d7c23cdc 14572
39bc1876
NS
14573@item -mfused-madd
14574@itemx -mno-fused-madd
14575@opindex mfused-madd
14576@opindex mno-fused-madd
14577Enable (disable) use of the floating point multiply-accumulate
14578instructions, when they are available. The default is
14579@option{-mfused-madd}.
74291a4b 14580
39bc1876
NS
14581When multiply-accumulate instructions are used, the intermediate
14582product is calculated to infinite precision and is not subject to
14583the FCSR Flush to Zero bit. This may be undesirable in some
14584circumstances.
74291a4b 14585
39bc1876
NS
14586@item -nocpp
14587@opindex nocpp
14588Tell the MIPS assembler to not run its preprocessor over user
14589assembler files (with a @samp{.s} suffix) when assembling them.
74291a4b 14590
39bc1876
NS
14591@item -mfix-r4000
14592@itemx -mno-fix-r4000
14593@opindex mfix-r4000
14594@opindex mno-fix-r4000
14595Work around certain R4000 CPU errata:
14596@itemize @minus
14597@item
14598A double-word or a variable shift may give an incorrect result if executed
14599immediately after starting an integer division.
14600@item
14601A double-word or a variable shift may give an incorrect result if executed
14602while an integer multiplication is in progress.
14603@item
14604An integer division may give an incorrect result if started in a delay slot
14605of a taken branch or a jump.
14606@end itemize
74291a4b 14607
39bc1876
NS
14608@item -mfix-r4400
14609@itemx -mno-fix-r4400
14610@opindex mfix-r4400
14611@opindex mno-fix-r4400
14612Work around certain R4400 CPU errata:
14613@itemize @minus
14614@item
14615A double-word or a variable shift may give an incorrect result if executed
14616immediately after starting an integer division.
14617@end itemize
dcb9d1f0 14618
ee9a72e5
JK
14619@item -mfix-r10000
14620@itemx -mno-fix-r10000
14621@opindex mfix-r10000
14622@opindex mno-fix-r10000
14623Work around certain R10000 errata:
14624@itemize @minus
14625@item
14626@code{ll}/@code{sc} sequences may not behave atomically on revisions
14627prior to 3.0. They may deadlock on revisions 2.6 and earlier.
14628@end itemize
14629
14630This option can only be used if the target architecture supports
14631branch-likely instructions. @option{-mfix-r10000} is the default when
14632@option{-march=r10000} is used; @option{-mno-fix-r10000} is the default
14633otherwise.
14634
39bc1876
NS
14635@item -mfix-vr4120
14636@itemx -mno-fix-vr4120
14637@opindex mfix-vr4120
14638Work around certain VR4120 errata:
14639@itemize @minus
14640@item
14641@code{dmultu} does not always produce the correct result.
14642@item
14643@code{div} and @code{ddiv} do not always produce the correct result if one
14644of the operands is negative.
14645@end itemize
14646The workarounds for the division errata rely on special functions in
14647@file{libgcc.a}. At present, these functions are only provided by
14648the @code{mips64vr*-elf} configurations.
39ba95b5 14649
39bc1876
NS
14650Other VR4120 errata require a nop to be inserted between certain pairs of
14651instructions. These errata are handled by the assembler, not by GCC itself.
17f0f8fa 14652
0ac40e7a
RS
14653@item -mfix-vr4130
14654@opindex mfix-vr4130
14655Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
14656workarounds are implemented by the assembler rather than by GCC,
14657although GCC will avoid using @code{mflo} and @code{mfhi} if the
14658VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
14659instructions are available instead.
14660
39bc1876
NS
14661@item -mfix-sb1
14662@itemx -mno-fix-sb1
14663@opindex mfix-sb1
14664Work around certain SB-1 CPU core errata.
14665(This flag currently works around the SB-1 revision 2
14666``F1'' and ``F2'' floating point errata.)
74291a4b 14667
4d210b07
RS
14668@item -mr10k-cache-barrier=@var{setting}
14669@opindex mr10k-cache-barrier
14670Specify whether GCC should insert cache barriers to avoid the
14671side-effects of speculation on R10K processors.
14672
14673In common with many processors, the R10K tries to predict the outcome
14674of a conditional branch and speculatively executes instructions from
14675the ``taken'' branch. It later aborts these instructions if the
14676predicted outcome was wrong. However, on the R10K, even aborted
14677instructions can have side effects.
14678
14679This problem only affects kernel stores and, depending on the system,
14680kernel loads. As an example, a speculatively-executed store may load
14681the target memory into cache and mark the cache line as dirty, even if
14682the store itself is later aborted. If a DMA operation writes to the
14683same area of memory before the ``dirty'' line is flushed, the cached
14684data will overwrite the DMA-ed data. See the R10K processor manual
14685for a full description, including other potential problems.
14686
14687One workaround is to insert cache barrier instructions before every memory
14688access that might be speculatively executed and that might have side
14689effects even if aborted. @option{-mr10k-cache-barrier=@var{setting}}
14690controls GCC's implementation of this workaround. It assumes that
14691aborted accesses to any byte in the following regions will not have
14692side effects:
14693
14694@enumerate
14695@item
14696the memory occupied by the current function's stack frame;
14697
14698@item
14699the memory occupied by an incoming stack argument;
14700
14701@item
14702the memory occupied by an object with a link-time-constant address.
14703@end enumerate
14704
14705It is the kernel's responsibility to ensure that speculative
14706accesses to these regions are indeed safe.
14707
14708If the input program contains a function declaration such as:
14709
14710@smallexample
14711void foo (void);
14712@end smallexample
14713
14714then the implementation of @code{foo} must allow @code{j foo} and
14715@code{jal foo} to be executed speculatively. GCC honors this
14716restriction for functions it compiles itself. It expects non-GCC
14717functions (such as hand-written assembly code) to do the same.
14718
14719The option has three forms:
14720
14721@table @gcctabopt
14722@item -mr10k-cache-barrier=load-store
14723Insert a cache barrier before a load or store that might be
14724speculatively executed and that might have side effects even
14725if aborted.
14726
14727@item -mr10k-cache-barrier=store
14728Insert a cache barrier before a store that might be speculatively
14729executed and that might have side effects even if aborted.
14730
14731@item -mr10k-cache-barrier=none
14732Disable the insertion of cache barriers. This is the default setting.
14733@end table
14734
39bc1876
NS
14735@item -mflush-func=@var{func}
14736@itemx -mno-flush-func
14737@opindex mflush-func
14738Specifies the function to call to flush the I and D caches, or to not
14739call any such function. If called, the function must take the same
14740arguments as the common @code{_flush_func()}, that is, the address of the
14741memory range for which the cache is being flushed, the size of the
14742memory range, and the number 3 (to flush both caches). The default
14743depends on the target GCC was configured for, but commonly is either
14744@samp{_flush_func} or @samp{__cpu_flush}.
74291a4b 14745
a05bea76
RS
14746@item mbranch-cost=@var{num}
14747@opindex mbranch-cost
14748Set the cost of branches to roughly @var{num} ``simple'' instructions.
14749This cost is only a heuristic and is not guaranteed to produce
14750consistent results across releases. A zero cost redundantly selects
14751the default, which is based on the @option{-mtune} setting.
14752
39bc1876
NS
14753@item -mbranch-likely
14754@itemx -mno-branch-likely
14755@opindex mbranch-likely
14756@opindex mno-branch-likely
14757Enable or disable use of Branch Likely instructions, regardless of the
14758default for the selected architecture. By default, Branch Likely
14759instructions may be generated if they are supported by the selected
14760architecture. An exception is for the MIPS32 and MIPS64 architectures
14761and processors which implement those architectures; for those, Branch
14762Likely instructions will not be generated by default because the MIPS32
14763and MIPS64 architectures specifically deprecate their use.
74291a4b 14764
39bc1876
NS
14765@item -mfp-exceptions
14766@itemx -mno-fp-exceptions
14767@opindex mfp-exceptions
14768Specifies whether FP exceptions are enabled. This affects how we schedule
14769FP instructions for some processors. The default is that FP exceptions are
14770enabled.
74291a4b 14771
39bc1876
NS
14772For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
1477364-bit code, then we can use both FP pipes. Otherwise, we can only use one
14774FP pipe.
74291a4b 14775
39bc1876
NS
14776@item -mvr4130-align
14777@itemx -mno-vr4130-align
14778@opindex mvr4130-align
14779The VR4130 pipeline is two-way superscalar, but can only issue two
14780instructions together if the first one is 8-byte aligned. When this
14781option is enabled, GCC will align pairs of instructions that it
14782thinks should execute in parallel.
74291a4b 14783
39bc1876
NS
14784This option only has an effect when optimizing for the VR4130.
14785It normally makes code faster, but at the expense of making it bigger.
14786It is enabled by default at optimization level @option{-O3}.
b96c5923
DD
14787
14788@item -msynci
14789@itemx -mno-synci
14790@opindex msynci
14791Enable (disable) generation of @code{synci} instructions on
14792architectures that support it. The @code{synci} instructions (if
14793enabled) will be generated when @code{__builtin___clear_cache()} is
14794compiled.
14795
14796This option defaults to @code{-mno-synci}, but the default can be
14797overridden by configuring with @code{--with-synci}.
14798
14799When compiling code for single processor systems, it is generally safe
14800to use @code{synci}. However, on many multi-core (SMP) systems, it
14801will not invalidate the instruction caches on all cores and may lead
14802to undefined behavior.
b53da244
AN
14803
14804@item -mrelax-pic-calls
14805@itemx -mno-relax-pic-calls
14806@opindex mrelax-pic-calls
14807Try to turn PIC calls that are normally dispatched via register
14808@code{$25} into direct calls. This is only possible if the linker can
14809resolve the destination at link-time and if the destination is within
14810range for a direct call.
14811
14812@option{-mrelax-pic-calls} is the default if GCC was configured to use
14813an assembler and a linker that supports the @code{.reloc} assembly
14814directive and @code{-mexplicit-relocs} is in effect. With
14815@code{-mno-explicit-relocs}, this optimization can be performed by the
14816assembler and the linker alone without help from the compiler.
c376dbfb
DD
14817
14818@item -mmcount-ra-address
14819@itemx -mno-mcount-ra-address
14820@opindex mmcount-ra-address
14821@opindex mno-mcount-ra-address
14822Emit (do not emit) code that allows @code{_mcount} to modify the
8d023933 14823calling function's return address. When enabled, this option extends
c376dbfb
DD
14824the usual @code{_mcount} interface with a new @var{ra-address}
14825parameter, which has type @code{intptr_t *} and is passed in register
14826@code{$12}. @code{_mcount} can then modify the return address by
14827doing both of the following:
14828@itemize
14829@item
14830Returning the new address in register @code{$31}.
14831@item
14832Storing the new address in @code{*@var{ra-address}},
14833if @var{ra-address} is nonnull.
14834@end itemize
14835
14836The default is @option{-mno-mcount-ra-address}.
14837
39bc1876 14838@end table
3a8699c7 14839
39bc1876
NS
14840@node MMIX Options
14841@subsection MMIX Options
14842@cindex MMIX Options
74291a4b 14843
39bc1876 14844These options are defined for the MMIX:
74291a4b 14845
39bc1876
NS
14846@table @gcctabopt
14847@item -mlibfuncs
14848@itemx -mno-libfuncs
14849@opindex mlibfuncs
14850@opindex mno-libfuncs
14851Specify that intrinsic library functions are being compiled, passing all
14852values in registers, no matter the size.
3cadd778 14853
39bc1876
NS
14854@item -mepsilon
14855@itemx -mno-epsilon
14856@opindex mepsilon
14857@opindex mno-epsilon
14858Generate floating-point comparison instructions that compare with respect
14859to the @code{rE} epsilon register.
3cadd778 14860
39bc1876
NS
14861@item -mabi=mmixware
14862@itemx -mabi=gnu
d376d545 14863@opindex mabi=mmixware
39bc1876
NS
14864@opindex mabi=gnu
14865Generate code that passes function parameters and return values that (in
14866the called function) are seen as registers @code{$0} and up, as opposed to
14867the GNU ABI which uses global registers @code{$231} and up.
3cadd778 14868
39bc1876
NS
14869@item -mzero-extend
14870@itemx -mno-zero-extend
14871@opindex mzero-extend
14872@opindex mno-zero-extend
14873When reading data from memory in sizes shorter than 64 bits, use (do not
14874use) zero-extending load instructions by default, rather than
14875sign-extending ones.
3cadd778 14876
39bc1876
NS
14877@item -mknuthdiv
14878@itemx -mno-knuthdiv
14879@opindex mknuthdiv
14880@opindex mno-knuthdiv
14881Make the result of a division yielding a remainder have the same sign as
14882the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
14883remainder follows the sign of the dividend. Both methods are
14884arithmetically valid, the latter being almost exclusively used.
74291a4b 14885
39bc1876
NS
14886@item -mtoplevel-symbols
14887@itemx -mno-toplevel-symbols
14888@opindex mtoplevel-symbols
14889@opindex mno-toplevel-symbols
14890Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
14891code can be used with the @code{PREFIX} assembly directive.
74291a4b 14892
39bc1876
NS
14893@item -melf
14894@opindex melf
14895Generate an executable in the ELF format, rather than the default
14896@samp{mmo} format used by the @command{mmix} simulator.
3d5a0820 14897
39bc1876
NS
14898@item -mbranch-predict
14899@itemx -mno-branch-predict
14900@opindex mbranch-predict
14901@opindex mno-branch-predict
14902Use (do not use) the probable-branch instructions, when static branch
14903prediction indicates a probable branch.
3cadd778 14904
39bc1876
NS
14905@item -mbase-addresses
14906@itemx -mno-base-addresses
14907@opindex mbase-addresses
14908@opindex mno-base-addresses
14909Generate (do not generate) code that uses @emph{base addresses}. Using a
14910base address automatically generates a request (handled by the assembler
14911and the linker) for a constant to be set up in a global register. The
14912register is used for one or more base address requests within the range 0
14913to 255 from the value held in the register. The generally leads to short
14914and fast code, but the number of different data items that can be
14915addressed is limited. This means that a program that uses lots of static
14916data may require @option{-mno-base-addresses}.
3cadd778 14917
39bc1876
NS
14918@item -msingle-exit
14919@itemx -mno-single-exit
14920@opindex msingle-exit
14921@opindex mno-single-exit
14922Force (do not force) generated code to have a single exit point in each
14923function.
14924@end table
3cadd778 14925
39bc1876
NS
14926@node MN10300 Options
14927@subsection MN10300 Options
14928@cindex MN10300 options
3cadd778 14929
39bc1876 14930These @option{-m} options are defined for Matsushita MN10300 architectures:
3cadd778 14931
39bc1876
NS
14932@table @gcctabopt
14933@item -mmult-bug
14934@opindex mmult-bug
14935Generate code to avoid bugs in the multiply instructions for the MN10300
14936processors. This is the default.
c474f76b 14937
39bc1876
NS
14938@item -mno-mult-bug
14939@opindex mno-mult-bug
14940Do not generate code to avoid bugs in the multiply instructions for the
14941MN10300 processors.
3cadd778 14942
39bc1876
NS
14943@item -mam33
14944@opindex mam33
14945Generate code which uses features specific to the AM33 processor.
3cadd778 14946
39bc1876
NS
14947@item -mno-am33
14948@opindex mno-am33
14949Do not generate code which uses features specific to the AM33 processor. This
14950is the default.
1a66cd67 14951
f3f63737
NC
14952@item -mam33-2
14953@opindex mam33-2
14954Generate code which uses features specific to the AM33/2.0 processor.
14955
14956@item -mam34
14957@opindex mam34
14958Generate code which uses features specific to the AM34 processor.
14959
14960@item -mtune=@var{cpu-type}
14961@opindex mtune
14962Use the timing characteristics of the indicated CPU type when
14963scheduling instructions. This does not change the targeted processor
14964type. The CPU type must be one of @samp{mn10300}, @samp{am33},
14965@samp{am33-2} or @samp{am34}.
14966
b1eb8119
DD
14967@item -mreturn-pointer-on-d0
14968@opindex mreturn-pointer-on-d0
14969When generating a function which returns a pointer, return the pointer
14970in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
14971only in a0, and attempts to call such functions without a prototype
14972would result in errors. Note that this option is on by default; use
14973@option{-mno-return-pointer-on-d0} to disable it.
14974
39bc1876
NS
14975@item -mno-crt0
14976@opindex mno-crt0
14977Do not link in the C run-time initialization object file.
93ca1662 14978
39bc1876
NS
14979@item -mrelax
14980@opindex mrelax
14981Indicate to the linker that it should perform a relaxation optimization pass
14982to shorten branches, calls and absolute memory addresses. This option only
14983has an effect when used on the command line for the final link step.
14984
14985This option makes symbolic debugging impossible.
74291a4b
MM
14986@end table
14987
39bc1876
NS
14988@node PDP-11 Options
14989@subsection PDP-11 Options
14990@cindex PDP-11 Options
f84271d9 14991
39bc1876 14992These options are defined for the PDP-11:
f84271d9 14993
2642624b 14994@table @gcctabopt
39bc1876
NS
14995@item -mfpu
14996@opindex mfpu
14997Use hardware FPP floating point. This is the default. (FIS floating
14998point on the PDP-11/40 is not supported.)
f84271d9 14999
39bc1876
NS
15000@item -msoft-float
15001@opindex msoft-float
15002Do not use hardware floating point.
f84271d9 15003
39bc1876
NS
15004@item -mac0
15005@opindex mac0
15006Return floating-point results in ac0 (fr0 in Unix assembler syntax).
f84271d9 15007
39bc1876
NS
15008@item -mno-ac0
15009@opindex mno-ac0
15010Return floating-point results in memory. This is the default.
15011
15012@item -m40
15013@opindex m40
15014Generate code for a PDP-11/40.
15015
15016@item -m45
15017@opindex m45
15018Generate code for a PDP-11/45. This is the default.
f84271d9 15019
39bc1876
NS
15020@item -m10
15021@opindex m10
15022Generate code for a PDP-11/10.
f84271d9 15023
39bc1876 15024@item -mbcopy-builtin
d376d545 15025@opindex mbcopy-builtin
70128ad9 15026Use inline @code{movmemhi} patterns for copying memory. This is the
39bc1876 15027default.
f84271d9 15028
39bc1876
NS
15029@item -mbcopy
15030@opindex mbcopy
70128ad9 15031Do not use inline @code{movmemhi} patterns for copying memory.
02f52e19 15032
39bc1876
NS
15033@item -mint16
15034@itemx -mno-int32
15035@opindex mint16
15036@opindex mno-int32
15037Use 16-bit @code{int}. This is the default.
48f0be1b 15038
39bc1876
NS
15039@item -mint32
15040@itemx -mno-int16
15041@opindex mint32
15042@opindex mno-int16
15043Use 32-bit @code{int}.
b4378319 15044
39bc1876
NS
15045@item -mfloat64
15046@itemx -mno-float32
15047@opindex mfloat64
15048@opindex mno-float32
15049Use 64-bit @code{float}. This is the default.
b4378319 15050
39bc1876
NS
15051@item -mfloat32
15052@itemx -mno-float64
15053@opindex mfloat32
15054@opindex mno-float64
15055Use 32-bit @code{float}.
daf2f129 15056
39bc1876
NS
15057@item -mabshi
15058@opindex mabshi
15059Use @code{abshi2} pattern. This is the default.
232830b7 15060
39bc1876
NS
15061@item -mno-abshi
15062@opindex mno-abshi
15063Do not use @code{abshi2} pattern.
b4378319 15064
39bc1876
NS
15065@item -mbranch-expensive
15066@opindex mbranch-expensive
15067Pretend that branches are expensive. This is for experimenting with
15068code generation only.
b4378319 15069
39bc1876
NS
15070@item -mbranch-cheap
15071@opindex mbranch-cheap
15072Do not pretend that branches are expensive. This is the default.
b4378319 15073
39bc1876
NS
15074@item -munix-asm
15075@opindex munix-asm
15076Use Unix assembler syntax. This is the default when configured for
15077@samp{pdp11-*-bsd}.
56b2d7a7 15078
39bc1876
NS
15079@item -mdec-asm
15080@opindex mdec-asm
15081Use DEC assembler syntax. This is the default when configured for any
15082PDP-11 target other than @samp{pdp11-*-bsd}.
15083@end table
56b2d7a7 15084
358da97e
HS
15085@node picoChip Options
15086@subsection picoChip Options
15087@cindex picoChip options
15088
15089These @samp{-m} options are defined for picoChip implementations:
15090
15091@table @gcctabopt
15092
15093@item -mae=@var{ae_type}
15094@opindex mcpu
15095Set the instruction set, register set, and instruction scheduling
15096parameters for array element type @var{ae_type}. Supported values
15097for @var{ae_type} are @samp{ANY}, @samp{MUL}, and @samp{MAC}.
15098
15099@option{-mae=ANY} selects a completely generic AE type. Code
15100generated with this option will run on any of the other AE types. The
15101code will not be as efficient as it would be if compiled for a specific
15102AE type, and some types of operation (e.g., multiplication) will not
15103work properly on all types of AE.
15104
15105@option{-mae=MUL} selects a MUL AE type. This is the most useful AE type
15106for compiled code, and is the default.
15107
15108@option{-mae=MAC} selects a DSP-style MAC AE. Code compiled with this
15109option may suffer from poor performance of byte (char) manipulation,
15110since the DSP AE does not provide hardware support for byte load/stores.
15111
15112@item -msymbol-as-address
15113Enable the compiler to directly use a symbol name as an address in a
15114load/store instruction, without first loading it into a
15115register. Typically, the use of this option will generate larger
15116programs, which run faster than when the option isn't used. However, the
15117results vary from program to program, so it is left as a user option,
15118rather than being permanently enabled.
15119
15120@item -mno-inefficient-warnings
15121Disables warnings about the generation of inefficient code. These
15122warnings can be generated, for example, when compiling code which
15123performs byte-level memory operations on the MAC AE type. The MAC AE has
15124no hardware support for byte-level memory operations, so all byte
a640c13b 15125load/stores must be synthesized from word load/store operations. This is
358da97e
HS
15126inefficient and a warning will be generated indicating to the programmer
15127that they should rewrite the code to avoid byte operations, or to target
15128an AE type which has the necessary hardware support. This option enables
15129the warning to be turned off.
15130
15131@end table
15132
39bc1876
NS
15133@node PowerPC Options
15134@subsection PowerPC Options
15135@cindex PowerPC options
56b2d7a7 15136
39bc1876 15137These are listed under @xref{RS/6000 and PowerPC Options}.
56b2d7a7 15138
39bc1876
NS
15139@node RS/6000 and PowerPC Options
15140@subsection IBM RS/6000 and PowerPC Options
15141@cindex RS/6000 and PowerPC Options
15142@cindex IBM RS/6000 and PowerPC Options
56b2d7a7 15143
39bc1876
NS
15144These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
15145@table @gcctabopt
15146@item -mpower
15147@itemx -mno-power
15148@itemx -mpower2
15149@itemx -mno-power2
15150@itemx -mpowerpc
15151@itemx -mno-powerpc
15152@itemx -mpowerpc-gpopt
15153@itemx -mno-powerpc-gpopt
15154@itemx -mpowerpc-gfxopt
15155@itemx -mno-powerpc-gfxopt
ab940b73 15156@need 800
39bc1876
NS
15157@itemx -mpowerpc64
15158@itemx -mno-powerpc64
9719f3b7
DE
15159@itemx -mmfcrf
15160@itemx -mno-mfcrf
15161@itemx -mpopcntb
15162@itemx -mno-popcntb
29e6733c
MM
15163@itemx -mpopcntd
15164@itemx -mno-popcntd
9719f3b7
DE
15165@itemx -mfprnd
15166@itemx -mno-fprnd
ab940b73 15167@need 800
b639c3c2
JJ
15168@itemx -mcmpb
15169@itemx -mno-cmpb
44cd321e
PS
15170@itemx -mmfpgpr
15171@itemx -mno-mfpgpr
4daf6471
AK
15172@itemx -mhard-dfp
15173@itemx -mno-hard-dfp
39bc1876
NS
15174@opindex mpower
15175@opindex mno-power
15176@opindex mpower2
15177@opindex mno-power2
15178@opindex mpowerpc
15179@opindex mno-powerpc
15180@opindex mpowerpc-gpopt
15181@opindex mno-powerpc-gpopt
15182@opindex mpowerpc-gfxopt
15183@opindex mno-powerpc-gfxopt
15184@opindex mpowerpc64
15185@opindex mno-powerpc64
9719f3b7
DE
15186@opindex mmfcrf
15187@opindex mno-mfcrf
15188@opindex mpopcntb
15189@opindex mno-popcntb
29e6733c
MM
15190@opindex mpopcntd
15191@opindex mno-popcntd
9719f3b7
DE
15192@opindex mfprnd
15193@opindex mno-fprnd
b639c3c2
JJ
15194@opindex mcmpb
15195@opindex mno-cmpb
44cd321e
PS
15196@opindex mmfpgpr
15197@opindex mno-mfpgpr
4daf6471
AK
15198@opindex mhard-dfp
15199@opindex mno-hard-dfp
39bc1876
NS
15200GCC supports two related instruction set architectures for the
15201RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
15202instructions supported by the @samp{rios} chip set used in the original
15203RS/6000 systems and the @dfn{PowerPC} instruction set is the
9719f3b7
DE
15204architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
15205the IBM 4xx, 6xx, and follow-on microprocessors.
56b2d7a7 15206
39bc1876
NS
15207Neither architecture is a subset of the other. However there is a
15208large common subset of instructions supported by both. An MQ
15209register is included in processors supporting the POWER architecture.
56b2d7a7 15210
39bc1876
NS
15211You use these options to specify which instructions are available on the
15212processor you are using. The default value of these options is
15213determined when configuring GCC@. Specifying the
15214@option{-mcpu=@var{cpu_type}} overrides the specification of these
15215options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
15216rather than the options listed above.
56b2d7a7 15217
39bc1876
NS
15218The @option{-mpower} option allows GCC to generate instructions that
15219are found only in the POWER architecture and to use the MQ register.
15220Specifying @option{-mpower2} implies @option{-power} and also allows GCC
15221to generate instructions that are present in the POWER2 architecture but
15222not the original POWER architecture.
83575957 15223
39bc1876
NS
15224The @option{-mpowerpc} option allows GCC to generate instructions that
15225are found only in the 32-bit subset of the PowerPC architecture.
15226Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
15227GCC to use the optional PowerPC architecture instructions in the
15228General Purpose group, including floating-point square root. Specifying
15229@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
15230use the optional PowerPC architecture instructions in the Graphics
15231group, including floating-point select.
83575957 15232
9719f3b7
DE
15233The @option{-mmfcrf} option allows GCC to generate the move from
15234condition register field instruction implemented on the POWER4
15235processor and other processors that support the PowerPC V2.01
15236architecture.
15237The @option{-mpopcntb} option allows GCC to generate the popcount and
15238double precision FP reciprocal estimate instruction implemented on the
15239POWER5 processor and other processors that support the PowerPC V2.02
15240architecture.
29e6733c
MM
15241The @option{-mpopcntd} option allows GCC to generate the popcount
15242instruction implemented on the POWER7 processor and other processors
15243that support the PowerPC V2.06 architecture.
9719f3b7
DE
15244The @option{-mfprnd} option allows GCC to generate the FP round to
15245integer instructions implemented on the POWER5+ processor and other
15246processors that support the PowerPC V2.03 architecture.
b639c3c2
JJ
15247The @option{-mcmpb} option allows GCC to generate the compare bytes
15248instruction implemented on the POWER6 processor and other processors
15249that support the PowerPC V2.05 architecture.
44cd321e
PS
15250The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
15251general purpose register instructions implemented on the POWER6X
15252processor and other processors that support the extended PowerPC V2.05
15253architecture.
4daf6471 15254The @option{-mhard-dfp} option allows GCC to generate the decimal floating
b639c3c2 15255point instructions implemented on some POWER processors.
9719f3b7 15256
39bc1876
NS
15257The @option{-mpowerpc64} option allows GCC to generate the additional
1525864-bit instructions that are found in the full PowerPC64 architecture
15259and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
15260@option{-mno-powerpc64}.
83575957 15261
39bc1876
NS
15262If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
15263will use only the instructions in the common subset of both
15264architectures plus some special AIX common-mode calls, and will not use
15265the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
15266permits GCC to use any instruction from either architecture and to
15267allow use of the MQ register; specify this for the Motorola MPC601.
83575957 15268
39bc1876
NS
15269@item -mnew-mnemonics
15270@itemx -mold-mnemonics
15271@opindex mnew-mnemonics
15272@opindex mold-mnemonics
15273Select which mnemonics to use in the generated assembler code. With
15274@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
15275the PowerPC architecture. With @option{-mold-mnemonics} it uses the
15276assembler mnemonics defined for the POWER architecture. Instructions
15277defined in only one architecture have only one mnemonic; GCC uses that
15278mnemonic irrespective of which of these options is specified.
83575957 15279
39bc1876
NS
15280GCC defaults to the mnemonics appropriate for the architecture in
15281use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
15282value of these option. Unless you are building a cross-compiler, you
15283should normally not specify either @option{-mnew-mnemonics} or
15284@option{-mold-mnemonics}, but should instead accept the default.
83575957 15285
39bc1876
NS
15286@item -mcpu=@var{cpu_type}
15287@opindex mcpu
15288Set architecture type, register usage, choice of mnemonics, and
15289instruction scheduling parameters for machine type @var{cpu_type}.
15290Supported values for @var{cpu_type} are @samp{401}, @samp{403},
4adf8008 15291@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{464}, @samp{464fp},
47f67e51
PB
15292@samp{476}, @samp{476fp}, @samp{505}, @samp{601}, @samp{602}, @samp{603},
15293@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{630}, @samp{740},
15294@samp{7400}, @samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
ebde32fd 15295@samp{860}, @samp{970}, @samp{8540}, @samp{a2}, @samp{e300c2},
b17f98b1 15296@samp{e300c3}, @samp{e500mc}, @samp{e500mc64}, @samp{ec603e}, @samp{G3},
3c005e6c 15297@samp{G4}, @samp{G5}, @samp{titan}, @samp{power}, @samp{power2}, @samp{power3},
b17f98b1
EW
15298@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6}, @samp{power6x},
15299@samp{power7}, @samp{common}, @samp{powerpc}, @samp{powerpc64}, @samp{rios},
edae5fe3 15300@samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
83575957 15301
39bc1876
NS
15302@option{-mcpu=common} selects a completely generic processor. Code
15303generated under this option will run on any POWER or PowerPC processor.
15304GCC will use only the instructions in the common subset of both
15305architectures, and will not use the MQ register. GCC assumes a generic
15306processor model for scheduling purposes.
83575957 15307
39bc1876
NS
15308@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
15309@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
15310PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
15311types, with an appropriate, generic processor model assumed for
15312scheduling purposes.
83575957 15313
39bc1876
NS
15314The other options specify a specific processor. Code generated under
15315those options will run best on that processor, and may not run at all on
15316others.
83575957 15317
39bc1876 15318The @option{-mcpu} options automatically enable or disable the
78681dbd
RS
15319following options:
15320
15321@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
29e6733c 15322-mnew-mnemonics -mpopcntb -mpopcntd -mpower -mpower2 -mpowerpc64 @gol
696e45ba 15323-mpowerpc-gpopt -mpowerpc-gfxopt -msingle-float -mdouble-float @gol
29e6733c 15324-msimple-fpu -mstring -mmulhw -mdlmzb -mmfpgpr -mvsx}
78681dbd 15325
44cd321e
PS
15326The particular options set for any particular CPU will vary between
15327compiler versions, depending on what setting seems to produce optimal
15328code for that CPU; it doesn't necessarily reflect the actual hardware's
15329capabilities. If you wish to set an individual option to a particular
15330value, you may specify it after the @option{-mcpu} option, like
15331@samp{-mcpu=970 -mno-altivec}.
5d7c2819 15332
39bc1876 15333On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
9719f3b7 15334not enabled or disabled by the @option{-mcpu} option at present because
39bc1876
NS
15335AIX does not have full support for these options. You may still
15336enable or disable them individually if you're sure it'll work in your
15337environment.
83575957 15338
39bc1876
NS
15339@item -mtune=@var{cpu_type}
15340@opindex mtune
15341Set the instruction scheduling parameters for machine type
15342@var{cpu_type}, but do not set the architecture type, register usage, or
15343choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
15344values for @var{cpu_type} are used for @option{-mtune} as for
15345@option{-mcpu}. If both are specified, the code generated will use the
15346architecture, registers, and mnemonics set by @option{-mcpu}, but the
15347scheduling parameters set by @option{-mtune}.
83575957 15348
070b27da
AM
15349@item -mcmodel=small
15350@opindex mcmodel=small
15351Generate PowerPC64 code for the small model: The TOC is limited to
1535264k.
15353
5a79bcc4
AM
15354@item -mcmodel=medium
15355@opindex mcmodel=medium
15356Generate PowerPC64 code for the medium model: The TOC and other static
15357data may be up to a total of 4G in size.
15358
070b27da
AM
15359@item -mcmodel=large
15360@opindex mcmodel=large
15361Generate PowerPC64 code for the large model: The TOC may be up to 4G
15362in size. Other data and code is only limited by the 64-bit address
15363space.
15364
39bc1876
NS
15365@item -maltivec
15366@itemx -mno-altivec
15367@opindex maltivec
15368@opindex mno-altivec
7088c6e4
GK
15369Generate code that uses (does not use) AltiVec instructions, and also
15370enable the use of built-in functions that allow more direct access to
15371the AltiVec instruction set. You may also need to set
39bc1876
NS
15372@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
15373enhancements.
83575957 15374
78f5898b 15375@item -mvrsave
33558d94 15376@itemx -mno-vrsave
78f5898b
AH
15377@opindex mvrsave
15378@opindex mno-vrsave
15379Generate VRSAVE instructions when generating AltiVec code.
15380
c921bad8
AP
15381@item -mgen-cell-microcode
15382@opindex mgen-cell-microcode
15383Generate Cell microcode instructions
15384
15385@item -mwarn-cell-microcode
15386@opindex mwarn-cell-microcode
15387Warning when a Cell microcode instruction is going to emitted. An example
15388of a Cell microcode instruction is a variable shift.
15389
7f970b70
AM
15390@item -msecure-plt
15391@opindex msecure-plt
15392Generate code that allows ld and ld.so to build executables and shared
15393libraries with non-exec .plt and .got sections. This is a PowerPC
1539432-bit SYSV ABI option.
15395
15396@item -mbss-plt
15397@opindex mbss-plt
15398Generate code that uses a BSS .plt section that ld.so fills in, and
15399requires .plt and .got sections that are both writable and executable.
15400This is a PowerPC 32-bit SYSV ABI option.
15401
78f5898b
AH
15402@item -misel
15403@itemx -mno-isel
39bc1876 15404@opindex misel
78f5898b 15405@opindex mno-isel
39bc1876 15406This switch enables or disables the generation of ISEL instructions.
83575957 15407
78f5898b
AH
15408@item -misel=@var{yes/no}
15409This switch has been deprecated. Use @option{-misel} and
15410@option{-mno-isel} instead.
15411
15412@item -mspe
ea574900 15413@itemx -mno-spe
39bc1876 15414@opindex mspe
78f5898b 15415@opindex mno-spe
39bc1876
NS
15416This switch enables or disables the generation of SPE simd
15417instructions.
83575957 15418
96038623
DE
15419@item -mpaired
15420@itemx -mno-paired
15421@opindex mpaired
15422@opindex mno-paired
15423This switch enables or disables the generation of PAIRED simd
15424instructions.
15425
78f5898b
AH
15426@item -mspe=@var{yes/no}
15427This option has been deprecated. Use @option{-mspe} and
15428@option{-mno-spe} instead.
15429
29e6733c
MM
15430@item -mvsx
15431@itemx -mno-vsx
15432@opindex mvsx
15433@opindex mno-vsx
15434Generate code that uses (does not use) vector/scalar (VSX)
15435instructions, and also enable the use of built-in functions that allow
15436more direct access to the VSX instruction set.
15437
4d4cbc0e 15438@item -mfloat-gprs=@var{yes/single/double/no}
39bc1876
NS
15439@itemx -mfloat-gprs
15440@opindex mfloat-gprs
15441This switch enables or disables the generation of floating point
15442operations on the general purpose registers for architectures that
4d4cbc0e
AH
15443support it.
15444
15445The argument @var{yes} or @var{single} enables the use of
15446single-precision floating point operations.
15447
15448The argument @var{double} enables the use of single and
15449double-precision floating point operations.
15450
15451The argument @var{no} disables floating point operations on the
15452general purpose registers.
15453
15454This option is currently only available on the MPC854x.
83575957 15455
49bd1d27
SS
15456@item -m32
15457@itemx -m64
15458@opindex m32
15459@opindex m64
15460Generate code for 32-bit or 64-bit environments of Darwin and SVR4
15461targets (including GNU/Linux). The 32-bit environment sets int, long
15462and pointer to 32 bits and generates code that runs on any PowerPC
15463variant. The 64-bit environment sets int to 32 bits and long and
15464pointer to 64 bits, and generates code for PowerPC64, as for
15465@option{-mpowerpc64}.
15466
39bc1876
NS
15467@item -mfull-toc
15468@itemx -mno-fp-in-toc
15469@itemx -mno-sum-in-toc
15470@itemx -mminimal-toc
15471@opindex mfull-toc
15472@opindex mno-fp-in-toc
15473@opindex mno-sum-in-toc
15474@opindex mminimal-toc
15475Modify generation of the TOC (Table Of Contents), which is created for
15476every executable file. The @option{-mfull-toc} option is selected by
15477default. In that case, GCC will allocate at least one TOC entry for
15478each unique non-automatic variable reference in your program. GCC
15479will also place floating-point constants in the TOC@. However, only
1548016,384 entries are available in the TOC@.
83575957 15481
39bc1876
NS
15482If you receive a linker error message that saying you have overflowed
15483the available TOC space, you can reduce the amount of TOC space used
15484with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
15485@option{-mno-fp-in-toc} prevents GCC from putting floating-point
15486constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
15487generate code to calculate the sum of an address and a constant at
15488run-time instead of putting that sum into the TOC@. You may specify one
15489or both of these options. Each causes GCC to produce very slightly
15490slower and larger code at the expense of conserving TOC space.
83575957 15491
39bc1876
NS
15492If you still run out of space in the TOC even when you specify both of
15493these options, specify @option{-mminimal-toc} instead. This option causes
15494GCC to make only one TOC entry for every file. When you specify this
15495option, GCC will produce code that is slower and larger but which
15496uses extremely little TOC space. You may wish to use this option
15497only on files that contain less frequently executed code.
83575957 15498
39bc1876
NS
15499@item -maix64
15500@itemx -maix32
15501@opindex maix64
15502@opindex maix32
15503Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
15504@code{long} type, and the infrastructure needed to support them.
15505Specifying @option{-maix64} implies @option{-mpowerpc64} and
15506@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
15507implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
83575957 15508
de17c25f
DE
15509@item -mxl-compat
15510@itemx -mno-xl-compat
15511@opindex mxl-compat
15512@opindex mno-xl-compat
8fbe3bb2 15513Produce code that conforms more closely to IBM XL compiler semantics
0ee2ea09 15514when using AIX-compatible ABI@. Pass floating-point arguments to
8fbe3bb2
DE
15515prototyped functions beyond the register save area (RSA) on the stack
15516in addition to argument FPRs. Do not assume that most significant
15517double in 128-bit long double value is properly rounded when comparing
15518values and converting to double. Use XL symbol names for long double
15519support routines.
de17c25f
DE
15520
15521The AIX calling convention was extended but not initially documented to
39bc1876 15522handle an obscure K&R C case of calling a function that takes the
8fbe3bb2 15523address of its arguments with fewer arguments than declared. IBM XL
39bc1876
NS
15524compilers access floating point arguments which do not fit in the
15525RSA from the stack when a subroutine is compiled without
15526optimization. Because always storing floating-point arguments on the
15527stack is inefficient and rarely needed, this option is not enabled by
8fbe3bb2 15528default and only is necessary when calling subroutines compiled by IBM
39bc1876 15529XL compilers without optimization.
83575957 15530
39bc1876
NS
15531@item -mpe
15532@opindex mpe
15533Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
15534application written to use message passing with special startup code to
15535enable the application to run. The system must have PE installed in the
15536standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
15537must be overridden with the @option{-specs=} option to specify the
15538appropriate directory location. The Parallel Environment does not
15539support threads, so the @option{-mpe} option and the @option{-pthread}
15540option are incompatible.
83575957 15541
39bc1876
NS
15542@item -malign-natural
15543@itemx -malign-power
15544@opindex malign-natural
15545@opindex malign-power
d9168963 15546On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
39bc1876
NS
15547@option{-malign-natural} overrides the ABI-defined alignment of larger
15548types, such as floating-point doubles, on their natural size-based boundary.
15549The option @option{-malign-power} instructs GCC to follow the ABI-specified
8a36672b 15550alignment rules. GCC defaults to the standard alignment defined in the ABI@.
83575957 15551
d9168963
SS
15552On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
15553is not supported.
15554
39bc1876
NS
15555@item -msoft-float
15556@itemx -mhard-float
15557@opindex msoft-float
15558@opindex mhard-float
15559Generate code that does not use (uses) the floating-point register set.
15560Software floating point emulation is provided if you use the
15561@option{-msoft-float} option, and pass the option to GCC when linking.
83575957 15562
696e45ba
ME
15563@item -msingle-float
15564@itemx -mdouble-float
15565@opindex msingle-float
15566@opindex mdouble-float
7a61cf6f
NC
15567Generate code for single or double-precision floating point operations.
15568@option{-mdouble-float} implies @option{-msingle-float}.
696e45ba
ME
15569
15570@item -msimple-fpu
15571@opindex msimple-fpu
15572Do not generate sqrt and div instructions for hardware floating point unit.
15573
0bb7b92e
ME
15574@item -mfpu
15575@opindex mfpu
7a61cf6f 15576Specify type of floating point unit. Valid values are @var{sp_lite}
0bb7b92e
ME
15577(equivalent to -msingle-float -msimple-fpu), @var{dp_lite} (equivalent
15578to -mdouble-float -msimple-fpu), @var{sp_full} (equivalent to -msingle-float),
15579and @var{dp_full} (equivalent to -mdouble-float).
15580
15581@item -mxilinx-fpu
15582@opindex mxilinx-fpu
15583Perform optimizations for floating point unit on Xilinx PPC 405/440.
15584
39bc1876
NS
15585@item -mmultiple
15586@itemx -mno-multiple
15587@opindex mmultiple
15588@opindex mno-multiple
15589Generate code that uses (does not use) the load multiple word
15590instructions and the store multiple word instructions. These
15591instructions are generated by default on POWER systems, and not
15592generated on PowerPC systems. Do not use @option{-mmultiple} on little
15593endian PowerPC systems, since those instructions do not work when the
15594processor is in little endian mode. The exceptions are PPC740 and
15595PPC750 which permit the instructions usage in little endian mode.
83575957 15596
39bc1876
NS
15597@item -mstring
15598@itemx -mno-string
15599@opindex mstring
15600@opindex mno-string
15601Generate code that uses (does not use) the load string instructions
15602and the store string word instructions to save multiple registers and
15603do small block moves. These instructions are generated by default on
15604POWER systems, and not generated on PowerPC systems. Do not use
15605@option{-mstring} on little endian PowerPC systems, since those
15606instructions do not work when the processor is in little endian mode.
15607The exceptions are PPC740 and PPC750 which permit the instructions
15608usage in little endian mode.
052a4b28 15609
39bc1876
NS
15610@item -mupdate
15611@itemx -mno-update
15612@opindex mupdate
15613@opindex mno-update
15614Generate code that uses (does not use) the load or store instructions
15615that update the base register to the address of the calculated memory
15616location. These instructions are generated by default. If you use
15617@option{-mno-update}, there is a small window between the time that the
15618stack pointer is updated and the address of the previous frame is
15619stored, which means code that walks the stack frame across interrupts or
15620signals may get corrupted data.
052a4b28 15621
001b9eb6 15622@item -mavoid-indexed-addresses
1588fb31 15623@itemx -mno-avoid-indexed-addresses
001b9eb6
PH
15624@opindex mavoid-indexed-addresses
15625@opindex mno-avoid-indexed-addresses
15626Generate code that tries to avoid (not avoid) the use of indexed load
15627or store instructions. These instructions can incur a performance
15628penalty on Power6 processors in certain situations, such as when
15629stepping through large arrays that cross a 16M boundary. This option
15630is enabled by default when targetting Power6 and disabled otherwise.
15631
39bc1876
NS
15632@item -mfused-madd
15633@itemx -mno-fused-madd
15634@opindex mfused-madd
15635@opindex mno-fused-madd
15636Generate code that uses (does not use) the floating point multiply and
fd438373
MM
15637accumulate instructions. These instructions are generated by default
15638if hardware floating point is used. The machine dependent
15639@option{-mfused-madd} option is now mapped to the machine independent
15640@option{-ffp-contract=fast} option, and @option{-mno-fused-madd} is
15641mapped to @option{-ffp-contract=off}.
3a69a7d5 15642
131aeb82
JM
15643@item -mmulhw
15644@itemx -mno-mulhw
15645@opindex mmulhw
15646@opindex mno-mulhw
15647Generate code that uses (does not use) the half-word multiply and
47f67e51 15648multiply-accumulate instructions on the IBM 405, 440, 464 and 476 processors.
131aeb82
JM
15649These instructions are generated by default when targetting those
15650processors.
15651
716019c0
JM
15652@item -mdlmzb
15653@itemx -mno-dlmzb
15654@opindex mdlmzb
15655@opindex mno-dlmzb
15656Generate code that uses (does not use) the string-search @samp{dlmzb}
47f67e51 15657instruction on the IBM 405, 440, 464 and 476 processors. This instruction is
716019c0
JM
15658generated by default when targetting those processors.
15659
39bc1876
NS
15660@item -mno-bit-align
15661@itemx -mbit-align
15662@opindex mno-bit-align
15663@opindex mbit-align
15664On System V.4 and embedded PowerPC systems do not (do) force structures
15665and unions that contain bit-fields to be aligned to the base type of the
15666bit-field.
3a69a7d5 15667
39bc1876
NS
15668For example, by default a structure containing nothing but 8
15669@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
15670boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
15671the structure would be aligned to a 1 byte boundary and be one byte in
15672size.
3a69a7d5 15673
39bc1876
NS
15674@item -mno-strict-align
15675@itemx -mstrict-align
15676@opindex mno-strict-align
15677@opindex mstrict-align
15678On System V.4 and embedded PowerPC systems do not (do) assume that
15679unaligned memory references will be handled by the system.
3a69a7d5 15680
39bc1876
NS
15681@item -mrelocatable
15682@itemx -mno-relocatable
15683@opindex mrelocatable
15684@opindex mno-relocatable
4942323e
AM
15685Generate code that allows (does not allow) a static executable to be
15686relocated to a different address at runtime. A simple embedded
15687PowerPC system loader should relocate the entire contents of
15688@code{.got2} and 4-byte locations listed in the @code{.fixup} section,
15689a table of 32-bit addresses generated by this option. For this to
15690work, all objects linked together must be compiled with
15691@option{-mrelocatable} or @option{-mrelocatable-lib}.
15692@option{-mrelocatable} code aligns the stack to an 8 byte boundary.
3a69a7d5 15693
39bc1876
NS
15694@item -mrelocatable-lib
15695@itemx -mno-relocatable-lib
15696@opindex mrelocatable-lib
15697@opindex mno-relocatable-lib
4942323e
AM
15698Like @option{-mrelocatable}, @option{-mrelocatable-lib} generates a
15699@code{.fixup} section to allow static executables to be relocated at
15700runtime, but @option{-mrelocatable-lib} does not use the smaller stack
15701alignment of @option{-mrelocatable}. Objects compiled with
15702@option{-mrelocatable-lib} may be linked with objects compiled with
15703any combination of the @option{-mrelocatable} options.
052a4b28 15704
39bc1876
NS
15705@item -mno-toc
15706@itemx -mtoc
15707@opindex mno-toc
15708@opindex mtoc
15709On System V.4 and embedded PowerPC systems do not (do) assume that
15710register 2 contains a pointer to a global area pointing to the addresses
15711used in the program.
052a4b28 15712
39bc1876
NS
15713@item -mlittle
15714@itemx -mlittle-endian
15715@opindex mlittle
15716@opindex mlittle-endian
15717On System V.4 and embedded PowerPC systems compile code for the
15718processor in little endian mode. The @option{-mlittle-endian} option is
15719the same as @option{-mlittle}.
052a4b28 15720
39bc1876
NS
15721@item -mbig
15722@itemx -mbig-endian
15723@opindex mbig
15724@opindex mbig-endian
15725On System V.4 and embedded PowerPC systems compile code for the
15726processor in big endian mode. The @option{-mbig-endian} option is
15727the same as @option{-mbig}.
052a4b28 15728
39bc1876
NS
15729@item -mdynamic-no-pic
15730@opindex mdynamic-no-pic
15731On Darwin and Mac OS X systems, compile code so that it is not
15732relocatable, but that its external references are relocatable. The
15733resulting code is suitable for applications, but not shared
15734libraries.
3a69a7d5 15735
042abba2
JT
15736@item -msingle-pic-base
15737@opindex msingle-pic-base
15738Treat the register used for PIC addressing as read-only, rather than
15739loading it in the prologue for each function. The run-time system is
15740responsible for initializing this register with an appropriate value
15741before execution begins.
15742
39bc1876
NS
15743@item -mprioritize-restricted-insns=@var{priority}
15744@opindex mprioritize-restricted-insns
15745This option controls the priority that is assigned to
15746dispatch-slot restricted instructions during the second scheduling
15747pass. The argument @var{priority} takes the value @var{0/1/2} to assign
15748@var{no/highest/second-highest} priority to dispatch slot restricted
15749instructions.
3a69a7d5 15750
39bc1876
NS
15751@item -msched-costly-dep=@var{dependence_type}
15752@opindex msched-costly-dep
15753This option controls which dependences are considered costly
15754by the target during instruction scheduling. The argument
15755@var{dependence_type} takes one of the following values:
15756@var{no}: no dependence is costly,
15757@var{all}: all dependences are costly,
15758@var{true_store_to_load}: a true dependence from store to load is costly,
15759@var{store_to_load}: any dependence from store to load is costly,
15760@var{number}: any dependence which latency >= @var{number} is costly.
11338cda 15761
39bc1876
NS
15762@item -minsert-sched-nops=@var{scheme}
15763@opindex minsert-sched-nops
15764This option controls which nop insertion scheme will be used during
8a36672b 15765the second scheduling pass. The argument @var{scheme} takes one of the
39bc1876
NS
15766following values:
15767@var{no}: Don't insert nops.
15768@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
15769according to the scheduler's grouping.
15770@var{regroup_exact}: Insert nops to force costly dependent insns into
15771separate groups. Insert exactly as many nops as needed to force an insn
15772to a new group, according to the estimated processor grouping.
15773@var{number}: Insert nops to force costly dependent insns into
15774separate groups. Insert @var{number} nops to force an insn to a new group.
052a4b28 15775
39bc1876
NS
15776@item -mcall-sysv
15777@opindex mcall-sysv
15778On System V.4 and embedded PowerPC systems compile code using calling
15779conventions that adheres to the March 1995 draft of the System V
15780Application Binary Interface, PowerPC processor supplement. This is the
15781default unless you configured GCC using @samp{powerpc-*-eabiaix}.
789a3090 15782
39bc1876 15783@item -mcall-sysv-eabi
244609a6 15784@itemx -mcall-eabi
39bc1876 15785@opindex mcall-sysv-eabi
244609a6 15786@opindex mcall-eabi
39bc1876 15787Specify both @option{-mcall-sysv} and @option{-meabi} options.
789a3090 15788
39bc1876
NS
15789@item -mcall-sysv-noeabi
15790@opindex mcall-sysv-noeabi
15791Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
789a3090 15792
244609a6
BE
15793@item -mcall-aixdesc
15794@opindex m
15795On System V.4 and embedded PowerPC systems compile code for the AIX
39bc1876 15796operating system.
789a3090 15797
39bc1876
NS
15798@item -mcall-linux
15799@opindex mcall-linux
15800On System V.4 and embedded PowerPC systems compile code for the
15801Linux-based GNU system.
789a3090 15802
39bc1876
NS
15803@item -mcall-gnu
15804@opindex mcall-gnu
15805On System V.4 and embedded PowerPC systems compile code for the
15806Hurd-based GNU system.
789a3090 15807
244609a6
BE
15808@item -mcall-freebsd
15809@opindex mcall-freebsd
15810On System V.4 and embedded PowerPC systems compile code for the
15811FreeBSD operating system.
15812
39bc1876
NS
15813@item -mcall-netbsd
15814@opindex mcall-netbsd
15815On System V.4 and embedded PowerPC systems compile code for the
15816NetBSD operating system.
789a3090 15817
244609a6
BE
15818@item -mcall-openbsd
15819@opindex mcall-netbsd
15820On System V.4 and embedded PowerPC systems compile code for the
15821OpenBSD operating system.
15822
39bc1876
NS
15823@item -maix-struct-return
15824@opindex maix-struct-return
15825Return all structures in memory (as specified by the AIX ABI)@.
789a3090 15826
39bc1876
NS
15827@item -msvr4-struct-return
15828@opindex msvr4-struct-return
15829Return structures smaller than 8 bytes in registers (as specified by the
15830SVR4 ABI)@.
789a3090 15831
78f5898b
AH
15832@item -mabi=@var{abi-type}
15833@opindex mabi
15834Extend the current ABI with a particular extension, or remove such extension.
15835Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
602ea4d3
JJ
15836@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
15837
15838@item -mabi=spe
15839@opindex mabi=spe
15840Extend the current ABI with SPE ABI extensions. This does not change
15841the default ABI, instead it adds the SPE ABI extensions to the current
15842ABI@.
15843
15844@item -mabi=no-spe
15845@opindex mabi=no-spe
15846Disable Booke SPE ABI extensions for the current ABI@.
15847
15848@item -mabi=ibmlongdouble
15849@opindex mabi=ibmlongdouble
15850Change the current ABI to use IBM extended precision long double.
15851This is a PowerPC 32-bit SYSV ABI option.
15852
15853@item -mabi=ieeelongdouble
15854@opindex mabi=ieeelongdouble
15855Change the current ABI to use IEEE extended precision long double.
15856This is a PowerPC 32-bit Linux ABI option.
789a3090 15857
39bc1876
NS
15858@item -mprototype
15859@itemx -mno-prototype
15860@opindex mprototype
15861@opindex mno-prototype
15862On System V.4 and embedded PowerPC systems assume that all calls to
15863variable argument functions are properly prototyped. Otherwise, the
15864compiler must insert an instruction before every non prototyped call to
15865set or clear bit 6 of the condition code register (@var{CR}) to
15866indicate whether floating point values were passed in the floating point
15867registers in case the function takes a variable arguments. With
15868@option{-mprototype}, only calls to prototyped variable argument functions
15869will set or clear the bit.
83575957 15870
39bc1876
NS
15871@item -msim
15872@opindex msim
15873On embedded PowerPC systems, assume that the startup module is called
15874@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
a31cfd58 15875@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}
39bc1876 15876configurations.
df6194d4 15877
39bc1876
NS
15878@item -mmvme
15879@opindex mmvme
15880On embedded PowerPC systems, assume that the startup module is called
15881@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
15882@file{libc.a}.
df6194d4 15883
39bc1876
NS
15884@item -mads
15885@opindex mads
15886On embedded PowerPC systems, assume that the startup module is called
15887@file{crt0.o} and the standard C libraries are @file{libads.a} and
15888@file{libc.a}.
df6194d4 15889
39bc1876
NS
15890@item -myellowknife
15891@opindex myellowknife
15892On embedded PowerPC systems, assume that the startup module is called
15893@file{crt0.o} and the standard C libraries are @file{libyk.a} and
15894@file{libc.a}.
df6194d4 15895
39bc1876
NS
15896@item -mvxworks
15897@opindex mvxworks
15898On System V.4 and embedded PowerPC systems, specify that you are
15899compiling for a VxWorks system.
df6194d4 15900
39bc1876
NS
15901@item -memb
15902@opindex memb
15903On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
15904header to indicate that @samp{eabi} extended relocations are used.
df6194d4 15905
39bc1876
NS
15906@item -meabi
15907@itemx -mno-eabi
15908@opindex meabi
15909@opindex mno-eabi
15910On System V.4 and embedded PowerPC systems do (do not) adhere to the
15911Embedded Applications Binary Interface (eabi) which is a set of
15912modifications to the System V.4 specifications. Selecting @option{-meabi}
15913means that the stack is aligned to an 8 byte boundary, a function
15914@code{__eabi} is called to from @code{main} to set up the eabi
15915environment, and the @option{-msdata} option can use both @code{r2} and
15916@code{r13} to point to two separate small data areas. Selecting
15917@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
15918do not call an initialization function from @code{main}, and the
15919@option{-msdata} option will only use @code{r13} to point to a single
15920small data area. The @option{-meabi} option is on by default if you
15921configured GCC using one of the @samp{powerpc*-*-eabi*} options.
df6194d4 15922
39bc1876
NS
15923@item -msdata=eabi
15924@opindex msdata=eabi
15925On System V.4 and embedded PowerPC systems, put small initialized
15926@code{const} global and static data in the @samp{.sdata2} section, which
15927is pointed to by register @code{r2}. Put small initialized
15928non-@code{const} global and static data in the @samp{.sdata} section,
15929which is pointed to by register @code{r13}. Put small uninitialized
15930global and static data in the @samp{.sbss} section, which is adjacent to
15931the @samp{.sdata} section. The @option{-msdata=eabi} option is
15932incompatible with the @option{-mrelocatable} option. The
15933@option{-msdata=eabi} option also sets the @option{-memb} option.
df6194d4 15934
39bc1876
NS
15935@item -msdata=sysv
15936@opindex msdata=sysv
15937On System V.4 and embedded PowerPC systems, put small global and static
15938data in the @samp{.sdata} section, which is pointed to by register
15939@code{r13}. Put small uninitialized global and static data in the
15940@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
15941The @option{-msdata=sysv} option is incompatible with the
15942@option{-mrelocatable} option.
df6194d4 15943
39bc1876 15944@item -msdata=default
df6194d4 15945@itemx -msdata
39bc1876 15946@opindex msdata=default
cd3bb277 15947@opindex msdata
39bc1876
NS
15948On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
15949compile code the same as @option{-msdata=eabi}, otherwise compile code the
15950same as @option{-msdata=sysv}.
df6194d4 15951
64e4a1a6
BE
15952@item -msdata=data
15953@opindex msdata=data
05f25017
AM
15954On System V.4 and embedded PowerPC systems, put small global
15955data in the @samp{.sdata} section. Put small uninitialized global
15956data in the @samp{.sbss} section. Do not use register @code{r13}
39bc1876
NS
15957to address small data however. This is the default behavior unless
15958other @option{-msdata} options are used.
df6194d4 15959
39bc1876
NS
15960@item -msdata=none
15961@itemx -mno-sdata
15962@opindex msdata=none
15963@opindex mno-sdata
15964On embedded PowerPC systems, put all initialized global and static data
15965in the @samp{.data} section, and all uninitialized data in the
15966@samp{.bss} section.
df6194d4 15967
d95016e0
NF
15968@item -mblock-move-inline-limit=@var{num}
15969@opindex mblock-move-inline-limit
15970Inline all block moves (such as calls to @code{memcpy} or structure
15971copies) less than or equal to @var{num} bytes. The minimum value for
15972@var{num} is 32 bytes on 32-bit targets and 64 bytes on 64-bit
15973targets. The default value is target-specific.
15974
39bc1876
NS
15975@item -G @var{num}
15976@opindex G
15977@cindex smaller data references (PowerPC)
15978@cindex .sdata/.sdata2 references (PowerPC)
15979On embedded PowerPC systems, put global and static items less than or
15980equal to @var{num} bytes into the small data or bss sections instead of
15981the normal data or bss section. By default, @var{num} is 8. The
15982@option{-G @var{num}} switch is also passed to the linker.
15983All modules should be compiled with the same @option{-G @var{num}} value.
dcffbade 15984
39bc1876
NS
15985@item -mregnames
15986@itemx -mno-regnames
15987@opindex mregnames
15988@opindex mno-regnames
15989On System V.4 and embedded PowerPC systems do (do not) emit register
15990names in the assembly language output using symbolic forms.
dcffbade 15991
39bc1876
NS
15992@item -mlongcall
15993@itemx -mno-longcall
15994@opindex mlongcall
15995@opindex mno-longcall
87c365a4
NS
15996By default assume that all calls are far away so that a longer more
15997expensive calling sequence is required. This is required for calls
15998further than 32 megabytes (33,554,432 bytes) from the current location.
15999A short call will be generated if the compiler knows
16000the call cannot be that far away. This setting can be overridden by
16001the @code{shortcall} function attribute, or by @code{#pragma
16002longcall(0)}.
dcffbade 16003
39bc1876
NS
16004Some linkers are capable of detecting out-of-range calls and generating
16005glue code on the fly. On these systems, long calls are unnecessary and
16006generate slower code. As of this writing, the AIX linker can do this,
16007as can the GNU linker for PowerPC/64. It is planned to add this feature
16008to the GNU linker for 32-bit PowerPC systems as well.
df6194d4 16009
39bc1876
NS
16010On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
16011callee, L42'', plus a ``branch island'' (glue code). The two target
d78aa55c 16012addresses represent the callee and the ``branch island''. The
39bc1876
NS
16013Darwin/PPC linker will prefer the first address and generate a ``bl
16014callee'' if the PPC ``bl'' instruction will reach the callee directly;
16015otherwise, the linker will generate ``bl L42'' to call the ``branch
d78aa55c 16016island''. The ``branch island'' is appended to the body of the
39bc1876
NS
16017calling function; it computes the full 32-bit address of the callee
16018and jumps to it.
df6194d4 16019
39bc1876
NS
16020On Mach-O (Darwin) systems, this option directs the compiler emit to
16021the glue for every direct call, and the Darwin linker decides whether
16022to use or discard it.
16023
16024In the future, we may cause GCC to ignore all longcall specifications
16025when the linker is known to generate glue.
16026
9752c4ad
AM
16027@item -mtls-markers
16028@itemx -mno-tls-markers
16029@opindex mtls-markers
16030@opindex mno-tls-markers
16031Mark (do not mark) calls to @code{__tls_get_addr} with a relocation
16032specifying the function argument. The relocation allows ld to
16033reliably associate function call with argument setup instructions for
16034TLS optimization, which in turn allows gcc to better schedule the
16035sequence.
16036
39bc1876
NS
16037@item -pthread
16038@opindex pthread
16039Adds support for multithreading with the @dfn{pthreads} library.
16040This option sets flags for both the preprocessor and linker.
30028c85 16041
92902797
MM
16042@item -mrecip
16043@itemx -mno-recip
16044@opindex mrecip
16045This option will enable GCC to use the reciprocal estimate and
16046reciprocal square root estimate instructions with additional
16047Newton-Raphson steps to increase precision instead of doing a divide or
16048square root and divide for floating point arguments. You should use
16049the @option{-ffast-math} option when using @option{-mrecip} (or at
16050least @option{-funsafe-math-optimizations},
16051@option{-finite-math-only}, @option{-freciprocal-math} and
16052@option{-fno-trapping-math}). Note that while the throughput of the
16053sequence is generally higher than the throughput of the non-reciprocal
16054instruction, the precision of the sequence can be decreased by up to 2
16055ulp (i.e. the inverse of 1.0 equals 0.99999994) for reciprocal square
16056roots.
16057
16058@item -mrecip=@var{opt}
16059@opindex mrecip=opt
16060This option allows to control which reciprocal estimate instructions
16061may be used. @var{opt} is a comma separated list of options, that may
16062be preceeded by a @code{!} to invert the option:
16063@code{all}: enable all estimate instructions,
16064@code{default}: enable the default instructions, equvalent to @option{-mrecip},
16065@code{none}: disable all estimate instructions, equivalent to @option{-mno-recip};
16066@code{div}: enable the reciprocal approximation instructions for both single and double precision;
16067@code{divf}: enable the single precision reciprocal approximation instructions;
16068@code{divd}: enable the double precision reciprocal approximation instructions;
16069@code{rsqrt}: enable the reciprocal square root approximation instructions for both single and double precision;
16070@code{rsqrtf}: enable the single precision reciprocal square root approximation instructions;
16071@code{rsqrtd}: enable the double precision reciprocal square root approximation instructions;
16072
16073So for example, @option{-mrecip=all,!rsqrtd} would enable the
16074all of the reciprocal estimate instructions, except for the
16075@code{FRSQRTE}, @code{XSRSQRTEDP}, and @code{XVRSQRTEDP} instructions
16076which handle the double precision reciprocal square root calculations.
16077
16078@item -mrecip-precision
16079@itemx -mno-recip-precision
16080@opindex mrecip-precision
16081Assume (do not assume) that the reciprocal estimate instructions
16082provide higher precision estimates than is mandated by the powerpc
16083ABI. Selecting @option{-mcpu=power6} or @option{-mcpu=power7}
16084automatically selects @option{-mrecip-precision}. The double
16085precision square root estimate instructions are not generated by
16086default on low precision machines, since they do not provide an
16087estimate that converges after three steps.
8bcc0304 16088
b36cf9d2
MM
16089@item -mveclibabi=@var{type}
16090@opindex mveclibabi
16091Specifies the ABI type to use for vectorizing intrinsics using an
16092external library. The only type supported at present is @code{mass},
16093which specifies to use IBM's Mathematical Acceleration Subsystem
16094(MASS) libraries for vectorizing intrinsics using external libraries.
16095GCC will currently emit calls to @code{acosd2}, @code{acosf4},
8bcc0304
MM
16096@code{acoshd2}, @code{acoshf4}, @code{asind2}, @code{asinf4},
16097@code{asinhd2}, @code{asinhf4}, @code{atan2d2}, @code{atan2f4},
16098@code{atand2}, @code{atanf4}, @code{atanhd2}, @code{atanhf4},
16099@code{cbrtd2}, @code{cbrtf4}, @code{cosd2}, @code{cosf4},
16100@code{coshd2}, @code{coshf4}, @code{erfcd2}, @code{erfcf4},
16101@code{erfd2}, @code{erff4}, @code{exp2d2}, @code{exp2f4},
16102@code{expd2}, @code{expf4}, @code{expm1d2}, @code{expm1f4},
16103@code{hypotd2}, @code{hypotf4}, @code{lgammad2}, @code{lgammaf4},
16104@code{log10d2}, @code{log10f4}, @code{log1pd2}, @code{log1pf4},
16105@code{log2d2}, @code{log2f4}, @code{logd2}, @code{logf4},
16106@code{powd2}, @code{powf4}, @code{sind2}, @code{sinf4}, @code{sinhd2},
16107@code{sinhf4}, @code{sqrtd2}, @code{sqrtf4}, @code{tand2},
16108@code{tanf4}, @code{tanhd2}, and @code{tanhf4} when generating code
16109for power7. Both @option{-ftree-vectorize} and
16110@option{-funsafe-math-optimizations} have to be enabled. The MASS
16111libraries will have to be specified at link time.
688e4919
MM
16112
16113@item -mfriz
16114@itemx -mno-friz
16115@opindex mfriz
16116Generate (do not generate) the @code{friz} instruction when the
16117@option{-funsafe-math-optimizations} option is used to optimize
16118rounding a floating point value to 64-bit integer and back to floating
16119point. The @code{friz} instruction does not return the same value if
16120the floating point number is too large to fit in an integer.
df6194d4
JW
16121@end table
16122
65a324b4
NC
16123@node RX Options
16124@subsection RX Options
16125@cindex RX Options
16126
5f75e477 16127These command line options are defined for RX targets:
65a324b4
NC
16128
16129@table @gcctabopt
16130@item -m64bit-doubles
16131@itemx -m32bit-doubles
16132@opindex m64bit-doubles
16133@opindex m32bit-doubles
16134Make the @code{double} data type be 64-bits (@option{-m64bit-doubles})
16135or 32-bits (@option{-m32bit-doubles}) in size. The default is
5f75e477
NC
16136@option{-m32bit-doubles}. @emph{Note} RX floating point hardware only
16137works on 32-bit values, which is why the default is
16138@option{-m32bit-doubles}.
16139
16140@item -fpu
16141@itemx -nofpu
16142@opindex fpu
16143@opindex nofpu
16144Enables (@option{-fpu}) or disables (@option{-nofpu}) the use of RX
16145floating point hardware. The default is enabled for the @var{RX600}
16146series and disabled for the @var{RX200} series.
16147
16148Floating point instructions will only be generated for 32-bit floating
16149point values however, so if the @option{-m64bit-doubles} option is in
16150use then the FPU hardware will not be used for doubles.
16151
16152@emph{Note} If the @option{-fpu} option is enabled then
16153@option{-funsafe-math-optimizations} is also enabled automatically.
16154This is because the RX FPU instructions are themselves unsafe.
9595a419
NC
16155
16156@item -mcpu=@var{name}
9595a419 16157@opindex -mcpu
5f75e477
NC
16158Selects the type of RX CPU to be targeted. Currently three types are
16159supported, the generic @var{RX600} and @var{RX200} series hardware and
16160the specific @var{RX610} cpu. The default is @var{RX600}.
16161
16162The only difference between @var{RX600} and @var{RX610} is that the
16163@var{RX610} does not support the @code{MVTIPL} instruction.
16164
16165The @var{RX200} series does not have a hardware floating point unit
16166and so @option{-nofpu} is enabled by default when this type is
16167selected.
9595a419 16168
65a324b4
NC
16169@item -mbig-endian-data
16170@itemx -mlittle-endian-data
16171@opindex mbig-endian-data
16172@opindex mlittle-endian-data
16173Store data (but not code) in the big-endian format. The default is
16174@option{-mlittle-endian-data}, ie to store data in the little endian
16175format.
16176
16177@item -msmall-data-limit=@var{N}
16178@opindex msmall-data-limit
16179Specifies the maximum size in bytes of global and static variables
16180which can be placed into the small data area. Using the small data
16181area can lead to smaller and faster code, but the size of area is
16182limited and it is up to the programmer to ensure that the area does
16183not overflow. Also when the small data area is used one of the RX's
16184registers (@code{r13}) is reserved for use pointing to this area, so
16185it is no longer available for use by the compiler. This could result
16186in slower and/or larger code if variables which once could have been
16187held in @code{r13} are now pushed onto the stack.
16188
16189Note, common variables (variables which have not been initialised) and
16190constants are not placed into the small data area as they are assigned
a4ce9883 16191to other sections in the output executable.
65a324b4
NC
16192
16193The default value is zero, which disables this feature. Note, this
16194feature is not enabled by default with higher optimization levels
a4ce9883 16195(@option{-O2} etc) because of the potentially detrimental effects of
65a324b4
NC
16196reserving register @code{r13}. It is up to the programmer to
16197experiment and discover whether this feature is of benefit to their
16198program.
16199
16200@item -msim
1588fb31 16201@itemx -mno-sim
65a324b4
NC
16202@opindex msim
16203@opindex mno-sim
16204Use the simulator runtime. The default is to use the libgloss board
16205specific runtime.
16206
16207@item -mas100-syntax
1588fb31 16208@itemx -mno-as100-syntax
65a324b4
NC
16209@opindex mas100-syntax
16210@opindex mno-as100-syntax
16211When generating assembler output use a syntax that is compatible with
16212Renesas's AS100 assembler. This syntax can also be handled by the GAS
16213assembler but it has some restrictions so generating it is not the
16214default option.
16215
16216@item -mmax-constant-size=@var{N}
16217@opindex mmax-constant-size
02a9370c 16218Specifies the maximum size, in bytes, of a constant that can be used as
65a324b4 16219an operand in a RX instruction. Although the RX instruction set does
a4ce9883 16220allow constants of up to 4 bytes in length to be used in instructions,
65a324b4
NC
16221a longer value equates to a longer instruction. Thus in some
16222circumstances it can be beneficial to restrict the size of constants
16223that are used in instructions. Constants that are too big are instead
16224placed into a constant pool and referenced via register indirection.
16225
c9c27b72
NC
16226The value @var{N} can be between 0 and 4. A value of 0 (the default)
16227or 4 means that constants of any size are allowed.
65a324b4
NC
16228
16229@item -mrelax
16230@opindex mrelax
16231Enable linker relaxation. Linker relaxation is a process whereby the
16232linker will attempt to reduce the size of a program by finding shorter
16233versions of various instructions. Disabled by default.
16234
16235@item -mint-register=@var{N}
16236@opindex mint-register
16237Specify the number of registers to reserve for fast interrupt handler
16238functions. The value @var{N} can be between 0 and 4. A value of 1
02a9370c 16239means that register @code{r13} will be reserved for the exclusive use
65a324b4
NC
16240of fast interrupt handlers. A value of 2 reserves @code{r13} and
16241@code{r12}. A value of 3 reserves @code{r13}, @code{r12} and
16242@code{r11}, and a value of 4 reserves @code{r13} through @code{r10}.
16243A value of 0, the default, does not reserve any registers.
9595a419
NC
16244
16245@item -msave-acc-in-interrupts
16246@opindex msave-acc-in-interrupts
16247Specifies that interrupt handler functions should preserve the
16248accumulator register. This is only necessary if normal code might use
16249the accumulator register, for example because it performs 64-bit
16250multiplications. The default is to ignore the accumulator as this
16251makes the interrupt handlers faster.
16252
65a324b4
NC
16253@end table
16254
16255@emph{Note:} The generic GCC command line @option{-ffixed-@var{reg}}
16256has special significance to the RX port when used with the
16257@code{interrupt} function attribute. This attribute indicates a
16258function intended to process fast interrupts. GCC will will ensure
16259that it only uses the registers @code{r10}, @code{r11}, @code{r12}
16260and/or @code{r13} and only provided that the normal use of the
16261corresponding registers have been restricted via the
16262@option{-ffixed-@var{reg}} or @option{-mint-register} command line
16263options.
16264
91abf72d
HP
16265@node S/390 and zSeries Options
16266@subsection S/390 and zSeries Options
16267@cindex S/390 and zSeries Options
16268
16269These are the @samp{-m} options defined for the S/390 and zSeries architecture.
16270
16271@table @gcctabopt
16272@item -mhard-float
16273@itemx -msoft-float
16274@opindex mhard-float
16275@opindex msoft-float
16276Use (do not use) the hardware floating-point instructions and registers
16277for floating-point operations. When @option{-msoft-float} is specified,
16278functions in @file{libgcc.a} will be used to perform floating-point
16279operations. When @option{-mhard-float} is specified, the compiler
16280generates IEEE floating-point instructions. This is the default.
16281
59a1bff3
AK
16282@item -mhard-dfp
16283@itemx -mno-hard-dfp
16284@opindex mhard-dfp
16285@opindex mno-hard-dfp
16286Use (do not use) the hardware decimal-floating-point instructions for
16287decimal-floating-point operations. When @option{-mno-hard-dfp} is
16288specified, functions in @file{libgcc.a} will be used to perform
16289decimal-floating-point operations. When @option{-mhard-dfp} is
16290specified, the compiler generates decimal-floating-point hardware
16291instructions. This is the default for @option{-march=z9-ec} or higher.
16292
f61a2c7d
AK
16293@item -mlong-double-64
16294@itemx -mlong-double-128
16295@opindex mlong-double-64
16296@opindex mlong-double-128
16297These switches control the size of @code{long double} type. A size
16298of 64bit makes the @code{long double} type equivalent to the @code{double}
16299type. This is the default.
16300
91abf72d
HP
16301@item -mbackchain
16302@itemx -mno-backchain
16303@opindex mbackchain
16304@opindex mno-backchain
b3d31392
AK
16305Store (do not store) the address of the caller's frame as backchain pointer
16306into the callee's stack frame.
adf39f8f
AK
16307A backchain may be needed to allow debugging using tools that do not understand
16308DWARF-2 call frame information.
b3d31392
AK
16309When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
16310at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
16311the backchain is placed into the topmost word of the 96/160 byte register
16312save area.
16313
16314In general, code compiled with @option{-mbackchain} is call-compatible with
16315code compiled with @option{-mmo-backchain}; however, use of the backchain
16316for debugging purposes usually requires that the whole binary is built with
6b78f6be
AK
16317@option{-mbackchain}. Note that the combination of @option{-mbackchain},
16318@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
16319to build a linux kernel use @option{-msoft-float}.
b3d31392
AK
16320
16321The default is to not maintain the backchain.
16322
16323@item -mpacked-stack
33558d94 16324@itemx -mno-packed-stack
b3d31392
AK
16325@opindex mpacked-stack
16326@opindex mno-packed-stack
16327Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
16328specified, the compiler uses the all fields of the 96/160 byte register save
16329area only for their default purpose; unused fields still take up stack space.
16330When @option{-mpacked-stack} is specified, register save slots are densely
16331packed at the top of the register save area; unused space is reused for other
16332purposes, allowing for more efficient use of the available stack space.
16333However, when @option{-mbackchain} is also in effect, the topmost word of
16334the save area is always used to store the backchain, and the return address
16335register is always saved two words below the backchain.
16336
f2fd3821 16337As long as the stack frame backchain is not used, code generated with
b3d31392
AK
16338@option{-mpacked-stack} is call-compatible with code generated with
16339@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
16340S/390 or zSeries generated code that uses the stack frame backchain at run
16341time, not just for debugging purposes. Such code is not call-compatible
16342with code compiled with @option{-mpacked-stack}. Also, note that the
6b78f6be
AK
16343combination of @option{-mbackchain},
16344@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
16345to build a linux kernel use @option{-msoft-float}.
b3d31392
AK
16346
16347The default is to not use the packed stack layout.
91abf72d
HP
16348
16349@item -msmall-exec
16350@itemx -mno-small-exec
16351@opindex msmall-exec
16352@opindex mno-small-exec
f282ffb3
JM
16353Generate (or do not generate) code using the @code{bras} instruction
16354to do subroutine calls.
91abf72d
HP
16355This only works reliably if the total executable size does not
16356exceed 64k. The default is to use the @code{basr} instruction instead,
16357which does not have this limitation.
16358
16359@item -m64
16360@itemx -m31
16361@opindex m64
16362@opindex m31
16363When @option{-m31} is specified, generate code compliant to the
95fef11f
JM
16364GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
16365code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
91abf72d 16366particular to generate 64-bit instructions. For the @samp{s390}
f282ffb3 16367targets, the default is @option{-m31}, while the @samp{s390x}
91abf72d
HP
16368targets default to @option{-m64}.
16369
1fec52be
HP
16370@item -mzarch
16371@itemx -mesa
16372@opindex mzarch
16373@opindex mesa
daf2f129
JM
16374When @option{-mzarch} is specified, generate code using the
16375instructions available on z/Architecture.
16376When @option{-mesa} is specified, generate code using the
8a36672b 16377instructions available on ESA/390. Note that @option{-mesa} is
1fec52be 16378not possible with @option{-m64}.
95fef11f 16379When generating code compliant to the GNU/Linux for S/390 ABI,
f13e0d4e 16380the default is @option{-mesa}. When generating code compliant
95fef11f 16381to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
1fec52be 16382
91abf72d
HP
16383@item -mmvcle
16384@itemx -mno-mvcle
16385@opindex mmvcle
16386@opindex mno-mvcle
f282ffb3 16387Generate (or do not generate) code using the @code{mvcle} instruction
3364c33b 16388to perform block moves. When @option{-mno-mvcle} is specified,
8daf098e
AS
16389use a @code{mvc} loop instead. This is the default unless optimizing for
16390size.
91abf72d
HP
16391
16392@item -mdebug
16393@itemx -mno-debug
16394@opindex mdebug
16395@opindex mno-debug
16396Print (or do not print) additional debug information when compiling.
16397The default is to not print debug information.
16398
f13e0d4e 16399@item -march=@var{cpu-type}
1fec52be 16400@opindex march
f13e0d4e 16401Generate code that will run on @var{cpu-type}, which is the name of a system
8a36672b 16402representing a certain processor type. Possible values for
59a1bff3
AK
16403@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, @samp{z990},
16404@samp{z9-109}, @samp{z9-ec} and @samp{z10}.
f13e0d4e
UW
16405When generating code using the instructions available on z/Architecture,
16406the default is @option{-march=z900}. Otherwise, the default is
16407@option{-march=g5}.
1fec52be 16408
f13e0d4e 16409@item -mtune=@var{cpu-type}
35082351 16410@opindex mtune
1fec52be 16411Tune to @var{cpu-type} everything applicable about the generated code,
f13e0d4e
UW
16412except for the ABI and the set of available instructions.
16413The list of @var{cpu-type} values is the same as for @option{-march}.
16414The default is the value used for @option{-march}.
1fec52be 16415
f26c1794
EC
16416@item -mtpf-trace
16417@itemx -mno-tpf-trace
16418@opindex mtpf-trace
16419@opindex mno-tpf-trace
16420Generate code that adds (does not add) in TPF OS specific branches to trace
16421routines in the operating system. This option is off by default, even
8a36672b 16422when compiling for the TPF OS@.
f26c1794 16423
f2d226e1
AK
16424@item -mfused-madd
16425@itemx -mno-fused-madd
16426@opindex mfused-madd
16427@opindex mno-fused-madd
16428Generate code that uses (does not use) the floating point multiply and
16429accumulate instructions. These instructions are generated by default if
16430hardware floating point is used.
d75f90f1
AK
16431
16432@item -mwarn-framesize=@var{framesize}
16433@opindex mwarn-framesize
16434Emit a warning if the current function exceeds the given frame size. Because
16435this is a compile time check it doesn't need to be a real problem when the program
f0eb93a8
JM
16436runs. It is intended to identify functions which most probably cause
16437a stack overflow. It is useful to be used in an environment with limited stack
431ae0bf 16438size e.g.@: the linux kernel.
d75f90f1
AK
16439
16440@item -mwarn-dynamicstack
16441@opindex mwarn-dynamicstack
16442Emit a warning if the function calls alloca or uses dynamically
16443sized arrays. This is generally a bad idea with a limited stack size.
16444
16445@item -mstack-guard=@var{stack-guard}
33558d94 16446@itemx -mstack-size=@var{stack-size}
d75f90f1
AK
16447@opindex mstack-guard
16448@opindex mstack-size
690e7b63
AK
16449If these options are provided the s390 back end emits additional instructions in
16450the function prologue which trigger a trap if the stack size is @var{stack-guard}
16451bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
16452If the @var{stack-guard} option is omitted the smallest power of 2 larger than
16453the frame size of the compiled function is chosen.
16454These options are intended to be used to help debugging stack overflow problems.
16455The additionally emitted code causes only little overhead and hence can also be
16456used in production like systems without greater performance degradation. The given
16457values have to be exact powers of 2 and @var{stack-size} has to be greater than
16458@var{stack-guard} without exceeding 64k.
d75f90f1
AK
16459In order to be efficient the extra code makes the assumption that the stack starts
16460at an address aligned to the value given by @var{stack-size}.
690e7b63 16461The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
91abf72d
HP
16462@end table
16463
93ef7c1f
CL
16464@node Score Options
16465@subsection Score Options
16466@cindex Score Options
16467
16468These options are defined for Score implementations:
16469
16470@table @gcctabopt
93ef7c1f
CL
16471@item -meb
16472@opindex meb
16473Compile code for big endian mode. This is the default.
16474
c6681463 16475@item -mel
edc5f63b 16476@opindex mel
7a61cf6f 16477Compile code for little endian mode.
c6681463
CL
16478
16479@item -mnhwloop
edc5f63b 16480@opindex mnhwloop
c6681463
CL
16481Disable generate bcnz instruction.
16482
16483@item -muls
edc5f63b 16484@opindex muls
c6681463
CL
16485Enable generate unaligned load and store instruction.
16486
93ef7c1f
CL
16487@item -mmac
16488@opindex mmac
7a61cf6f 16489Enable the use of multiply-accumulate instructions. Disabled by default.
c6681463
CL
16490
16491@item -mscore5
16492@opindex mscore5
16493Specify the SCORE5 as the target architecture.
93ef7c1f
CL
16494
16495@item -mscore5u
16496@opindex mscore5u
16497Specify the SCORE5U of the target architecture.
16498
16499@item -mscore7
16500@opindex mscore7
c6681463
CL
16501Specify the SCORE7 as the target architecture. This is the default.
16502
16503@item -mscore7d
16504@opindex mscore7d
16505Specify the SCORE7D as the target architecture.
93ef7c1f
CL
16506@end table
16507
39bc1876
NS
16508@node SH Options
16509@subsection SH Options
bcf684c7 16510
39bc1876 16511These @samp{-m} options are defined for the SH implementations:
bcf684c7 16512
5d22c1a5 16513@table @gcctabopt
39bc1876
NS
16514@item -m1
16515@opindex m1
16516Generate code for the SH1.
9f85bca7 16517
39bc1876
NS
16518@item -m2
16519@opindex m2
16520Generate code for the SH2.
9f85bca7 16521
39bc1876
NS
16522@item -m2e
16523Generate code for the SH2e.
9f85bca7 16524
b4589acc
TY
16525@item -m2a-nofpu
16526@opindex m2a-nofpu
16527Generate code for the SH2a without FPU, or for a SH2a-FPU in such a way
16528that the floating-point unit is not used.
16529
16530@item -m2a-single-only
16531@opindex m2a-single-only
16532Generate code for the SH2a-FPU, in such a way that no double-precision
16533floating point operations are used.
16534
16535@item -m2a-single
16536@opindex m2a-single
16537Generate code for the SH2a-FPU assuming the floating-point unit is in
16538single-precision mode by default.
16539
16540@item -m2a
16541@opindex m2a
16542Generate code for the SH2a-FPU assuming the floating-point unit is in
16543double-precision mode by default.
16544
39bc1876
NS
16545@item -m3
16546@opindex m3
16547Generate code for the SH3.
9f85bca7 16548
39bc1876
NS
16549@item -m3e
16550@opindex m3e
16551Generate code for the SH3e.
9f85bca7 16552
39bc1876
NS
16553@item -m4-nofpu
16554@opindex m4-nofpu
16555Generate code for the SH4 without a floating-point unit.
9f85bca7 16556
39bc1876
NS
16557@item -m4-single-only
16558@opindex m4-single-only
16559Generate code for the SH4 with a floating-point unit that only
16560supports single-precision arithmetic.
9f85bca7 16561
39bc1876
NS
16562@item -m4-single
16563@opindex m4-single
16564Generate code for the SH4 assuming the floating-point unit is in
16565single-precision mode by default.
9f85bca7 16566
39bc1876
NS
16567@item -m4
16568@opindex m4
16569Generate code for the SH4.
9f85bca7 16570
312209c6
AO
16571@item -m4a-nofpu
16572@opindex m4a-nofpu
16573Generate code for the SH4al-dsp, or for a SH4a in such a way that the
16574floating-point unit is not used.
16575
16576@item -m4a-single-only
16577@opindex m4a-single-only
16578Generate code for the SH4a, in such a way that no double-precision
16579floating point operations are used.
16580
16581@item -m4a-single
16582@opindex m4a-single
16583Generate code for the SH4a assuming the floating-point unit is in
16584single-precision mode by default.
16585
16586@item -m4a
16587@opindex m4a
16588Generate code for the SH4a.
16589
16590@item -m4al
16591@opindex m4al
16592Same as @option{-m4a-nofpu}, except that it implicitly passes
16593@option{-dsp} to the assembler. GCC doesn't generate any DSP
16594instructions at the moment.
16595
39bc1876
NS
16596@item -mb
16597@opindex mb
16598Compile code for the processor in big endian mode.
9f85bca7 16599
39bc1876
NS
16600@item -ml
16601@opindex ml
16602Compile code for the processor in little endian mode.
9f85bca7 16603
39bc1876
NS
16604@item -mdalign
16605@opindex mdalign
16606Align doubles at 64-bit boundaries. Note that this changes the calling
16607conventions, and thus some functions from the standard C library will
16608not work unless you recompile it first with @option{-mdalign}.
9f85bca7 16609
39bc1876
NS
16610@item -mrelax
16611@opindex mrelax
16612Shorten some address references at link time, when possible; uses the
16613linker option @option{-relax}.
9f85bca7 16614
39bc1876
NS
16615@item -mbigtable
16616@opindex mbigtable
16617Use 32-bit offsets in @code{switch} tables. The default is to use
1661816-bit offsets.
9f85bca7 16619
9eb3a0dd
N
16620@item -mbitops
16621@opindex mbitops
16622Enable the use of bit manipulation instructions on SH2A.
16623
6a799f6e
CB
16624@item -mfmovd
16625@opindex mfmovd
16626Enable the use of the instruction @code{fmovd}. Check @option{-mdalign} for
16627alignment constraints.
16628
39bc1876
NS
16629@item -mhitachi
16630@opindex mhitachi
16631Comply with the calling conventions defined by Renesas.
9f85bca7 16632
2acc29bd
NC
16633@item -mrenesas
16634@opindex mhitachi
16635Comply with the calling conventions defined by Renesas.
16636
16637@item -mno-renesas
16638@opindex mhitachi
16639Comply with the calling conventions defined for GCC before the Renesas
16640conventions were available. This option is the default for all
16641targets of the SH toolchain except for @samp{sh-symbianelf}.
16642
39bc1876
NS
16643@item -mnomacsave
16644@opindex mnomacsave
16645Mark the @code{MAC} register as call-clobbered, even if
16646@option{-mhitachi} is given.
9f85bca7 16647
39bc1876
NS
16648@item -mieee
16649@opindex mieee
16650Increase IEEE-compliance of floating-point code.
73a4d10b
R
16651At the moment, this is equivalent to @option{-fno-finite-math-only}.
16652When generating 16 bit SH opcodes, getting IEEE-conforming results for
16653comparisons of NANs / infinities incurs extra overhead in every
16654floating point comparison, therefore the default is set to
16655@option{-ffinite-math-only}.
9f85bca7 16656
dc557046
R
16657@item -minline-ic_invalidate
16658@opindex minline-ic_invalidate
16659Inline code to invalidate instruction cache entries after setting up
16660nested function trampolines.
16661This option has no effect if -musermode is in effect and the selected
16662code generation option (e.g. -m4) does not allow the use of the icbi
16663instruction.
16664If the selected code generation option does not allow the use of the icbi
16665instruction, and -musermode is not in effect, the inlined code will
16666manipulate the instruction cache address array directly with an associative
16667write. This not only requires privileged mode, but it will also
16668fail if the cache line had been mapped via the TLB and has become unmapped.
16669
39bc1876
NS
16670@item -misize
16671@opindex misize
16672Dump instruction size and location in the assembly code.
9f85bca7 16673
39bc1876
NS
16674@item -mpadstruct
16675@opindex mpadstruct
16676This option is deprecated. It pads structures to multiple of 4 bytes,
16677which is incompatible with the SH ABI@.
9f85bca7 16678
39bc1876
NS
16679@item -mspace
16680@opindex mspace
16681Optimize for space instead of speed. Implied by @option{-Os}.
9f85bca7 16682
39bc1876
NS
16683@item -mprefergot
16684@opindex mprefergot
16685When generating position-independent code, emit function calls using
16686the Global Offset Table instead of the Procedure Linkage Table.
9f85bca7 16687
39bc1876
NS
16688@item -musermode
16689@opindex musermode
dc557046
R
16690Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
16691if the inlined code would not work in user mode.
16692This is the default when the target is @code{sh-*-linux*}.
73a4d10b
R
16693
16694@item -multcost=@var{number}
16695@opindex multcost=@var{number}
16696Set the cost to assume for a multiply insn.
16697
16698@item -mdiv=@var{strategy}
16699@opindex mdiv=@var{strategy}
16700Set the division strategy to use for SHmedia code. @var{strategy} must be
16701one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
16702inv:call2, inv:fp .
16703"fp" performs the operation in floating point. This has a very high latency,
16704but needs only a few instructions, so it might be a good choice if
30dc60c7 16705your code has enough easily exploitable ILP to allow the compiler to
73a4d10b
R
16706schedule the floating point instructions together with other instructions.
16707Division by zero causes a floating point exception.
16708"inv" uses integer operations to calculate the inverse of the divisor,
30dc60c7 16709and then multiplies the dividend with the inverse. This strategy allows
73a4d10b
R
16710cse and hoisting of the inverse calculation. Division by zero calculates
16711an unspecified result, but does not trap.
16712"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
16713have been found, or if the entire operation has been hoisted to the same
16714place, the last stages of the inverse calculation are intertwined with the
16715final multiply to reduce the overall latency, at the expense of using a few
16716more instructions, and thus offering fewer scheduling opportunities with
16717other code.
16718"call" calls a library function that usually implements the inv:minlat
16719strategy.
16720This gives high code density for m5-*media-nofpu compilations.
16721"call2" uses a different entry point of the same library function, where it
16722assumes that a pointer to a lookup table has already been set up, which
16723exposes the pointer load to cse / code hoisting optimizations.
16724"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
16725code generation, but if the code stays unoptimized, revert to the "call",
30dc60c7 16726"call2", or "fp" strategies, respectively. Note that the
73a4d10b
R
16727potentially-trapping side effect of division by zero is carried by a
16728separate instruction, so it is possible that all the integer instructions
16729are hoisted out, but the marker for the side effect stays where it is.
16730A recombination to fp operations or a call is not possible in that case.
16731"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
16732that the inverse calculation was nor separated from the multiply, they speed
16733up division where the dividend fits into 20 bits (plus sign where applicable),
16734by inserting a test to skip a number of operations in this case; this test
30dc60c7 16735slows down the case of larger dividends. inv20u assumes the case of a such
73a4d10b
R
16736a small dividend to be unlikely, and inv20l assumes it to be likely.
16737
7a296495
CB
16738@item -maccumulate-outgoing-args
16739@opindex maccumulate-outgoing-args
16740Reserve space once for outgoing arguments in the function prologue rather
16741than around each call. Generally beneficial for performance and size. Also
16742needed for unwinding to avoid changing the stack frame around conditional code.
16743
73a4d10b
R
16744@item -mdivsi3_libfunc=@var{name}
16745@opindex mdivsi3_libfunc=@var{name}
16746Set the name of the library function used for 32 bit signed division to
16747@var{name}. This only affect the name used in the call and inv:call
16748division strategies, and the compiler will still expect the same
16749sets of input/output/clobbered registers as if this option was not present.
16750
3217af3e
KK
16751@item -mfixed-range=@var{register-range}
16752@opindex mfixed-range
16753Generate code treating the given register range as fixed registers.
16754A fixed register is one that the register allocator can not use. This is
16755useful when compiling kernel code. A register range is specified as
16756two registers separated by a dash. Multiple register ranges can be
16757specified separated by a comma.
16758
73a4d10b
R
16759@item -madjust-unroll
16760@opindex madjust-unroll
16761Throttle unrolling to avoid thrashing target registers.
16762This option only has an effect if the gcc code base supports the
16763TARGET_ADJUST_UNROLL_MAX target hook.
16764
16765@item -mindexed-addressing
16766@opindex mindexed-addressing
16767Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
16768This is only safe if the hardware and/or OS implement 32 bit wrap-around
16769semantics for the indexed addressing mode. The architecture allows the
16770implementation of processors with 64 bit MMU, which the OS could use to
30dc60c7 16771get 32 bit addressing, but since no current hardware implementation supports
73a4d10b
R
16772this or any other way to make the indexed addressing mode safe to use in
16773the 32 bit ABI, the default is -mno-indexed-addressing.
16774
16775@item -mgettrcost=@var{number}
16776@opindex mgettrcost=@var{number}
16777Set the cost assumed for the gettr instruction to @var{number}.
16778The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
16779
16780@item -mpt-fixed
16781@opindex mpt-fixed
16782Assume pt* instructions won't trap. This will generally generate better
16783scheduled code, but is unsafe on current hardware. The current architecture
16784definition says that ptabs and ptrel trap when the target anded with 3 is 3.
16785This has the unintentional effect of making it unsafe to schedule ptabs /
16786ptrel before a branch, or hoist it out of a loop. For example,
16787__do_global_ctors, a part of libgcc that runs constructors at program
78681dbd
RS
16788startup, calls functions in a list which is delimited by @minus{}1. With the
16789-mpt-fixed option, the ptabs will be done before testing against @minus{}1.
73a4d10b 16790That means that all the constructors will be run a bit quicker, but when
30dc60c7 16791the loop comes to the end of the list, the program crashes because ptabs
78681dbd 16792loads @minus{}1 into a target register. Since this option is unsafe for any
73a4d10b
R
16793hardware implementing the current architecture specification, the default
16794is -mno-pt-fixed. Unless the user specifies a specific cost with
16795@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
16796this deters register allocation using target registers for storing
16797ordinary integers.
16798
16799@item -minvalid-symbols
16800@opindex minvalid-symbols
16801Assume symbols might be invalid. Ordinary function symbols generated by
16802the compiler will always be valid to load with movi/shori/ptabs or
16803movi/shori/ptrel, but with assembler and/or linker tricks it is possible
16804to generate symbols that will cause ptabs / ptrel to trap.
16805This option is only meaningful when @option{-mno-pt-fixed} is in effect.
16806It will then prevent cross-basic-block cse, hoisting and most scheduling
16807of symbol loads. The default is @option{-mno-invalid-symbols}.
9f85bca7
JM
16808@end table
16809
c28aa982
RO
16810@node Solaris 2 Options
16811@subsection Solaris 2 Options
16812@cindex Solaris 2 options
16813
16814These @samp{-m} options are supported on Solaris 2:
16815
16816@table @gcctabopt
16817@item -mimpure-text
16818@opindex mimpure-text
16819@option{-mimpure-text}, used in addition to @option{-shared}, tells
16820the compiler to not pass @option{-z text} to the linker when linking a
16821shared object. Using this option, you can link position-dependent
16822code into a shared object.
16823
16824@option{-mimpure-text} suppresses the ``relocations remain against
16825allocatable but non-writable sections'' linker error message.
16826However, the necessary relocations will trigger copy-on-write, and the
16827shared object is not actually shared across processes. Instead of
16828using @option{-mimpure-text}, you should compile all source code with
16829@option{-fpic} or @option{-fPIC}.
16830
16831@end table
16832
16833These switches are supported in addition to the above on Solaris 2:
16834
16835@table @gcctabopt
16836@item -threads
16837@opindex threads
16838Add support for multithreading using the Solaris threads library. This
16839option sets flags for both the preprocessor and linker. This option does
16840not affect the thread safety of object code produced by the compiler or
16841that of libraries supplied with it.
16842
16843@item -pthreads
16844@opindex pthreads
16845Add support for multithreading using the POSIX threads library. This
16846option sets flags for both the preprocessor and linker. This option does
16847not affect the thread safety of object code produced by the compiler or
16848that of libraries supplied with it.
16849
16850@item -pthread
16851@opindex pthread
16852This is a synonym for @option{-pthreads}.
16853@end table
16854
39bc1876
NS
16855@node SPARC Options
16856@subsection SPARC Options
16857@cindex SPARC options
69a0611f 16858
39bc1876 16859These @samp{-m} options are supported on the SPARC:
69a0611f
GK
16860
16861@table @gcctabopt
39bc1876
NS
16862@item -mno-app-regs
16863@itemx -mapp-regs
16864@opindex mno-app-regs
16865@opindex mapp-regs
16866Specify @option{-mapp-regs} to generate output using the global registers
168672 through 4, which the SPARC SVR4 ABI reserves for applications. This
d14f5ecb 16868is the default.
69a0611f 16869
39bc1876
NS
16870To be fully SVR4 ABI compliant at the cost of some performance loss,
16871specify @option{-mno-app-regs}. You should compile libraries and system
16872software with this option.
70899148 16873
39bc1876
NS
16874@item -mfpu
16875@itemx -mhard-float
16876@opindex mfpu
16877@opindex mhard-float
16878Generate output containing floating point instructions. This is the
16879default.
70899148 16880
39bc1876
NS
16881@item -mno-fpu
16882@itemx -msoft-float
16883@opindex mno-fpu
16884@opindex msoft-float
16885Generate output containing library calls for floating point.
16886@strong{Warning:} the requisite libraries are not available for all SPARC
16887targets. Normally the facilities of the machine's usual C compiler are
16888used, but this cannot be done directly in cross-compilation. You must make
16889your own arrangements to provide suitable library functions for
16890cross-compilation. The embedded targets @samp{sparc-*-aout} and
16891@samp{sparclite-*-*} do provide software floating point support.
70899148 16892
39bc1876
NS
16893@option{-msoft-float} changes the calling convention in the output file;
16894therefore, it is only useful if you compile @emph{all} of a program with
16895this option. In particular, you need to compile @file{libgcc.a}, the
16896library that comes with GCC, with @option{-msoft-float} in order for
16897this to work.
70899148 16898
39bc1876
NS
16899@item -mhard-quad-float
16900@opindex mhard-quad-float
16901Generate output containing quad-word (long double) floating point
16902instructions.
70899148 16903
39bc1876
NS
16904@item -msoft-quad-float
16905@opindex msoft-quad-float
16906Generate output containing library calls for quad-word (long double)
16907floating point instructions. The functions called are those specified
16908in the SPARC ABI@. This is the default.
70899148 16909
39bc1876
NS
16910As of this writing, there are no SPARC implementations that have hardware
16911support for the quad-word floating point instructions. They all invoke
16912a trap handler for one of these instructions, and then the trap handler
16913emulates the effect of the instruction. Because of the trap handler overhead,
16914this is much slower than calling the ABI library routines. Thus the
16915@option{-msoft-quad-float} option is the default.
70899148 16916
39bc1876
NS
16917@item -mno-unaligned-doubles
16918@itemx -munaligned-doubles
16919@opindex mno-unaligned-doubles
16920@opindex munaligned-doubles
16921Assume that doubles have 8 byte alignment. This is the default.
70899148 16922
39bc1876
NS
16923With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
16924alignment only if they are contained in another type, or if they have an
16925absolute address. Otherwise, it assumes they have 4 byte alignment.
16926Specifying this option avoids some rare compatibility problems with code
16927generated by other compilers. It is not the default because it results
16928in a performance loss, especially for floating point code.
70899148 16929
39bc1876
NS
16930@item -mno-faster-structs
16931@itemx -mfaster-structs
16932@opindex mno-faster-structs
16933@opindex mfaster-structs
16934With @option{-mfaster-structs}, the compiler assumes that structures
16935should have 8 byte alignment. This enables the use of pairs of
16936@code{ldd} and @code{std} instructions for copies in structure
16937assignment, in place of twice as many @code{ld} and @code{st} pairs.
16938However, the use of this changed alignment directly violates the SPARC
16939ABI@. Thus, it's intended only for use on targets where the developer
16940acknowledges that their resulting code will not be directly in line with
16941the rules of the ABI@.
70899148 16942
39bc1876
NS
16943@item -mcpu=@var{cpu_type}
16944@opindex mcpu
16945Set the instruction set, register set, and instruction scheduling parameters
16946for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
16947@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
16948@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
4c837a1e 16949@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
9eeaed6e 16950@samp{ultrasparc3}, @samp{niagara} and @samp{niagara2}.
70899148 16951
39bc1876
NS
16952Default instruction scheduling parameters are used for values that select
16953an architecture and not an implementation. These are @samp{v7}, @samp{v8},
16954@samp{sparclite}, @samp{sparclet}, @samp{v9}.
70899148 16955
39bc1876
NS
16956Here is a list of each supported architecture and their supported
16957implementations.
70899148 16958
39bc1876
NS
16959@smallexample
16960 v7: cypress
16961 v8: supersparc, hypersparc
16962 sparclite: f930, f934, sparclite86x
16963 sparclet: tsc701
9eeaed6e 16964 v9: ultrasparc, ultrasparc3, niagara, niagara2
39bc1876 16965@end smallexample
70899148 16966
39bc1876
NS
16967By default (unless configured otherwise), GCC generates code for the V7
16968variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
16969additionally optimizes it for the Cypress CY7C602 chip, as used in the
16970SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
16971SPARCStation 1, 2, IPX etc.
70899148 16972
39bc1876
NS
16973With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
16974architecture. The only difference from V7 code is that the compiler emits
16975the integer multiply and integer divide instructions which exist in SPARC-V8
16976but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
16977optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
169782000 series.
70899148 16979
39bc1876
NS
16980With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
16981the SPARC architecture. This adds the integer multiply, integer divide step
16982and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
16983With @option{-mcpu=f930}, the compiler additionally optimizes it for the
8a36672b 16984Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
39bc1876 16985@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
8a36672b 16986MB86934 chip, which is the more recent SPARClite with FPU@.
70899148 16987
39bc1876
NS
16988With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
16989the SPARC architecture. This adds the integer multiply, multiply/accumulate,
16990integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
16991but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
16992optimizes it for the TEMIC SPARClet chip.
70899148 16993
39bc1876
NS
16994With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
16995architecture. This adds 64-bit integer and floating-point move instructions,
169963 additional floating-point condition code registers and conditional move
16997instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
4c837a1e 16998optimizes it for the Sun UltraSPARC I/II/IIi chips. With
39bc1876 16999@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
4c837a1e
DM
17000Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
17001@option{-mcpu=niagara}, the compiler additionally optimizes it for
9eeaed6e
DM
17002Sun UltraSPARC T1 chips. With @option{-mcpu=niagara2}, the compiler
17003additionally optimizes it for Sun UltraSPARC T2 chips.
70899148 17004
39bc1876
NS
17005@item -mtune=@var{cpu_type}
17006@opindex mtune
17007Set the instruction scheduling parameters for machine type
17008@var{cpu_type}, but do not set the instruction set or register set that the
17009option @option{-mcpu=@var{cpu_type}} would.
70899148 17010
39bc1876
NS
17011The same values for @option{-mcpu=@var{cpu_type}} can be used for
17012@option{-mtune=@var{cpu_type}}, but the only useful values are those
17013that select a particular cpu implementation. Those are @samp{cypress},
17014@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
4c837a1e 17015@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
9eeaed6e 17016@samp{ultrasparc3}, @samp{niagara}, and @samp{niagara2}.
70899148 17017
39bc1876
NS
17018@item -mv8plus
17019@itemx -mno-v8plus
17020@opindex mv8plus
17021@opindex mno-v8plus
8a36672b 17022With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
39bc1876
NS
17023difference from the V8 ABI is that the global and out registers are
17024considered 64-bit wide. This is enabled by default on Solaris in 32-bit
17025mode for all SPARC-V9 processors.
70899148 17026
39bc1876
NS
17027@item -mvis
17028@itemx -mno-vis
17029@opindex mvis
17030@opindex mno-vis
17031With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
17032Visual Instruction Set extensions. The default is @option{-mno-vis}.
17033@end table
70899148 17034
39bc1876
NS
17035These @samp{-m} options are supported in addition to the above
17036on SPARC-V9 processors in 64-bit environments:
70899148 17037
39bc1876
NS
17038@table @gcctabopt
17039@item -mlittle-endian
17040@opindex mlittle-endian
8a36672b 17041Generate code for a processor running in little-endian mode. It is only
d4e1591f 17042available for a few configurations and most notably not on Solaris and Linux.
70899148 17043
39bc1876
NS
17044@item -m32
17045@itemx -m64
17046@opindex m32
17047@opindex m64
17048Generate code for a 32-bit or 64-bit environment.
17049The 32-bit environment sets int, long and pointer to 32 bits.
17050The 64-bit environment sets int to 32 bits and long and pointer
17051to 64 bits.
70899148 17052
39bc1876
NS
17053@item -mcmodel=medlow
17054@opindex mcmodel=medlow
17055Generate code for the Medium/Low code model: 64-bit addresses, programs
17056must be linked in the low 32 bits of memory. Programs can be statically
17057or dynamically linked.
70899148 17058
39bc1876
NS
17059@item -mcmodel=medmid
17060@opindex mcmodel=medmid
17061Generate code for the Medium/Middle code model: 64-bit addresses, programs
17062must be linked in the low 44 bits of memory, the text and data segments must
17063be less than 2GB in size and the data segment must be located within 2GB of
17064the text segment.
70899148 17065
39bc1876
NS
17066@item -mcmodel=medany
17067@opindex mcmodel=medany
17068Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
17069may be linked anywhere in memory, the text and data segments must be less
17070than 2GB in size and the data segment must be located within 2GB of the
17071text segment.
70899148 17072
39bc1876
NS
17073@item -mcmodel=embmedany
17074@opindex mcmodel=embmedany
17075Generate code for the Medium/Anywhere code model for embedded systems:
1707664-bit addresses, the text and data segments must be less than 2GB in
17077size, both starting anywhere in memory (determined at link time). The
17078global register %g4 points to the base of the data segment. Programs
17079are statically linked and PIC is not supported.
70899148 17080
39bc1876
NS
17081@item -mstack-bias
17082@itemx -mno-stack-bias
17083@opindex mstack-bias
17084@opindex mno-stack-bias
17085With @option{-mstack-bias}, GCC assumes that the stack pointer, and
17086frame pointer if present, are offset by @minus{}2047 which must be added back
17087when making stack frame references. This is the default in 64-bit mode.
17088Otherwise, assume no such offset is present.
17089@end table
70899148 17090
85d9c13c
TS
17091@node SPU Options
17092@subsection SPU Options
17093@cindex SPU options
17094
17095These @samp{-m} options are supported on the SPU:
17096
17097@table @gcctabopt
17098@item -mwarn-reloc
17099@itemx -merror-reloc
17100@opindex mwarn-reloc
17101@opindex merror-reloc
17102
17103The loader for SPU does not handle dynamic relocations. By default, GCC
17104will give an error when it generates code that requires a dynamic
17105relocation. @option{-mno-error-reloc} disables the error,
17106@option{-mwarn-reloc} will generate a warning instead.
17107
17108@item -msafe-dma
17109@itemx -munsafe-dma
17110@opindex msafe-dma
17111@opindex munsafe-dma
17112
17113Instructions which initiate or test completion of DMA must not be
17114reordered with respect to loads and stores of the memory which is being
17115accessed. Users typically address this problem using the volatile
17116keyword, but that can lead to inefficient code in places where the
17117memory is known to not change. Rather than mark the memory as volatile
17118we treat the DMA instructions as potentially effecting all memory. With
17119@option{-munsafe-dma} users must use the volatile keyword to protect
17120memory accesses.
17121
17122@item -mbranch-hints
17123@opindex mbranch-hints
17124
17125By default, GCC will generate a branch hint instruction to avoid
17126pipeline stalls for always taken or probably taken branches. A hint
17127will not be generated closer than 8 instructions away from its branch.
17128There is little reason to disable them, except for debugging purposes,
17129or to make an object a little bit smaller.
17130
17131@item -msmall-mem
17132@itemx -mlarge-mem
17133@opindex msmall-mem
17134@opindex mlarge-mem
17135
17136By default, GCC generates code assuming that addresses are never larger
17137than 18 bits. With @option{-mlarge-mem} code is generated that assumes
17138a full 32 bit address.
17139
cc8d70cd
SL
17140@item -mstdmain
17141@opindex mstdmain
17142
17143By default, GCC links against startup code that assumes the SPU-style
17144main function interface (which has an unconventional parameter list).
17145With @option{-mstdmain}, GCC will link your program against startup
17146code that assumes a C99-style interface to @code{main}, including a
17147local copy of @code{argv} strings.
17148
32fb22af
SL
17149@item -mfixed-range=@var{register-range}
17150@opindex mfixed-range
17151Generate code treating the given register range as fixed registers.
17152A fixed register is one that the register allocator can not use. This is
17153useful when compiling kernel code. A register range is specified as
17154two registers separated by a dash. Multiple register ranges can be
17155specified separated by a comma.
17156
299456f3
BE
17157@item -mea32
17158@itemx -mea64
17159@opindex mea32
17160@opindex mea64
17161Compile code assuming that pointers to the PPU address space accessed
17162via the @code{__ea} named address space qualifier are either 32 or 64
17163bits wide. The default is 32 bits. As this is an ABI changing option,
17164all object code in an executable must be compiled with the same setting.
17165
17166@item -maddress-space-conversion
17167@itemx -mno-address-space-conversion
17168@opindex maddress-space-conversion
17169@opindex mno-address-space-conversion
17170Allow/disallow treating the @code{__ea} address space as superset
17171of the generic address space. This enables explicit type casts
17172between @code{__ea} and generic pointer as well as implicit
17173conversions of generic pointers to @code{__ea} pointers. The
17174default is to allow address space pointer conversions.
17175
17176@item -mcache-size=@var{cache-size}
17177@opindex mcache-size
17178This option controls the version of libgcc that the compiler links to an
17179executable and selects a software-managed cache for accessing variables
17180in the @code{__ea} address space with a particular cache size. Possible
17181options for @var{cache-size} are @samp{8}, @samp{16}, @samp{32}, @samp{64}
17182and @samp{128}. The default cache size is 64KB.
17183
17184@item -matomic-updates
17185@itemx -mno-atomic-updates
17186@opindex matomic-updates
17187@opindex mno-atomic-updates
17188This option controls the version of libgcc that the compiler links to an
17189executable and selects whether atomic updates to the software-managed
17190cache of PPU-side variables are used. If you use atomic updates, changes
17191to a PPU variable from SPU code using the @code{__ea} named address space
17192qualifier will not interfere with changes to other PPU variables residing
17193in the same cache line from PPU code. If you do not use atomic updates,
17194such interference may occur; however, writing back cache lines will be
17195more efficient. The default behavior is to use atomic updates.
17196
9dcc2e87
TS
17197@item -mdual-nops
17198@itemx -mdual-nops=@var{n}
17199@opindex mdual-nops
17200By default, GCC will insert nops to increase dual issue when it expects
17201it to increase performance. @var{n} can be a value from 0 to 10. A
17202smaller @var{n} will insert fewer nops. 10 is the default, 0 is the
17203same as @option{-mno-dual-nops}. Disabled with @option{-Os}.
17204
17205@item -mhint-max-nops=@var{n}
17206@opindex mhint-max-nops
17207Maximum number of nops to insert for a branch hint. A branch hint must
17208be at least 8 instructions away from the branch it is effecting. GCC
17209will insert up to @var{n} nops to enforce this, otherwise it will not
17210generate the branch hint.
17211
17212@item -mhint-max-distance=@var{n}
17213@opindex mhint-max-distance
17214The encoding of the branch hint instruction limits the hint to be within
17215256 instructions of the branch it is effecting. By default, GCC makes
7a61cf6f 17216sure it is within 125.
9dcc2e87
TS
17217
17218@item -msafe-hints
17219@opindex msafe-hints
17220Work around a hardware bug which causes the SPU to stall indefinitely.
17221By default, GCC will insert the @code{hbrp} instruction to make sure
17222this stall won't happen.
17223
85d9c13c
TS
17224@end table
17225
39bc1876
NS
17226@node System V Options
17227@subsection Options for System V
70899148 17228
39bc1876
NS
17229These additional options are available on System V Release 4 for
17230compatibility with other compilers on those systems:
70899148 17231
39bc1876
NS
17232@table @gcctabopt
17233@item -G
17234@opindex G
17235Create a shared object.
17236It is recommended that @option{-symbolic} or @option{-shared} be used instead.
70899148 17237
39bc1876
NS
17238@item -Qy
17239@opindex Qy
17240Identify the versions of each tool used by the compiler, in a
17241@code{.ident} assembler directive in the output.
70899148 17242
39bc1876
NS
17243@item -Qn
17244@opindex Qn
17245Refrain from adding @code{.ident} directives to the output file (this is
17246the default).
70899148 17247
39bc1876
NS
17248@item -YP,@var{dirs}
17249@opindex YP
17250Search the directories @var{dirs}, and no others, for libraries
17251specified with @option{-l}.
70899148 17252
39bc1876
NS
17253@item -Ym,@var{dir}
17254@opindex Ym
17255Look in the directory @var{dir} to find the M4 preprocessor.
17256The assembler uses this option.
17257@c This is supposed to go with a -Yd for predefined M4 macro files, but
17258@c the generic assembler that comes with Solaris takes just -Ym.
17259@end table
70899148 17260
39bc1876
NS
17261@node V850 Options
17262@subsection V850 Options
17263@cindex V850 Options
70899148 17264
39bc1876 17265These @samp{-m} options are defined for V850 implementations:
70899148 17266
39bc1876
NS
17267@table @gcctabopt
17268@item -mlong-calls
17269@itemx -mno-long-calls
17270@opindex mlong-calls
17271@opindex mno-long-calls
17272Treat all calls as being far away (near). If calls are assumed to be
17273far away, the compiler will always load the functions address up into a
17274register, and call indirect through the pointer.
70899148 17275
39bc1876
NS
17276@item -mno-ep
17277@itemx -mep
17278@opindex mno-ep
17279@opindex mep
17280Do not optimize (do optimize) basic blocks that use the same index
17281pointer 4 or more times to copy pointer into the @code{ep} register, and
17282use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
17283option is on by default if you optimize.
70899148 17284
39bc1876
NS
17285@item -mno-prolog-function
17286@itemx -mprolog-function
17287@opindex mno-prolog-function
17288@opindex mprolog-function
17289Do not use (do use) external functions to save and restore registers
17290at the prologue and epilogue of a function. The external functions
17291are slower, but use less code space if more than one function saves
17292the same number of registers. The @option{-mprolog-function} option
17293is on by default if you optimize.
70899148 17294
39bc1876
NS
17295@item -mspace
17296@opindex mspace
17297Try to make the code as small as possible. At present, this just turns
17298on the @option{-mep} and @option{-mprolog-function} options.
70899148 17299
39bc1876
NS
17300@item -mtda=@var{n}
17301@opindex mtda
17302Put static or global variables whose size is @var{n} bytes or less into
17303the tiny data area that register @code{ep} points to. The tiny data
17304area can hold up to 256 bytes in total (128 bytes for byte references).
70899148 17305
39bc1876
NS
17306@item -msda=@var{n}
17307@opindex msda
17308Put static or global variables whose size is @var{n} bytes or less into
17309the small data area that register @code{gp} points to. The small data
17310area can hold up to 64 kilobytes.
70899148 17311
39bc1876
NS
17312@item -mzda=@var{n}
17313@opindex mzda
17314Put static or global variables whose size is @var{n} bytes or less into
17315the first 32 kilobytes of memory.
70899148 17316
39bc1876
NS
17317@item -mv850
17318@opindex mv850
17319Specify that the target processor is the V850.
70899148 17320
39bc1876
NS
17321@item -mbig-switch
17322@opindex mbig-switch
17323Generate code suitable for big switch tables. Use this option only if
17324the assembler/linker complain about out of range branches within a switch
17325table.
70899148 17326
39bc1876
NS
17327@item -mapp-regs
17328@opindex mapp-regs
17329This option will cause r2 and r5 to be used in the code generated by
17330the compiler. This setting is the default.
70899148 17331
39bc1876
NS
17332@item -mno-app-regs
17333@opindex mno-app-regs
17334This option will cause r2 and r5 to be treated as fixed registers.
70899148 17335
223a9d64
N
17336@item -mv850e2v3
17337@opindex mv850e2v3
17338Specify that the target processor is the V850E2V3. The preprocessor
17339constants @samp{__v850e2v3__} will be defined if
17340this option is used.
17341
17342@item -mv850e2
17343@opindex mv850e2
17344Specify that the target processor is the V850E2. The preprocessor
17345constants @samp{__v850e2__} will be defined if
17346
39bc1876
NS
17347@item -mv850e1
17348@opindex mv850e1
17349Specify that the target processor is the V850E1. The preprocessor
17350constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
70899148 17351
39bc1876
NS
17352@item -mv850e
17353@opindex mv850e
8a36672b 17354Specify that the target processor is the V850E@. The preprocessor
39bc1876 17355constant @samp{__v850e__} will be defined if this option is used.
70899148 17356
39bc1876 17357If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
223a9d64 17358nor @option{-mv850e2} nor @option{-mv850e2v3}
39bc1876
NS
17359are defined then a default target processor will be chosen and the
17360relevant @samp{__v850*__} preprocessor constant will be defined.
70899148 17361
39bc1876
NS
17362The preprocessor constants @samp{__v850} and @samp{__v851__} are always
17363defined, regardless of which processor variant is the target.
70899148 17364
39bc1876
NS
17365@item -mdisable-callt
17366@opindex mdisable-callt
17367This option will suppress generation of the CALLT instruction for the
223a9d64 17368v850e, v850e1, v850e2 and v850e2v3 flavors of the v850 architecture. The default is
39bc1876 17369@option{-mno-disable-callt} which allows the CALLT instruction to be used.
70899148 17370
39bc1876 17371@end table
70899148 17372
39bc1876
NS
17373@node VAX Options
17374@subsection VAX Options
17375@cindex VAX options
70899148 17376
39bc1876 17377These @samp{-m} options are defined for the VAX:
70899148 17378
39bc1876
NS
17379@table @gcctabopt
17380@item -munix
17381@opindex munix
17382Do not output certain jump instructions (@code{aobleq} and so on)
17383that the Unix assembler for the VAX cannot handle across long
17384ranges.
70899148 17385
39bc1876
NS
17386@item -mgnu
17387@opindex mgnu
17388Do output those jump instructions, on the assumption that you
17389will assemble with the GNU assembler.
70899148 17390
39bc1876
NS
17391@item -mg
17392@opindex mg
17393Output code for g-format floating point numbers instead of d-format.
17394@end table
70899148 17395
cd773ac4
RS
17396@node VxWorks Options
17397@subsection VxWorks Options
17398@cindex VxWorks Options
17399
17400The options in this section are defined for all VxWorks targets.
17401Options specific to the target hardware are listed with the other
17402options for that target.
17403
17404@table @gcctabopt
17405@item -mrtp
17406@opindex mrtp
17407GCC can generate code for both VxWorks kernels and real time processes
17408(RTPs). This option switches from the former to the latter. It also
17409defines the preprocessor macro @code{__RTP__}.
17410
17411@item -non-static
17412@opindex non-static
17413Link an RTP executable against shared libraries rather than static
17414libraries. The options @option{-static} and @option{-shared} can
17415also be used for RTPs (@pxref{Link Options}); @option{-static}
17416is the default.
17417
17418@item -Bstatic
17419@itemx -Bdynamic
17420@opindex Bstatic
17421@opindex Bdynamic
17422These options are passed down to the linker. They are defined for
17423compatibility with Diab.
17424
17425@item -Xbind-lazy
17426@opindex Xbind-lazy
17427Enable lazy binding of function calls. This option is equivalent to
17428@option{-Wl,-z,now} and is defined for compatibility with Diab.
17429
17430@item -Xbind-now
17431@opindex Xbind-now
17432Disable lazy binding of function calls. This option is the default and
17433is defined for compatibility with Diab.
17434@end table
17435
39bc1876
NS
17436@node x86-64 Options
17437@subsection x86-64 Options
17438@cindex x86-64 options
70899148 17439
39bc1876 17440These are listed under @xref{i386 and x86-64 Options}.
70899148 17441
46994828
KT
17442@node i386 and x86-64 Windows Options
17443@subsection i386 and x86-64 Windows Options
17444@cindex i386 and x86-64 Windows Options
17445
17446These additional options are available for Windows targets:
17447
17448@table @gcctabopt
17449@item -mconsole
17450@opindex mconsole
17451This option is available for Cygwin and MinGW targets. It
17452specifies that a console application is to be generated, by
17453instructing the linker to set the PE header subsystem type
17454required for console applications.
c782f1dd 17455This is the default behavior for Cygwin and MinGW targets.
46994828 17456
46994828
KT
17457@item -mdll
17458@opindex mdll
17459This option is available for Cygwin and MinGW targets. It
17460specifies that a DLL - a dynamic link library - is to be
17461generated, enabling the selection of the required runtime
17462startup object and entry point.
17463
17464@item -mnop-fun-dllimport
17465@opindex mnop-fun-dllimport
17466This option is available for Cygwin and MinGW targets. It
17467specifies that the dllimport attribute should be ignored.
17468
17469@item -mthread
17470@opindex mthread
17471This option is available for MinGW targets. It specifies
17472that MinGW-specific thread support is to be used.
17473
35091630
KT
17474@item -municode
17475@opindex municode
17476This option is available for mingw-w64 targets. It specifies
17477that the UNICODE macro is getting pre-defined and that the
a4ce9883 17478unicode capable runtime startup code is chosen.
35091630 17479
46994828
KT
17480@item -mwin32
17481@opindex mwin32
17482This option is available for Cygwin and MinGW targets. It
17483specifies that the typical Windows pre-defined macros are to
17484be set in the pre-processor, but does not influence the choice
17485of runtime library/startup code.
17486
17487@item -mwindows
17488@opindex mwindows
17489This option is available for Cygwin and MinGW targets. It
17490specifies that a GUI application is to be generated by
17491instructing the linker to set the PE header subsystem type
17492appropriately.
233215fe 17493
41ca8d08
KT
17494@item -fno-set-stack-executable
17495@opindex fno-set-stack-executable
17496This option is available for MinGW targets. It specifies that
17497the executable flag for stack used by nested functions isn't
17498set. This is necessary for binaries running in kernel mode of
17499Windows, as there the user32 API, which is used to set executable
17500privileges, isn't available.
17501
233215fe
DK
17502@item -mpe-aligned-commons
17503@opindex mpe-aligned-commons
17504This option is available for Cygwin and MinGW targets. It
7a61cf6f 17505specifies that the GNU extension to the PE file format that
233215fe
DK
17506permits the correct alignment of COMMON variables should be
17507used when generating code. It will be enabled by default if
17508GCC detects that the target assembler found during configuration
17509supports the feature.
46994828
KT
17510@end table
17511
6f401211 17512See also under @ref{i386 and x86-64 Options} for standard options.
46994828 17513
39bc1876
NS
17514@node Xstormy16 Options
17515@subsection Xstormy16 Options
17516@cindex Xstormy16 Options
70899148 17517
39bc1876 17518These options are defined for Xstormy16:
70899148 17519
39bc1876
NS
17520@table @gcctabopt
17521@item -msim
17522@opindex msim
17523Choose startup files and linker script suitable for the simulator.
70899148
BS
17524@end table
17525
03984308
BW
17526@node Xtensa Options
17527@subsection Xtensa Options
17528@cindex Xtensa Options
17529
6cedbe44 17530These options are supported for Xtensa targets:
03984308
BW
17531
17532@table @gcctabopt
f42f5a1b
BW
17533@item -mconst16
17534@itemx -mno-const16
17535@opindex mconst16
17536@opindex mno-const16
6c2e8d1c
BW
17537Enable or disable use of @code{CONST16} instructions for loading
17538constant values. The @code{CONST16} instruction is currently not a
17539standard option from Tensilica. When enabled, @code{CONST16}
17540instructions are always used in place of the standard @code{L32R}
17541instructions. The use of @code{CONST16} is enabled by default only if
17542the @code{L32R} instruction is not available.
17543
03984308
BW
17544@item -mfused-madd
17545@itemx -mno-fused-madd
17546@opindex mfused-madd
17547@opindex mno-fused-madd
17548Enable or disable use of fused multiply/add and multiply/subtract
17549instructions in the floating-point option. This has no effect if the
17550floating-point option is not also enabled. Disabling fused multiply/add
17551and multiply/subtract instructions forces the compiler to use separate
17552instructions for the multiply and add/subtract operations. This may be
17553desirable in some cases where strict IEEE 754-compliant results are
17554required: the fused multiply add/subtract instructions do not round the
17555intermediate result, thereby producing results with @emph{more} bits of
17556precision than specified by the IEEE standard. Disabling fused multiply
17557add/subtract instructions also ensures that the program output is not
17558sensitive to the compiler's ability to combine multiply and add/subtract
17559operations.
17560
66e58b33
BW
17561@item -mserialize-volatile
17562@itemx -mno-serialize-volatile
17563@opindex mserialize-volatile
17564@opindex mno-serialize-volatile
17565When this option is enabled, GCC inserts @code{MEMW} instructions before
17566@code{volatile} memory references to guarantee sequential consistency.
17567The default is @option{-mserialize-volatile}. Use
17568@option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
17569
1b408ba1
SA
17570@item -mforce-no-pic
17571@opindex mforce-no-pic
17572For targets, like GNU/Linux, where all user-mode Xtensa code must be
17573position-independent code (PIC), this option disables PIC for compiling
17574kernel code.
17575
03984308
BW
17576@item -mtext-section-literals
17577@itemx -mno-text-section-literals
17578@opindex mtext-section-literals
17579@opindex mno-text-section-literals
17580Control the treatment of literal pools. The default is
17581@option{-mno-text-section-literals}, which places literals in a separate
17582section in the output file. This allows the literal pool to be placed
17583in a data RAM/ROM, and it also allows the linker to combine literal
17584pools from separate object files to remove redundant literals and
17585improve code size. With @option{-mtext-section-literals}, the literals
17586are interspersed in the text section in order to keep them as close as
17587possible to their references. This may be necessary for large assembly
17588files.
17589
17590@item -mtarget-align
17591@itemx -mno-target-align
17592@opindex mtarget-align
17593@opindex mno-target-align
17594When this option is enabled, GCC instructs the assembler to
17595automatically align instructions to reduce branch penalties at the
17596expense of some code density. The assembler attempts to widen density
17597instructions to align branch targets and the instructions following call
17598instructions. If there are not enough preceding safe density
17599instructions to align a target, no widening will be performed. The
17600default is @option{-mtarget-align}. These options do not affect the
17601treatment of auto-aligned instructions like @code{LOOP}, which the
17602assembler will always align, either by widening density instructions or
17603by inserting no-op instructions.
17604
17605@item -mlongcalls
17606@itemx -mno-longcalls
17607@opindex mlongcalls
17608@opindex mno-longcalls
17609When this option is enabled, GCC instructs the assembler to translate
17610direct calls to indirect calls unless it can determine that the target
17611of a direct call is in the range allowed by the call instruction. This
17612translation typically occurs for calls to functions in other source
17613files. Specifically, the assembler translates a direct @code{CALL}
17614instruction into an @code{L32R} followed by a @code{CALLX} instruction.
17615The default is @option{-mno-longcalls}. This option should be used in
17616programs where the call target can potentially be out of range. This
17617option is implemented in the assembler, not the compiler, so the
17618assembly code generated by GCC will still show direct call
17619instructions---look at the disassembled object code to see the actual
17620instructions. Note that the assembler will use an indirect call for
17621every cross-file call, not just those that really will be out of range.
17622@end table
17623
39bc1876
NS
17624@node zSeries Options
17625@subsection zSeries Options
17626@cindex zSeries options
17627
17628These are listed under @xref{S/390 and zSeries Options}.
17629
74291a4b
MM
17630@node Code Gen Options
17631@section Options for Code Generation Conventions
17632@cindex code generation conventions
17633@cindex options, code generation
17634@cindex run-time options
17635
17636These machine-independent options control the interface conventions
17637used in code generation.
17638
17639Most of them have both positive and negative forms; the negative form
630d3d5a 17640of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
74291a4b
MM
17641one of the forms is listed---the one which is not the default. You
17642can figure out the other form by either removing @samp{no-} or adding
17643it.
17644
2642624b 17645@table @gcctabopt
d4463dfc
JQ
17646@item -fbounds-check
17647@opindex fbounds-check
17648For front-ends that support it, generate additional code to check that
17649indices used to access arrays are within the declared range. This is
dc5abe77 17650currently only supported by the Java and Fortran front-ends, where
d4463dfc
JQ
17651this option defaults to true and false respectively.
17652
17653@item -ftrapv
17654@opindex ftrapv
17655This option generates traps for signed overflow on addition, subtraction,
17656multiplication operations.
17657
4fa26a60
RS
17658@item -fwrapv
17659@opindex fwrapv
17660This option instructs the compiler to assume that signed arithmetic
17661overflow of addition, subtraction and multiplication wraps around
c0cbdbd9 17662using twos-complement representation. This flag enables some optimizations
aa58883c 17663and disables others. This option is enabled by default for the Java
4fa26a60
RS
17664front-end, as required by the Java language specification.
17665
956d6950 17666@item -fexceptions
cd3bb277 17667@opindex fexceptions
767094dd 17668Enable exception handling. Generates extra code needed to propagate
f0523f02 17669exceptions. For some targets, this implies GCC will generate frame
c5c76735
JL
17670unwind information for all functions, which can produce significant data
17671size overhead, although it does not affect execution. If you do not
f0523f02 17672specify this option, GCC will enable it by default for languages like
90ecce3e 17673C++ which normally require exception handling, and disable it for
c5c76735
JL
17674languages like C that do not normally require it. However, you may need
17675to enable this option when compiling C code that needs to interoperate
17676properly with exception handlers written in C++. You may also wish to
17677disable this option if you are compiling older C++ programs that don't
17678use exception handling.
956d6950 17679
6cfc0341
RH
17680@item -fnon-call-exceptions
17681@opindex fnon-call-exceptions
17682Generate code that allows trapping instructions to throw exceptions.
17683Note that this requires platform-specific runtime support that does
17684not exist everywhere. Moreover, it only allows @emph{trapping}
e979f9e8 17685instructions to throw exceptions, i.e.@: memory references or floating
6cfc0341
RH
17686point instructions. It does not allow exceptions to be thrown from
17687arbitrary signal handlers such as @code{SIGALRM}.
17688
14a774a9 17689@item -funwind-tables
cd3bb277 17690@opindex funwind-tables
bedc7537 17691Similar to @option{-fexceptions}, except that it will just generate any needed
14a774a9
RK
17692static data, but will not affect the generated code in any other way.
17693You will normally not enable this option; instead, a language processor
17694that needs this handling would enable it on your behalf.
17695
b932f770 17696@item -fasynchronous-unwind-tables
2a9dc917 17697@opindex fasynchronous-unwind-tables
b932f770
JH
17698Generate unwind table in dwarf2 format, if supported by target machine. The
17699table is exact at each instruction boundary, so it can be used for stack
17700unwinding from asynchronous events (such as debugger or garbage collector).
17701
74291a4b 17702@item -fpcc-struct-return
cd3bb277 17703@opindex fpcc-struct-return
74291a4b
MM
17704Return ``short'' @code{struct} and @code{union} values in memory like
17705longer ones, rather than in registers. This convention is less
17706efficient, but it has the advantage of allowing intercallability between
a9c60612
JJ
17707GCC-compiled files and files compiled with other compilers, particularly
17708the Portable C Compiler (pcc).
74291a4b
MM
17709
17710The precise convention for returning structures in memory depends
17711on the target configuration macros.
17712
17713Short structures and unions are those whose size and alignment match
17714that of some integer type.
17715
a9c60612
JJ
17716@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
17717switch is not binary compatible with code compiled with the
17718@option{-freg-struct-return} switch.
17719Use it to conform to a non-default application binary interface.
17720
74291a4b 17721@item -freg-struct-return
cd3bb277 17722@opindex freg-struct-return
9c34dbbf
ZW
17723Return @code{struct} and @code{union} values in registers when possible.
17724This is more efficient for small structures than
17725@option{-fpcc-struct-return}.
74291a4b 17726
9c34dbbf 17727If you specify neither @option{-fpcc-struct-return} nor
630d3d5a 17728@option{-freg-struct-return}, GCC defaults to whichever convention is
0c2d1a2a 17729standard for the target. If there is no standard convention, GCC
9c34dbbf
ZW
17730defaults to @option{-fpcc-struct-return}, except on targets where GCC is
17731the principal compiler. In those cases, we can choose the standard, and
17732we chose the more efficient register return alternative.
74291a4b 17733
a9c60612
JJ
17734@strong{Warning:} code compiled with the @option{-freg-struct-return}
17735switch is not binary compatible with code compiled with the
17736@option{-fpcc-struct-return} switch.
17737Use it to conform to a non-default application binary interface.
17738
74291a4b 17739@item -fshort-enums
cd3bb277 17740@opindex fshort-enums
74291a4b
MM
17741Allocate to an @code{enum} type only as many bytes as it needs for the
17742declared range of possible values. Specifically, the @code{enum} type
17743will be equivalent to the smallest integer type which has enough room.
17744
a9c60612
JJ
17745@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
17746code that is not binary compatible with code generated without that switch.
17747Use it to conform to a non-default application binary interface.
17748
74291a4b 17749@item -fshort-double
cd3bb277 17750@opindex fshort-double
74291a4b
MM
17751Use the same size for @code{double} as for @code{float}.
17752
a9c60612
JJ
17753@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
17754code that is not binary compatible with code generated without that switch.
17755Use it to conform to a non-default application binary interface.
17756
17757@item -fshort-wchar
17758@opindex fshort-wchar
17759Override the underlying type for @samp{wchar_t} to be @samp{short
17760unsigned int} instead of the default for the target. This option is
17761useful for building programs to run under WINE@.
17762
17763@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
17764code that is not binary compatible with code generated without that switch.
17765Use it to conform to a non-default application binary interface.
17766
74291a4b 17767@item -fno-common
cd3bb277 17768@opindex fno-common
332459cd
SL
17769In C code, controls the placement of uninitialized global variables.
17770Unix C compilers have traditionally permitted multiple definitions of
17771such variables in different compilation units by placing the variables
7a61cf6f
NC
17772in a common block.
17773This is the behavior specified by @option{-fcommon}, and is the default
17774for GCC on most targets.
332459cd
SL
17775On the other hand, this behavior is not required by ISO C, and on some
17776targets may carry a speed or code size penalty on variable references.
7a61cf6f 17777The @option{-fno-common} option specifies that the compiler should place
332459cd
SL
17778uninitialized global variables in the data section of the object file,
17779rather than generating them as common blocks.
7a61cf6f 17780This has the effect that if the same variable is declared
332459cd
SL
17781(without @code{extern}) in two different compilations,
17782you will get a multiple-definition error when you link them.
7a61cf6f
NC
17783In this case, you must compile with @option{-fcommon} instead.
17784Compiling with @option{-fno-common} is useful on targets for which
332459cd
SL
17785it provides better performance, or if you wish to verify that the
17786program will work on other systems which always treat uninitialized
17787variable declarations this way.
74291a4b
MM
17788
17789@item -fno-ident
cd3bb277 17790@opindex fno-ident
74291a4b
MM
17791Ignore the @samp{#ident} directive.
17792
74291a4b 17793@item -finhibit-size-directive
cd3bb277 17794@opindex finhibit-size-directive
74291a4b
MM
17795Don't output a @code{.size} assembler directive, or anything else that
17796would cause trouble if the function is split in the middle, and the
17797two halves are placed at locations far apart in memory. This option is
17798used when compiling @file{crtstuff.c}; you should not need to use it
17799for anything else.
17800
17801@item -fverbose-asm
cd3bb277 17802@opindex fverbose-asm
74291a4b
MM
17803Put extra commentary information in the generated assembly code to
17804make it more readable. This option is generally only of use to those
17805who actually need to read the generated assembly code (perhaps while
17806debugging the compiler itself).
17807
630d3d5a 17808@option{-fno-verbose-asm}, the default, causes the
74291a4b
MM
17809extra information to be omitted and is useful when comparing two assembler
17810files.
17811
e0d9d0dd
NC
17812@item -frecord-gcc-switches
17813@opindex frecord-gcc-switches
17814This switch causes the command line that was used to invoke the
17815compiler to be recorded into the object file that is being created.
17816This switch is only implemented on some targets and the exact format
17817of the recording is target and binary file format dependent, but it
17818usually takes the form of a section containing ASCII text. This
17819switch is related to the @option{-fverbose-asm} switch, but that
17820switch only records information in the assembler output file as
17821comments, so it never reaches the object file.
17822
74291a4b 17823@item -fpic
cd3bb277 17824@opindex fpic
74291a4b
MM
17825@cindex global offset table
17826@cindex PIC
17827Generate position-independent code (PIC) suitable for use in a shared
17828library, if supported for the target machine. Such code accesses all
161d7b59 17829constant addresses through a global offset table (GOT)@. The dynamic
861bb6c1 17830loader resolves the GOT entries when the program starts (the dynamic
0c2d1a2a 17831loader is not part of GCC; it is part of the operating system). If
861bb6c1
JL
17832the GOT size for the linked executable exceeds a machine-specific
17833maximum size, you get an error message from the linker indicating that
630d3d5a 17834@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
b6e69d94 17835instead. (These maximums are 8k on the SPARC and 32k
861bb6c1 17836on the m68k and RS/6000. The 386 has no such limit.)
74291a4b
MM
17837
17838Position-independent code requires special support, and therefore works
0c2d1a2a 17839only on certain machines. For the 386, GCC supports PIC for System V
74291a4b
MM
17840but not for the Sun 386i. Code generated for the IBM RS/6000 is always
17841position-independent.
17842
3d119f8f
KG
17843When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17844are defined to 1.
17845
74291a4b 17846@item -fPIC
cd3bb277 17847@opindex fPIC
74291a4b
MM
17848If supported for the target machine, emit position-independent code,
17849suitable for dynamic linking and avoiding any limit on the size of the
068d4f38
BE
17850global offset table. This option makes a difference on the m68k,
17851PowerPC and SPARC@.
74291a4b
MM
17852
17853Position-independent code requires special support, and therefore works
17854only on certain machines.
17855
3d119f8f
KG
17856When this flag is set, the macros @code{__pic__} and @code{__PIC__}
17857are defined to 2.
17858
24a4dd31
JJ
17859@item -fpie
17860@itemx -fPIE
17861@opindex fpie
17862@opindex fPIE
17863These options are similar to @option{-fpic} and @option{-fPIC}, but
17864generated position independent code can be only linked into executables.
17865Usually these options are used when @option{-pie} GCC option will be
17866used during linking.
17867
7c0ffd09
RS
17868@option{-fpie} and @option{-fPIE} both define the macros
17869@code{__pie__} and @code{__PIE__}. The macros have the value 1
17870for @option{-fpie} and 2 for @option{-fPIE}.
17871
82c0180d
JM
17872@item -fno-jump-tables
17873@opindex fno-jump-tables
17874Do not use jump tables for switch statements even where it would be
17875more efficient than other code generation strategies. This option is
17876of use in conjunction with @option{-fpic} or @option{-fPIC} for
17877building code which forms part of a dynamic linker and cannot
17878reference the address of a jump table. On some targets, jump tables
17879do not require a GOT and this option is not needed.
17880
74291a4b 17881@item -ffixed-@var{reg}
cd3bb277 17882@opindex ffixed
74291a4b
MM
17883Treat the register named @var{reg} as a fixed register; generated code
17884should never refer to it (except perhaps as a stack pointer, frame
17885pointer or in some other fixed role).
17886
17887@var{reg} must be the name of a register. The register names accepted
17888are machine-specific and are defined in the @code{REGISTER_NAMES}
17889macro in the machine description macro file.
17890
17891This flag does not have a negative form, because it specifies a
17892three-way choice.
17893
17894@item -fcall-used-@var{reg}
cd3bb277 17895@opindex fcall-used
956d6950 17896Treat the register named @var{reg} as an allocable register that is
74291a4b
MM
17897clobbered by function calls. It may be allocated for temporaries or
17898variables that do not live across a call. Functions compiled this way
17899will not save and restore the register @var{reg}.
17900
cb2fdc84
GRK
17901It is an error to used this flag with the frame pointer or stack pointer.
17902Use of this flag for other registers that have fixed pervasive roles in
17903the machine's execution model will produce disastrous results.
74291a4b
MM
17904
17905This flag does not have a negative form, because it specifies a
17906three-way choice.
17907
17908@item -fcall-saved-@var{reg}
cd3bb277 17909@opindex fcall-saved
956d6950 17910Treat the register named @var{reg} as an allocable register saved by
74291a4b
MM
17911functions. It may be allocated even for temporaries or variables that
17912live across a call. Functions compiled this way will save and restore
17913the register @var{reg} if they use it.
17914
cb2fdc84
GRK
17915It is an error to used this flag with the frame pointer or stack pointer.
17916Use of this flag for other registers that have fixed pervasive roles in
17917the machine's execution model will produce disastrous results.
74291a4b
MM
17918
17919A different sort of disaster will result from the use of this flag for
17920a register in which function values may be returned.
17921
17922This flag does not have a negative form, because it specifies a
17923three-way choice.
17924
467cecf3 17925@item -fpack-struct[=@var{n}]
cd3bb277 17926@opindex fpack-struct
467cecf3 17927Without a value specified, pack all structure members together without
8a36672b 17928holes. When a value is specified (which must be a small power of two), pack
467cecf3
JB
17929structure members according to this value, representing the maximum
17930alignment (that is, objects with default alignment requirements larger than
17931this will be output potentially unaligned at the next fitting location.
a9c60612
JJ
17932
17933@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
17934code that is not binary compatible with code generated without that switch.
3364c33b 17935Additionally, it makes the code suboptimal.
a9c60612 17936Use it to conform to a non-default application binary interface.
74291a4b 17937
07417085 17938@item -finstrument-functions
cd3bb277 17939@opindex finstrument-functions
07417085
KR
17940Generate instrumentation calls for entry and exit to functions. Just
17941after function entry and just before function exit, the following
17942profiling functions will be called with the address of the current
17943function and its call site. (On some platforms,
17944@code{__builtin_return_address} does not work beyond the current
17945function, so the call site information may not be available to the
17946profiling functions otherwise.)
17947
3ab51846 17948@smallexample
310668e8
JM
17949void __cyg_profile_func_enter (void *this_fn,
17950 void *call_site);
17951void __cyg_profile_func_exit (void *this_fn,
17952 void *call_site);
3ab51846 17953@end smallexample
07417085
KR
17954
17955The first argument is the address of the start of the current function,
17956which may be looked up exactly in the symbol table.
17957
17958This instrumentation is also done for functions expanded inline in other
17959functions. The profiling calls will indicate where, conceptually, the
17960inline function is entered and exited. This means that addressable
17961versions of such functions must be available. If all your uses of a
17962function are expanded inline, this may mean an additional expansion of
17963code size. If you use @samp{extern inline} in your C code, an
17964addressable version of such functions must be provided. (This is
17965normally the case anyways, but if you get lucky and the optimizer always
17966expands the functions inline, you might have gotten away without
17967providing static copies.)
17968
17969A function may be given the attribute @code{no_instrument_function}, in
17970which case this instrumentation will not be done. This can be used, for
17971example, for the profiling functions listed above, high-priority
17972interrupt routines, and any functions from which the profiling functions
17973cannot safely be called (perhaps signal handlers, if the profiling
17974routines generate output or allocate memory).
17975
8d5a7d1f
ILT
17976@item -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{}
17977@opindex finstrument-functions-exclude-file-list
17978
17979Set the list of functions that are excluded from instrumentation (see
17980the description of @code{-finstrument-functions}). If the file that
17981contains a function definition matches with one of @var{file}, then
17982that function is not instrumented. The match is done on substrings:
17983if the @var{file} parameter is a substring of the file name, it is
17984considered to be a match.
17985
ab940b73
RW
17986For example:
17987
17988@smallexample
17989-finstrument-functions-exclude-file-list=/bits/stl,include/sys
17990@end smallexample
17991
17992@noindent
8d5a7d1f
ILT
17993will exclude any inline function defined in files whose pathnames
17994contain @code{/bits/stl} or @code{include/sys}.
17995
17996If, for some reason, you want to include letter @code{','} in one of
17997@var{sym}, write @code{'\,'}. For example,
17998@code{-finstrument-functions-exclude-file-list='\,\,tmp'}
17999(note the single quote surrounding the option).
18000
18001@item -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{}
18002@opindex finstrument-functions-exclude-function-list
18003
18004This is similar to @code{-finstrument-functions-exclude-file-list},
18005but this option sets the list of function names to be excluded from
18006instrumentation. The function name to be matched is its user-visible
18007name, such as @code{vector<int> blah(const vector<int> &)}, not the
18008internal mangled name (e.g., @code{_Z4blahRSt6vectorIiSaIiEE}). The
18009match is done on substrings: if the @var{sym} parameter is a substring
4f1e4960
JM
18010of the function name, it is considered to be a match. For C99 and C++
18011extended identifiers, the function name must be given in UTF-8, not
18012using universal character names.
8d5a7d1f 18013
861bb6c1 18014@item -fstack-check
cd3bb277 18015@opindex fstack-check
861bb6c1
JL
18016Generate code to verify that you do not go beyond the boundary of the
18017stack. You should specify this flag if you are running in an
18018environment with multiple threads, but only rarely need to specify it in
18019a single-threaded environment since stack overflow is automatically
18020detected on nearly all systems if there is only one stack.
18021
a157febd 18022Note that this switch does not actually cause checking to be done; the
b38f3813
EB
18023operating system or the language runtime must do that. The switch causes
18024generation of code to ensure that they see the stack being extended.
18025
18026You can additionally specify a string parameter: @code{no} means no
18027checking, @code{generic} means force the use of old-style checking,
18028@code{specific} means use the best checking method and is equivalent
18029to bare @option{-fstack-check}.
18030
18031Old-style checking is a generic mechanism that requires no specific
18032target support in the compiler but comes with the following drawbacks:
18033
18034@enumerate
18035@item
18036Modified allocation strategy for large objects: they will always be
18037allocated dynamically if their size exceeds a fixed threshold.
18038
18039@item
18040Fixed limit on the size of the static frame of functions: when it is
18041topped by a particular function, stack checking is not reliable and
18042a warning is issued by the compiler.
18043
18044@item
18045Inefficiency: because of both the modified allocation strategy and the
18046generic implementation, the performances of the code are hampered.
18047@end enumerate
18048
18049Note that old-style stack checking is also the fallback method for
18050@code{specific} if no target support has been added in the compiler.
a157febd
GK
18051
18052@item -fstack-limit-register=@var{reg}
18053@itemx -fstack-limit-symbol=@var{sym}
18054@itemx -fno-stack-limit
cd3bb277
JM
18055@opindex fstack-limit-register
18056@opindex fstack-limit-symbol
18057@opindex fno-stack-limit
a157febd
GK
18058Generate code to ensure that the stack does not grow beyond a certain value,
18059either the value of a register or the address of a symbol. If the stack
18060would grow beyond the value, a signal is raised. For most targets,
18061the signal is raised before the stack overruns the boundary, so
18062it is possible to catch the signal without taking special precautions.
18063
9c34dbbf
ZW
18064For instance, if the stack starts at absolute address @samp{0x80000000}
18065and grows downwards, you can use the flags
18066@option{-fstack-limit-symbol=__stack_limit} and
18067@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
18068of 128KB@. Note that this may only work with the GNU linker.
a157febd 18069
7458026b
ILT
18070@item -fsplit-stack
18071@opindex fsplit-stack
18072Generate code to automatically split the stack before it overflows.
18073The resulting program has a discontiguous stack which can only
18074overflow if the program is unable to allocate any more memory. This
18075is most useful when running threaded programs, as it is no longer
18076necessary to calculate a good stack size to use for each thread. This
18077is currently only implemented for the i386 and x86_64 backends running
18078GNU/Linux.
18079
18080When code compiled with @option{-fsplit-stack} calls code compiled
18081without @option{-fsplit-stack}, there may not be much stack space
18082available for the latter code to run. If compiling all code,
18083including library code, with @option{-fsplit-stack} is not an option,
18084then the linker can fix up these calls so that the code compiled
18085without @option{-fsplit-stack} always has a large stack. Support for
18086this is implemented in the gold linker in GNU binutils release 2.21
18087and later.
18088
19283265 18089@item -fleading-underscore
cd3bb277 18090@opindex fleading-underscore
695ac33f 18091This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19283265
RH
18092change the way C symbols are represented in the object file. One use
18093is to help link with legacy assembly code.
18094
a9c60612
JJ
18095@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
18096generate code that is not binary compatible with code generated without that
18097switch. Use it to conform to a non-default application binary interface.
18098Not all targets provide complete support for this switch.
3d78f2e9
RH
18099
18100@item -ftls-model=@var{model}
d228aace 18101@opindex ftls-model
3d78f2e9
RH
18102Alter the thread-local storage model to be used (@pxref{Thread-Local}).
18103The @var{model} argument should be one of @code{global-dynamic},
18104@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
18105
18106The default without @option{-fpic} is @code{initial-exec}; with
18107@option{-fpic} the default is @code{global-dynamic}.
d7afec4b
ND
18108
18109@item -fvisibility=@var{default|internal|hidden|protected}
18110@opindex fvisibility
78466c0e 18111Set the default ELF image symbol visibility to the specified option---all
27ef2cdd 18112symbols will be marked with this unless overridden within the code.
d7afec4b 18113Using this feature can very substantially improve linking and
27ef2cdd 18114load times of shared object libraries, produce more optimized
d7afec4b
ND
18115code, provide near-perfect API export and prevent symbol clashes.
18116It is @strong{strongly} recommended that you use this in any shared objects
18117you distribute.
f0eb93a8 18118
d7afec4b
ND
18119Despite the nomenclature, @code{default} always means public ie;
18120available to be linked against from outside the shared object.
18121@code{protected} and @code{internal} are pretty useless in real-world
18122usage so the only other commonly used option will be @code{hidden}.
78466c0e
JM
18123The default if @option{-fvisibility} isn't specified is
18124@code{default}, i.e., make every
18125symbol public---this causes the same behavior as previous versions of
8a36672b 18126GCC@.
f0eb93a8 18127
d7afec4b
ND
18128A good explanation of the benefits offered by ensuring ELF
18129symbols have the correct visibility is given by ``How To Write
18130Shared Libraries'' by Ulrich Drepper (which can be found at
78466c0e 18131@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
d7afec4b
ND
18132solution made possible by this option to marking things hidden when
18133the default is public is to make the default hidden and mark things
8a36672b 18134public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
d7afec4b
ND
18135and @code{__attribute__ ((visibility("default")))} instead of
18136@code{__declspec(dllexport)} you get almost identical semantics with
8a36672b 18137identical syntax. This is a great boon to those working with
d7afec4b
ND
18138cross-platform projects.
18139
18140For those adding visibility support to existing code, you may find
8a36672b 18141@samp{#pragma GCC visibility} of use. This works by you enclosing
d7afec4b
ND
18142the declarations you wish to set visibility for with (for example)
18143@samp{#pragma GCC visibility push(hidden)} and
be1b1c9b
L
18144@samp{#pragma GCC visibility pop}.
18145Bear in mind that symbol visibility should be viewed @strong{as
d7afec4b
ND
18146part of the API interface contract} and thus all new code should
18147always specify visibility when it is not the default ie; declarations
18148only for use within the local DSO should @strong{always} be marked explicitly
78466c0e 18149as hidden as so to avoid PLT indirection overheads---making this
d7afec4b
ND
18150abundantly clear also aids readability and self-documentation of the code.
18151Note that due to ISO C++ specification requirements, operator new and
18152operator delete must always be of default visibility.
18153
46bdbc00
GK
18154Be aware that headers from outside your project, in particular system
18155headers and headers from any other library you use, may not be
18156expecting to be compiled with visibility other than the default. You
18157may need to explicitly say @samp{#pragma GCC visibility push(default)}
18158before including any such headers.
18159
b9e75696
JM
18160@samp{extern} declarations are not affected by @samp{-fvisibility}, so
18161a lot of code can be recompiled with @samp{-fvisibility=hidden} with
18162no modifications. However, this means that calls to @samp{extern}
18163functions with no explicit visibility will use the PLT, so it is more
18164effective to use @samp{__attribute ((visibility))} and/or
18165@samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
18166declarations should be treated as hidden.
18167
18168Note that @samp{-fvisibility} does affect C++ vague linkage
18169entities. This means that, for instance, an exception class that will
18170be thrown between DSOs must be explicitly marked with default
18171visibility so that the @samp{type_info} nodes will be unified between
18172the DSOs.
18173
ce84fa41 18174An overview of these techniques, their benefits and how to use them
ab940b73 18175is at @uref{http://gcc.gnu.org/@/wiki/@/Visibility}.
ce84fa41 18176
6a78b724 18177@item -fstrict-volatile-bitfields
c1721efb 18178@opindex fstrict-volatile-bitfields
6a78b724
DD
18179This option should be used if accesses to volatile bitfields (or other
18180structure fields, although the compiler usually honors those types
0d600fce
JZ
18181anyway) should use a single access of the width of the
18182field's type, aligned to a natural alignment if possible. For
6a78b724
DD
18183example, targets with memory-mapped peripheral registers might require
18184all such accesses to be 16 bits wide; with this flag the user could
18185declare all peripheral bitfields as ``unsigned short'' (assuming short
18186is 16 bits on these targets) to force GCC to use 16 bit accesses
18187instead of, perhaps, a more efficient 32 bit access.
18188
18189If this option is disabled, the compiler will use the most efficient
18190instruction. In the previous example, that might be a 32-bit load
18191instruction, even though that will access bytes that do not contain
18192any portion of the bitfield, or memory-mapped registers unrelated to
18193the one being updated.
18194
0d600fce 18195If the target requires strict alignment, and honoring the field
6a78b724 18196type would require violating this alignment, a warning is issued.
0d600fce
JZ
18197If the field has @code{packed} attribute, the access is done without
18198honoring the field type. If the field doesn't have @code{packed}
18199attribute, the access is done honoring the field type. In both cases,
18200GCC assumes that the user knows something about the target hardware
18201that it is unaware of.
6a78b724
DD
18202
18203The default value of this option is determined by the application binary
18204interface for the target processor.
18205
74291a4b
MM
18206@end table
18207
ee457005
JM
18208@c man end
18209
74291a4b 18210@node Environment Variables
0c2d1a2a 18211@section Environment Variables Affecting GCC
74291a4b
MM
18212@cindex environment variables
18213
ee457005 18214@c man begin ENVIRONMENT
0c2d1a2a
JB
18215This section describes several environment variables that affect how GCC
18216operates. Some of them work by specifying directories or prefixes to use
767094dd 18217when searching for various kinds of files. Some are used to specify other
46103ab4 18218aspects of the compilation environment.
74291a4b 18219
74291a4b 18220Note that you can also specify places to search using options such as
630d3d5a 18221@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
74291a4b 18222take precedence over places specified using environment variables, which
161d7b59 18223in turn take precedence over those specified by the configuration of GCC@.
b11cc610
JM
18224@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
18225GNU Compiler Collection (GCC) Internals}.
74291a4b 18226
bedc7537 18227@table @env
ab87f8c8
JL
18228@item LANG
18229@itemx LC_CTYPE
18230@c @itemx LC_COLLATE
18231@itemx LC_MESSAGES
18232@c @itemx LC_MONETARY
18233@c @itemx LC_NUMERIC
18234@c @itemx LC_TIME
18235@itemx LC_ALL
18236@findex LANG
18237@findex LC_CTYPE
18238@c @findex LC_COLLATE
18239@findex LC_MESSAGES
18240@c @findex LC_MONETARY
18241@c @findex LC_NUMERIC
18242@c @findex LC_TIME
18243@findex LC_ALL
18244@cindex locale
0c2d1a2a
JB
18245These environment variables control the way that GCC uses
18246localization information that allow GCC to work with different
18247national conventions. GCC inspects the locale categories
bedc7537 18248@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
ab87f8c8 18249so. These locale categories can be set to any value supported by your
0e6d31fb
JM
18250installation. A typical value is @samp{en_GB.UTF-8} for English in the United
18251Kingdom encoded in UTF-8.
ab87f8c8 18252
bedc7537 18253The @env{LC_CTYPE} environment variable specifies character
0c2d1a2a 18254classification. GCC uses it to determine the character boundaries in
ab87f8c8
JL
18255a string; this is needed for some multibyte encodings that contain quote
18256and escape characters that would otherwise be interpreted as a string
18257end or escape.
18258
bedc7537 18259The @env{LC_MESSAGES} environment variable specifies the language to
ab87f8c8
JL
18260use in diagnostic messages.
18261
bedc7537
NC
18262If the @env{LC_ALL} environment variable is set, it overrides the value
18263of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
18264and @env{LC_MESSAGES} default to the value of the @env{LANG}
0c2d1a2a 18265environment variable. If none of these variables are set, GCC
ab87f8c8
JL
18266defaults to traditional C English behavior.
18267
74291a4b
MM
18268@item TMPDIR
18269@findex TMPDIR
bedc7537 18270If @env{TMPDIR} is set, it specifies the directory to use for temporary
0c2d1a2a 18271files. GCC uses temporary files to hold the output of one stage of
74291a4b
MM
18272compilation which is to be used as input to the next stage: for example,
18273the output of the preprocessor, which is the input to the compiler
18274proper.
18275
18276@item GCC_EXEC_PREFIX
18277@findex GCC_EXEC_PREFIX
bedc7537 18278If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
74291a4b
MM
18279names of the subprograms executed by the compiler. No slash is added
18280when this prefix is combined with the name of a subprogram, but you can
18281specify a prefix that ends with a slash if you wish.
18282
f0523f02 18283If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
0deb20df
TT
18284an appropriate prefix to use based on the pathname it was invoked with.
18285
0c2d1a2a 18286If GCC cannot find the subprogram using the specified prefix, it
74291a4b
MM
18287tries looking in the usual places for the subprogram.
18288
bedc7537 18289The default value of @env{GCC_EXEC_PREFIX} is
fe037b8a
CD
18290@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
18291the installed compiler. In many cases @var{prefix} is the value
74291a4b
MM
18292of @code{prefix} when you ran the @file{configure} script.
18293
630d3d5a 18294Other prefixes specified with @option{-B} take precedence over this prefix.
74291a4b
MM
18295
18296This prefix is also used for finding files such as @file{crt0.o} that are
18297used for linking.
18298
18299In addition, the prefix is used in an unusual way in finding the
18300directories to search for header files. For each of the standard
8e5f33ff 18301directories whose name normally begins with @samp{/usr/local/lib/gcc}
bedc7537 18302(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
74291a4b 18303replacing that beginning with the specified prefix to produce an
630d3d5a 18304alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
74291a4b
MM
18305@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
18306These alternate directories are searched first; the standard directories
cb7ad97b
EC
18307come next. If a standard directory begins with the configured
18308@var{prefix} then the value of @var{prefix} is replaced by
fe037b8a 18309@env{GCC_EXEC_PREFIX} when looking for header files.
74291a4b
MM
18310
18311@item COMPILER_PATH
18312@findex COMPILER_PATH
bedc7537
NC
18313The value of @env{COMPILER_PATH} is a colon-separated list of
18314directories, much like @env{PATH}. GCC tries the directories thus
74291a4b 18315specified when searching for subprograms, if it can't find the
bedc7537 18316subprograms using @env{GCC_EXEC_PREFIX}.
74291a4b
MM
18317
18318@item LIBRARY_PATH
18319@findex LIBRARY_PATH
bedc7537
NC
18320The value of @env{LIBRARY_PATH} is a colon-separated list of
18321directories, much like @env{PATH}. When configured as a native compiler,
0c2d1a2a 18322GCC tries the directories thus specified when searching for special
bedc7537 18323linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
0c2d1a2a 18324using GCC also uses these directories when searching for ordinary
630d3d5a
JM
18325libraries for the @option{-l} option (but directories specified with
18326@option{-L} come first).
74291a4b 18327
56f48ce9
DB
18328@item LANG
18329@findex LANG
18330@cindex locale definition
767094dd 18331This variable is used to pass locale information to the compiler. One way in
56f48ce9
DB
18332which this information is used is to determine the character set to be used
18333when character literals, string literals and comments are parsed in C and C++.
18334When the compiler is configured to allow multibyte characters,
bedc7537 18335the following values for @env{LANG} are recognized:
56f48ce9 18336
2642624b 18337@table @samp
56f48ce9
DB
18338@item C-JIS
18339Recognize JIS characters.
18340@item C-SJIS
18341Recognize SJIS characters.
18342@item C-EUCJP
18343Recognize EUCJP characters.
18344@end table
18345
bedc7537 18346If @env{LANG} is not defined, or if it has some other value, then the
56f48ce9
DB
18347compiler will use mblen and mbtowc as defined by the default locale to
18348recognize and translate multibyte characters.
74291a4b
MM
18349@end table
18350
40adaa27
NB
18351@noindent
18352Some additional environments variables affect the behavior of the
18353preprocessor.
18354
18355@include cppenv.texi
18356
9d86bffc
JM
18357@c man end
18358
17211ab5
GK
18359@node Precompiled Headers
18360@section Using Precompiled Headers
18361@cindex precompiled headers
18362@cindex speed of compilation
18363
18364Often large projects have many header files that are included in every
18365source file. The time the compiler takes to process these header files
18366over and over again can account for nearly all of the time required to
18367build the project. To make builds faster, GCC allows users to
18368`precompile' a header file; then, if builds can use the precompiled
18369header file they will be much faster.
18370
18371To create a precompiled header file, simply compile it as you would any
18372other file, if necessary using the @option{-x} option to make the driver
18373treat it as a C or C++ header file. You will probably want to use a
18374tool like @command{make} to keep the precompiled header up-to-date when
18375the headers it contains change.
18376
18377A precompiled header file will be searched for when @code{#include} is
18378seen in the compilation. As it searches for the included file
24726b96 18379(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
17211ab5
GK
18380compiler looks for a precompiled header in each directory just before it
18381looks for the include file in that directory. The name searched for is
d8fad4ea 18382the name specified in the @code{#include} with @samp{.gch} appended. If
17211ab5
GK
18383the precompiled header file can't be used, it is ignored.
18384
18385For instance, if you have @code{#include "all.h"}, and you have
d8fad4ea 18386@file{all.h.gch} in the same directory as @file{all.h}, then the
17211ab5
GK
18387precompiled header file will be used if possible, and the original
18388header will be used otherwise.
18389
18390Alternatively, you might decide to put the precompiled header file in a
18391directory and use @option{-I} to ensure that directory is searched
18392before (or instead of) the directory containing the original header.
18393Then, if you want to check that the precompiled header file is always
18394used, you can put a file of the same name as the original header in this
18395directory containing an @code{#error} command.
18396
18397This also works with @option{-include}. So yet another way to use
18398precompiled headers, good for projects not designed with precompiled
18399header files in mind, is to simply take most of the header files used by
18400a project, include them from another header file, precompile that header
18401file, and @option{-include} the precompiled header. If the header files
18402have guards against multiple inclusion, they will be skipped because
18403they've already been included (in the precompiled header).
18404
18405If you need to precompile the same header file for different
18406languages, targets, or compiler options, you can instead make a
d8fad4ea 18407@emph{directory} named like @file{all.h.gch}, and put each precompiled
54e109ed
GK
18408header in the directory, perhaps using @option{-o}. It doesn't matter
18409what you call the files in the directory, every precompiled header in
18410the directory will be considered. The first precompiled header
18411encountered in the directory that is valid for this compilation will
18412be used; they're searched in no particular order.
17211ab5
GK
18413
18414There are many other possibilities, limited only by your imagination,
18415good sense, and the constraints of your build system.
18416
18417A precompiled header file can be used only when these conditions apply:
18418
18419@itemize
18420@item
18421Only one precompiled header can be used in a particular compilation.
54e109ed 18422
17211ab5
GK
18423@item
18424A precompiled header can't be used once the first C token is seen. You
18425can have preprocessor directives before a precompiled header; you can
18426even include a precompiled header from inside another header, so long as
18427there are no C tokens before the @code{#include}.
54e109ed 18428
17211ab5
GK
18429@item
18430The precompiled header file must be produced for the same language as
18431the current compilation. You can't use a C precompiled header for a C++
18432compilation.
54e109ed 18433
17211ab5 18434@item
3fd30b88
GK
18435The precompiled header file must have been produced by the same compiler
18436binary as the current compilation is using.
54e109ed 18437
17211ab5 18438@item
54e109ed
GK
18439Any macros defined before the precompiled header is included must
18440either be defined in the same way as when the precompiled header was
18441generated, or must not affect the precompiled header, which usually
0bdcd332 18442means that they don't appear in the precompiled header at all.
54e109ed
GK
18443
18444The @option{-D} option is one way to define a macro before a
18445precompiled header is included; using a @code{#define} can also do it.
18446There are also some options that define macros implicitly, like
18447@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
18448defined this way.
18449
18450@item If debugging information is output when using the precompiled
18451header, using @option{-g} or similar, the same kind of debugging information
18452must have been output when building the precompiled header. However,
18453a precompiled header built using @option{-g} can be used in a compilation
18454when no debugging information is being output.
18455
18456@item The same @option{-m} options must generally be used when building
18457and using the precompiled header. @xref{Submodel Options},
18458for any cases where this rule is relaxed.
18459
18460@item Each of the following options must be the same when building and using
18461the precompiled header:
18462
d6cc6ec9 18463@gccoptlist{-fexceptions}
54e109ed 18464
17211ab5 18465@item
54e109ed
GK
18466Some other command-line options starting with @option{-f},
18467@option{-p}, or @option{-O} must be defined in the same way as when
18468the precompiled header was generated. At present, it's not clear
18469which options are safe to change and which are not; the safest choice
18470is to use exactly the same options when generating and using the
18471precompiled header. The following are known to be safe:
18472
78681dbd
RS
18473@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
18474-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
18475-fsched-verbose=<number> -fschedule-insns -fvisibility= @gol
3fd30b88 18476-pedantic-errors}
54e109ed 18477
17211ab5
GK
18478@end itemize
18479
54e109ed
GK
18480For all of these except the last, the compiler will automatically
18481ignore the precompiled header if the conditions aren't met. If you
18482find an option combination that doesn't work and doesn't cause the
18483precompiled header to be ignored, please consider filing a bug report,
18484see @ref{Bugs}.
17211ab5 18485
c0d578e6 18486If you do use differing options when generating and using the
83c99486
KH
18487precompiled header, the actual behavior will be a mixture of the
18488behavior for the options. For instance, if you use @option{-g} to
c0d578e6
GK
18489generate the precompiled header but not when using it, you may or may
18490not get debugging information for routines in the precompiled header.