]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/invoke.texi
bfin-protos.h (enum bfin_cpu): Add BFIN_CPU_BF534, BFIN_CPU_BF536 and BFIN_CPU_BF561.
[thirdparty/gcc.git] / gcc / doc / invoke.texi
CommitLineData
d0a5eb32 1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
5b3e6663
PB
2@c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
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
JM
13Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
141999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
9d86bffc 15
77bd67cb 16Permission is granted to copy, distribute and/or modify this document
b3a8389d 17under the terms of the GNU Free Documentation License, Version 1.2 or
77bd67cb
JM
18any later version published by the Free Software Foundation; with the
19Invariant Sections being ``GNU General Public License'' and ``Funding
20Free Software'', the Front-Cover texts being (a) (see below), and with
21the Back-Cover Texts being (b) (see below). A copy of the license is
22included in the gfdl(7) man page.
9d86bffc 23
77bd67cb 24(a) The FSF's Front-Cover Text is:
9d86bffc 25
77bd67cb
JM
26 A GNU Manual
27
28(b) The FSF's Back-Cover Text is:
29
30 You have freedom to copy and modify this GNU Manual, like GNU
31 software. Copies published by the Free Software Foundation raise
32 funds for GNU development.
9d86bffc
JM
33@c man end
34@c Set file name and title for the man page.
35@setfilename gcc
36@settitle GNU project C and C++ compiler
37@c man begin SYNOPSIS
630d3d5a
JM
38gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
39 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
40 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
41 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
42 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
43 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
9d530538 44 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
9d86bffc
JM
45
46Only the most useful options are listed here; see below for the
47remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
48@c man end
49@c man begin SEEALSO
77bd67cb 50gpl(7), gfdl(7), fsf-funding(7),
b4117c30
ZW
51cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
52and the Info entries for @file{gcc}, @file{cpp}, @file{as},
9d86bffc
JM
53@file{ld}, @file{binutils} and @file{gdb}.
54@c man end
2642624b
JM
55@c man begin BUGS
56For instructions on reporting bugs, see
ee86feaf 57@w{@uref{http://gcc.gnu.org/bugs.html}}.
2642624b
JM
58@c man end
59@c man begin AUTHOR
24dbb440
GP
60See the Info entry for @command{gcc}, or
61@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
62for contributors to GCC@.
2642624b 63@c man end
9d86bffc
JM
64@end ignore
65
74291a4b 66@node Invoking GCC
0c2d1a2a
JB
67@chapter GCC Command Options
68@cindex GCC command options
74291a4b 69@cindex command options
0c2d1a2a 70@cindex options, GCC command
74291a4b 71
9d86bffc 72@c man begin DESCRIPTION
0c2d1a2a 73When you invoke GCC, it normally does preprocessing, compilation,
74291a4b 74assembly and linking. The ``overall options'' allow you to stop this
630d3d5a 75process at an intermediate stage. For example, the @option{-c} option
74291a4b
MM
76says not to run the linker. Then the output consists of object files
77output by the assembler.
78
79Other options are passed on to one stage of processing. Some options
80control the preprocessor and others the compiler itself. Yet other
81options control the assembler and linker; most of these are not
82documented here, since you rarely need to use any of them.
83
84@cindex C compilation options
0c2d1a2a 85Most of the command line options that you can use with GCC are useful
74291a4b
MM
86for C programs; when an option is only useful with another language
87(usually C++), the explanation says so explicitly. If the description
88for a particular option does not mention a source language, you can use
89that option with all supported languages.
90
91@cindex C++ compilation options
92@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
93options for compiling C++ programs.
94
95@cindex grouping options
96@cindex options, grouping
bedc7537 97The @command{gcc} program accepts options and file names as operands. Many
b192711e 98options have multi-letter names; therefore multiple single-letter options
630d3d5a 99may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
74291a4b
MM
100-r}}.
101
102@cindex order of options
103@cindex options, order
104You can mix options and other arguments. For the most part, the order
105you use doesn't matter. Order does matter when you use several options
630d3d5a 106of the same kind; for example, if you specify @option{-L} more than once,
74291a4b
MM
107the directories are searched in the order specified.
108
109Many options have long names starting with @samp{-f} or with
cb7ad97b 110@samp{-W}---for example,
efa1cdf0 111@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
74291a4b 112these have both positive and negative forms; the negative form of
630d3d5a 113@option{-ffoo} would be @option{-fno-foo}. This manual documents
74291a4b
MM
114only one of these two forms, whichever one is not the default.
115
9d86bffc
JM
116@c man end
117
cd3bb277
JM
118@xref{Option Index}, for an index to GCC's options.
119
74291a4b
MM
120@menu
121* Option Summary:: Brief list of all options, without explanations.
122* Overall Options:: Controlling the kind of output:
123 an executable, object files, assembler files,
124 or preprocessed source.
125* Invoking G++:: Compiling C++ programs.
126* C Dialect Options:: Controlling the variant of C language compiled.
127* C++ Dialect Options:: Variations on C++.
46e34f96
ZL
128* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
129 and Objective-C++.
764dbbf2 130* Language Independent Options:: Controlling how diagnostics should be
02f52e19 131 formatted.
74291a4b
MM
132* Warning Options:: How picky should the compiler be?
133* Debugging Options:: Symbol tables, measurements, and debugging dumps.
134* Optimize Options:: How much optimization?
135* Preprocessor Options:: Controlling header files and macro definitions.
136 Also, getting dependency information for Make.
137* Assembler Options:: Passing options to the assembler.
138* Link Options:: Specifying libraries and so on.
139* Directory Options:: Where to find header files and libraries.
140 Where to find the compiler executable files.
a743d340 141* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 142* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
143* Submodel Options:: Specifying minor hardware or convention variations,
144 such as 68010 vs 68020.
145* Code Gen Options:: Specifying conventions for function calls, data layout
146 and register usage.
0c2d1a2a 147* Environment Variables:: Env vars that affect GCC.
17211ab5 148* Precompiled Headers:: Compiling a header once, and using it many times.
74291a4b
MM
149* Running Protoize:: Automatically adding or removing function prototypes.
150@end menu
151
4bc1997b
JM
152@c man begin OPTIONS
153
74291a4b
MM
154@node Option Summary
155@section Option Summary
156
157Here is a summary of all the options, grouped by type. Explanations are
158in the following sections.
159
160@table @emph
161@item Overall Options
162@xref{Overall Options,,Options Controlling the Kind of Output}.
c662432e 163@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
cb7ad97b 164-x @var{language} -v -### --help@r{[}=@var{class}@r{]} --target-help @gol
c662432e 165--version @@@var{file}}
74291a4b
MM
166
167@item C Language Options
168@xref{C Dialect Options,,Options Controlling C Dialect}.
da1c7394
ILT
169@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
170-aux-info @var{filename} @gol
9a94f7f3 171-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
17d6caa1 172-fhosted -ffreestanding -fopenmp -fms-extensions @gol
8a035a6b 173-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
00c8e9f6 174-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
4bc1997b 175-fsigned-bitfields -fsigned-char @gol
3521b33c 176-funsigned-bitfields -funsigned-char}
74291a4b
MM
177
178@item C++ Language Options
179@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
9a94f7f3 180@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
cfb10bd3 181-fconserve-space -ffriend-injection @gol
aa0cc562 182-fno-elide-constructors @gol
7813d14c 183-fno-enforce-eh-specs @gol
1dbb6023 184-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
90ecce3e 185-fno-implicit-templates @gol
4bc1997b
JM
186-fno-implicit-inline-templates @gol
187-fno-implement-inlines -fms-extensions @gol
aa0cc562 188-fno-nonansi-builtins -fno-operator-names @gol
4bc1997b 189-fno-optional-diags -fpermissive @gol
aa0cc562 190-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
40aac948 191-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
d7afec4b
ND
192-fno-default-inline -fvisibility-inlines-hidden @gol
193-Wabi -Wctor-dtor-privacy @gol
4bc1997b 194-Wnon-virtual-dtor -Wreorder @gol
b2f97e4a 195-Weffc++ -Wno-deprecated -Wstrict-null-sentinel @gol
4bc1997b
JM
196-Wno-non-template-friend -Wold-style-cast @gol
197-Woverloaded-virtual -Wno-pmf-conversions @gol
4e2db7a8 198-Wsign-promo}
74291a4b 199
46e34f96
ZL
200@item Objective-C and Objective-C++ Language Options
201@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
202Objective-C and Objective-C++ Dialects}.
dd508457 203@gccoptlist{-fconstant-string-class=@var{class-name} @gol
264fa2db
ZL
204-fgnu-runtime -fnext-runtime @gol
205-fno-nil-receivers @gol
6e955430
ZL
206-fobjc-call-cxx-cdtors @gol
207-fobjc-direct-dispatch @gol
264fa2db 208-fobjc-exceptions @gol
6e955430 209-fobjc-gc @gol
264fa2db
ZL
210-freplace-objc-classes @gol
211-fzero-link @gol
212-gen-decls @gol
6e955430
ZL
213-Wassign-intercept @gol
214-Wno-protocol -Wselector @gol
215-Wstrict-selector-match @gol
216-Wundeclared-selector}
60de6385 217
764dbbf2
GDR
218@item Language Independent Options
219@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
9a94f7f3 220@gccoptlist{-fmessage-length=@var{n} @gol
dd508457
BM
221-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
222-fdiagnostics-show-option}
764dbbf2 223
74291a4b
MM
224@item Warning Options
225@xref{Warning Options,,Options to Request or Suppress Warnings}.
9a94f7f3 226@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
c116cd05 227-w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
e1f1ee86
DG
228-Wno-attributes -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
229-Wchar-subscripts -Wclobbered -Wcomment @gol
16c1c158 230-Wconversion -Wcoverage-mismatch -Wno-deprecated-declarations @gol
b3b433c5
MLI
231-Wdisabled-optimization -Wno-div-by-zero @gol
232-Wempty-body -Wno-endif-labels @gol
dc90f45b 233-Werror -Werror=* @gol
c65a01af 234-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
fb0317c6 235-Wno-format-extra-args -Wformat-nonliteral @gol
c76f4e8e 236-Wformat-security -Wformat-y2k @gol
fb0317c6
VR
237-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
238-Wimport -Wno-import -Winit-self -Winline @gol
63a08740
DM
239-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
240-Winvalid-pch -Wlarger-than-@var{len} -Wunsafe-loop-optimizations @gol
241-Wlogical-op -Wlong-long @gol
eaac4679 242-Wmain -Wmissing-braces -Wmissing-field-initializers @gol
b02398bd
BE
243-Wmissing-format-attribute -Wmissing-include-dirs @gol
244-Wmissing-noreturn @gol
71834ad3
RS
245-Wno-multichar -Wnonnull -Wno-overflow @gol
246-Woverlength-strings -Wpacked -Wpadded @gol
53a2494e
JM
247-Wparentheses -Wpointer-arith -Wno-pointer-to-int-cast @gol
248-Wredundant-decls @gol
4bc1997b 249-Wreturn-type -Wsequence-point -Wshadow @gol
0aca9021
JW
250-Wsign-compare -Wstack-protector @gol
251-Wstrict-aliasing -Wstrict-aliasing=2 @gol
6ac01510 252-Wstrict-overflow -Wstrict-overflow=@var{n} @gol
9a94f7f3
JM
253-Wswitch -Wswitch-default -Wswitch-enum @gol
254-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol
b9b8dde3 255-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
4bc1997b 256-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
50d50fc7
SP
257-Wunused-value -Wunused-variable @gol
258-Wvariadic-macros -Wvla @gol
d35a40fc 259-Wvolatile-register-var -Wwrite-strings}
74291a4b 260
fe50c0eb 261@item C-only Warning Options
9a94f7f3 262@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
b1ed4cb4
MLI
263-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
264-Wold-style-declaration -Wold-style-definition @gol
05170031 265-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
f4e9414e 266-Wdeclaration-after-statement -Wpointer-sign}
fe50c0eb 267
74291a4b
MM
268@item Debugging Options
269@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
9a94f7f3 270@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
24a7799e 271-fdump-noaddr -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
aee96fe9 272-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
9b3e897d 273-fdump-ipa-all -fdump-ipa-cgraph @gol
6de9cd9a 274-fdump-tree-all @gol
9a94f7f3
JM
275-fdump-tree-original@r{[}-@var{n}@r{]} @gol
276-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
22367161 277-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
6de9cd9a
DN
278-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
279-fdump-tree-ch @gol
280-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
281-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
282-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
283-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
284-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
285-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
286-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
287-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
79fe1b3b 288-fdump-tree-nrv -fdump-tree-vect @gol
fa555252 289-fdump-tree-sink @gol
6de9cd9a 290-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
c75ab022 291-fdump-tree-salias @gol
ff2ad0f7 292-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
08873e96 293-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
c866976a 294-ftree-vectorizer-verbose=@var{n} @gol
0bca51f0 295-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
a37db56b 296-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
e713adf6 297-feliminate-unused-debug-symbols -femit-class-debug-always @gol
a5573239 298-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
a37db56b 299-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
014a1138 300-ftest-coverage -ftime-report -fvar-tracking @gol
def66b10 301-g -g@var{level} -gcoff -gdwarf-2 @gol
5f98259a 302-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
39ef6592
LC
303-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
304-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
4bc1997b 305-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
b1018de6 306-print-multi-directory -print-multi-lib @gol
4bc1997b 307-print-prog-name=@var{program} -print-search-dirs -Q @gol
14da6073 308-print-sysroot-headers-suffix @gol
4bc1997b 309-save-temps -time}
74291a4b
MM
310
311@item Optimization Options
312@xref{Optimize Options,,Options that Control Optimization}.
9a94f7f3 313@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol
4bc1997b 314-falign-labels=@var{n} -falign-loops=@var{n} @gol
6de9cd9a 315-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
fca9dc00 316-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
1194fc79 317-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
c7463669 318-fcaller-saves -fcprop-registers -fcse-follow-jumps @gol
3450cbc4 319-fcse-skip-blocks -fcx-limited-range -fdata-sections @gol
d63db217 320-fdelayed-branch -fdelete-null-pointer-checks -fearly-inlining @gol
4bc1997b 321-fexpensive-optimizations -ffast-math -ffloat-store @gol
a52b023a 322-fforce-addr -fforward-propagate -ffunction-sections @gol
db643b91 323-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol
37818e7c 324-fcrossjumping -fif-conversion -fif-conversion2 @gol
355866de
RG
325-finline-functions -finline-functions-called-once @gol
326-finline-limit=@var{n} -fkeep-inline-functions @gol
201556f0 327-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
cd280abb 328-fmodulo-sched -fno-branch-count-reg @gol
1f922264 329-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol
feb48bde 330-fno-function-cse -fno-guess-branch-probability @gol
6cfc0341 331-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
db02da79
RS
332-funsafe-math-optimizations -funsafe-loop-optimizations @gol
333-ffinite-math-only -fno-signed-zeros @gol
474eccc6 334-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
4bc1997b 335-fomit-frame-pointer -foptimize-register-move @gol
efa1cdf0 336-foptimize-sibling-calls -fprefetch-loop-arrays @gol
a8a5f53a 337-fprofile-generate -fprofile-use @gol
a924fe34 338-fregmove -frename-registers @gol
750054a2 339-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
efa1cdf0 340-frerun-cse-after-loop @gol
38109dab
GL
341-frounding-math -frtl-abstract-sequences @gol
342-fschedule-insns -fschedule-insns2 @gol
e03b7153 343-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol
569fa502 344-fsched-spec-load-dangerous @gol
0aca9021 345-fsched-stalled-insns=@var{n} -fsched-stalled-insns-dep=@var{n} @gol
569fa502 346-fsched2-use-superblocks @gol
8cd37d0b 347-fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol
aacd3885 348-fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol
e53a16e7 349-fno-split-wide-types -fstack-protector -fstack-protector-all @gol
eeef0e45 350-fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol
9a94f7f3 351-funroll-all-loops -funroll-loops -fpeel-loops @gol
113d659a 352-fsplit-ivs-in-unroller -funswitch-loops @gol
f37a4f14 353-fvariable-expansion-in-unroller @gol
c66b6c66 354-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol
599eabdb 355-ftree-loop-linear -ftree-loop-im -ftree-loop-ivcanon -fivopts @gol
3d8864c0 356-fcheck-data-deps @gol
fa555252 357-ftree-dominator-opts -ftree-dse -ftree-copyrename -ftree-sink @gol
8af63653 358-ftree-ch -ftree-sra -ftree-ter -ftree-fre -ftree-vectorize @gol
4cf4d6a3 359-ftree-vect-loop-version -ftree-salias -fipa-pta -fweb @gol
ce91e74c 360-ftree-copy-prop -ftree-store-ccp -ftree-store-copy-prop -fwhole-program @gol
3af64fd6 361--param @var{name}=@var{value}
4bc1997b 362-O -O0 -O1 -O2 -O3 -Os}
74291a4b
MM
363
364@item Preprocessor Options
365@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
c2d635bc 366@gccoptlist{-A@var{question}=@var{answer} @gol
9a94f7f3 367-A-@var{question}@r{[}=@var{answer}@r{]} @gol
4bc1997b
JM
368-C -dD -dI -dM -dN @gol
369-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
370-idirafter @var{dir} @gol
371-include @var{file} -imacros @var{file} @gol
372-iprefix @var{file} -iwithprefix @var{dir} @gol
bdd42dd9 373-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
2b6dd222 374-imultilib @var{dir} -isysroot @var{dir} @gol
b20d9f0c
AO
375-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
376-P -fworking-directory -remap @gol
9a94f7f3
JM
377-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
378-Xpreprocessor @var{option}}
74291a4b
MM
379
380@item Assembler Option
381@xref{Assembler Options,,Passing Options to the Assembler}.
9a94f7f3 382@gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
74291a4b
MM
383
384@item Linker Options
385@xref{Link Options,,Options for Linking}.
9a94f7f3 386@gccoptlist{@var{object-file-name} -l@var{library} @gol
0cbc4d77 387-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
4bc1997b 388-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
aee96fe9 389-Wl,@var{option} -Xlinker @var{option} @gol
4bc1997b 390-u @var{symbol}}
74291a4b
MM
391
392@item Directory Options
393@xref{Directory Options,,Options for Directory Search}.
160633c6
MM
394@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir}
395-specs=@var{file} -I- --sysroot=@var{dir}}
74291a4b
MM
396
397@item Target Options
398@c I wrote this xref this way to avoid overfull hbox. -- rms
399@xref{Target Options}.
9a94f7f3 400@gccoptlist{-V @var{version} -b @var{machine}}
74291a4b
MM
401
402@item Machine Dependent Options
403@xref{Submodel Options,,Hardware Models and Configurations}.
39bc1876
NS
404@c This list is ordered alphanumerically by subsection name.
405@c Try and put the significant identifier (CPU or system) first,
406@c so users have a clue at guessing where the ones they want will be.
5d22c1a5 407
39bc1876
NS
408@emph{ARC Options}
409@gccoptlist{-EB -EL @gol
410-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
411-mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
74291a4b 412
74291a4b 413@emph{ARM Options}
9a94f7f3 414@gccoptlist{-mapcs-frame -mno-apcs-frame @gol
5848830f 415-mabi=@var{name} @gol
310668e8
JM
416-mapcs-stack-check -mno-apcs-stack-check @gol
417-mapcs-float -mno-apcs-float @gol
418-mapcs-reentrant -mno-apcs-reentrant @gol
419-msched-prolog -mno-sched-prolog @gol
420-mlittle-endian -mbig-endian -mwords-little-endian @gol
34a86306 421-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
310668e8 422-mthumb-interwork -mno-thumb-interwork @gol
9b66ebb1 423-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
247f8561 424-mstructure-size-boundary=@var{n} @gol
4bc1997b 425-mabort-on-noreturn @gol
310668e8
JM
426-mlong-calls -mno-long-calls @gol
427-msingle-pic-base -mno-single-pic-base @gol
247f8561
PB
428-mpic-register=@var{reg} @gol
429-mnop-fun-dllimport @gol
9b6b54e2 430-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
247f8561 431-mpoke-function-name @gol
310668e8
JM
432-mthumb -marm @gol
433-mtpcs-frame -mtpcs-leaf-frame @gol
d3585b76
DJ
434-mcaller-super-interworking -mcallee-super-interworking @gol
435-mtp=@var{name}}
74291a4b 436
39bc1876
NS
437@emph{AVR Options}
438@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
439-mcall-prologues -mno-tablejump -mtiny-stack -mint8}
861bb6c1 440
0d4a78eb 441@emph{Blackfin Options}
28f601ff
JZ
442@gccoptlist{-mcpu=@var{cpu} -msim -momit-leaf-frame-pointer @gol
443-mno-omit-leaf-frame-pointer -mspecld-anomaly -mno-specld-anomaly @gol
444-mcsync-anomaly -mno-csync-anomaly -mlow-64k -mno-low64k @gol
445-mstack-check-l1 -mid-shared-library -mno-id-shared-library @gol
446-mshared-library-id=@var{n} -mleaf-id-shared-library @gol
447-mno-leaf-id-shared-library -msep-data -mno-sep-data -mlong-calls @gol
448-mno-long-calls}
0d4a78eb 449
39bc1876
NS
450@emph{CRIS Options}
451@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
452-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
453-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
454-mstack-align -mdata-align -mconst-align @gol
455-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
456-melf -maout -melinux -mlinux -sim -sim2 @gol
457-mmul-bug-workaround -mno-mul-bug-workaround}
74291a4b 458
53054e77
PW
459@emph{CRX Options}
460@gccoptlist{-mmac -mpush-args}
461
48aec0bc 462@emph{Darwin Options}
6d2f9dd3
JM
463@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
464-arch_only -bind_at_load -bundle -bundle_loader @gol
465-client_name -compatibility_version -current_version @gol
5079843a 466-dead_strip @gol
6d2f9dd3
JM
467-dependency-file -dylib_file -dylinker_install_name @gol
468-dynamic -dynamiclib -exported_symbols_list @gol
469-filelist -flat_namespace -force_cpusubtype_ALL @gol
470-force_flat_namespace -headerpad_max_install_names @gol
1f1d5130 471-iframework @gol
6d2f9dd3
JM
472-image_base -init -install_name -keep_private_externs @gol
473-multi_module -multiply_defined -multiply_defined_unused @gol
5079843a
DP
474-noall_load -no_dead_strip_inits_and_terms @gol
475-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
6d2f9dd3
JM
476-pagezero_size -prebind -prebind_all_twolevel_modules @gol
477-private_bundle -read_only_relocs -sectalign @gol
478-sectobjectsymbols -whyload -seg1addr @gol
479-sectcreate -sectobjectsymbols -sectorder @gol
5826770c 480-segaddr -segs_read_only_addr -segs_read_write_addr @gol
6d2f9dd3
JM
481-seg_addr_table -seg_addr_table_filename -seglinkedit @gol
482-segprot -segs_read_only_addr -segs_read_write_addr @gol
483-single_module -static -sub_library -sub_umbrella @gol
484-twolevel_namespace -umbrella -undefined @gol
485-unexported_symbols_list -weak_reference_mismatches @gol
337f2a22 486-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
57164024 487-mkernel -mone-byte-bool}
48aec0bc 488
74291a4b 489@emph{DEC Alpha Options}
9a94f7f3 490@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
4bc1997b
JM
491-mieee -mieee-with-inexact -mieee-conformant @gol
492-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
493-mtrap-precision=@var{mode} -mbuild-constants @gol
58605ba0
RH
494-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
495-mbwx -mmax -mfix -mcix @gol
496-mfloat-vax -mfloat-ieee @gol
9a94f7f3
JM
497-mexplicit-relocs -msmall-data -mlarge-data @gol
498-msmall-text -mlarge-text @gol
4bc1997b 499-mmemory-latency=@var{time}}
74291a4b 500
d7c23cdc 501@emph{DEC Alpha/VMS Options}
9a94f7f3 502@gccoptlist{-mvms-return-codes}
d7c23cdc 503
39bc1876
NS
504@emph{FRV Options}
505@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
506-mhard-float -msoft-float @gol
507-malloc-cc -mfixed-cc -mdword -mno-dword @gol
508-mdouble -mno-double @gol
509-mmedia -mno-media -mmuladd -mno-muladd @gol
c557edf4
RS
510-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
511-mlinked-fp -mlong-calls -malign-labels @gol
512-mlibrary-pic -macc-4 -macc-8 @gol
39bc1876 513-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
38c28a25 514-moptimize-membar -mno-optimize-membar @gol
39bc1876
NS
515-mscc -mno-scc -mcond-exec -mno-cond-exec @gol
516-mvliw-branch -mno-vliw-branch @gol
517-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
518-mno-nested-cond-exec -mtomcat-stats @gol
e4dd71de 519-mTLS -mtls @gol
39bc1876
NS
520-mcpu=@var{cpu}}
521
464aea98
JM
522@emph{GNU/Linux Options}
523@gccoptlist{-muclibc}
524
74291a4b 525@emph{H8/300 Options}
9a94f7f3 526@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
74291a4b 527
39bc1876
NS
528@emph{HPPA Options}
529@gccoptlist{-march=@var{architecture-type} @gol
530-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
531-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
a2017852 532-mfixed-range=@var{register-range} @gol
39bc1876
NS
533-mjump-in-delay -mlinker-opt -mlong-calls @gol
534-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
535-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
536-mno-jump-in-delay -mno-long-load-store @gol
537-mno-portable-runtime -mno-soft-float @gol
538-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
539-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
540-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
d711cf67 541-munix=@var{unix-std} -nolibdld -static -threads}
74291a4b 542
39bc1876
NS
543@emph{i386 and x86-64 Options}
544@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
545-mfpmath=@var{unit} @gol
546-masm=@var{dialect} -mno-fancy-math-387 @gol
c33104d6 547-mno-fp-ret-in-387 -msoft-float @gol
39bc1876 548-mno-wide-multiply -mrtd -malign-double @gol
5be6cb59 549-mpreferred-stack-boundary=@var{num} -mcx16 -msahf @gol
21efb4d4 550-mmmx -msse -msse2 -msse3 -mssse3 -msse4a -m3dnow -mpopcnt -mabm @gol
39bc1876
NS
551-mthreads -mno-align-stringops -minline-all-stringops @gol
552-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
fa283935 553-m96bit-long-double -mregparm=@var{num} -msseregparm @gol
577565f9 554-mpc32 -mpc64 -mpc80 mstackrealign @gol
1f97667f 555-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
39bc1876 556-mcmodel=@var{code-model} @gol
7dcbf659 557-m32 -m64 -mlarge-data-threshold=@var{num}}
56b2d7a7 558
39bc1876
NS
559@emph{IA-64 Options}
560@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
4c334b37 561-mvolatile-asm-stop -mregister-names -mno-sdata @gol
39bc1876
NS
562-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol
563-minline-float-divide-max-throughput @gol
564-minline-int-divide-min-latency @gol
28b43def
SE
565-minline-int-divide-max-throughput @gol
566-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
567-mno-dwarf2-asm -mearly-stop-bits @gol
568-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
048d0d36
MK
569-mtune=@var{cpu-type} -mt -pthread -milp32 -mlp64 @gol
570-mno-sched-br-data-spec -msched-ar-data-spec -mno-sched-control-spec @gol
571-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
572-msched-ldc -mno-sched-control-ldc -mno-sched-spec-verbose @gol
573-mno-sched-prefer-non-data-spec-insns @gol
574-mno-sched-prefer-non-control-spec-insns @gol
575-mno-sched-count-spec-in-critical-path}
282a61e6 576
39bc1876
NS
577@emph{M32R/D Options}
578@gccoptlist{-m32r2 -m32rx -m32r @gol
579-mdebug @gol
580-malign-loops -mno-align-loops @gol
581-missue-rate=@var{number} @gol
582-mbranch-cost=@var{number} @gol
583-mmodel=@var{code-size-model-type} @gol
584-msdata=@var{sdata-type} @gol
585-mno-flush-func -mflush-func=@var{name} @gol
586-mno-flush-trap -mflush-trap=@var{number} @gol
587-G @var{num}}
83575957 588
38b2d076
DD
589@emph{M32C Options}
590@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
591
39bc1876 592@emph{M680x0 Options}
900ec02d
JB
593@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
594-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
595-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
64826589
NS
596-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
597-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
598-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
39bc1876
NS
599-malign-int -mstrict-align -msep-data -mno-sep-data @gol
600-mshared-library-id=n -mid-shared-library -mno-id-shared-library}
789a3090 601
39bc1876
NS
602@emph{M68hc1x Options}
603@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
604-mauto-incdec -minmax -mlong-calls -mshort @gol
605-msoft-reg-count=@var{count}}
052a4b28 606
789a3090 607@emph{MCore Options}
9a94f7f3 608@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
310668e8
JM
609-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
610-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
611-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
612-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
f84271d9 613
39bc1876
NS
614@emph{MIPS Options}
615@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
616-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol
617-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
500fc425
TS
618-mshared -mno-shared -mxgot -mno-xgot -mgp32 -mgp64 @gol
619-mfp32 -mfp64 -mhard-float -msoft-float @gol
620-msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
621-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
622-mips3d -mno-mips3d -mmt -mno-mt @gol
fb8136b2 623-mlong64 -mlong32 -msym32 -mno-sym32 @gol
39bc1876
NS
624-G@var{num} -membedded-data -mno-embedded-data @gol
625-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
500fc425
TS
626-msplit-addresses -mno-split-addresses @gol
627-mexplicit-relocs -mno-explicit-relocs @gol
39bc1876 628-mcheck-zero-division -mno-check-zero-division @gol
9f0df97a 629-mdivide-traps -mdivide-breaks @gol
39bc1876
NS
630-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
631-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
632-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
500fc425 633-mfix-vr4120 -mno-fix-vr4120 -mfix-vr4130 -mno-fix-vr4130 @gol
0ac40e7a 634-mfix-sb1 -mno-fix-sb1 @gol
39bc1876
NS
635-mflush-func=@var{func} -mno-flush-func @gol
636-mbranch-likely -mno-branch-likely @gol
637-mfp-exceptions -mno-fp-exceptions @gol
638-mvr4130-align -mno-vr4130-align}
bcf684c7 639
39bc1876
NS
640@emph{MMIX Options}
641@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
642-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
643-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
644-mno-base-addresses -msingle-exit -mno-single-exit}
df6194d4 645
39bc1876
NS
646@emph{MN10300 Options}
647@gccoptlist{-mmult-bug -mno-mult-bug @gol
648-mam33 -mno-am33 @gol
649-mam33-2 -mno-am33-2 @gol
b1eb8119 650-mreturn-pointer-on-d0 @gol
39bc1876 651-mno-crt0 -mrelax}
91abf72d 652
6c9ac67a
NS
653@emph{MT Options}
654@gccoptlist{-mno-crt0 -mbacc -msim @gol
c85ba4fb
AH
655-march=@var{cpu-type} }
656
9f85bca7 657@emph{PDP-11 Options}
9a94f7f3 658@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
9f85bca7
JM
659-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
660-mint16 -mno-int32 -mfloat32 -mno-float64 @gol
661-mfloat64 -mno-float32 -mabshi -mno-abshi @gol
662-mbranch-expensive -mbranch-cheap @gol
663-msplit -mno-split -munix-asm -mdec-asm}
664
39bc1876
NS
665@emph{PowerPC Options}
666See RS/6000 and PowerPC Options.
667
668@emph{RS/6000 and PowerPC Options}
669@gccoptlist{-mcpu=@var{cpu-type} @gol
670-mtune=@var{cpu-type} @gol
671-mpower -mno-power -mpower2 -mno-power2 @gol
672-mpowerpc -mpowerpc64 -mno-powerpc @gol
673-maltivec -mno-altivec @gol
674-mpowerpc-gpopt -mno-powerpc-gpopt @gol
675-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
9719f3b7 676-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mfprnd -mno-fprnd @gol
b639c3c2 677-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mdfp -mno-dfp @gol
39bc1876
NS
678-mnew-mnemonics -mold-mnemonics @gol
679-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
de17c25f 680-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
39bc1876
NS
681-malign-power -malign-natural @gol
682-msoft-float -mhard-float -mmultiple -mno-multiple @gol
683-mstring -mno-string -mupdate -mno-update @gol
684-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
685-mstrict-align -mno-strict-align -mrelocatable @gol
686-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
687-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
ef765ea9 688-mdynamic-no-pic -maltivec -mswdiv @gol
39bc1876
NS
689-mprioritize-restricted-insns=@var{priority} @gol
690-msched-costly-dep=@var{dependence_type} @gol
691-minsert-sched-nops=@var{scheme} @gol
692-mcall-sysv -mcall-netbsd @gol
693-maix-struct-return -msvr4-struct-return @gol
7f970b70 694-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
78f5898b 695-misel -mno-isel @gol
39bc1876 696-misel=yes -misel=no @gol
78f5898b 697-mspe -mno-spe @gol
39bc1876 698-mspe=yes -mspe=no @gol
78f5898b 699-mvrsave -mno-vrsave @gol
131aeb82 700-mmulhw -mno-mulhw @gol
716019c0 701-mdlmzb -mno-dlmzb @gol
4d4cbc0e 702-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
39bc1876
NS
703-mprototype -mno-prototype @gol
704-msim -mmvme -mads -myellowknife -memb -msdata @gol
705-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread}
706
707@emph{S/390 and zSeries Options}
708@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
f61a2c7d
AK
709-mhard-float -msoft-float -mlong-double-64 -mlong-double-128 @gol
710-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
39bc1876
NS
711-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
712-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
d75f90f1
AK
713-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
714-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
39bc1876 715
93ef7c1f 716@emph{Score Options}
c6681463
CL
717@gccoptlist{-meb -mel @gol
718-mnhwloop @gol
719-muls @gol
93ef7c1f 720-mmac @gol
c6681463 721-mscore5 -mscore5u -mscore7 -mscore7d}
cb7ad97b 722
39bc1876
NS
723@emph{SH Options}
724@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol
725-m4-nofpu -m4-single-only -m4-single -m4 @gol
312209c6 726-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
39bc1876
NS
727-m5-64media -m5-64media-nofpu @gol
728-m5-32media -m5-32media-nofpu @gol
729-m5-compact -m5-compact-nofpu @gol
730-mb -ml -mdalign -mrelax @gol
2acc29bd 731-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
dc557046 732-mieee -misize -minline-ic_invalidate -mpadstruct -mspace @gol
73a4d10b
R
733-mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
734-mdivsi3_libfunc=@var{name} @gol
735-madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
736 -minvalid-symbols}
39bc1876
NS
737
738@emph{SPARC Options}
739@gccoptlist{-mcpu=@var{cpu-type} @gol
740-mtune=@var{cpu-type} @gol
741-mcmodel=@var{code-model} @gol
742-m32 -m64 -mapp-regs -mno-app-regs @gol
743-mfaster-structs -mno-faster-structs @gol
744-mfpu -mno-fpu -mhard-float -msoft-float @gol
745-mhard-quad-float -msoft-quad-float @gol
746-mimpure-text -mno-impure-text -mlittle-endian @gol
747-mstack-bias -mno-stack-bias @gol
748-munaligned-doubles -mno-unaligned-doubles @gol
6bfb2f93 749-mv8plus -mno-v8plus -mvis -mno-vis
f5e2061b 750-threads -pthreads -pthread}
39bc1876 751
85d9c13c
TS
752@emph{SPU Options}
753@gccoptlist{-mwarn-reloc -merror-reloc @gol
754-msafe-dma -munsafe-dma @gol
755-mbranch-hints @gol
32fb22af
SL
756-msmall-mem -mlarge-mem -mstdmain @gol
757-mfixed-range=@var{register-range}}
85d9c13c 758
39bc1876
NS
759@emph{System V Options}
760@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
761
762@emph{TMS320C3x/C4x Options}
763@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol
764-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol
765-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol
766-mparallel-insns -mparallel-mpy -mpreserve-float}
767
768@emph{V850 Options}
769@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
770-mprolog-function -mno-prolog-function -mspace @gol
771-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
772-mapp-regs -mno-app-regs @gol
773-mdisable-callt -mno-disable-callt @gol
774-mv850e1 @gol
775-mv850e @gol
776-mv850 -mbig-switch}
777
778@emph{VAX Options}
779@gccoptlist{-mg -mgnu -munix}
780
cd773ac4
RS
781@emph{VxWorks Options}
782@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
783-Xbind-lazy -Xbind-now}
784
39bc1876
NS
785@emph{x86-64 Options}
786See i386 and x86-64 Options.
787
69a0611f 788@emph{Xstormy16 Options}
9a94f7f3 789@gccoptlist{-msim}
69a0611f 790
03984308 791@emph{Xtensa Options}
6cedbe44 792@gccoptlist{-mconst16 -mno-const16 @gol
9a94f7f3 793-mfused-madd -mno-fused-madd @gol
9a94f7f3
JM
794-mtext-section-literals -mno-text-section-literals @gol
795-mtarget-align -mno-target-align @gol
796-mlongcalls -mno-longcalls}
03984308 797
39bc1876
NS
798@emph{zSeries Options}
799See S/390 and zSeries Options.
70899148 800
74291a4b
MM
801@item Code Generation Options
802@xref{Code Gen Options,,Options for Code Generation Conventions}.
9a94f7f3
JM
803@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
804-ffixed-@var{reg} -fexceptions @gol
5d22c1a5 805-fnon-call-exceptions -funwind-tables @gol
a944ceb9 806-fasynchronous-unwind-tables @gol
4bc1997b 807-finhibit-size-directive -finstrument-functions @gol
dc170a87 808-fno-common -fno-ident @gol
24a4dd31 809-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
82c0180d 810-fno-jump-tables @gol
e0d9d0dd 811-frecord-gcc-switches @gol
f5e605e5 812-freg-struct-return -fshort-enums @gol
271bd540 813-fshort-double -fshort-wchar @gol
467cecf3 814-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
4bc1997b
JM
815-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
816-fargument-alias -fargument-noalias @gol
0698a1d2
TM
817-fargument-noalias-global -fargument-noalias-anything
818-fleading-underscore -ftls-model=@var{model} @gol
d7afec4b 819-ftrapv -fwrapv -fbounds-check @gol
17d6caa1 820-fvisibility}
74291a4b
MM
821@end table
822
823@menu
824* Overall Options:: Controlling the kind of output:
825 an executable, object files, assembler files,
826 or preprocessed source.
827* C Dialect Options:: Controlling the variant of C language compiled.
828* C++ Dialect Options:: Variations on C++.
46e34f96
ZL
829* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
830 and Objective-C++.
764dbbf2 831* Language Independent Options:: Controlling how diagnostics should be
02f52e19 832 formatted.
74291a4b
MM
833* Warning Options:: How picky should the compiler be?
834* Debugging Options:: Symbol tables, measurements, and debugging dumps.
835* Optimize Options:: How much optimization?
836* Preprocessor Options:: Controlling header files and macro definitions.
837 Also, getting dependency information for Make.
838* Assembler Options:: Passing options to the assembler.
839* Link Options:: Specifying libraries and so on.
840* Directory Options:: Where to find header files and libraries.
841 Where to find the compiler executable files.
a743d340 842* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 843* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
844@end menu
845
846@node Overall Options
847@section Options Controlling the Kind of Output
848
849Compilation can involve up to four stages: preprocessing, compilation
d1bd0ded
GK
850proper, assembly and linking, always in that order. GCC is capable of
851preprocessing and compiling several files either into several
852assembler input files, or into one assembler input file; then each
853assembler input file produces an object file, and linking combines all
854the object files (those newly compiled, and those specified as input)
855into an executable file.
74291a4b
MM
856
857@cindex file name suffix
858For any given input file, the file name suffix determines what kind of
859compilation is done:
860
2642624b 861@table @gcctabopt
74291a4b
MM
862@item @var{file}.c
863C source code which must be preprocessed.
864
865@item @var{file}.i
866C source code which should not be preprocessed.
867
868@item @var{file}.ii
869C++ source code which should not be preprocessed.
870
871@item @var{file}.m
46e34f96
ZL
872Objective-C source code. Note that you must link with the @file{libobjc}
873library to make an Objective-C program work.
74291a4b 874
b9265ec1
JM
875@item @var{file}.mi
876Objective-C source code which should not be preprocessed.
877
46e34f96
ZL
878@item @var{file}.mm
879@itemx @var{file}.M
880Objective-C++ source code. Note that you must link with the @file{libobjc}
881library to make an Objective-C++ program work. Note that @samp{.M} refers
882to a literal capital M@.
883
884@item @var{file}.mii
885Objective-C++ source code which should not be preprocessed.
886
74291a4b 887@item @var{file}.h
46e34f96
ZL
888C, C++, Objective-C or Objective-C++ header file to be turned into a
889precompiled header.
74291a4b
MM
890
891@item @var{file}.cc
b9265ec1 892@itemx @var{file}.cp
74291a4b
MM
893@itemx @var{file}.cxx
894@itemx @var{file}.cpp
ee8acf89 895@itemx @var{file}.CPP
b9265ec1 896@itemx @var{file}.c++
74291a4b
MM
897@itemx @var{file}.C
898C++ source code which must be preprocessed. Note that in @samp{.cxx},
899the last two letters must both be literally @samp{x}. Likewise,
161d7b59 900@samp{.C} refers to a literal capital C@.
74291a4b 901
6e955430
ZL
902@item @var{file}.mm
903@itemx @var{file}.M
904Objective-C++ source code which must be preprocessed.
905
906@item @var{file}.mii
907Objective-C++ source code which should not be preprocessed.
908
17211ab5
GK
909@item @var{file}.hh
910@itemx @var{file}.H
911C++ header file to be turned into a precompiled header.
912
b9265ec1
JM
913@item @var{file}.f
914@itemx @var{file}.for
915@itemx @var{file}.FOR
80a0c50a 916Fixed form Fortran source code which should not be preprocessed.
b9265ec1
JM
917
918@item @var{file}.F
919@itemx @var{file}.fpp
920@itemx @var{file}.FPP
80a0c50a 921Fixed form Fortran source code which must be preprocessed (with the traditional
b9265ec1
JM
922preprocessor).
923
6de9cd9a
DN
924@item @var{file}.f90
925@itemx @var{file}.f95
80a0c50a 926Free form Fortran source code which should not be preprocessed.
6de9cd9a 927
5a006700
MR
928@item @var{file}.F90
929@itemx @var{file}.F95
80a0c50a 930Free form Fortran source code which must be preprocessed (with the
5a006700
MR
931traditional preprocessor).
932
b9265ec1
JM
933@c FIXME: Descriptions of Java file types.
934@c @var{file}.java
935@c @var{file}.class
936@c @var{file}.zip
937@c @var{file}.jar
938
e23381df
GB
939@item @var{file}.ads
940Ada source code file which contains a library unit declaration (a
941declaration of a package, subprogram, or generic, or a generic
942instantiation), or a library unit renaming declaration (a package,
943generic, or subprogram renaming declaration). Such files are also
944called @dfn{specs}.
945
946@itemx @var{file}.adb
947Ada source code file containing a library unit body (a subprogram or
948package body). Such files are also called @dfn{bodies}.
949
b9265ec1 950@c GCC also knows about some suffixes for languages not yet included:
b9265ec1
JM
951@c Pascal:
952@c @var{file}.p
953@c @var{file}.pas
80a0c50a
TS
954@c Ratfor:
955@c @var{file}.r
b9265ec1 956
74291a4b
MM
957@item @var{file}.s
958Assembler code.
959
960@item @var{file}.S
961Assembler code which must be preprocessed.
962
963@item @var{other}
964An object file to be fed straight into linking.
965Any file name with no recognized suffix is treated this way.
966@end table
967
cd3bb277 968@opindex x
630d3d5a 969You can specify the input language explicitly with the @option{-x} option:
74291a4b 970
2642624b 971@table @gcctabopt
74291a4b
MM
972@item -x @var{language}
973Specify explicitly the @var{language} for the following input files
974(rather than letting the compiler choose a default based on the file
975name suffix). This option applies to all following input files until
630d3d5a 976the next @option{-x} option. Possible values for @var{language} are:
3ab51846 977@smallexample
46e34f96 978c c-header c-cpp-output
17211ab5 979c++ c++-header c++-cpp-output
46e34f96
ZL
980objective-c objective-c-header objective-c-cpp-output
981objective-c++ objective-c++-header objective-c++-cpp-output
74291a4b 982assembler assembler-with-cpp
e23381df 983ada
acd1a829 984f95 f95-cpp-input
e23381df 985java
b38b97c4 986treelang
3ab51846 987@end smallexample
74291a4b
MM
988
989@item -x none
990Turn off any specification of a language, so that subsequent files are
630d3d5a 991handled according to their file name suffixes (as they are if @option{-x}
74291a4b 992has not been used at all).
14a774a9
RK
993
994@item -pass-exit-codes
cd3bb277 995@opindex pass-exit-codes
bedc7537 996Normally the @command{gcc} program will exit with the code of 1 if any
14a774a9 997phase of the compiler returns a non-success return code. If you specify
630d3d5a 998@option{-pass-exit-codes}, the @command{gcc} program will instead return with
14a774a9 999numerically highest error produced by any phase that returned an error
ddaf3b86
VR
1000indication. The C, C++, and Fortran frontends return 4, if an internal
1001compiler error is encountered.
74291a4b
MM
1002@end table
1003
1004If you only want some of the stages of compilation, you can use
630d3d5a
JM
1005@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1006one of the options @option{-c}, @option{-S}, or @option{-E} to say where
bedc7537
NC
1007@command{gcc} is to stop. Note that some combinations (for example,
1008@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
74291a4b 1009
2642624b 1010@table @gcctabopt
74291a4b 1011@item -c
cd3bb277 1012@opindex c
74291a4b
MM
1013Compile or assemble the source files, but do not link. The linking
1014stage simply is not done. The ultimate output is in the form of an
1015object file for each source file.
1016
1017By default, the object file name for a source file is made by replacing
1018the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1019
1020Unrecognized input files, not requiring compilation or assembly, are
1021ignored.
1022
1023@item -S
cd3bb277 1024@opindex S
74291a4b
MM
1025Stop after the stage of compilation proper; do not assemble. The output
1026is in the form of an assembler code file for each non-assembler input
1027file specified.
1028
1029By default, the assembler file name for a source file is made by
1030replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1031
1032Input files that don't require compilation are ignored.
1033
1034@item -E
cd3bb277 1035@opindex E
74291a4b
MM
1036Stop after the preprocessing stage; do not run the compiler proper. The
1037output is in the form of preprocessed source code, which is sent to the
1038standard output.
1039
1040Input files which don't require preprocessing are ignored.
1041
1042@cindex output file option
1043@item -o @var{file}
cd3bb277 1044@opindex o
74291a4b
MM
1045Place output in file @var{file}. This applies regardless to whatever
1046sort of output is being produced, whether it be an executable file,
1047an object file, an assembler file or preprocessed C code.
1048
488061c8
GK
1049If @option{-o} is not specified, the default is to put an executable
1050file in @file{a.out}, the object file for
1051@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1052assembler file in @file{@var{source}.s}, a precompiled header file in
1053@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1054standard output.
74291a4b
MM
1055
1056@item -v
cd3bb277 1057@opindex v
74291a4b
MM
1058Print (on standard error output) the commands executed to run the stages
1059of compilation. Also print the version number of the compiler driver
1060program and of the preprocessor and the compiler proper.
1061
e8b3c8ac
IR
1062@item -###
1063@opindex ###
1064Like @option{-v} except the commands are not executed and all command
1065arguments are quoted. This is useful for shell scripts to capture the
1066driver-generated command lines.
1067
74291a4b 1068@item -pipe
cd3bb277 1069@opindex pipe
74291a4b
MM
1070Use pipes rather than temporary files for communication between the
1071various stages of compilation. This fails to work on some systems where
1072the assembler is unable to read from a pipe; but the GNU assembler has
1073no trouble.
844642e6 1074
0855eab7
CT
1075@item -combine
1076@opindex combine
1077If you are compiling multiple source files, this option tells the driver
f26c1794 1078to pass all the source files to the compiler at once (for those
0855eab7
CT
1079languages for which the compiler can handle this). This will allow
1080intermodule analysis (IMA) to be performed by the compiler. Currently the only
78466c0e 1081language for which this is supported is C@. If you pass source files for
0855eab7
CT
1082multiple languages to the driver, using this option, the driver will invoke
1083the compiler(s) that support IMA once each, passing each compiler all the
1084source files appropriate for it. For those languages that do not support
1085IMA this option will be ignored, and the compiler will be invoked once for
1086each source file in that language. If you use this option in conjunction
78466c0e
JM
1087with @option{-save-temps}, the compiler will generate multiple
1088pre-processed files
1089(one for each source file), but only one (combined) @file{.o} or
1090@file{.s} file.
0855eab7 1091
844642e6 1092@item --help
cd3bb277 1093@opindex help
844642e6 1094Print (on the standard output) a description of the command line options
bedc7537
NC
1095understood by @command{gcc}. If the @option{-v} option is also specified
1096then @option{--help} will also be passed on to the various processes
1097invoked by @command{gcc}, so that they can display the command line options
c662432e
NC
1098they accept. If the @option{-Wextra} option has also been specified
1099(prior to the @option{--help} option), then command line options which
1100have no documentation associated with them will also be displayed.
10501d8f
CC
1101
1102@item --target-help
cd3bb277 1103@opindex target-help
c662432e 1104Print (on the standard output) a description of target-specific command
10501d8f 1105line options for each tool.
e03b7153 1106
c662432e
NC
1107@item --help=@var{class}@r{[},@var{qualifier}@r{]}
1108Print (on the standard output) a description of the command line
1109options understood by the compiler that fit into a specific class.
5bb43e6d
BM
1110The class can be one of @samp{optimizers}, @samp{warnings}, @samp{target},
1111@samp{params}, or @var{language}:
c662432e 1112
5bb43e6d
BM
1113@table @asis
1114@item @samp{optimizers}
c662432e
NC
1115This will display all of the optimization options supported by the
1116compiler.
1117
5bb43e6d 1118@item @samp{warnings}
c662432e
NC
1119This will display all of the options controlling warning messages
1120produced by the compiler.
1121
5bb43e6d 1122@item @samp{target}
c662432e
NC
1123This will display target-specific options. Unlike the
1124@option{--target-help} option however, target-specific options of the
1125linker and assembler will not be displayed. This is because those
1126tools do not currently support the extended @option{--help=} syntax.
1127
5bb43e6d 1128@item @samp{params}
c662432e
NC
1129This will display the values recognized by the @option{--param}
1130option.
5bb43e6d
BM
1131
1132@item @var{language}
1133This will display the options supported for @var{language}, where
1134@var{language} is the name of one of the languages supported in this
1135version of GCC.
06a97569
BM
1136
1137@item @samp{common}
1138This will display the options that are common to all languages.
c662432e
NC
1139@end table
1140
1141It is possible to further refine the output of the @option{--help=}
1142option by adding a comma separated list of qualifiers after the
1143class. These can be any from the following list:
1144
5bb43e6d
BM
1145@table @asis
1146@item @samp{undocumented}
c662432e
NC
1147Display only those options which are undocumented.
1148
5bb43e6d 1149@item @samp{joined}
c662432e
NC
1150Display options which take an argument that appears after an equal
1151sign in the same continuous piece of text, such as:
1152@samp{--help=target}.
1153
5bb43e6d 1154@item @samp{separate}
c662432e
NC
1155Display options which take an argument that appears as a separate word
1156following the original option, such as: @samp{-o output-file}.
1157@end table
1158
1159Thus for example to display all the undocumented target-specific
1160switches supported by the compiler the following can be used:
1161
1162@smallexample
1163--help=target,undocumented
1164@end smallexample
1165
1166The sense of a qualifier can be inverted by prefixing it with the
1167@var{^} character, so for example to display all binary warning
1168options (i.e. ones that are either on or off and that do not take an
1169argument), which have a description the following can be used:
1170
1171@smallexample
1172--help=warnings,^joined,^undocumented
1173@end smallexample
1174
1175A class can also be used as a qualifier, although this usually
1176restricts the output by so much that there is nothing to display. One
1177case where it does work however is when one of the classes is
1178@var{target}. So for example to display all the target-specific
1179optimization options the following can be used:
1180
1181@smallexample
1182--help=target,optimizers
1183@end smallexample
1184
1185The @option{--help=} option can be repeated on the command line. Each
1186successive use will display its requested class of options, skipping
1187those that have already been displayed.
1188
1189If the @option{-Q} option appears on the command line before the
1190@option{--help=} option, then the descriptive text displayed by
1191@option{--help=} is changed. Instead of describing the displayed
1192options, an indication is given as to whether the option is enabled,
1193disabled or set to a specific value (assuming that the compiler
1194knows this at the point where the @option{--help=} option is used).
1195
1196Here is a truncated example from the ARM port of @command{gcc}:
1197
1198@smallexample
1199 % gcc -Q -mabi=2 --help=target -c
1200 The following options are target specific:
1201 -mabi= 2
1202 -mabort-on-noreturn [disabled]
1203 -mapcs [disabled]
1204@end smallexample
1205
1206The output is sensitive to the effects of previous command line
1207options, so for example it is possible to find out which optimizations
1208are enabled at @option{-O2} by using:
1209
1210@smallexample
1211-O2 --help=optimizers
1212@end smallexample
1213
1214Alternatively you can discover which binary optimizations are enabled
1215by @option{-O3} by using:
1216
1217@smallexample
1218gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1219gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1220diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1221@end smallexample
1222
e03b7153
RS
1223@item --version
1224@opindex version
8a36672b 1225Display the version number and copyrights of the invoked GCC@.
9d530538
MM
1226
1227@include @value{srcdir}/../libiberty/at-file.texi
74291a4b
MM
1228@end table
1229
1230@node Invoking G++
1231@section Compiling C++ Programs
1232
1233@cindex suffixes for C++ source
1234@cindex C++ source file suffixes
1235C++ source files conventionally use one of the suffixes @samp{.C},
17211ab5
GK
1236@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1237@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
0c2d1a2a 1238preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
bba975d4 1239files with these names and compiles them as C++ programs even if you
17211ab5
GK
1240call the compiler the same way as for compiling C programs (usually
1241with the name @command{gcc}).
74291a4b
MM
1242
1243@findex g++
1244@findex c++
63b08b60
MS
1245However, the use of @command{gcc} does not add the C++ library.
1246@command{g++} is a program that calls GCC and treats @samp{.c},
1247@samp{.h} and @samp{.i} files as C++ source files instead of C source
1248files unless @option{-x} is used, and automatically specifies linking
5548b688
MS
1249against the C++ library. This program is also useful when
1250precompiling a C header file with a @samp{.h} extension for use in C++
1251compilations. On many systems, @command{g++} is also installed with
1252the name @command{c++}.
74291a4b 1253
bedc7537 1254@cindex invoking @command{g++}
74291a4b
MM
1255When you compile C++ programs, you may specify many of the same
1256command-line options that you use for compiling programs in any
1257language; or command-line options meaningful for C and related
1258languages; or options that are meaningful only for C++ programs.
1259@xref{C Dialect Options,,Options Controlling C Dialect}, for
161d7b59 1260explanations of options for languages related to C@.
74291a4b
MM
1261@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1262explanations of options that are meaningful only for C++ programs.
1263
1264@node C Dialect Options
1265@section Options Controlling C Dialect
1266@cindex dialect options
1267@cindex language dialect options
1268@cindex options, dialect
1269
1270The following options control the dialect of C (or languages derived
46e34f96
ZL
1271from C, such as C++, Objective-C and Objective-C++) that the compiler
1272accepts:
74291a4b 1273
2642624b 1274@table @gcctabopt
74291a4b 1275@cindex ANSI support
c1030c7c 1276@cindex ISO support
74291a4b 1277@item -ansi
cd3bb277 1278@opindex ansi
3764f879 1279In C mode, support all ISO C90 programs. In C++ mode,
775afb25 1280remove GNU extensions that conflict with ISO C++.
74291a4b 1281
c1030c7c 1282This turns off certain features of GCC that are incompatible with ISO
3764f879 1283C90 (when compiling C code), or of standard C++ (when compiling C++ code),
0c2d1a2a 1284such as the @code{asm} and @code{typeof} keywords, and
74291a4b
MM
1285predefined macros such as @code{unix} and @code{vax} that identify the
1286type of system you are using. It also enables the undesirable and
02f52e19 1287rarely used ISO trigraph feature. For the C compiler,
0c2d1a2a 1288it disables recognition of C++ style @samp{//} comments as well as
775afb25 1289the @code{inline} keyword.
74291a4b
MM
1290
1291The alternate keywords @code{__asm__}, @code{__extension__},
1292@code{__inline__} and @code{__typeof__} continue to work despite
630d3d5a 1293@option{-ansi}. You would not want to use them in an ISO C program, of
74291a4b 1294course, but it is useful to put them in header files that might be included
630d3d5a 1295in compilations done with @option{-ansi}. Alternate predefined macros
74291a4b 1296such as @code{__unix__} and @code{__vax__} are also available, with or
630d3d5a 1297without @option{-ansi}.
74291a4b 1298
630d3d5a
JM
1299The @option{-ansi} option does not cause non-ISO programs to be
1300rejected gratuitously. For that, @option{-pedantic} is required in
1301addition to @option{-ansi}. @xref{Warning Options}.
74291a4b 1302
630d3d5a 1303The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
74291a4b
MM
1304option is used. Some header files may notice this macro and refrain
1305from declaring certain functions or defining certain macros that the
c1030c7c 1306ISO standard doesn't call for; this is to avoid interfering with any
74291a4b
MM
1307programs that might use these names for other things.
1308
c771326b
JM
1309Functions which would normally be built in but do not have semantics
1310defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
630d3d5a 1311functions with @option{-ansi} is used. @xref{Other Builtins,,Other
f0523f02 1312built-in functions provided by GCC}, for details of the functions
01702459 1313affected.
74291a4b 1314
49419c8f 1315@item -std=
cd3bb277 1316@opindex std
aee96fe9 1317Determine the language standard. This option is currently only
f749a36b
NB
1318supported when compiling C or C++. A value for this option must be
1319provided; possible values are
3932261a 1320
ee457005 1321@table @samp
aee96fe9
JM
1322@item c89
1323@itemx iso9899:1990
3764f879 1324ISO C90 (same as @option{-ansi}).
3043b30e
ML
1325
1326@item iso9899:199409
3764f879 1327ISO C90 as modified in amendment 1.
3043b30e 1328
49419c8f 1329@item c99
aee96fe9
JM
1330@itemx c9x
1331@itemx iso9899:1999
1332@itemx iso9899:199x
1333ISO C99. Note that this standard is not yet fully supported; see
1334@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1335names @samp{c9x} and @samp{iso9899:199x} are deprecated.
3043b30e
ML
1336
1337@item gnu89
3764f879 1338Default, ISO C90 plus GNU extensions (including some C99 features).
3043b30e 1339
49419c8f 1340@item gnu99
31775d31 1341@itemx gnu9x
d15a05b3
EC
1342ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
1343this will become the default. The name @samp{gnu9x} is deprecated.
49419c8f 1344
f749a36b
NB
1345@item c++98
1346The 1998 ISO C++ standard plus amendments.
1347
1348@item gnu++98
1349The same as @option{-std=c++98} plus GNU extensions. This is the
1350default for C++ code.
966541e3
DG
1351
1352@item c++0x
1353The working draft of the upcoming ISO C++0x standard. This option
1354enables experimental features that are likely to be included in
1355C++0x. The working draft is constantly changing, and any feature that is
1356enabled by this flag may be removed from future versions of GCC if it is
1357not part of the C++0x standard.
1358
1359@item gnu++0x
1360The same as @option{-std=c++0x} plus GNU extensions. As with
1361@option{-std=c++0x}, this option enables experimental features that may
1362be removed in future versions of GCC.
ee457005 1363@end table
3043b30e
ML
1364
1365Even when this option is not specified, you can still use some of the
1366features of newer standards in so far as they do not conflict with
1367previous C standards. For example, you may use @code{__restrict__} even
bedc7537 1368when @option{-std=c99} is not specified.
3932261a 1369
5490d604 1370The @option{-std} options specifying some version of ISO C have the same
3764f879 1371effects as @option{-ansi}, except that features that were not in ISO C90
5490d604
JM
1372but are in the specified version (for example, @samp{//} comments and
1373the @code{inline} keyword in ISO C99) are not disabled.
1374
c1030c7c
JM
1375@xref{Standards,,Language Standards Supported by GCC}, for details of
1376these standard versions.
1377
da1c7394
ILT
1378@item -fgnu89-inline
1379@opindex fgnu89-inline
1380The option @option{-fgnu89-inline} tells GCC to use the traditional
1381GNU semantics for @code{inline} functions when in C99 mode.
1382@xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1383is accepted and ignored by GCC versions 4.1.3 up to but not including
13844.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1385C99 mode. Using this option is roughly equivalent to adding the
1386@code{gnu_inline} function attribute to all inline functions
1387(@pxref{Function Attributes}).
1388
1389The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1390C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1391specifies the default behavior). This option was first supported in
1392GCC 4.3. This option is not supported in C89 or gnu89 mode.
1393
44c7bd63 1394The preprocessor macros @code{__GNUC_GNU_INLINE__} and
da1c7394
ILT
1395@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1396in effect for @code{inline} functions. @xref{Common Predefined
7d07e4ea 1397Macros,,,cpp,The C Preprocessor}.
da1c7394 1398
b1018de6
AO
1399@item -aux-info @var{filename}
1400@opindex aux-info
1401Output to the given filename prototyped declarations for all functions
1402declared and/or defined in a translation unit, including those in header
161d7b59 1403files. This option is silently ignored in any language other than C@.
b1018de6
AO
1404
1405Besides declarations, the file indicates, in comments, the origin of
1406each declaration (source file and line), whether the declaration was
1407implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1408@samp{O} for old, respectively, in the first character after the line
1409number and the colon), and whether it came from a declaration or a
1410definition (@samp{C} or @samp{F}, respectively, in the following
1411character). In the case of function definitions, a K&R-style list of
1412arguments followed by their declarations is also provided, inside
1413comments, after the declaration.
1414
74291a4b 1415@item -fno-asm
cd3bb277 1416@opindex fno-asm
74291a4b
MM
1417Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1418keyword, so that code can use these words as identifiers. You can use
1419the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
630d3d5a 1420instead. @option{-ansi} implies @option{-fno-asm}.
74291a4b
MM
1421
1422In C++, this switch only affects the @code{typeof} keyword, since
1423@code{asm} and @code{inline} are standard keywords. You may want to
630d3d5a 1424use the @option{-fno-gnu-keywords} flag instead, which has the same
5490d604
JM
1425effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1426switch only affects the @code{asm} and @code{typeof} keywords, since
1427@code{inline} is a standard keyword in ISO C99.
74291a4b
MM
1428
1429@item -fno-builtin
a3926fe1 1430@itemx -fno-builtin-@var{function}
cd3bb277 1431@opindex fno-builtin
c771326b
JM
1432@cindex built-in functions
1433Don't recognize built-in functions that do not begin with
01702459 1434@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
f0523f02 1435functions provided by GCC}, for details of the functions affected,
c771326b 1436including those which are not built-in functions when @option{-ansi} or
5490d604
JM
1437@option{-std} options for strict ISO C conformance are used because they
1438do not have an ISO standard meaning.
74291a4b 1439
c771326b 1440GCC normally generates special code to handle certain built-in functions
74291a4b
MM
1441more efficiently; for instance, calls to @code{alloca} may become single
1442instructions that adjust the stack directly, and calls to @code{memcpy}
1443may become inline copy loops. The resulting code is often both smaller
1444and faster, but since the function calls no longer appear as such, you
1445cannot set a breakpoint on those calls, nor can you change the behavior
e6e931b7
JM
1446of the functions by linking with a different library. In addition,
1447when a function is recognized as a built-in function, GCC may use
1448information about that function to warn about problems with calls to
1449that function, or to generate more efficient code, even if the
1450resulting code still contains calls to that function. For example,
1451warnings are given with @option{-Wformat} for bad calls to
1452@code{printf}, when @code{printf} is built in, and @code{strlen} is
1453known not to modify global memory.
74291a4b 1454
a3926fe1
RS
1455With the @option{-fno-builtin-@var{function}} option
1456only the built-in function @var{function} is
7d14c755
JM
1457disabled. @var{function} must not begin with @samp{__builtin_}. If a
1458function is named this is not built-in in this version of GCC, this
1459option is ignored. There is no corresponding
1460@option{-fbuiltin-@var{function}} option; if you wish to enable
1461built-in functions selectively when using @option{-fno-builtin} or
1462@option{-ffreestanding}, you may define macros such as:
1463
1464@smallexample
1465#define abs(n) __builtin_abs ((n))
1466#define strcpy(d, s) __builtin_strcpy ((d), (s))
1467@end smallexample
1468
861bb6c1 1469@item -fhosted
cd3bb277 1470@opindex fhosted
861bb6c1
JL
1471@cindex hosted environment
1472
1473Assert that compilation takes place in a hosted environment. This implies
630d3d5a 1474@option{-fbuiltin}. A hosted environment is one in which the
861bb6c1
JL
1475entire standard library is available, and in which @code{main} has a return
1476type of @code{int}. Examples are nearly everything except a kernel.
630d3d5a 1477This is equivalent to @option{-fno-freestanding}.
861bb6c1
JL
1478
1479@item -ffreestanding
cd3bb277 1480@opindex ffreestanding
861bb6c1
JL
1481@cindex hosted environment
1482
1483Assert that compilation takes place in a freestanding environment. This
630d3d5a 1484implies @option{-fno-builtin}. A freestanding environment
861bb6c1
JL
1485is one in which the standard library may not exist, and program startup may
1486not necessarily be at @code{main}. The most obvious example is an OS kernel.
630d3d5a 1487This is equivalent to @option{-fno-hosted}.
861bb6c1 1488
c1030c7c
JM
1489@xref{Standards,,Language Standards Supported by GCC}, for details of
1490freestanding and hosted environments.
1491
17d6caa1
AP
1492@item -fopenmp
1493@opindex fopenmp
1494@cindex openmp parallel
1495Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1496@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1497compiler generates parallel code according to the OpenMP Application
1498Program Interface v2.5 @w{@uref{http://www.openmp.org/}}.
1499
750491fc
RH
1500@item -fms-extensions
1501@opindex fms-extensions
1502Accept some non-standard constructs used in Microsoft header files.
1503
2fbebc71
JM
1504Some cases of unnamed fields in structures and unions are only
1505accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1506fields within structs/unions}, for details.
1507
74291a4b 1508@item -trigraphs
cd3bb277 1509@opindex trigraphs
3bce8a01
NB
1510Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1511options for strict ISO C conformance) implies @option{-trigraphs}.
74291a4b 1512
8a035a6b
AH
1513@item -no-integrated-cpp
1514@opindex no-integrated-cpp
1515Performs a compilation in two passes: preprocessing and compiling. This
1516option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
8a36672b 1517@option{-B} option. The user supplied compilation step can then add in
8a035a6b 1518an additional preprocessing step after normal preprocessing but before
8a36672b 1519compiling. The default is to use the integrated cpp (internal cpp)
8a035a6b
AH
1520
1521The semantics of this option will change if "cc1", "cc1plus", and
1522"cc1obj" are merged.
1523
74291a4b
MM
1524@cindex traditional C language
1525@cindex C language, traditional
1526@item -traditional
f458d1d5 1527@itemx -traditional-cpp
cd3bb277 1528@opindex traditional-cpp
f458d1d5
ZW
1529@opindex traditional
1530Formerly, these options caused GCC to attempt to emulate a pre-standard
1531C compiler. They are now only supported with the @option{-E} switch.
1532The preprocessor continues to support a pre-standard mode. See the GNU
1533CPP manual for details.
74291a4b
MM
1534
1535@item -fcond-mismatch
cd3bb277 1536@opindex fcond-mismatch
74291a4b 1537Allow conditional expressions with mismatched types in the second and
a7537031
JM
1538third arguments. The value of such an expression is void. This option
1539is not supported for C++.
74291a4b 1540
00c8e9f6
MS
1541@item -flax-vector-conversions
1542@opindex flax-vector-conversions
1543Allow implicit conversions between vectors with differing numbers of
1544elements and/or incompatible element types. This option should not be
1545used for new code.
1546
74291a4b 1547@item -funsigned-char
cd3bb277 1548@opindex funsigned-char
74291a4b
MM
1549Let the type @code{char} be unsigned, like @code{unsigned char}.
1550
1551Each kind of machine has a default for what @code{char} should
1552be. It is either like @code{unsigned char} by default or like
1553@code{signed char} by default.
1554
1555Ideally, a portable program should always use @code{signed char} or
1556@code{unsigned char} when it depends on the signedness of an object.
1557But many programs have been written to use plain @code{char} and
1558expect it to be signed, or expect it to be unsigned, depending on the
1559machines they were written for. This option, and its inverse, let you
1560make such a program work with the opposite default.
1561
1562The type @code{char} is always a distinct type from each of
1563@code{signed char} or @code{unsigned char}, even though its behavior
1564is always just like one of those two.
1565
1566@item -fsigned-char
cd3bb277 1567@opindex fsigned-char
74291a4b
MM
1568Let the type @code{char} be signed, like @code{signed char}.
1569
630d3d5a
JM
1570Note that this is equivalent to @option{-fno-unsigned-char}, which is
1571the negative form of @option{-funsigned-char}. Likewise, the option
1572@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
74291a4b 1573
74291a4b
MM
1574@item -fsigned-bitfields
1575@itemx -funsigned-bitfields
1576@itemx -fno-signed-bitfields
1577@itemx -fno-unsigned-bitfields
cd3bb277
JM
1578@opindex fsigned-bitfields
1579@opindex funsigned-bitfields
1580@opindex fno-signed-bitfields
1581@opindex fno-unsigned-bitfields
c771326b 1582These options control whether a bit-field is signed or unsigned, when the
74291a4b 1583declaration does not use either @code{signed} or @code{unsigned}. By
c771326b 1584default, such a bit-field is signed, because this is consistent: the
74291a4b 1585basic integer types such as @code{int} are signed types.
74291a4b
MM
1586@end table
1587
1588@node C++ Dialect Options
1589@section Options Controlling C++ Dialect
1590
1591@cindex compiler options, C++
1592@cindex C++ options, command line
1593@cindex options, C++
1594This section describes the command-line options that are only meaningful
1595for C++ programs; but you can also use most of the GNU compiler options
1596regardless of what language your program is in. For example, you
1597might compile a file @code{firstClass.C} like this:
1598
3ab51846 1599@smallexample
1dc5fc4b 1600g++ -g -frepo -O -c firstClass.C
3ab51846 1601@end smallexample
74291a4b
MM
1602
1603@noindent
630d3d5a 1604In this example, only @option{-frepo} is an option meant
74291a4b 1605only for C++ programs; you can use the other options with any
161d7b59 1606language supported by GCC@.
74291a4b
MM
1607
1608Here is a list of options that are @emph{only} for compiling C++ programs:
1609
2642624b 1610@table @gcctabopt
2d3e278d
MM
1611
1612@item -fabi-version=@var{n}
1613@opindex fabi-version
8a36672b 1614Use version @var{n} of the C++ ABI@. Version 2 is the version of the
57702a80
MM
1615C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1616the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1617the version that conforms most closely to the C++ ABI specification.
1618Therefore, the ABI obtained using version 0 will change as ABI bugs
1619are fixed.
2d3e278d 1620
d150ccef 1621The default is version 2.
46c83bce 1622
74291a4b 1623@item -fno-access-control
cd3bb277 1624@opindex fno-access-control
74291a4b
MM
1625Turn off all access checking. This switch is mainly useful for working
1626around bugs in the access control code.
1627
74291a4b 1628@item -fcheck-new
cd3bb277 1629@opindex fcheck-new
74291a4b 1630Check that the pointer returned by @code{operator new} is non-null
6d9c4c83
JW
1631before attempting to modify the storage allocated. This check is
1632normally unnecessary because the C++ standard specifies that
1633@code{operator new} will only return @code{0} if it is declared
1634@samp{throw()}, in which case the compiler will always check the
1635return value even without this option. In all other cases, when
1636@code{operator new} has a non-empty exception specification, memory
1637exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1638@samp{new (nothrow)}.
1dc5fc4b 1639
74291a4b 1640@item -fconserve-space
cd3bb277 1641@opindex fconserve-space
74291a4b
MM
1642Put uninitialized or runtime-initialized global variables into the
1643common segment, as C does. This saves space in the executable at the
1644cost of not diagnosing duplicate definitions. If you compile with this
1645flag and your program mysteriously crashes after @code{main()} has
1646completed, you may have an object that is being destroyed twice because
1647two definitions were merged.
1648
1dc5fc4b
JM
1649This option is no longer useful on most targets, now that support has
1650been added for putting variables into BSS without making them common.
1651
d63d5d0c
ILT
1652@item -ffriend-injection
1653@opindex ffriend-injection
1654Inject friend functions into the enclosing namespace, so that they are
1655visible outside the scope of the class in which they are declared.
1656Friend functions were documented to work this way in the old Annotated
1657C++ Reference Manual, and versions of G++ before 4.1 always worked
1658that way. However, in ISO C++ a friend function which is not declared
1659in an enclosing scope can only be found using argument dependent
1660lookup. This option causes friends to be injected as they were in
1661earlier releases.
1662
1663This option is for compatibility, and may be removed in a future
1664release of G++.
1665
1dc5fc4b 1666@item -fno-elide-constructors
cd3bb277 1667@opindex fno-elide-constructors
1dc5fc4b
JM
1668The C++ standard allows an implementation to omit creating a temporary
1669which is only used to initialize another object of the same type.
aee96fe9 1670Specifying this option disables that optimization, and forces G++ to
1dc5fc4b 1671call the copy constructor in all cases.
74291a4b 1672
dd1ba632 1673@item -fno-enforce-eh-specs
cd3bb277 1674@opindex fno-enforce-eh-specs
4381020e
JM
1675Don't generate code to check for violation of exception specifications
1676at runtime. This option violates the C++ standard, but may be useful
1677for reducing code size in production builds, much like defining
1678@samp{NDEBUG}. This does not give user code permission to throw
1679exceptions in violation of the exception specifications; the compiler
1680will still optimize based on the specifications, so throwing an
1681unexpected exception will result in undefined behavior.
dd1ba632 1682
74291a4b 1683@item -ffor-scope
8c81598d 1684@itemx -fno-for-scope
cd3bb277
JM
1685@opindex ffor-scope
1686@opindex fno-for-scope
695ac33f 1687If @option{-ffor-scope} is specified, the scope of variables declared in
74291a4b 1688a @i{for-init-statement} is limited to the @samp{for} loop itself,
34527c47 1689as specified by the C++ standard.
695ac33f 1690If @option{-fno-for-scope} is specified, the scope of variables declared in
74291a4b 1691a @i{for-init-statement} extends to the end of the enclosing scope,
aee96fe9 1692as was the case in old versions of G++, and other (traditional)
74291a4b
MM
1693implementations of C++.
1694
1695The default if neither flag is given to follow the standard,
1696but to allow and give a warning for old-style code that would
1697otherwise be invalid, or have different behavior.
1698
1699@item -fno-gnu-keywords
cd3bb277 1700@opindex fno-gnu-keywords
9762e8a4 1701Do not recognize @code{typeof} as a keyword, so that code can use this
767094dd 1702word as an identifier. You can use the keyword @code{__typeof__} instead.
630d3d5a 1703@option{-ansi} implies @option{-fno-gnu-keywords}.
74291a4b 1704
1dc5fc4b 1705@item -fno-implicit-templates
cd3bb277 1706@opindex fno-implicit-templates
bba975d4 1707Never emit code for non-inline templates which are instantiated
e979f9e8 1708implicitly (i.e.@: by use); only emit code for explicit instantiations.
bba975d4
JM
1709@xref{Template Instantiation}, for more information.
1710
1711@item -fno-implicit-inline-templates
cd3bb277 1712@opindex fno-implicit-inline-templates
bba975d4
JM
1713Don't emit code for implicit instantiations of inline templates, either.
1714The default is to handle inlines differently so that compiles with and
1715without optimization will need the same set of explicit instantiations.
1dc5fc4b 1716
74291a4b 1717@item -fno-implement-inlines
cd3bb277 1718@opindex fno-implement-inlines
74291a4b
MM
1719To save space, do not emit out-of-line copies of inline functions
1720controlled by @samp{#pragma implementation}. This will cause linker
1721errors if these functions are not inlined everywhere they are called.
1722
631cf95d 1723@item -fms-extensions
cd3bb277 1724@opindex fms-extensions
32fb1fb2
PE
1725Disable pedantic warnings about constructs used in MFC, such as implicit
1726int and getting a pointer to member function via non-standard syntax.
631cf95d 1727
fcca588c 1728@item -fno-nonansi-builtins
cd3bb277 1729@opindex fno-nonansi-builtins
c771326b 1730Disable built-in declarations of functions that are not mandated by
161d7b59 1731ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
fcca588c
MM
1732@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1733
775afb25 1734@item -fno-operator-names
cd3bb277 1735@opindex fno-operator-names
775afb25 1736Do not treat the operator name keywords @code{and}, @code{bitand},
74291a4b 1737@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
775afb25 1738synonyms as keywords.
74291a4b 1739
4f8b4fd9 1740@item -fno-optional-diags
cd3bb277 1741@opindex fno-optional-diags
4f8b4fd9 1742Disable diagnostics that the standard says a compiler does not need to
aee96fe9 1743issue. Currently, the only such diagnostic issued by G++ is the one for
bba975d4 1744a name having multiple meanings within a class.
4f8b4fd9 1745
8c7707b0 1746@item -fpermissive
cd3bb277 1747@opindex fpermissive
4a386498
MM
1748Downgrade some diagnostics about nonconformant code from errors to
1749warnings. Thus, using @option{-fpermissive} will allow some
1750nonconforming code to compile.
8c7707b0 1751
8c81598d 1752@item -frepo
cd3bb277 1753@opindex frepo
9c34dbbf
ZW
1754Enable automatic template instantiation at link time. This option also
1755implies @option{-fno-implicit-templates}. @xref{Template
1756Instantiation}, for more information.
8c81598d 1757
8c7707b0 1758@item -fno-rtti
cd3bb277 1759@opindex fno-rtti
a7fbfcf9
JM
1760Disable generation of information about every class with virtual
1761functions for use by the C++ runtime type identification features
1762(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1763of the language, you can save some space by using this flag. Note that
1764exception handling uses the same information, but it will generate it as
6c9384c3
BS
1765needed. The @samp{dynamic_cast} operator can still be used for casts that
1766do not require runtime type information, i.e. casts to @code{void *} or to
1767unambiguous base classes.
8c7707b0 1768
fcca588c 1769@item -fstats
cd3bb277 1770@opindex fstats
fcca588c
MM
1771Emit statistics about front-end processing at the end of the compilation.
1772This information is generally only useful to the G++ development team.
1773
1dc5fc4b 1774@item -ftemplate-depth-@var{n}
cd3bb277 1775@opindex ftemplate-depth
1dc5fc4b
JM
1776Set the maximum instantiation depth for template classes to @var{n}.
1777A limit on the template instantiation depth is needed to detect
767094dd 1778endless recursions during template class instantiation. ANSI/ISO C++
1dc5fc4b
JM
1779conforming programs must not rely on a maximum depth greater than 17.
1780
40aac948
JM
1781@item -fno-threadsafe-statics
1782@opindex fno-threadsafe-statics
1783Do not emit the extra code to use the routines specified in the C++
1784ABI for thread-safe initialization of local statics. You can use this
1785option to reduce code size slightly in code that doesn't need to be
1786thread-safe.
1787
fc693822 1788@item -fuse-cxa-atexit
cd3bb277 1789@opindex fuse-cxa-atexit
fc693822
MM
1790Register destructors for objects with static storage duration with the
1791@code{__cxa_atexit} function rather than the @code{atexit} function.
1792This option is required for fully standards-compliant handling of static
1793destructors, but will only work if your C library supports
1794@code{__cxa_atexit}.
1795
c7b5e395
GK
1796@item -fno-use-cxa-get-exception-ptr
1797@opindex fno-use-cxa-get-exception-ptr
1798Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
1799will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1800if the runtime routine is not available.
1801
d7afec4b
ND
1802@item -fvisibility-inlines-hidden
1803@opindex fvisibility-inlines-hidden
46bdbc00
GK
1804This switch declares that the user does not attempt to compare
1805pointers to inline methods where the addresses of the two functions
1806were taken in different shared objects.
1807
1808The effect of this is that GCC may, effectively, mark inline methods with
d7afec4b
ND
1809@code{__attribute__ ((visibility ("hidden")))} so that they do not
1810appear in the export table of a DSO and do not require a PLT indirection
8a36672b 1811when used within the DSO@. Enabling this option can have a dramatic effect
d7afec4b 1812on load and link times of a DSO as it massively reduces the size of the
46bdbc00
GK
1813dynamic export table when the library makes heavy use of templates.
1814
9f5ed61a 1815The behavior of this switch is not quite the same as marking the
7c0de6a5
GK
1816methods as hidden directly, because it does not affect static variables
1817local to the function or cause the compiler to deduce that
1818the function is defined in only one shared object.
1819
46bdbc00
GK
1820You may mark a method as having a visibility explicitly to negate the
1821effect of the switch for that method. For example, if you do want to
7c0de6a5 1822compare pointers to a particular inline method, you might mark it as
bd741f34
JM
1823having default visibility. Marking the enclosing class with explicit
1824visibility will have no effect.
d7afec4b 1825
dfb84d62
MS
1826Explicitly instantiated inline methods are unaffected by this option
1827as their linkage might otherwise cross a shared library boundary.
1828@xref{Template Instantiation}.
1829
02f52e19 1830@item -fno-weak
cd3bb277 1831@opindex fno-weak
90ecce3e 1832Do not use weak symbol support, even if it is provided by the linker.
fcca588c
MM
1833By default, G++ will use weak symbols if they are available. This
1834option exists only for testing, and should not be used by end-users;
1835it will result in inferior code and has no benefits. This option may
1836be removed in a future release of G++.
1837
74291a4b 1838@item -nostdinc++
cd3bb277 1839@opindex nostdinc++
74291a4b
MM
1840Do not search for header files in the standard directories specific to
1841C++, but do still search the other standard directories. (This option
e5e809f4 1842is used when building the C++ library.)
74291a4b
MM
1843@end table
1844
1845In addition, these optimization, warning, and code generation options
1846have meanings only for C++ programs:
1847
2642624b 1848@table @gcctabopt
74291a4b 1849@item -fno-default-inline
cd3bb277 1850@opindex fno-default-inline
74291a4b 1851Do not assume @samp{inline} for functions defined inside a class scope.
1dc5fc4b
JM
1852@xref{Optimize Options,,Options That Control Optimization}. Note that these
1853functions will have linkage like inline functions; they just won't be
1854inlined by default.
74291a4b 1855
eca7f13c
MM
1856@item -Wabi @r{(C++ only)}
1857@opindex Wabi
1858Warn when G++ generates code that is probably not compatible with the
8a36672b 1859vendor-neutral C++ ABI@. Although an effort has been made to warn about
daf2f129 1860all such cases, there are probably some cases that are not warned about,
eca7f13c
MM
1861even though G++ is generating incompatible code. There may also be
1862cases where warnings are emitted even though the code that is generated
1863will be compatible.
1864
1865You should rewrite your code to avoid these warnings if you are
1866concerned about the fact that code generated by G++ may not be binary
1867compatible with code generated by other compilers.
1868
3364c33b 1869The known incompatibilities at this point include:
eca7f13c
MM
1870
1871@itemize @bullet
1872
1873@item
1874Incorrect handling of tail-padding for bit-fields. G++ may attempt to
1875pack data into the same byte as a base class. For example:
1876
1877@smallexample
1878struct A @{ virtual void f(); int f1 : 1; @};
1879struct B : public A @{ int f2 : 1; @};
1880@end smallexample
1881
1882@noindent
1883In this case, G++ will place @code{B::f2} into the same byte
daf2f129 1884as@code{A::f1}; other compilers will not. You can avoid this problem
eca7f13c
MM
1885by explicitly padding @code{A} so that its size is a multiple of the
1886byte size on your platform; that will cause G++ and other compilers to
1887layout @code{B} identically.
1888
1889@item
1890Incorrect handling of tail-padding for virtual bases. G++ does not use
1891tail padding when laying out virtual bases. For example:
1892
1893@smallexample
1894struct A @{ virtual void f(); char c1; @};
1895struct B @{ B(); char c2; @};
1896struct C : public A, public virtual B @{@};
1897@end smallexample
1898
1899@noindent
1900In this case, G++ will not place @code{B} into the tail-padding for
1901@code{A}; other compilers will. You can avoid this problem by
1902explicitly padding @code{A} so that its size is a multiple of its
1903alignment (ignoring virtual base classes); that will cause G++ and other
1904compilers to layout @code{C} identically.
1905
2d3e278d
MM
1906@item
1907Incorrect handling of bit-fields with declared widths greater than that
1908of their underlying types, when the bit-fields appear in a union. For
1909example:
1910
1911@smallexample
1912union U @{ int i : 4096; @};
1913@end smallexample
1914
1915@noindent
1916Assuming that an @code{int} does not have 4096 bits, G++ will make the
1917union too small by the number of bits in an @code{int}.
1918
956d9305
MM
1919@item
1920Empty classes can be placed at incorrect offsets. For example:
daf2f129 1921
956d9305
MM
1922@smallexample
1923struct A @{@};
1924
1925struct B @{
1926 A a;
1927 virtual void f ();
1928@};
1929
1930struct C : public B, public A @{@};
1931@end smallexample
1932
1933@noindent
c0478a66 1934G++ will place the @code{A} base class of @code{C} at a nonzero offset;
956d9305
MM
1935it should be placed at offset zero. G++ mistakenly believes that the
1936@code{A} data member of @code{B} is already at offset zero.
1937
6397d80b
MM
1938@item
1939Names of template functions whose types involve @code{typename} or
1940template template parameters can be mangled incorrectly.
1941
1942@smallexample
1943template <typename Q>
1944void f(typename Q::X) @{@}
1945
1946template <template <typename> class Q>
1947void f(typename Q<int>::X) @{@}
1948@end smallexample
1949
1950@noindent
3364c33b 1951Instantiations of these templates may be mangled incorrectly.
6397d80b 1952
eca7f13c
MM
1953@end itemize
1954
aee96fe9 1955@item -Wctor-dtor-privacy @r{(C++ only)}
cd3bb277 1956@opindex Wctor-dtor-privacy
9eff22bc
LG
1957Warn when a class seems unusable because all the constructors or
1958destructors in that class are private, and it has neither friends nor
78d0a54d 1959public static member functions.
bba975d4 1960
aee96fe9 1961@item -Wnon-virtual-dtor @r{(C++ only)}
cd3bb277 1962@opindex Wnon-virtual-dtor
9eff22bc 1963Warn when a class appears to be polymorphic, thereby requiring a virtual
efee9ded
GDR
1964destructor, yet it declares a non-virtual one. This warning is also
1965enabled if -Weffc++ is specified.
bba975d4 1966
aee96fe9 1967@item -Wreorder @r{(C++ only)}
cd3bb277 1968@opindex Wreorder
bba975d4
JM
1969@cindex reordering, warning
1970@cindex warning for reordering of member initializers
1971Warn when the order of member initializers given in the code does not
1972match the order in which they must be executed. For instance:
1973
1974@smallexample
1975struct A @{
1976 int i;
1977 int j;
1978 A(): j (0), i (1) @{ @}
1979@};
1980@end smallexample
1981
9eff22bc
LG
1982The compiler will rearrange the member initializers for @samp{i}
1983and @samp{j} to match the declaration order of the members, emitting
1984a warning to that effect. This warning is enabled by @option{-Wall}.
bba975d4
JM
1985@end table
1986
630d3d5a 1987The following @option{-W@dots{}} options are not affected by @option{-Wall}.
bba975d4 1988
2642624b 1989@table @gcctabopt
aee96fe9 1990@item -Weffc++ @r{(C++ only)}
cd3bb277 1991@opindex Weffc++
77f6c1eb
RS
1992Warn about violations of the following style guidelines from Scott Meyers'
1993@cite{Effective C++} book:
1994
1995@itemize @bullet
1996@item
1997Item 11: Define a copy constructor and an assignment operator for classes
1998with dynamically allocated memory.
1999
2000@item
2001Item 12: Prefer initialization to assignment in constructors.
2002
2003@item
2004Item 14: Make destructors virtual in base classes.
2005
2006@item
2007Item 15: Have @code{operator=} return a reference to @code{*this}.
2008
2009@item
2010Item 23: Don't try to return a reference when you must return an object.
2011
2012@end itemize
2013
daf2f129 2014Also warn about violations of the following style guidelines from
9eff22bc 2015Scott Meyers' @cite{More Effective C++} book:
77f6c1eb
RS
2016
2017@itemize @bullet
2018@item
2019Item 6: Distinguish between prefix and postfix forms of increment and
2020decrement operators.
2021
2022@item
2023Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2024
2025@end itemize
2026
9eff22bc
LG
2027When selecting this option, be aware that the standard library
2028headers do not obey all of these guidelines; use @samp{grep -v}
77f6c1eb 2029to filter out those warnings.
bba975d4 2030
aee96fe9 2031@item -Wno-deprecated @r{(C++ only)}
cd3bb277 2032@opindex Wno-deprecated
767094dd 2033Do not warn about usage of deprecated features. @xref{Deprecated Features}.
2de45c06 2034
b2f97e4a
MM
2035@item -Wstrict-null-sentinel @r{(C++ only)}
2036@opindex Wstrict-null-sentinel
2037Warn also about the use of an uncasted @code{NULL} as sentinel. When
2038compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2039to @code{__null}. Although it is a null pointer constant not a null pointer,
2040it is guaranteed to of the same size as a pointer. But this use is
2041not portable across different compilers.
2042
aee96fe9 2043@item -Wno-non-template-friend @r{(C++ only)}
cd3bb277 2044@opindex Wno-non-template-friend
bba975d4 2045Disable warnings when non-templatized friend functions are declared
9eff22bc 2046within a template. Since the advent of explicit template specification
aee96fe9 2047support in G++, if the name of the friend is an unqualified-id (i.e.,
bba975d4 2048@samp{friend foo(int)}), the C++ language specification demands that the
767094dd 2049friend declare or define an ordinary, nontemplate function. (Section
aee96fe9 205014.5.3). Before G++ implemented explicit specification, unqualified-ids
bba975d4 2051could be interpreted as a particular specialization of a templatized
767094dd 2052function. Because this non-conforming behavior is no longer the default
aee96fe9 2053behavior for G++, @option{-Wnon-template-friend} allows the compiler to
9eff22bc 2054check existing code for potential trouble spots and is on by default.
2228d450 2055This new compiler behavior can be turned off with
630d3d5a 2056@option{-Wno-non-template-friend} which keeps the conformant compiler code
2228d450 2057but disables the helpful warning.
bba975d4 2058
aee96fe9 2059@item -Wold-style-cast @r{(C++ only)}
cd3bb277 2060@opindex Wold-style-cast
323728aa 2061Warn if an old-style (C-style) cast to a non-void type is used within
7cd5c075
GP
2062a C++ program. The new-style casts (@samp{dynamic_cast},
2063@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2064less vulnerable to unintended effects and much easier to search for.
bba975d4 2065
aee96fe9 2066@item -Woverloaded-virtual @r{(C++ only)}
cd3bb277 2067@opindex Woverloaded-virtual
bba975d4
JM
2068@cindex overloaded virtual fn, warning
2069@cindex warning for overloaded virtual fn
3747f3dc
MM
2070Warn when a function declaration hides virtual functions from a
2071base class. For example, in:
2072
2073@smallexample
2074struct A @{
2075 virtual void f();
2076@};
2077
2078struct B: public A @{
2079 void f(int);
2080@};
2081@end smallexample
2082
2083the @code{A} class version of @code{f} is hidden in @code{B}, and code
9eff22bc 2084like:
3747f3dc
MM
2085
2086@smallexample
2087B* b;
2088b->f();
2089@end smallexample
2090
2091will fail to compile.
bba975d4 2092
aee96fe9 2093@item -Wno-pmf-conversions @r{(C++ only)}
cd3bb277 2094@opindex Wno-pmf-conversions
bba975d4
JM
2095Disable the diagnostic for converting a bound pointer to member function
2096to a plain pointer.
2097
aee96fe9 2098@item -Wsign-promo @r{(C++ only)}
cd3bb277 2099@opindex Wsign-promo
bba975d4 2100Warn when overload resolution chooses a promotion from unsigned or
2eac577f 2101enumerated type to a signed type, over a conversion to an unsigned type of
aee96fe9 2102the same size. Previous versions of G++ would try to preserve
bba975d4
JM
2103unsignedness, but the standard mandates the current behavior.
2104
bba975d4
JM
2105@smallexample
2106struct A @{
2107 operator int ();
2108 A& operator = (int);
2109@};
2110
2111main ()
2112@{
2113 A a,b;
2114 a = b;
2115@}
2116@end smallexample
74291a4b 2117
aee96fe9 2118In this example, G++ will synthesize a default @samp{A& operator =
bba975d4 2119(const A&);}, while cfront will use the user-defined @samp{operator =}.
74291a4b
MM
2120@end table
2121
46e34f96
ZL
2122@node Objective-C and Objective-C++ Dialect Options
2123@section Options Controlling Objective-C and Objective-C++ Dialects
60de6385 2124
46e34f96
ZL
2125@cindex compiler options, Objective-C and Objective-C++
2126@cindex Objective-C and Objective-C++ options, command line
2127@cindex options, Objective-C and Objective-C++
2128(NOTE: This manual does not describe the Objective-C and Objective-C++
2129languages themselves. See @xref{Standards,,Language Standards
2130Supported by GCC}, for references.)
264fa2db 2131
60de6385 2132This section describes the command-line options that are only meaningful
46e34f96
ZL
2133for Objective-C and Objective-C++ programs, but you can also use most of
2134the language-independent GNU compiler options.
2135For example, you might compile a file @code{some_class.m} like this:
60de6385 2136
3ab51846 2137@smallexample
60de6385 2138gcc -g -fgnu-runtime -O -c some_class.m
3ab51846 2139@end smallexample
60de6385
SS
2140
2141@noindent
9eff22bc 2142In this example, @option{-fgnu-runtime} is an option meant only for
46e34f96
ZL
2143Objective-C and Objective-C++ programs; you can use the other options with
2144any language supported by GCC@.
2145
2146Note that since Objective-C is an extension of the C language, Objective-C
f0eb93a8 2147compilations may also use options specific to the C front-end (e.g.,
46e34f96
ZL
2148@option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2149C++-specific options (e.g., @option{-Wabi}).
60de6385
SS
2150
2151Here is a list of options that are @emph{only} for compiling Objective-C
46e34f96 2152and Objective-C++ programs:
60de6385
SS
2153
2154@table @gcctabopt
630d3d5a 2155@item -fconstant-string-class=@var{class-name}
cd3bb277 2156@opindex fconstant-string-class
630d3d5a 2157Use @var{class-name} as the name of the class to instantiate for each
695ac33f 2158literal string specified with the syntax @code{@@"@dots{}"}. The default
264fa2db
ZL
2159class name is @code{NXConstantString} if the GNU runtime is being used, and
2160@code{NSConstantString} if the NeXT runtime is being used (see below). The
2161@option{-fconstant-cfstrings} option, if also present, will override the
2162@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2163to be laid out as constant CoreFoundation strings.
60de6385
SS
2164
2165@item -fgnu-runtime
cd3bb277 2166@opindex fgnu-runtime
60de6385
SS
2167Generate object code compatible with the standard GNU Objective-C
2168runtime. This is the default for most types of systems.
2169
2170@item -fnext-runtime
cd3bb277 2171@opindex fnext-runtime
60de6385 2172Generate output compatible with the NeXT runtime. This is the default
1f676100
NP
2173for NeXT-based systems, including Darwin and Mac OS X@. The macro
2174@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2175used.
60de6385 2176
264fa2db 2177@item -fno-nil-receivers
5ad7ae7f 2178@opindex fno-nil-receivers
daf2f129
JM
2179Assume that all Objective-C message dispatches (e.g.,
2180@code{[receiver message:arg]}) in this translation unit ensure that the receiver
46e34f96
ZL
2181is not @code{nil}. This allows for more efficient entry points in the runtime
2182to be used. Currently, this option is only available in conjunction with
264fa2db
ZL
2183the NeXT runtime on Mac OS X 10.3 and later.
2184
6e955430
ZL
2185@item -fobjc-call-cxx-cdtors
2186@opindex fobjc-call-cxx-cdtors
2187For each Objective-C class, check if any of its instance variables is a
2188C++ object with a non-trivial default constructor. If so, synthesize a
2189special @code{- (id) .cxx_construct} instance method that will run
2190non-trivial default constructors on any such instance variables, in order,
2191and then return @code{self}. Similarly, check if any instance variable
2192is a C++ object with a non-trivial destructor, and if so, synthesize a
2193special @code{- (void) .cxx_destruct} method that will run
2194all such default destructors, in reverse order.
2195
2196The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2197thusly generated will only operate on instance variables declared in the
2198current Objective-C class, and not those inherited from superclasses. It
2199is the responsibility of the Objective-C runtime to invoke all such methods
2200in an object's inheritance hierarchy. The @code{- (id) .cxx_construct} methods
2201will be invoked by the runtime immediately after a new object
2202instance is allocated; the @code{- (void) .cxx_destruct} methods will
2203be invoked immediately before the runtime deallocates an object instance.
2204
2205As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2206support for invoking the @code{- (id) .cxx_construct} and
2207@code{- (void) .cxx_destruct} methods.
2208
2209@item -fobjc-direct-dispatch
2210@opindex fobjc-direct-dispatch
2211Allow fast jumps to the message dispatcher. On Darwin this is
128a79fb 2212accomplished via the comm page.
6e955430 2213
264fa2db 2214@item -fobjc-exceptions
5ad7ae7f 2215@opindex fobjc-exceptions
daf2f129 2216Enable syntactic support for structured exception handling in Objective-C,
3dd9b65f
MS
2217similar to what is offered by C++ and Java. This option is
2218unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2219earlier.
264fa2db
ZL
2220
2221@smallexample
2222 @@try @{
2223 @dots{}
2224 @@throw expr;
2225 @dots{}
2226 @}
2227 @@catch (AnObjCClass *exc) @{
2228 @dots{}
2229 @@throw expr;
2230 @dots{}
2231 @@throw;
2232 @dots{}
2233 @}
2234 @@catch (AnotherClass *exc) @{
2235 @dots{}
2236 @}
2237 @@catch (id allOthers) @{
2238 @dots{}
2239 @}
2240 @@finally @{
2241 @dots{}
2242 @@throw expr;
2243 @dots{}
2244 @}
2245@end smallexample
2246
2247The @code{@@throw} statement may appear anywhere in an Objective-C or
daf2f129
JM
2248Objective-C++ program; when used inside of a @code{@@catch} block, the
2249@code{@@throw} may appear without an argument (as shown above), in which case
264fa2db
ZL
2250the object caught by the @code{@@catch} will be rethrown.
2251
2252Note that only (pointers to) Objective-C objects may be thrown and
2253caught using this scheme. When an object is thrown, it will be caught
2254by the nearest @code{@@catch} clause capable of handling objects of that type,
daf2f129
JM
2255analogously to how @code{catch} blocks work in C++ and Java. A
2256@code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
264fa2db
ZL
2257any and all Objective-C exceptions not caught by previous @code{@@catch}
2258clauses (if any).
2259
2260The @code{@@finally} clause, if present, will be executed upon exit from the
2261immediately preceding @code{@@try @dots{} @@catch} section. This will happen
2262regardless of whether any exceptions are thrown, caught or rethrown
2263inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2264of the @code{finally} clause in Java.
2265
2266There are several caveats to using the new exception mechanism:
2267
2268@itemize @bullet
2269@item
daf2f129 2270Although currently designed to be binary compatible with @code{NS_HANDLER}-style
264fa2db
ZL
2271idioms provided by the @code{NSException} class, the new
2272exceptions can only be used on Mac OS X 10.3 (Panther) and later
2273systems, due to additional functionality needed in the (NeXT) Objective-C
2274runtime.
2275
2276@item
2277As mentioned above, the new exceptions do not support handling
daf2f129 2278types other than Objective-C objects. Furthermore, when used from
264fa2db
ZL
2279Objective-C++, the Objective-C exception model does not interoperate with C++
2280exceptions at this time. This means you cannot @code{@@throw} an exception
daf2f129 2281from Objective-C and @code{catch} it in C++, or vice versa
264fa2db
ZL
2282(i.e., @code{throw @dots{} @@catch}).
2283@end itemize
daf2f129 2284
264fa2db
ZL
2285The @option{-fobjc-exceptions} switch also enables the use of synchronization
2286blocks for thread-safe execution:
2287
2288@smallexample
2289 @@synchronized (ObjCClass *guard) @{
2290 @dots{}
2291 @}
2292@end smallexample
2293
2294Upon entering the @code{@@synchronized} block, a thread of execution shall
2295first check whether a lock has been placed on the corresponding @code{guard}
2296object by another thread. If it has, the current thread shall wait until
daf2f129 2297the other thread relinquishes its lock. Once @code{guard} becomes available,
264fa2db
ZL
2298the current thread will place its own lock on it, execute the code contained in
2299the @code{@@synchronized} block, and finally relinquish the lock (thereby
2300making @code{guard} available to other threads).
2301
2302Unlike Java, Objective-C does not allow for entire methods to be marked
2303@code{@@synchronized}. Note that throwing exceptions out of
2304@code{@@synchronized} blocks is allowed, and will cause the guarding object
2305to be unlocked properly.
2306
6e955430
ZL
2307@item -fobjc-gc
2308@opindex fobjc-gc
2309Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2310
264fa2db 2311@item -freplace-objc-classes
5ad7ae7f 2312@opindex freplace-objc-classes
264fa2db
ZL
2313Emit a special marker instructing @command{ld(1)} not to statically link in
2314the resulting object file, and allow @command{dyld(1)} to load it in at
2315run time instead. This is used in conjunction with the Fix-and-Continue
daf2f129 2316debugging mode, where the object file in question may be recompiled and
264fa2db
ZL
2317dynamically reloaded in the course of program execution, without the need
2318to restart the program itself. Currently, Fix-and-Continue functionality
daf2f129 2319is only available in conjunction with the NeXT runtime on Mac OS X 10.3
264fa2db
ZL
2320and later.
2321
2322@item -fzero-link
5ad7ae7f 2323@opindex fzero-link
264fa2db
ZL
2324When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2325to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2326compile time) with static class references that get initialized at load time,
2327which improves run-time performance. Specifying the @option{-fzero-link} flag
2328suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
daf2f129 2329to be retained. This is useful in Zero-Link debugging mode, since it allows
264fa2db
ZL
2330for individual class implementations to be modified during program execution.
2331
60de6385 2332@item -gen-decls
cd3bb277 2333@opindex gen-decls
60de6385
SS
2334Dump interface declarations for all classes seen in the source file to a
2335file named @file{@var{sourcename}.decl}.
2336
6e955430
ZL
2337@item -Wassign-intercept
2338@opindex Wassign-intercept
2339Warn whenever an Objective-C assignment is being intercepted by the
2340garbage collector.
2341
60de6385 2342@item -Wno-protocol
cd3bb277 2343@opindex Wno-protocol
1f676100
NP
2344If a class is declared to implement a protocol, a warning is issued for
2345every method in the protocol that is not implemented by the class. The
6335b0aa 2346default behavior is to issue a warning for every method not explicitly
1f676100 2347implemented in the class, even if a method implementation is inherited
4ec7afd7 2348from the superclass. If you use the @option{-Wno-protocol} option, then
1f676100
NP
2349methods inherited from the superclass are considered to be implemented,
2350and no warning is issued for them.
60de6385
SS
2351
2352@item -Wselector
cd3bb277 2353@opindex Wselector
1f676100
NP
2354Warn if multiple methods of different types for the same selector are
2355found during compilation. The check is performed on the list of methods
2356in the final stage of compilation. Additionally, a check is performed
9eff22bc
LG
2357for each selector appearing in a @code{@@selector(@dots{})}
2358expression, and a corresponding method for that selector has been found
1f676100
NP
2359during compilation. Because these checks scan the method table only at
2360the end of compilation, these warnings are not produced if the final
2361stage of compilation is not reached, for example because an error is
4ec7afd7 2362found during compilation, or because the @option{-fsyntax-only} option is
1f676100
NP
2363being used.
2364
6e955430
ZL
2365@item -Wstrict-selector-match
2366@opindex Wstrict-selector-match
2367Warn if multiple methods with differing argument and/or return types are
2368found for a given selector when attempting to send a message using this
2369selector to a receiver of type @code{id} or @code{Class}. When this flag
2370is off (which is the default behavior), the compiler will omit such warnings
2371if any differences found are confined to types which share the same size
2372and alignment.
2373
1f676100
NP
2374@item -Wundeclared-selector
2375@opindex Wundeclared-selector
2376Warn if a @code{@@selector(@dots{})} expression referring to an
2377undeclared selector is found. A selector is considered undeclared if no
daf2f129 2378method with that name has been declared before the
9eff22bc
LG
2379@code{@@selector(@dots{})} expression, either explicitly in an
2380@code{@@interface} or @code{@@protocol} declaration, or implicitly in
2381an @code{@@implementation} section. This option always performs its
2382checks as soon as a @code{@@selector(@dots{})} expression is found,
4ec7afd7 2383while @option{-Wselector} only performs its checks in the final stage of
9eff22bc 2384compilation. This also enforces the coding style convention
1f676100 2385that methods and selectors must be declared before being used.
60de6385 2386
7989e4dc 2387@item -print-objc-runtime-info
5ad7ae7f 2388@opindex print-objc-runtime-info
7989e4dc
RO
2389Generate C header describing the largest structure that is passed by
2390value, if any.
60de6385
SS
2391
2392@end table
2393
764dbbf2
GDR
2394@node Language Independent Options
2395@section Options to Control Diagnostic Messages Formatting
2396@cindex options to control diagnostics formatting
2397@cindex diagnostic messages
2398@cindex message formatting
2399
b192711e 2400Traditionally, diagnostic messages have been formatted irrespective of
e979f9e8 2401the output device's aspect (e.g.@: its width, @dots{}). The options described
764dbbf2 2402below can be used to control the diagnostic messages formatting
e979f9e8 2403algorithm, e.g.@: how many characters per line, how often source location
6c0a4eab 2404information should be reported. Right now, only the C++ front end can
764dbbf2 2405honor these options. However it is expected, in the near future, that
6c0a4eab 2406the remaining front ends would be able to digest them correctly.
764dbbf2 2407
2642624b 2408@table @gcctabopt
764dbbf2 2409@item -fmessage-length=@var{n}
cd3bb277 2410@opindex fmessage-length
764dbbf2 2411Try to format error messages so that they fit on lines of about @var{n}
aee96fe9 2412characters. The default is 72 characters for @command{g++} and 0 for the rest of
161d7b59 2413the front ends supported by GCC@. If @var{n} is zero, then no
02f52e19 2414line-wrapping will be done; each error message will appear on a single
764dbbf2
GDR
2415line.
2416
cd3bb277 2417@opindex fdiagnostics-show-location
764dbbf2 2418@item -fdiagnostics-show-location=once
b192711e 2419Only meaningful in line-wrapping mode. Instructs the diagnostic messages
764dbbf2
GDR
2420reporter to emit @emph{once} source location information; that is, in
2421case the message is too long to fit on a single physical line and has to
2422be wrapped, the source location won't be emitted (as prefix) again,
2423over and over, in subsequent continuation lines. This is the default
c21cd8b1 2424behavior.
764dbbf2
GDR
2425
2426@item -fdiagnostics-show-location=every-line
2427Only meaningful in line-wrapping mode. Instructs the diagnostic
2428messages reporter to emit the same source location information (as
4fe9b91c 2429prefix) for physical lines that result from the process of breaking
b192711e 2430a message which is too long to fit on a single line.
764dbbf2 2431
1576e2be
RM
2432@item -fdiagnostics-show-option
2433@opindex fdiagnostics-show-option
ccf08a6e
DD
2434This option instructs the diagnostic machinery to add text to each
2435diagnostic emitted, which indicates which command line option directly
2436controls that diagnostic, when such an option is known to the
2437diagnostic machinery.
2438
16c1c158
RG
2439@item -Wcoverage-mismatch
2440@opindex Wcoverage-mismatch
2441Warn if feedback profiles do not match when using the
2442@option{-fprofile-use} option.
2443If a source file was changed between @option{-fprofile-gen} and
2444@option{-fprofile-use}, the files with the profile feedback can fail
2445to match the source file and GCC can not use the profile feedback
2446information. By default, GCC emits an error message in this case.
2447The option @option{-Wcoverage-mismatch} emits a warning instead of an
2448error. GCC does not use appropriate feedback profiles, so using this
2449option can result in poorly optimized code. This option is useful
b818de22 2450only in the case of very minor changes such as bug fixes to an
16c1c158
RG
2451existing code-base.
2452
764dbbf2
GDR
2453@end table
2454
74291a4b
MM
2455@node Warning Options
2456@section Options to Request or Suppress Warnings
2457@cindex options to control warnings
2458@cindex warning messages
2459@cindex messages, warning
2460@cindex suppressing warnings
2461
2462Warnings are diagnostic messages that report constructions which
2463are not inherently erroneous but which are risky or suggest there
2464may have been an error.
2465
2466You can request many specific warnings with options beginning @samp{-W},
630d3d5a 2467for example @option{-Wimplicit} to request warnings on implicit
74291a4b
MM
2468declarations. Each of these specific warning options also has a
2469negative form beginning @samp{-Wno-} to turn off warnings;
630d3d5a 2470for example, @option{-Wno-implicit}. This manual lists only one of the
74291a4b
MM
2471two forms, whichever is not the default.
2472
62aaa62c
GP
2473The following options control the amount and kinds of warnings produced
2474by GCC; for further, language-specific options also refer to
46e34f96
ZL
2475@ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect
2476Options}.
74291a4b 2477
2642624b 2478@table @gcctabopt
74291a4b
MM
2479@cindex syntax checking
2480@item -fsyntax-only
cd3bb277 2481@opindex fsyntax-only
74291a4b
MM
2482Check the code for syntax errors, but don't do anything beyond that.
2483
2484@item -pedantic
cd3bb277 2485@opindex pedantic
074e95e3
JM
2486Issue all the warnings demanded by strict ISO C and ISO C++;
2487reject all programs that use forbidden extensions, and some other
2488programs that do not follow ISO C and ISO C++. For ISO C, follows the
630d3d5a 2489version of the ISO C standard specified by any @option{-std} option used.
74291a4b 2490
074e95e3 2491Valid ISO C and ISO C++ programs should compile properly with or without
5490d604 2492this option (though a rare few will require @option{-ansi} or a
161d7b59 2493@option{-std} option specifying the required version of ISO C)@. However,
b1d16193
JL
2494without this option, certain GNU extensions and traditional C and C++
2495features are supported as well. With this option, they are rejected.
74291a4b 2496
630d3d5a 2497@option{-pedantic} does not cause warning messages for use of the
74291a4b
MM
2498alternate keywords whose names begin and end with @samp{__}. Pedantic
2499warnings are also disabled in the expression that follows
2500@code{__extension__}. However, only system header files should use
2501these escape routes; application programs should avoid them.
2502@xref{Alternate Keywords}.
2503
630d3d5a 2504Some users try to use @option{-pedantic} to check programs for strict ISO
74291a4b 2505C conformance. They soon find that it does not do quite what they want:
c1030c7c 2506it finds some non-ISO practices, but not all---only those for which
074e95e3
JM
2507ISO C @emph{requires} a diagnostic, and some others for which
2508diagnostics have been added.
74291a4b 2509
074e95e3 2510A feature to report any failure to conform to ISO C might be useful in
74291a4b 2511some instances, but would require considerable additional work and would
630d3d5a 2512be quite different from @option{-pedantic}. We don't have plans to
892d0a6d 2513support such a feature in the near future.
74291a4b 2514
91ea548a
JM
2515Where the standard specified with @option{-std} represents a GNU
2516extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2517corresponding @dfn{base standard}, the version of ISO C on which the GNU
2518extended dialect is based. Warnings from @option{-pedantic} are given
2519where they are required by the base standard. (It would not make sense
2520for such warnings to be given only for features not in the specified GNU
2521C dialect, since by definition the GNU dialects of C include all
2522features the compiler supports with the given option, and there would be
2523nothing to warn about.)
2524
74291a4b 2525@item -pedantic-errors
cd3bb277 2526@opindex pedantic-errors
630d3d5a 2527Like @option{-pedantic}, except that errors are produced rather than
74291a4b
MM
2528warnings.
2529
2530@item -w
cd3bb277 2531@opindex w
74291a4b
MM
2532Inhibit all warning messages.
2533
2534@item -Wno-import
cd3bb277 2535@opindex Wno-import
74291a4b
MM
2536Inhibit warning messages about the use of @samp{#import}.
2537
2538@item -Wchar-subscripts
cd3bb277 2539@opindex Wchar-subscripts
74291a4b
MM
2540Warn if an array subscript has type @code{char}. This is a common cause
2541of error, as programmers often forget that this type is signed on some
2542machines.
69cdf050 2543This warning is enabled by @option{-Wall}.
74291a4b
MM
2544
2545@item -Wcomment
cd3bb277 2546@opindex Wcomment
74291a4b
MM
2547Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2548comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
69cdf050 2549This warning is enabled by @option{-Wall}.
74291a4b 2550
c65a01af
RG
2551@item -Wfatal-errors
2552@opindex Wfatal-errors
2553This option causes the compiler to abort compilation on the first error
2554occurred rather than trying to keep going and printing further error
2555messages.
2556
74291a4b 2557@item -Wformat
cd3bb277 2558@opindex Wformat
e6e931b7
JM
2559@opindex ffreestanding
2560@opindex fno-builtin
74291a4b
MM
2561Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2562the arguments supplied have types appropriate to the format string
26f6672d
JM
2563specified, and that the conversions specified in the format string make
2564sense. This includes standard functions, and others specified by format
2565attributes (@pxref{Function Attributes}), in the @code{printf},
2566@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
a2bec818 2567not in the C standard) families (or other target-specific families).
e6e931b7
JM
2568Which functions are checked without format attributes having been
2569specified depends on the standard version selected, and such checks of
2570functions without the attribute specified are disabled by
2571@option{-ffreestanding} or @option{-fno-builtin}.
74291a4b 2572
8308e0b7 2573The formats are checked against the format features supported by GNU
3764f879 2574libc version 2.2. These include all ISO C90 and C99 features, as well
8308e0b7
JM
2575as features from the Single Unix Specification and some BSD and GNU
2576extensions. Other library implementations may not support all these
2577features; GCC does not support warning about features that go beyond a
630d3d5a
JM
2578particular library's limitations. However, if @option{-pedantic} is used
2579with @option{-Wformat}, warnings will be given about format features not
26f6672d
JM
2580in the selected standard version (but not for @code{strfmon} formats,
2581since those are not in any version of the C standard). @xref{C Dialect
2582Options,,Options Controlling C Dialect}.
8308e0b7 2583
b34c7881
JT
2584Since @option{-Wformat} also checks for null format arguments for
2585several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2586
630d3d5a 2587@option{-Wformat} is included in @option{-Wall}. For more control over some
c76f4e8e 2588aspects of format checking, the options @option{-Wformat-y2k},
e964a556
JT
2589@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2590@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2591@option{-Wformat=2} are available, but are not included in @option{-Wall}.
4d808927 2592
c76f4e8e
JM
2593@item -Wformat-y2k
2594@opindex Wformat-y2k
2595If @option{-Wformat} is specified, also warn about @code{strftime}
4d808927
JM
2596formats which may yield only a two-digit year.
2597
2598@item -Wno-format-extra-args
cd3bb277 2599@opindex Wno-format-extra-args
630d3d5a 2600If @option{-Wformat} is specified, do not warn about excess arguments to a
4d808927
JM
2601@code{printf} or @code{scanf} format function. The C standard specifies
2602that such arguments are ignored.
2603
7e5fb12f
JM
2604Where the unused arguments lie between used arguments that are
2605specified with @samp{$} operand number specifications, normally
2606warnings are still given, since the implementation could not know what
2607type to pass to @code{va_arg} to skip the unused arguments. However,
2608in the case of @code{scanf} formats, this option will suppress the
2609warning if the unused arguments are all pointers, since the Single
2610Unix Specification says that such unused arguments are allowed.
2611
e964a556
JT
2612@item -Wno-format-zero-length
2613@opindex Wno-format-zero-length
2614If @option{-Wformat} is specified, do not warn about zero-length formats.
2615The C standard specifies that zero-length formats are allowed.
2616
4d808927 2617@item -Wformat-nonliteral
cd3bb277 2618@opindex Wformat-nonliteral
630d3d5a 2619If @option{-Wformat} is specified, also warn if the format string is not a
4d808927
JM
2620string literal and so cannot be checked, unless the format function
2621takes its format arguments as a @code{va_list}.
2622
c907e684 2623@item -Wformat-security
cd3bb277 2624@opindex Wformat-security
630d3d5a 2625If @option{-Wformat} is specified, also warn about uses of format
c907e684
JM
2626functions that represent possible security problems. At present, this
2627warns about calls to @code{printf} and @code{scanf} functions where the
2628format string is not a string literal and there are no format arguments,
2629as in @code{printf (foo);}. This may be a security hole if the format
2630string came from untrusted input and contains @samp{%n}. (This is
630d3d5a
JM
2631currently a subset of what @option{-Wformat-nonliteral} warns about, but
2632in future warnings may be added to @option{-Wformat-security} that are not
2633included in @option{-Wformat-nonliteral}.)
c907e684 2634
4d808927 2635@item -Wformat=2
cd3bb277 2636@opindex Wformat=2
630d3d5a
JM
2637Enable @option{-Wformat} plus format checks not included in
2638@option{-Wformat}. Currently equivalent to @samp{-Wformat
c76f4e8e 2639-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
4d808927 2640
b34c7881
JT
2641@item -Wnonnull
2642@opindex Wnonnull
f6d9224f 2643Warn about passing a null pointer for arguments marked as
b34c7881
JT
2644requiring a non-null value by the @code{nonnull} function attribute.
2645
2646@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
2647can be disabled with the @option{-Wno-nonnull} option.
2648
46e34f96 2649@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3390f9c9 2650@opindex Winit-self
f6d9224f
GP
2651Warn about uninitialized variables which are initialized with themselves.
2652Note this option can only be used with the @option{-Wuninitialized} option,
2653which in turn only works with @option{-O1} and above.
3390f9c9 2654
f6d9224f
GP
2655For example, GCC will warn about @code{i} being uninitialized in the
2656following snippet only when @option{-Winit-self} has been specified:
3390f9c9
AP
2657@smallexample
2658@group
2659int f()
2660@{
2661 int i = i;
2662 return i;
2663@}
2664@end group
2665@end smallexample
2666
e9a25f70 2667@item -Wimplicit-int
cd3bb277 2668@opindex Wimplicit-int
e9a25f70 2669Warn when a declaration does not specify a type.
69cdf050 2670This warning is enabled by @option{-Wall}.
e9a25f70 2671
f5963e61 2672@item -Wimplicit-function-declaration
cd3bb277 2673@opindex Wimplicit-function-declaration
dc90f45b
MLI
2674@opindex Wno-implicit-function-declaration
2675Give a warning whenever a function is used before being declared. In
2676C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
2677enabled by default and it is made into an error by
2678@option{-pedantic-errors}. This warning is also enabled by
2679@option{-Wall}.
e9a25f70 2680
74291a4b 2681@item -Wimplicit
cd3bb277 2682@opindex Wimplicit
630d3d5a 2683Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
69cdf050 2684This warning is enabled by @option{-Wall}.
861bb6c1
JL
2685
2686@item -Wmain
cd3bb277 2687@opindex Wmain
861bb6c1
JL
2688Warn if the type of @samp{main} is suspicious. @samp{main} should be a
2689function with external linkage, returning int, taking either zero
2690arguments, two, or three arguments of appropriate types.
69cdf050 2691This warning is enabled by @option{-Wall}.
4a870dba 2692
1f0c3120 2693@item -Wmissing-braces
cd3bb277 2694@opindex Wmissing-braces
1f0c3120
JM
2695Warn if an aggregate or union initializer is not fully bracketed. In
2696the following example, the initializer for @samp{a} is not fully
2697bracketed, but that for @samp{b} is fully bracketed.
2698
2699@smallexample
2700int a[2][2] = @{ 0, 1, 2, 3 @};
2701int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2702@end smallexample
2703
69cdf050
JM
2704This warning is enabled by @option{-Wall}.
2705
46e34f96 2706@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
b02398bd
BE
2707@opindex Wmissing-include-dirs
2708Warn if a user-supplied include directory does not exist.
2709
74291a4b 2710@item -Wparentheses
cd3bb277 2711@opindex Wparentheses
74291a4b
MM
2712Warn if parentheses are omitted in certain contexts, such
2713as when there is an assignment in a context where a truth value
2714is expected, or when operators are nested whose precedence people
2a67bec2 2715often get confused about.
3e3970a2
JM
2716
2717Also warn if a comparison like @samp{x<=y<=z} appears; this is
2718equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2719interpretation from that of ordinary mathematical notation.
74291a4b 2720
e9a25f70
JL
2721Also warn about constructions where there may be confusion to which
2722@code{if} statement an @code{else} branch belongs. Here is an example of
2723such a case:
2724
2725@smallexample
aee96fe9 2726@group
e9a25f70
JL
2727@{
2728 if (a)
2729 if (b)
2730 foo ();
2731 else
2732 bar ();
2733@}
aee96fe9 2734@end group
e9a25f70
JL
2735@end smallexample
2736
2a67bec2
ILT
2737In C/C++, every @code{else} branch belongs to the innermost possible
2738@code{if} statement, which in this example is @code{if (b)}. This is
2739often not what the programmer expected, as illustrated in the above
2740example by indentation the programmer chose. When there is the
2741potential for this confusion, GCC will issue a warning when this flag
2742is specified. To eliminate the warning, add explicit braces around
2743the innermost @code{if} statement so there is no way the @code{else}
2744could belong to the enclosing @code{if}. The resulting code would
2745look like this:
e9a25f70
JL
2746
2747@smallexample
aee96fe9 2748@group
e9a25f70
JL
2749@{
2750 if (a)
2751 @{
2752 if (b)
2753 foo ();
2754 else
2755 bar ();
2756 @}
2757@}
aee96fe9 2758@end group
e9a25f70
JL
2759@end smallexample
2760
69cdf050
JM
2761This warning is enabled by @option{-Wall}.
2762
bb58bec5 2763@item -Wsequence-point
cd3bb277 2764@opindex Wsequence-point
bb58bec5 2765Warn about code that may have undefined semantics because of violations
7127d9c7
DM
2766of sequence point rules in the C and C++ standards.
2767
2768The C and C++ standards defines the order in which expressions in a C/C++
2769program are evaluated in terms of @dfn{sequence points}, which represent
2770a partial ordering between the execution of parts of the program: those
2771executed before the sequence point, and those executed after it. These
2772occur after the evaluation of a full expression (one which is not part
2773of a larger expression), after the evaluation of the first operand of a
bb58bec5
JM
2774@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2775function is called (but after the evaluation of its arguments and the
2776expression denoting the called function), and in certain other places.
2777Other than as expressed by the sequence point rules, the order of
2778evaluation of subexpressions of an expression is not specified. All
2779these rules describe only a partial order rather than a total order,
2780since, for example, if two functions are called within one expression
2781with no sequence point between them, the order in which the functions
2782are called is not specified. However, the standards committee have
2783ruled that function calls do not overlap.
2784
2785It is not specified when between sequence points modifications to the
2786values of objects take effect. Programs whose behavior depends on this
7127d9c7
DM
2787have undefined behavior; the C and C++ standards specify that ``Between
2788the previous and next sequence point an object shall have its stored
cb7ad97b 2789value modified at most once by the evaluation of an expression.
7127d9c7
DM
2790Furthermore, the prior value shall be read only to determine the value
2791to be stored.''. If a program breaks these rules, the results on any
bb58bec5
JM
2792particular implementation are entirely unpredictable.
2793
2794Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2795= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
2796diagnosed by this option, and it may give an occasional false positive
2797result, but in general it has been found fairly effective at detecting
2798this sort of problem in programs.
2799
7127d9c7 2800The standard is worded confusingly, therefore there is some debate
9c34dbbf
ZW
2801over the precise meaning of the sequence point rules in subtle cases.
2802Links to discussions of the problem, including proposed formal
962e6e00 2803definitions, may be found on the GCC readings page, at
c5122d75 2804@w{@uref{http://gcc.gnu.org/readings.html}}.
bb58bec5 2805
7127d9c7 2806This warning is enabled by @option{-Wall} for C and C++.
69cdf050 2807
74291a4b 2808@item -Wreturn-type
cd3bb277 2809@opindex Wreturn-type
32c4c36c
ML
2810Warn whenever a function is defined with a return-type that defaults to
2811@code{int}. Also warn about any @code{return} statement with no
02f52e19 2812return-value in a function whose return-type is not @code{void}.
32c4c36c 2813
01a40464
DM
2814Also warn if the return type of a function has a type qualifier
2815such as @code{const}. For ISO C such a type qualifier has no effect,
2816since the value returned by a function is not an lvalue.
2817For C++, the warning is only emitted for scalar types or @code{void}.
2818ISO C prohibits qualified @code{void} return types on function
2819definitions, so such return types always receive a warning
2820even without this option.
e508a019 2821
32c4c36c 2822For C++, a function without return type always produces a diagnostic
767094dd 2823message, even when @option{-Wno-return-type} is specified. The only
32c4c36c 2824exceptions are @samp{main} and functions defined in system headers.
74291a4b 2825
69cdf050
JM
2826This warning is enabled by @option{-Wall}.
2827
74291a4b 2828@item -Wswitch
cd3bb277 2829@opindex Wswitch
2eac577f 2830Warn whenever a @code{switch} statement has an index of enumerated type
74291a4b
MM
2831and lacks a @code{case} for one or more of the named codes of that
2832enumeration. (The presence of a @code{default} label prevents this
2833warning.) @code{case} labels outside the enumeration range also
2834provoke warnings when this option is used.
69cdf050 2835This warning is enabled by @option{-Wall}.
74291a4b 2836
d6961341
AC
2837@item -Wswitch-default
2838@opindex Wswitch-switch
2839Warn whenever a @code{switch} statement does not have a @code{default}
2840case.
2841
173028e5
AC
2842@item -Wswitch-enum
2843@opindex Wswitch-enum
2eac577f 2844Warn whenever a @code{switch} statement has an index of enumerated type
173028e5
AC
2845and lacks a @code{case} for one or more of the named codes of that
2846enumeration. @code{case} labels outside the enumeration range also
2847provoke warnings when this option is used.
2848
74291a4b 2849@item -Wtrigraphs
cd3bb277 2850@opindex Wtrigraphs
f2ecb02d
JM
2851Warn if any trigraphs are encountered that might change the meaning of
2852the program (trigraphs within comments are not warned about).
69cdf050 2853This warning is enabled by @option{-Wall}.
74291a4b 2854
078721e1 2855@item -Wunused-function
cd3bb277 2856@opindex Wunused-function
078721e1 2857Warn whenever a static function is declared but not defined or a
aa58883c 2858non-inline static function is unused.
69cdf050 2859This warning is enabled by @option{-Wall}.
74291a4b 2860
078721e1 2861@item -Wunused-label
cd3bb277 2862@opindex Wunused-label
078721e1 2863Warn whenever a label is declared but not used.
69cdf050 2864This warning is enabled by @option{-Wall}.
078721e1
AC
2865
2866To suppress this warning use the @samp{unused} attribute
2867(@pxref{Variable Attributes}).
2868
2869@item -Wunused-parameter
cd3bb277 2870@opindex Wunused-parameter
078721e1
AC
2871Warn whenever a function parameter is unused aside from its declaration.
2872
2873To suppress this warning use the @samp{unused} attribute
2874(@pxref{Variable Attributes}).
956d6950 2875
078721e1 2876@item -Wunused-variable
cd3bb277 2877@opindex Wunused-variable
078721e1 2878Warn whenever a local variable or non-constant static variable is unused
bc49e371 2879aside from its declaration.
69cdf050 2880This warning is enabled by @option{-Wall}.
078721e1
AC
2881
2882To suppress this warning use the @samp{unused} attribute
74291a4b
MM
2883(@pxref{Variable Attributes}).
2884
078721e1 2885@item -Wunused-value
cd3bb277 2886@opindex Wunused-value
27f33b15
MLI
2887Warn whenever a statement computes a result that is explicitly not
2888used. To suppress this warning cast the unused expression to
2889@samp{void}. This includes an expression-statement or the left-hand
2890side of a comma expression that contains no side effects. For example,
2891an expression such as @samp{x[i,j]} will cause a warning, while
2892@samp{x[(void)i,j]} will not.
078721e1 2893
27f33b15 2894This warning is enabled by @option{-Wall}.
078721e1
AC
2895
2896@item -Wunused
cd3bb277 2897@opindex Wunused
d3075b6c 2898All the above @option{-Wunused} options combined.
078721e1
AC
2899
2900In order to get a warning about an unused function parameter, you must
65ca2d60
PE
2901either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2902@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
078721e1 2903
74291a4b 2904@item -Wuninitialized
cd3bb277 2905@opindex Wuninitialized
c5c76735
JL
2906Warn if an automatic variable is used without first being initialized or
2907if a variable may be clobbered by a @code{setjmp} call.
74291a4b
MM
2908
2909These warnings are possible only in optimizing compilation,
2910because they require data flow information that is computed only
c662432e 2911when optimizing. If you do not specify @option{-O}, you will not get
d955420e
DP
2912these warnings. Instead, GCC will issue a warning about @option{-Wuninitialized}
2913requiring @option{-O}.
74291a4b 2914
3390f9c9
AP
2915If you want to warn about code which uses the uninitialized value of the
2916variable in its own initializer, use the @option{-Winit-self} option.
2917
8ceac9f8
JM
2918These warnings occur for individual uninitialized or clobbered
2919elements of structure, union or array variables as well as for
2920variables which are uninitialized or clobbered as a whole. They do
2921not occur for variables or elements declared @code{volatile}. Because
2922these warnings depend on optimization, the exact variables or elements
2923for which there are warnings will depend on the precise optimization
2924options and version of GCC used.
74291a4b
MM
2925
2926Note that there may be no warning about a variable that is used only
2927to compute a value that itself is never used, because such
2928computations may be deleted by data flow analysis before the warnings
2929are printed.
2930
0c2d1a2a 2931These warnings are made optional because GCC is not smart
74291a4b
MM
2932enough to see all the reasons why the code might be correct
2933despite appearing to have an error. Here is one example of how
2934this can happen:
2935
2936@smallexample
aee96fe9 2937@group
74291a4b
MM
2938@{
2939 int x;
2940 switch (y)
2941 @{
2942 case 1: x = 1;
2943 break;
2944 case 2: x = 4;
2945 break;
2946 case 3: x = 5;
2947 @}
2948 foo (x);
2949@}
aee96fe9 2950@end group
74291a4b
MM
2951@end smallexample
2952
2953@noindent
2954If the value of @code{y} is always 1, 2 or 3, then @code{x} is
0c2d1a2a 2955always initialized, but GCC doesn't know this. Here is
74291a4b
MM
2956another common case:
2957
2958@smallexample
2959@{
2960 int save_y;
2961 if (change_y) save_y = y, y = new_y;
2962 @dots{}
2963 if (change_y) y = save_y;
2964@}
2965@end smallexample
2966
2967@noindent
2968This has no bug because @code{save_y} is used only if it is set.
2969
20300b05 2970@cindex @code{longjmp} warnings
b192711e 2971This option also warns when a non-volatile automatic variable might be
c5c76735
JL
2972changed by a call to @code{longjmp}. These warnings as well are possible
2973only in optimizing compilation.
20300b05
GK
2974
2975The compiler sees only the calls to @code{setjmp}. It cannot know
2976where @code{longjmp} will be called; in fact, a signal handler could
2977call it at any point in the code. As a result, you may get a warning
2978even when there is in fact no problem because @code{longjmp} cannot
2979in fact be called at the place which would cause a problem.
2980
74291a4b
MM
2981Some spurious warnings can be avoided if you declare all the functions
2982you use that never return as @code{noreturn}. @xref{Function
2983Attributes}.
2984
69cdf050
JM
2985This warning is enabled by @option{-Wall}.
2986
d300e551 2987@item -Wunknown-pragmas
cd3bb277 2988@opindex Wunknown-pragmas
d300e551
NC
2989@cindex warning for unknown pragmas
2990@cindex unknown pragmas, warning
2991@cindex pragmas, warning of unknown
2992Warn when a #pragma directive is encountered which is not understood by
161d7b59 2993GCC@. If this command line option is used, warnings will even be issued
d300e551 2994for unknown pragmas in system header files. This is not the case if
630d3d5a 2995the warnings were only enabled by the @option{-Wall} command line option.
d300e551 2996
b9b8dde3
DD
2997@item -Wno-pragmas
2998@opindex Wno-pragmas
2999@opindex Wpragmas
3000Do not warn about misuses of pragmas, such as incorrect parameters,
3001invalid syntax, or conflicts between pragmas. See also
3002@samp{-Wunknown-pragmas}.
3003
bf52f899
NS
3004@item -Wstrict-aliasing
3005@opindex Wstrict-aliasing
3006This option is only active when @option{-fstrict-aliasing} is active.
3007It warns about code which might break the strict aliasing rules that the
8a36672b
JM
3008compiler is using for optimization. The warning does not catch all
3009cases, but does attempt to catch the more common pitfalls. It is
bf52f899
NS
3010included in @option{-Wall}.
3011
5399d643
JW
3012@item -Wstrict-aliasing=2
3013@opindex Wstrict-aliasing=2
3014This option is only active when @option{-fstrict-aliasing} is active.
66f33c03
JW
3015It warns about code which might break the strict aliasing rules that the
3016compiler is using for optimization. This warning catches more cases than
3017@option{-Wstrict-aliasing}, but it will also give a warning for some ambiguous
3018cases that are safe.
5399d643 3019
6ac01510
ILT
3020@item -Wstrict-overflow
3021@item -Wstrict-overflow=@var{n}
edc5f63b 3022@opindex Wstrict-overflow
6ac01510
ILT
3023This option is only active when @option{-fstrict-overflow} is active.
3024It warns about cases where the compiler optimizes based on the
3025assumption that signed overflow does not occur. Note that it does not
3026warn about all cases where the code might overflow: it only warns
3027about cases where the compiler implements some optimization. Thus
3028this warning depends on the optimization level.
3029
3030An optimization which assumes that signed overflow does not occur is
3031perfectly safe if the values of the variables involved are such that
3032overflow never does, in fact, occur. Therefore this warning can
3033easily give a false positive: a warning about code which is not
3034actually a problem. To help focus on important issues, several
4df28528
ILT
3035warning levels are defined. No warnings are issued for the use of
3036undefined signed overflow when estimating how many iterations a loop
3037will require, in particular when determining whether a loop will be
3038executed at all.
6ac01510
ILT
3039
3040@table @option
3041@item -Wstrict-overflow=1
3042Warn about cases which are both questionable and easy to avoid. For
3043example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
4d4362c8
ILT
3044compiler will simplify this to @code{1}. This level of
3045@option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3046are not, and must be explicitly requested.
6ac01510
ILT
3047
3048@item -Wstrict-overflow=2
3049Also warn about other cases where a comparison is simplified to a
3050constant. For example: @code{abs (x) >= 0}. This can only be
3051simplified when @option{-fstrict-overflow} is in effect, because
3052@code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
4d4362c8
ILT
3053zero. @option{-Wstrict-overflow} (with no level) is the same as
3054@option{-Wstrict-overflow=2}.
6ac01510
ILT
3055
3056@item -Wstrict-overflow=3
3057Also warn about other cases where a comparison is simplified. For
3058example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3059
3060@item -Wstrict-overflow=4
3061Also warn about other simplifications not covered by the above cases.
3062For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3063
3064@item -Wstrict-overflow=5
3065Also warn about cases where the compiler reduces the magnitude of a
3066constant involved in a comparison. For example: @code{x + 2 > y} will
3067be simplified to @code{x + 1 >= y}. This is reported only at the
3068highest warning level because this simplification applies to many
3069comparisons, so this warning level will give a very large number of
3070false positives.
3071@end table
3072
590b1f2d
DM
3073@item -Warray-bounds
3074@opindex Wno-array-bounds
3075@opindex Warray-bounds
3076This option is only active when @option{-ftree-vrp} is active
3077(default for -O2 and above). It warns about subscripts to arrays
3078that are always out of bounds. This warning is enabled by @option{-Wall}.
3079
74291a4b 3080@item -Wall
cd3bb277 3081@opindex Wall
74291a4b
MM
3082All of the above @samp{-W} options combined. This enables all the
3083warnings about constructions that some users consider questionable, and
3084that are easy to avoid (or modify to prevent the warning), even in
bd8f9aec
SP
3085conjunction with macros. This also enables some language-specific
3086warnings described in @ref{C++ Dialect Options} and
46e34f96 3087@ref{Objective-C and Objective-C++ Dialect Options}.
74291a4b
MM
3088@end table
3089
630d3d5a 3090The following @option{-W@dots{}} options are not implied by @option{-Wall}.
74291a4b
MM
3091Some of them warn about constructions that users generally do not
3092consider questionable, but which occasionally you might wish to check
3093for; others warn about constructions that are necessary or hard to avoid
3094in some cases, and there is no simple way to modify the code to suppress
3095the warning.
3096
2642624b 3097@table @gcctabopt
65ca2d60 3098@item -Wextra
cd3bb277 3099@opindex W
65ca2d60
PE
3100@opindex Wextra
3101(This option used to be called @option{-W}. The older name is still
3102supported, but the newer name is more descriptive.) Print extra warning
3103messages for these events:
74291a4b
MM
3104
3105@itemize @bullet
74291a4b
MM
3106@item
3107A function can return either with or without a value. (Falling
3108off the end of the function body is considered returning without
3109a value.) For example, this function would evoke such a
3110warning:
3111
3112@smallexample
3113@group
3114foo (a)
3115@{
3116 if (a > 0)
3117 return a;
3118@}
3119@end group
3120@end smallexample
3121
74291a4b 3122@item
65ca2d60 3123An unsigned value is compared against zero with @samp{<} or @samp{>=}.
74291a4b 3124
b1ed4cb4
MLI
3125@item @r{(C only)}
3126Storage-class specifiers like @code{static} are not the first things
3127in a declaration. According to the C Standard, this usage is
3128obsolescent. This warning can be independently controlled by
3129@option{-Wold-style-declaration}.
74291a4b
MM
3130
3131@item
630d3d5a 3132If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
74291a4b
MM
3133arguments.
3134
e9a25f70
JL
3135@item
3136A comparison between signed and unsigned values could produce an
3137incorrect result when the signed value is converted to unsigned.
630d3d5a 3138(But don't warn if @option{-Wno-sign-compare} is also specified.)
e9a25f70 3139
dbde0d5d
BH
3140@item
3141An aggregate has an initializer which does not initialize all members.
eaac4679
RS
3142This warning can be independently controlled by
3143@option{-Wmissing-field-initializers}.
65ca2d60 3144
7ed322d7
JM
3145@item
3146An initialized field without side effects is overridden when using
3147designated initializers (@pxref{Designated Inits, , Designated
3148Initializers}). This warning can be independently controlled by
3149@option{-Woverride-init}.
3150
cb4af25a 3151@item @r{(C only)}
65ca2d60 3152A function parameter is declared without a type specifier in K&R-style
cb4af25a
MLI
3153functions. This warning can be independently controlled by
3154@option{-Wmissing-parameter-type}.
65ca2d60
PE
3155
3156@item
62e00e94
DM
3157An empty body occurs in an @samp{if}, @samp{else} or
3158@samp{do while} statement. This warning can be independently
3159controlled by @option{-Wempty-body}.
65ca2d60 3160
841cc7da
MS
3161@item @r{(C++ only)}
3162An empty body occurs in a @samp{while} or @samp{for} statement with no
3163whitespacing before the semicolon. This warning can be independently
3164controlled by @option{-Wempty-body}.
3165
65ca2d60
PE
3166@item
3167A pointer is compared against integer zero with @samp{<}, @samp{<=},
3168@samp{>}, or @samp{>=}.
3169
3170@item
3171A variable might be changed by @samp{longjmp} or @samp{vfork}.
2b001724 3172This warning can be independently controlled by @option{-Wclobbered}.
65ca2d60 3173
65ca2d60
PE
3174@item @r{(C++ only)}
3175An enumerator and a non-enumerator both appear in a conditional expression.
3176
3177@item @r{(C++ only)}
3178A non-static reference or non-static @samp{const} member appears in a
3179class without constructors.
3180
3181@item @r{(C++ only)}
3182Ambiguous virtual bases.
3183
3184@item @r{(C++ only)}
3185Subscripting an array which has been declared @samp{register}.
3186
3187@item @r{(C++ only)}
3188Taking the address of a variable which has been declared @samp{register}.
3189
3190@item @r{(C++ only)}
62b9c42c 3191A base class is not initialized in a derived class' copy constructor.
74291a4b
MM
3192@end itemize
3193
75227a33
GK
3194@item -Wno-div-by-zero
3195@opindex Wno-div-by-zero
3196@opindex Wdiv-by-zero
3197Do not warn about compile-time integer division by zero. Floating point
3198division by zero is not warned about, as it can be a legitimate way of
3199obtaining infinities and NaNs.
3200
3201@item -Wsystem-headers
3202@opindex Wsystem-headers
3203@cindex warnings from system headers
3204@cindex system headers, warnings from
3205Print warning messages for constructs found in system header files.
3206Warnings from system headers are normally suppressed, on the assumption
3207that they usually do not indicate real problems and would only make the
3208compiler output harder to read. Using this command line option tells
3209GCC to emit warnings from system headers as if they occurred in user
3210code. However, note that using @option{-Wall} in conjunction with this
3211option will @emph{not} warn about unknown pragmas in system
3212headers---for that, @option{-Wunknown-pragmas} must also be used.
3213
f793a95e 3214@item -Wfloat-equal
cd3bb277 3215@opindex Wfloat-equal
f793a95e
JL
3216Warn if floating point values are used in equality comparisons.
3217
488d3985
GK
3218The idea behind this is that sometimes it is convenient (for the
3219programmer) to consider floating-point values as approximations to
3220infinitely precise real numbers. If you are doing this, then you need
c0478a66 3221to compute (by analyzing the code, or in some other way) the maximum or
488d3985
GK
3222likely maximum error that the computation introduces, and allow for it
3223when performing comparisons (and when producing output, but that's a
3224different problem). In particular, instead of testing for equality, you
3225would check to see whether the two values have ranges that overlap; and
3226this is done with the relational operators, so equality comparisons are
3227probably mistaken.
3228
aee96fe9 3229@item -Wtraditional @r{(C only)}
cd3bb277 3230@opindex Wtraditional
74291a4b 3231Warn about certain constructs that behave differently in traditional and
161d7b59 3232ISO C@. Also warn about ISO C constructs that have no traditional C
c8abc684 3233equivalent, and/or problematic constructs which should be avoided.
74291a4b
MM
3234
3235@itemize @bullet
3236@item
da312b55
NB
3237Macro parameters that appear within string literals in the macro body.
3238In traditional C macro replacement takes place within string literals,
161d7b59 3239but does not in ISO C@.
da312b55
NB
3240
3241@item
3242In traditional C, some preprocessor directives did not exist.
3243Traditional preprocessors would only consider a line to be a directive
3244if the @samp{#} appeared in column 1 on the line. Therefore
630d3d5a 3245@option{-Wtraditional} warns about directives that traditional C
da312b55
NB
3246understands but would ignore because the @samp{#} does not appear as the
3247first character on the line. It also suggests you hide directives like
3248@samp{#pragma} not understood by traditional C by indenting them. Some
c21cd8b1 3249traditional implementations would not recognize @samp{#elif}, so it
da312b55
NB
3250suggests avoiding it altogether.
3251
3252@item
3253A function-like macro that appears without arguments.
3254
3255@item
3256The unary plus operator.
3257
3258@item
c771326b
JM
3259The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3260constant suffixes. (Traditional C does support the @samp{L} suffix on integer
da312b55 3261constants.) Note, these suffixes appear in macros defined in the system
e979f9e8 3262headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
c8abc684 3263Use of these macros in user code might normally lead to spurious
2dd76960 3264warnings, however GCC's integrated preprocessor has enough context to
c8abc684 3265avoid warning in these cases.
74291a4b
MM
3266
3267@item
3268A function declared external in one block and then used after the end of
3269the block.
3270
3271@item
3272A @code{switch} statement has an operand of type @code{long}.
db838bb8
KG
3273
3274@item
3275A non-@code{static} function declaration follows a @code{static} one.
3276This construct is not accepted by some traditional C compilers.
48776cde
KG
3277
3278@item
c1030c7c 3279The ISO type of an integer constant has a different width or
48776cde 3280signedness from its traditional type. This warning is only issued if
e979f9e8 3281the base of the constant is ten. I.e.@: hexadecimal or octal values, which
48776cde 3282typically represent bit patterns, are not warned about.
bb66adca
KG
3283
3284@item
c1030c7c 3285Usage of ISO string concatenation is detected.
7f094a94 3286
895ea614
KG
3287@item
3288Initialization of automatic aggregates.
3289
3290@item
3291Identifier conflicts with labels. Traditional C lacks a separate
3292namespace for labels.
253b6b82
KG
3293
3294@item
3295Initialization of unions. If the initializer is zero, the warning is
3296omitted. This is done under the assumption that the zero initializer in
e979f9e8 3297user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
253b6b82
KG
3298initializer warnings and relies on default initialization to zero in the
3299traditional C case.
03829ad2
KG
3300
3301@item
3ed56f8a
KG
3302Conversions by prototypes between fixed/floating point values and vice
3303versa. The absence of these prototypes when compiling with traditional
3304C would cause serious problems. This is a subset of the possible
05170031 3305conversion warnings, for the full set use @option{-Wtraditional-conversion}.
622d3731
KG
3306
3307@item
3308Use of ISO C style function definitions. This warning intentionally is
3309@emph{not} issued for prototype declarations or variadic functions
3310because these ISO C features will appear in your code when using
3311libiberty's traditional C compatibility macros, @code{PARAMS} and
3312@code{VPARAMS}. This warning is also bypassed for nested functions
2dd76960 3313because that feature is already a GCC extension and thus not relevant to
622d3731 3314traditional C compatibility.
74291a4b
MM
3315@end itemize
3316
05170031
MLI
3317@item -Wtraditional-conversion @r{(C only)}
3318@opindex Wtraditional-conversion
3319Warn if a prototype causes a type conversion that is different from what
3320would happen to the same argument in the absence of a prototype. This
3321includes conversions of fixed point to floating and vice versa, and
3322conversions changing the width or signedness of a fixed point argument
3323except when the same as the default promotion.
3324
85617eba
HPN
3325@item -Wdeclaration-after-statement @r{(C only)}
3326@opindex Wdeclaration-after-statement
3327Warn when a declaration is found after a statement in a block. This
3328construct, known from C++, was introduced with ISO C99 and is by default
3329allowed in GCC@. It is not supported by ISO C90 and was not supported by
3330GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3331
861bb6c1 3332@item -Wundef
cd3bb277 3333@opindex Wundef
861bb6c1
JL
3334Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3335
90689ae1
JM
3336@item -Wno-endif-labels
3337@opindex Wno-endif-labels
909de5da 3338@opindex Wendif-labels
90689ae1 3339Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
909de5da 3340
74291a4b 3341@item -Wshadow
cd3bb277 3342@opindex Wshadow
d773df5a
DB
3343Warn whenever a local variable shadows another local variable, parameter or
3344global variable or whenever a built-in function is shadowed.
74291a4b 3345
74291a4b 3346@item -Wlarger-than-@var{len}
cd3bb277 3347@opindex Wlarger-than
74291a4b
MM
3348Warn whenever an object of larger than @var{len} bytes is defined.
3349
f9cc1a70
PB
3350@item -Wunsafe-loop-optimizations
3351@opindex Wunsafe-loop-optimizations
3352Warn if the loop cannot be optimized because the compiler could not
3353assume anything on the bounds of the loop indices. With
3354@option{-funsafe-loop-optimizations} warn if the compiler made
3355such assumptions.
3356
74291a4b 3357@item -Wpointer-arith
cd3bb277 3358@opindex Wpointer-arith
74291a4b
MM
3359Warn about anything that depends on the ``size of'' a function type or
3360of @code{void}. GNU C assigns these types a size of 1, for
3361convenience in calculations with @code{void *} pointers and pointers
b9edb4b1
MLI
3362to functions. In C++, warn also when an arithmetic operation involves
3363@code{NULL}. This warning is also enabled by @option{-pedantic}.
74291a4b 3364
aee96fe9 3365@item -Wbad-function-cast @r{(C only)}
cd3bb277 3366@opindex Wbad-function-cast
74291a4b
MM
3367Warn whenever a function call is cast to a non-matching type.
3368For example, warn if @code{int malloc()} is cast to @code{anything *}.
3369
b7e20b53
GDR
3370@item -Wc++-compat
3371Warn about ISO C constructs that are outside of the common subset of
3372ISO C and ISO C++, e.g.@: request for implicit conversion from
3373@code{void *} to a pointer to non-@code{void} type.
3374
e1f1ee86
DG
3375@item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3376Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
cb7ad97b 3377ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
e1f1ee86
DG
3378in ISO C++ 200x. This warning is enabled by @option{-Wall}.
3379
74291a4b 3380@item -Wcast-qual
cd3bb277 3381@opindex Wcast-qual
74291a4b
MM
3382Warn whenever a pointer is cast so as to remove a type qualifier from
3383the target type. For example, warn if a @code{const char *} is cast
3384to an ordinary @code{char *}.
3385
3386@item -Wcast-align
cd3bb277 3387@opindex Wcast-align
74291a4b
MM
3388Warn whenever a pointer is cast such that the required alignment of the
3389target is increased. For example, warn if a @code{char *} is cast to
3390an @code{int *} on machines where integers can only be accessed at
3391two- or four-byte boundaries.
3392
3393@item -Wwrite-strings
cd3bb277 3394@opindex Wwrite-strings
aee96fe9
JM
3395When compiling C, give string constants the type @code{const
3396char[@var{length}]} so that
74291a4b 3397copying the address of one into a non-@code{const} @code{char *}
aee96fe9 3398pointer will get a warning; when compiling C++, warn about the
d539b114
GDR
3399deprecated conversion from string literals to @code{char *}. This
3400warning, by default, is enabled for C++ programs.
aee96fe9 3401These warnings will help you find at
74291a4b
MM
3402compile time code that can try to write into a string constant, but
3403only if you have been very careful about using @code{const} in
3404declarations and prototypes. Otherwise, it will just be a nuisance;
630d3d5a 3405this is why we did not make @option{-Wall} request these warnings.
74291a4b 3406
2b001724
MLI
3407@item -Wclobbered
3408@opindex Wclobbered
3409Warn for variables that might be changed by @samp{longjmp} or
3410@samp{vfork}. This warning is also enabled by @option{-Wextra}.
3411
74291a4b 3412@item -Wconversion
cd3bb277 3413@opindex Wconversion
422c3a54
MLI
3414Warn for implicit conversions that may alter a value. This includes
3415conversions between real and integer, like @code{abs (x)} when
3416@code{x} is @code{double}; conversions between signed and unsigned,
3417like @code{unsigned ui = -1}; and conversions to smaller types, like
3418@code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3419((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3420changed by the conversion like in @code{abs (2.0)}.
74291a4b 3421
07231d4f
MLI
3422For C++, also warn for conversions between @code{NULL} and non-pointer
3423types; confusing overload resolution for user-defined conversions; and
3424conversions that will never use a type conversion operator:
3425conversions to @code{void}, the same type, a base class or a reference
3426to them.
3427
b3b433c5
MLI
3428@item -Wempty-body
3429@opindex Wempty-body
841cc7da
MS
3430Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
3431while} statement. Additionally, in C++, warn when an empty body occurs
3432in a @samp{while} or @samp{for} statement with no whitespacing before
3433the semicolon. This warning is also enabled by @option{-Wextra}.
b3b433c5 3434
e9a25f70 3435@item -Wsign-compare
cd3bb277 3436@opindex Wsign-compare
e9a25f70
JL
3437@cindex warning for comparison of signed and unsigned values
3438@cindex comparison of signed and unsigned values, warning
3439@cindex signed and unsigned values, comparison warning
3440Warn when a comparison between signed and unsigned values could produce
3441an incorrect result when the signed value is converted to unsigned.
65ca2d60
PE
3442This warning is also enabled by @option{-Wextra}; to get the other warnings
3443of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
e9a25f70 3444
c116cd05
MLI
3445@item -Waddress
3446@opindex Waddress
3447@opindex Wno-address
3448Warn about suspicious uses of memory addresses. These include using
3449the address of a function in a conditional expression, such as
3450@code{void func(void); if (func)}, and comparisons against the memory
3451address of a string literal, such as @code{if (x == "abc")}. Such
3452uses typically indicate a programmer error: the address of a function
3453always evaluates to true, so their use in a conditional usually
3454indicate that the programmer forgot the parentheses in a function
3455call; and comparisons against string literals result in unspecified
3456behavior and are not portable in C, so they usually indicate that the
3457programmer intended to use @code{strcmp}. This warning is enabled by
3458@option{-Wall}.
3459
63a08740
DM
3460@item -Wlogical-op
3461@opindex Wlogical-op
3462@opindex Wno-logical-op
3463Warn about suspicious uses of logical operators in expressions.
3464This includes using logical operators in contexts where a
3465bit-wise operator is likely to be expected.
3466
74291a4b 3467@item -Waggregate-return
cd3bb277 3468@opindex Waggregate-return
74291a4b
MM
3469Warn if any functions that return structures or unions are defined or
3470called. (In languages where you can return an array, this also elicits
3471a warning.)
3472
5c498b10
DD
3473@item -Wno-attributes
3474@opindex Wno-attributes
3475@opindex Wattributes
3476Do not warn if an unexpected @code{__attribute__} is used, such as
3477unrecognized attributes, function attributes applied to variables,
3478etc. This will not stop errors for incorrect use of supported
3479attributes.
3480
aee96fe9 3481@item -Wstrict-prototypes @r{(C only)}
cd3bb277 3482@opindex Wstrict-prototypes
74291a4b
MM
3483Warn if a function is declared or defined without specifying the
3484argument types. (An old-style function definition is permitted without
3485a warning if preceded by a declaration which specifies the argument
3486types.)
3487
b1ed4cb4
MLI
3488@item -Wold-style-declaration @r{(C only)}
3489@opindex Wold-style-declaration
3490Warn for obsolescent usages, according to the C Standard, in a
3491declaration. For example, warn if storage-class specifiers like
3492@code{static} are not the first things in a declaration. This warning
3493is also enabled by @option{-Wextra}.
3494
c034f121
AJ
3495@item -Wold-style-definition @r{(C only)}
3496@opindex Wold-style-definition
3497Warn if an old-style function definition is used. A warning is given
3498even if there is a previous prototype.
3499
cb4af25a
MLI
3500@item -Wmissing-parameter-type @r{(C only)}
3501@opindex Wmissing-parameter-type
3502A function parameter is declared without a type specifier in K&R-style
3503functions:
3504
3505@smallexample
3506void foo(bar) @{ @}
3507@end smallexample
3508
3509This warning is also enabled by @option{-Wextra}.
3510
aee96fe9 3511@item -Wmissing-prototypes @r{(C only)}
cd3bb277 3512@opindex Wmissing-prototypes
74291a4b
MM
3513Warn if a global function is defined without a previous prototype
3514declaration. This warning is issued even if the definition itself
3515provides a prototype. The aim is to detect global functions that fail
3516to be declared in header files.
3517
dfdec7a7 3518@item -Wmissing-declarations @r{(C and C++ only)}
cd3bb277 3519@opindex Wmissing-declarations
74291a4b
MM
3520Warn if a global function is defined without a previous declaration.
3521Do so even if the definition itself provides a prototype.
3522Use this option to detect global functions that are not declared in
dfdec7a7
ILT
3523header files. In C++, no warnings are issued for function templates,
3524or for inline functions, or for functions in anonymous namespaces.
74291a4b 3525
eaac4679
RS
3526@item -Wmissing-field-initializers
3527@opindex Wmissing-field-initializers
3528@opindex W
3529@opindex Wextra
3530Warn if a structure's initializer has some fields missing. For
3531example, the following code would cause such a warning, because
3532@code{x.h} is implicitly zero:
3533
3534@smallexample
3535struct s @{ int f, g, h; @};
3536struct s x = @{ 3, 4 @};
3537@end smallexample
3538
3539This option does not warn about designated initializers, so the following
3540modification would not trigger a warning:
3541
3542@smallexample
3543struct s @{ int f, g, h; @};
3544struct s x = @{ .f = 3, .g = 4 @};
3545@end smallexample
3546
3547This warning is included in @option{-Wextra}. To get other @option{-Wextra}
3548warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
3549
0ca3fb0a 3550@item -Wmissing-noreturn
cd3bb277 3551@opindex Wmissing-noreturn
0ca3fb0a
KG
3552Warn about functions which might be candidates for attribute @code{noreturn}.
3553Note these are only possible candidates, not absolute ones. Care should
3554be taken to manually verify functions actually do not ever return before
3555adding the @code{noreturn} attribute, otherwise subtle code generation
21c7361e
AJ
3556bugs could be introduced. You will not get a warning for @code{main} in
3557hosted C environments.
0ca3fb0a 3558
74ff4629 3559@item -Wmissing-format-attribute
cd3bb277
JM
3560@opindex Wmissing-format-attribute
3561@opindex Wformat
7876a414
KG
3562Warn about function pointers which might be candidates for @code{format}
3563attributes. Note these are only possible candidates, not absolute ones.
3564GCC will guess that function pointers with @code{format} attributes that
3565are used in assignment, initialization, parameter passing or return
3566statements should have a corresponding @code{format} attribute in the
3567resulting type. I.e.@: the left-hand side of the assignment or
3568initialization, the type of the parameter variable, or the return type
3569of the containing function respectively should also have a @code{format}
3570attribute to avoid the warning.
3571
3572GCC will also warn about function definitions which might be
3573candidates for @code{format} attributes. Again, these are only
3574possible candidates. GCC will guess that @code{format} attributes
3575might be appropriate for any function that calls a function like
3576@code{vprintf} or @code{vscanf}, but this might not always be the
74ff4629 3577case, and some functions for which @code{format} attributes are
7876a414 3578appropriate may not be detected.
74ff4629 3579
75227a33
GK
3580@item -Wno-multichar
3581@opindex Wno-multichar
3582@opindex Wmultichar
3583Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
3584Usually they indicate a typo in the user's code, as they have
3585implementation-defined values, and should not be used in portable code.
3586
50668cf6
GK
3587@item -Wnormalized=<none|id|nfc|nfkc>
3588@opindex Wnormalized
3589@cindex NFC
3590@cindex NFKC
3591@cindex character set, input normalization
3592In ISO C and ISO C++, two identifiers are different if they are
3593different sequences of characters. However, sometimes when characters
3594outside the basic ASCII character set are used, you can have two
3595different character sequences that look the same. To avoid confusion,
3596the ISO 10646 standard sets out some @dfn{normalization rules} which
3597when applied ensure that two sequences that look the same are turned into
3598the same sequence. GCC can warn you if you are using identifiers which
3599have not been normalized; this option controls that warning.
3600
3601There are four levels of warning that GCC supports. The default is
3602@option{-Wnormalized=nfc}, which warns about any identifier which is
3603not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
3604recommended form for most uses.
3605
3606Unfortunately, there are some characters which ISO C and ISO C++ allow
3607in identifiers that when turned into NFC aren't allowable as
3608identifiers. That is, there's no way to use these symbols in portable
3609ISO C or C++ and have all your identifiers in NFC.
3610@option{-Wnormalized=id} suppresses the warning for these characters.
3611It is hoped that future versions of the standards involved will correct
3612this, which is why this option is not the default.
3613
3614You can switch the warning off for all characters by writing
3615@option{-Wnormalized=none}. You would only want to do this if you
3616were using some other normalization scheme (like ``D''), because
3617otherwise you can easily create bugs that are literally impossible to see.
3618
3619Some characters in ISO 10646 have distinct meanings but look identical
3620in some fonts or display methodologies, especially once formatting has
3621been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
3622LETTER N'', will display just like a regular @code{n} which has been
3623placed in a superscript. ISO 10646 defines the @dfn{NFKC}
6fc0bb99 3624normalization scheme to convert all these into a standard form as
50668cf6
GK
3625well, and GCC will warn if your code is not in NFKC if you use
3626@option{-Wnormalized=nfkc}. This warning is comparable to warning
3627about every identifier that contains the letter O because it might be
3628confused with the digit 0, and so is not the default, but may be
3629useful as a local coding convention if the programming environment is
3630unable to be fixed to display these characters distinctly.
3631
e23bd218
IR
3632@item -Wno-deprecated-declarations
3633@opindex Wno-deprecated-declarations
e8c96d09
MS
3634Do not warn about uses of functions (@pxref{Function Attributes}),
3635variables (@pxref{Variable Attributes}), and types (@pxref{Type
3636Attributes}) marked as deprecated by using the @code{deprecated}
3637attribute.
e23bd218 3638
71834ad3
RS
3639@item -Wno-overflow
3640@opindex Wno-overflow
3641Do not warn about compile-time overflow in constant expressions.
3642
7ed322d7
JM
3643@item -Woverride-init
3644@opindex Woverride-init
3645@opindex W
3646@opindex Wextra
3647Warn if an initialized field without side effects is overridden when
3648using designated initializers (@pxref{Designated Inits, , Designated
3649Initializers}).
3650
3651This warning is included in @option{-Wextra}. To get other
3652@option{-Wextra} warnings without this one, use @samp{-Wextra
3653-Wno-override-init}.
3654
3c12fcc2 3655@item -Wpacked
cd3bb277 3656@opindex Wpacked
3c12fcc2 3657Warn if a structure is given the packed attribute, but the packed
02f52e19 3658attribute has no effect on the layout or size of the structure.
3c12fcc2
GM
3659Such structures may be mis-aligned for little benefit. For
3660instance, in this code, the variable @code{f.x} in @code{struct bar}
3661will be misaligned even though @code{struct bar} does not itself
3662have the packed attribute:
3663
3664@smallexample
3665@group
3666struct foo @{
3667 int x;
3668 char a, b, c, d;
3669@} __attribute__((packed));
3670struct bar @{
3671 char z;
3672 struct foo f;
3673@};
3674@end group
3675@end smallexample
3676
3677@item -Wpadded
cd3bb277 3678@opindex Wpadded
3c12fcc2
GM
3679Warn if padding is included in a structure, either to align an element
3680of the structure or to align the whole structure. Sometimes when this
3681happens it is possible to rearrange the fields of the structure to
3682reduce the padding and so make the structure smaller.
3683
74291a4b 3684@item -Wredundant-decls
cd3bb277 3685@opindex Wredundant-decls
74291a4b
MM
3686Warn if anything is declared more than once in the same scope, even in
3687cases where multiple declaration is valid and changes nothing.
3688
aee96fe9 3689@item -Wnested-externs @r{(C only)}
cd3bb277 3690@opindex Wnested-externs
252215a7 3691Warn if an @code{extern} declaration is encountered within a function.
74291a4b 3692
312f6255 3693@item -Wunreachable-code
cd3bb277 3694@opindex Wunreachable-code
312f6255
GK
3695Warn if the compiler detects that code will never be executed.
3696
3697This option is intended to warn when the compiler detects that at
3698least a whole line of source code will never be executed, because
3699some condition is never satisfied or because it is after a
3700procedure that never returns.
3701
3702It is possible for this option to produce a warning even though there
3703are circumstances under which part of the affected line can be executed,
3704so care should be taken when removing apparently-unreachable code.
3705
3706For instance, when a function is inlined, a warning may mean that the
02f52e19 3707line is unreachable in only one inlined copy of the function.
312f6255 3708
630d3d5a 3709This option is not made part of @option{-Wall} because in a debugging
312f6255
GK
3710version of a program there is often substantial code which checks
3711correct functioning of the program and is, hopefully, unreachable
3712because the program does work. Another common use of unreachable
c21cd8b1 3713code is to provide behavior which is selectable at compile-time.
312f6255 3714
74291a4b 3715@item -Winline
cd3bb277 3716@opindex Winline
c5c76735 3717Warn if a function can not be inlined and it was declared as inline.
ae4a7155 3718Even with this option, the compiler will not warn about failures to
daf2f129 3719inline functions declared in system headers.
ae4a7155
MM
3720
3721The compiler uses a variety of heuristics to determine whether or not
3722to inline a function. For example, the compiler takes into account
0bdcd332 3723the size of the function being inlined and the amount of inlining
ae4a7155
MM
3724that has already been done in the current function. Therefore,
3725seemingly insignificant changes in the source program can cause the
3726warnings produced by @option{-Winline} to appear or disappear.
74291a4b 3727
a01fff59
MA
3728@item -Wno-invalid-offsetof @r{(C++ only)}
3729@opindex Wno-invalid-offsetof
3730Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3731type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
3732to a non-POD type is undefined. In existing C++ implementations,
3733however, @samp{offsetof} typically gives meaningful results even when
3734applied to certain kinds of non-POD types. (Such as a simple
3735@samp{struct} that fails to be a POD type only by virtue of having a
3736constructor.) This flag is for users who are aware that they are
3737writing nonportable code and who have deliberately chosen to ignore the
3738warning about it.
3739
3740The restrictions on @samp{offsetof} may be relaxed in a future version
3741of the C++ standard.
3742
53a2494e
JM
3743@item -Wno-int-to-pointer-cast @r{(C only)}
3744@opindex Wno-int-to-pointer-cast
3745Suppress warnings from casts to pointer type of an integer of a
3746different size.
3747
3748@item -Wno-pointer-to-int-cast @r{(C only)}
3749@opindex Wno-pointer-to-int-cast
3750Suppress warnings from casts from a pointer to an integer type of a
3751different size.
3752
17211ab5
GK
3753@item -Winvalid-pch
3754@opindex Winvalid-pch
3755Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3756the search path but can't be used.
3757
795add94 3758@item -Wlong-long
cd3bb277
JM
3759@opindex Wlong-long
3760@opindex Wno-long-long
795add94 3761Warn if @samp{long long} type is used. This is default. To inhibit
630d3d5a
JM
3762the warning messages, use @option{-Wno-long-long}. Flags
3763@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3764only when @option{-pedantic} flag is used.
795add94 3765
7c4d376d
RH
3766@item -Wvariadic-macros
3767@opindex Wvariadic-macros
3768@opindex Wno-variadic-macros
3769Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3770alternate syntax when in pedantic ISO C99 mode. This is default.
3771To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3772
50d50fc7
SP
3773@item -Wvla
3774@opindex Wvla
3775@opindex Wno-vla
3776Warn if variable length array is used in the code.
3777@option{-Wno-vla} will prevent the @option{-pedantic} warning of
3778the variable length array.
3779
d35a40fc
DE
3780@item -Wvolatile-register-var
3781@opindex Wvolatile-register-var
3782@opindex Wno-volatile-register-var
3783Warn if a register variable is declared volatile. The volatile
3784modifier does not inhibit all optimizations that may eliminate reads
3785and/or writes to register variables.
3786
18424ae1 3787@item -Wdisabled-optimization
cd3bb277 3788@opindex Wdisabled-optimization
18424ae1
BL
3789Warn if a requested optimization pass is disabled. This warning does
3790not generally indicate that there is anything wrong with your code; it
3791merely indicates that GCC's optimizers were unable to handle the code
3792effectively. Often, the problem is that your code is too big or too
3793complex; GCC will refuse to optimize programs when the optimization
3794itself is likely to take inordinate amounts of time.
3795
f4e9414e
AO
3796@item -Wpointer-sign
3797@opindex Wpointer-sign
f2fd3821 3798@opindex Wno-pointer-sign
f4e9414e
AO
3799Warn for pointer argument passing or assignment with different signedness.
3800This option is only supported for C and Objective-C@. It is implied by
3801@option{-Wall} and by @option{-pedantic}, which can be disabled with
3802@option{-Wno-pointer-sign}.
f2fd3821 3803
74291a4b 3804@item -Werror
cd3bb277 3805@opindex Werror
74291a4b 3806Make all warnings into errors.
0aca9021 3807
79cf5994
DD
3808@item -Werror=
3809@opindex Werror=
3810Make the specified warning into an errors. The specifier for a
3811warning is appended, for example @option{-Werror=switch} turns the
3812warnings controlled by @option{-Wswitch} into errors. This switch
3813takes a negative form, to be used to negate @option{-Werror} for
3814specific warnings, for example @option{-Wno-error=switch} makes
3815@option{-Wswitch} warnings not be errors, even when @option{-Werror}
3816is in effect. You can use the @option{-fdiagnostics-show-option}
3817option to have each controllable warning amended with the option which
3818controls it, to determine what to use with this option.
3819
3820Note that specifying @option{-Werror=}@var{foo} automatically implies
3821@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3822imply anything.
3823
0aca9021 3824@item -Wstack-protector
d77314ec 3825@opindex Wstack-protector
0aca9021
JW
3826This option is only active when @option{-fstack-protector} is active. It
3827warns about functions that will not be protected against stack smashing.
3828
89a42ac8
ZW
3829@item -Woverlength-strings
3830@opindex Woverlength-strings
3831Warn about string constants which are longer than the ``minimum
3832maximum'' length specified in the C standard. Modern compilers
3833generally allow string constants which are much longer than the
3834standard's minimum limit, but very portable programs should avoid
3835using longer strings.
3836
3837The limit applies @emph{after} string constant concatenation, and does
3838not count the trailing NUL@. In C89, the limit was 509 characters; in
3839C99, it was raised to 4095. C++98 does not specify a normative
3840minimum maximum, so we do not diagnose overlength strings in C++@.
3841
3842This option is implied by @option{-pedantic}, and can be disabled with
3843@option{-Wno-overlength-strings}.
74291a4b
MM
3844@end table
3845
3846@node Debugging Options
0c2d1a2a 3847@section Options for Debugging Your Program or GCC
74291a4b
MM
3848@cindex options, debugging
3849@cindex debugging information options
3850
0c2d1a2a 3851GCC has various special options that are used for debugging
74291a4b
MM
3852either your program or GCC:
3853
2642624b 3854@table @gcctabopt
74291a4b 3855@item -g
cd3bb277 3856@opindex g
74291a4b 3857Produce debugging information in the operating system's native format
f8ca7e49 3858(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
74291a4b
MM
3859information.
3860
630d3d5a 3861On most systems that use stabs format, @option{-g} enables use of extra
74291a4b
MM
3862debugging information that only GDB can use; this extra information
3863makes debugging work better in GDB but will probably make other debuggers
3864crash or
3865refuse to read the program. If you want to control for certain whether
630d3d5a 3866to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
def66b10 3867@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
74291a4b 3868
f8ca7e49 3869GCC allows you to use @option{-g} with
630d3d5a 3870@option{-O}. The shortcuts taken by optimized code may occasionally
74291a4b
MM
3871produce surprising results: some variables you declared may not exist
3872at all; flow of control may briefly move where you did not expect it;
3873some statements may not be executed because they compute constant
3874results or their values were already at hand; some statements may
3875execute in different places because they were moved out of loops.
3876
3877Nevertheless it proves possible to debug optimized output. This makes
3878it reasonable to use the optimizer for programs that might have bugs.
3879
0c2d1a2a 3880The following options are useful when GCC is generated with the
74291a4b
MM
3881capability for more than one debugging format.
3882
3883@item -ggdb
cd3bb277 3884@opindex ggdb
161d7b59 3885Produce debugging information for use by GDB@. This means to use the
861bb6c1
JL
3886most expressive format available (DWARF 2, stabs, or the native format
3887if neither of those are supported), including GDB extensions if at all
3888possible.
74291a4b
MM
3889
3890@item -gstabs
cd3bb277 3891@opindex gstabs
74291a4b
MM
3892Produce debugging information in stabs format (if that is supported),
3893without GDB extensions. This is the format used by DBX on most BSD
3894systems. On MIPS, Alpha and System V Release 4 systems this option
161d7b59 3895produces stabs debugging output which is not understood by DBX or SDB@.
74291a4b
MM
3896On System V Release 4 systems this option requires the GNU assembler.
3897
6a08f7b3
DP
3898@item -feliminate-unused-debug-symbols
3899@opindex feliminate-unused-debug-symbols
3900Produce debugging information in stabs format (if that is supported),
c0cbdbd9 3901for only symbols that are actually used.
6a08f7b3 3902
e713adf6
CD
3903@item -femit-class-debug-always
3904Instead of emitting debugging information for a C++ class in only one
3905object file, emit it in all object files using the class. This option
3906should be used only with debuggers that are unable to handle the way GCC
3907normally emits debugging information for classes because using this
3908option will increase the size of debugging information by as much as a
3909factor of two.
3910
74291a4b 3911@item -gstabs+
cd3bb277 3912@opindex gstabs+
74291a4b 3913Produce debugging information in stabs format (if that is supported),
161d7b59 3914using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
3915use of these extensions is likely to make other debuggers crash or
3916refuse to read the program.
3917
3918@item -gcoff
cd3bb277 3919@opindex gcoff
74291a4b
MM
3920Produce debugging information in COFF format (if that is supported).
3921This is the format used by SDB on most System V systems prior to
3922System V Release 4.
3923
3924@item -gxcoff
cd3bb277 3925@opindex gxcoff
74291a4b
MM
3926Produce debugging information in XCOFF format (if that is supported).
3927This is the format used by the DBX debugger on IBM RS/6000 systems.
3928
3929@item -gxcoff+
cd3bb277 3930@opindex gxcoff+
74291a4b 3931Produce debugging information in XCOFF format (if that is supported),
161d7b59 3932using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
3933use of these extensions is likely to make other debuggers crash or
3934refuse to read the program, and may cause assemblers other than the GNU
3935assembler (GAS) to fail with an error.
3936
861bb6c1 3937@item -gdwarf-2
cd3bb277 3938@opindex gdwarf-2
861bb6c1 3939Produce debugging information in DWARF version 2 format (if that is
f8ca7e49
ZW
3940supported). This is the format used by DBX on IRIX 6. With this
3941option, GCC uses features of DWARF version 3 when they are useful;
3942version 3 is upward compatible with version 2, but may still cause
3943problems for older debuggers.
74291a4b 3944
5f98259a
RK
3945@item -gvms
3946@opindex gvms
3947Produce debugging information in VMS debug format (if that is
3948supported). This is the format used by DEBUG on VMS systems.
3949
74291a4b
MM
3950@item -g@var{level}
3951@itemx -ggdb@var{level}
3952@itemx -gstabs@var{level}
3953@itemx -gcoff@var{level}
3954@itemx -gxcoff@var{level}
5f98259a 3955@itemx -gvms@var{level}
74291a4b
MM
3956Request debugging information and also use @var{level} to specify how
3957much information. The default level is 2.
3958
ec75a430
GK
3959Level 0 produces no debug information at all. Thus, @option{-g0} negates
3960@option{-g}.
3961
74291a4b
MM
3962Level 1 produces minimal information, enough for making backtraces in
3963parts of the program that you don't plan to debug. This includes
3964descriptions of functions and external variables, but no information
3965about local variables and no line numbers.
3966
3967Level 3 includes extra information, such as all the macro definitions
3968present in the program. Some debuggers support macro expansion when
630d3d5a 3969you use @option{-g3}.
74291a4b 3970
f8ca7e49
ZW
3971@option{-gdwarf-2} does not accept a concatenated debug level, because
3972GCC used to support an option @option{-gdwarf} that meant to generate
3973debug information in version 1 of the DWARF format (which is very
3974different from version 2), and it would have been too confusing. That
3975debug format is long obsolete, but the option cannot be changed now.
3976Instead use an additional @option{-g@var{level}} option to change the
3977debug level for DWARF2.
eb7715a4 3978
e03b7153
RS
3979@item -feliminate-dwarf2-dups
3980@opindex feliminate-dwarf2-dups
3981Compress DWARF2 debugging information by eliminating duplicated
3982information about each symbol. This option only makes sense when
3983generating DWARF2 debugging information with @option{-gdwarf-2}.
3984
39ef6592
LC
3985@item -femit-struct-debug-baseonly
3986Emit debug information for struct-like types
3987only when the base name of the compilation source file
3988matches the base name of file in which the struct was defined.
3989
3990This option substantially reduces the size of debugging information,
3991but at significant potential loss in type information to the debugger.
3992See @option{-femit-struct-debug-reduced} for a less aggressive option.
3993See @option{-femit-struct-debug-detailed} for more detailed control.
3994
3995This option works only with DWARF 2.
3996
3997@item -femit-struct-debug-reduced
3998Emit debug information for struct-like types
3999only when the base name of the compilation source file
4000matches the base name of file in which the type was defined,
4001unless the struct is a template or defined in a system header.
4002
4003This option significantly reduces the size of debugging information,
4004with some potential loss in type information to the debugger.
4005See @option{-femit-struct-debug-baseonly} for a more aggressive option.
4006See @option{-femit-struct-debug-detailed} for more detailed control.
4007
4008This option works only with DWARF 2.
4009
4010@item -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]}
4011Specify the struct-like types
4012for which the compiler will generate debug information.
4013The intent is to reduce duplicate struct debug information
4014between different object files within the same program.
4015
4016This option is a detailed version of
4017@option{-femit-struct-debug-reduced} and @option{-femit-struct-debug-baseonly},
4018which will serve for most needs.
4019
4020A specification has the syntax
4021[@samp{dir:}|@samp{ind:}][@samp{ord:}|@samp{gen:}](@samp{any}|@samp{sys}|@samp{base}|@samp{none})
4022
4023The optional first word limits the specification to
4024structs that are used directly (@samp{dir:}) or used indirectly (@samp{ind:}).
4025A struct type is used directly when it is the type of a variable, member.
4026Indirect uses arise through pointers to structs.
4027That is, when use of an incomplete struct would be legal, the use is indirect.
4028An example is
4029@samp{struct one direct; struct two * indirect;}.
4030
4031The optional second word limits the specification to
4032ordinary structs (@samp{ord:}) or generic structs (@samp{gen:}).
4033Generic structs are a bit complicated to explain.
4034For C++, these are non-explicit specializations of template classes,
4035or non-template classes within the above.
4036Other programming languages have generics,
4037but @samp{-femit-struct-debug-detailed} does not yet implement them.
4038
4039The third word specifies the source files for those
4040structs for which the compiler will emit debug information.
4041The values @samp{none} and @samp{any} have the normal meaning.
4042The value @samp{base} means that
4043the base of name of the file in which the type declaration appears
4044must match the base of the name of the main compilation file.
4045In practice, this means that
4046types declared in @file{foo.c} and @file{foo.h} will have debug information,
4047but types declared in other header will not.
4048The value @samp{sys} means those types satisfying @samp{base}
4049or declared in system or compiler headers.
4050
4051You may need to experiment to determine the best settings for your application.
4052
4053The default is @samp{-femit-struct-debug-detailed=all}.
4054
4055This option works only with DWARF 2.
4056
05739753 4057@cindex @command{prof}
74291a4b 4058@item -p
cd3bb277 4059@opindex p
74291a4b 4060Generate extra code to write profile information suitable for the
05739753 4061analysis program @command{prof}. You must use this option when compiling
74291a4b
MM
4062the source files you want data about, and you must also use it when
4063linking.
4064
05739753 4065@cindex @command{gprof}
74291a4b 4066@item -pg
cd3bb277 4067@opindex pg
74291a4b 4068Generate extra code to write profile information suitable for the
05739753 4069analysis program @command{gprof}. You must use this option when compiling
74291a4b
MM
4070the source files you want data about, and you must also use it when
4071linking.
4072
898f531b 4073@item -Q
cd3bb277 4074@opindex Q
898f531b
JL
4075Makes the compiler print out each function name as it is compiled, and
4076print some statistics about each pass when it finishes.
4077
1f0c3120 4078@item -ftime-report
cd3bb277 4079@opindex ftime-report
1f0c3120
JM
4080Makes the compiler print some statistics about the time consumed by each
4081pass when it finishes.
4082
4083@item -fmem-report
cd3bb277 4084@opindex fmem-report
1f0c3120
JM
4085Makes the compiler print some statistics about permanent memory
4086allocation when it finishes.
4087
a5573239
JH
4088@item -fpre-ipa-mem-report
4089@opindex fpre-ipa-mem-report
4090@item -fpost-ipa-mem-report
4091@opindex fpost-ipa-mem-report
4092Makes the compiler print some statistics about permanent memory
4093allocation before or after interprocedural optimization.
4094
861bb6c1 4095@item -fprofile-arcs
cd3bb277 4096@opindex fprofile-arcs
23af32e6
NS
4097Add code so that program flow @dfn{arcs} are instrumented. During
4098execution the program records how many times each branch and call is
4099executed and how many times it is taken or returns. When the compiled
4100program exits it saves this data to a file called
8a36672b 4101@file{@var{auxname}.gcda} for each source file. The data may be used for
23af32e6 4102profile-directed optimizations (@option{-fbranch-probabilities}), or for
8a36672b 4103test coverage analysis (@option{-ftest-coverage}). Each object file's
23af32e6
NS
4104@var{auxname} is generated from the name of the output file, if
4105explicitly specified and it is not the final executable, otherwise it is
8a36672b 4106the basename of the source file. In both cases any suffix is removed
431ae0bf 4107(e.g.@: @file{foo.gcda} for input file @file{dir/foo.c}, or
a4878735 4108@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
992f396f 4109@xref{Cross-profiling}.
23af32e6 4110
ee4c708e
BE
4111@cindex @command{gcov}
4112@item --coverage
4113@opindex coverage
4114
4115This option is used to compile and link code instrumented for coverage
4116analysis. The option is a synonym for @option{-fprofile-arcs}
4117@option{-ftest-coverage} (when compiling) and @option{-lgcov} (when
4118linking). See the documentation for those options for more details.
4119
23af32e6
NS
4120@itemize
4121
4122@item
4123Compile the source files with @option{-fprofile-arcs} plus optimization
8a36672b
JM
4124and code generation options. For test coverage analysis, use the
4125additional @option{-ftest-coverage} option. You do not need to profile
23af32e6
NS
4126every source file in a program.
4127
4128@item
8555daff
NS
4129Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
4130(the latter implies the former).
23af32e6
NS
4131
4132@item
4133Run the program on a representative workload to generate the arc profile
8a36672b 4134information. This may be repeated any number of times. You can run
8555daff 4135concurrent instances of your program, and provided that the file system
8a36672b 4136supports locking, the data files will be correctly updated. Also
8555daff
NS
4137@code{fork} calls are detected and correctly handled (double counting
4138will not happen).
23af32e6
NS
4139
4140@item
4141For profile-directed optimizations, compile the source files again with
4142the same optimization and code generation options plus
630d3d5a 4143@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3de87bf2
JJ
4144Control Optimization}).
4145
23af32e6
NS
4146@item
4147For test coverage analysis, use @command{gcov} to produce human readable
8a36672b 4148information from the @file{.gcno} and @file{.gcda} files. Refer to the
23af32e6
NS
4149@command{gcov} documentation for further information.
4150
4151@end itemize
3de87bf2
JJ
4152
4153With @option{-fprofile-arcs}, for each function of your program GCC
4154creates a program flow graph, then finds a spanning tree for the graph.
4155Only arcs that are not on the spanning tree have to be instrumented: the
4156compiler adds code to count the number of times that these arcs are
4157executed. When an arc is the only exit or only entrance to a block, the
4158instrumentation code can be added to the block; otherwise, a new basic
4159block must be created to hold the instrumentation code.
4160
861bb6c1
JL
4161@need 2000
4162@item -ftest-coverage
cd3bb277 4163@opindex ftest-coverage
a4878735 4164Produce a notes file that the @command{gcov} code-coverage utility
23af32e6 4165(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
8a36672b
JM
4166show program coverage. Each source file's note file is called
4167@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
23af32e6 4168above for a description of @var{auxname} and instructions on how to
8a36672b 4169generate test coverage data. Coverage data will match the source files
23af32e6 4170more closely, if you do not optimize.
3de87bf2 4171
74291a4b 4172@item -d@var{letters}
9f8628ba 4173@item -fdump-rtl-@var{pass}
cd3bb277 4174@opindex d
74291a4b 4175Says to make debugging dumps during compilation at times specified by
9f8628ba
PB
4176@var{letters}. This is used for debugging the RTL-based passes of the
4177compiler. The file names for most of the dumps are made by appending a
4178pass number and a word to the @var{dumpname}. @var{dumpname} is generated
4179from the name of the output file, if explicitly specified and it is not
4180an executable, otherwise it is the basename of the source file.
74291a4b 4181
9f8628ba
PB
4182Most debug dumps can be enabled either passing a letter to the @option{-d}
4183option, or with a long @option{-fdump-rtl} switch; here are the possible
4184letters for use in @var{letters} and @var{pass}, and their meanings:
4185
4186@table @gcctabopt
4187@item -dA
cd3bb277 4188@opindex dA
375e2d5c 4189Annotate the assembler output with miscellaneous debugging information.
9f8628ba 4190
9f8628ba
PB
4191@item -dB
4192@itemx -fdump-rtl-bbro
cd3bb277 4193@opindex dB
9f8628ba 4194@opindex fdump-rtl-bbro
c6075909 4195Dump after block reordering, to @file{@var{file}.148r.bbro}.
9f8628ba
PB
4196
4197@item -dc
4198@itemx -fdump-rtl-combine
cd3bb277 4199@opindex dc
9f8628ba 4200@opindex fdump-rtl-combine
78681dbd
RS
4201Dump after the RTL instruction combination pass, to the file
4202@file{@var{file}.129r.combine}.
9f8628ba
PB
4203
4204@item -dC
4205@itemx -fdump-rtl-ce1
4206@itemx -fdump-rtl-ce2
cd3bb277 4207@opindex dC
9f8628ba
PB
4208@opindex fdump-rtl-ce1
4209@opindex fdump-rtl-ce2
4210@option{-dC} and @option{-fdump-rtl-ce1} enable dumping after the
c6075909 4211first if conversion, to the file @file{@var{file}.117r.ce1}. @option{-dC}
9f8628ba 4212and @option{-fdump-rtl-ce2} enable dumping after the second if
c6075909 4213conversion, to the file @file{@var{file}.130r.ce2}.
9f8628ba
PB
4214
4215@item -dd
4216@itemx -fdump-rtl-btl
4217@itemx -fdump-rtl-dbr
cd3bb277 4218@opindex dd
9f8628ba
PB
4219@opindex fdump-rtl-btl
4220@opindex fdump-rtl-dbr
4221@option{-dd} and @option{-fdump-rtl-btl} enable dumping after branch
0bdcd332 4222target load optimization, to @file{@var{file}.31.btl}. @option{-dd}
9f8628ba
PB
4223and @option{-fdump-rtl-dbr} enable dumping after delayed branch
4224scheduling, to @file{@var{file}.36.dbr}.
4225
4226@item -dD
cd3bb277 4227@opindex dD
f5963e61
JL
4228Dump all macro definitions, at the end of preprocessing, in addition to
4229normal output.
9f8628ba
PB
4230
4231@item -dE
4232@itemx -fdump-rtl-ce3
cd3bb277 4233@opindex dE
9f8628ba 4234@opindex fdump-rtl-ce3
c6075909 4235Dump after the third if conversion, to @file{@var{file}.146r.ce3}.
9f8628ba
PB
4236
4237@item -df
4238@itemx -fdump-rtl-cfg
4239@itemx -fdump-rtl-life
cd3bb277 4240@opindex df
9f8628ba
PB
4241@opindex fdump-rtl-cfg
4242@opindex fdump-rtl-life
4243@option{-df} and @option{-fdump-rtl-cfg} enable dumping after control
c6075909 4244and data flow analysis, to @file{@var{file}.116r.cfg}. @option{-df}
9f8628ba 4245and @option{-fdump-rtl-cfg} enable dumping dump after life analysis,
c6075909 4246to @file{@var{file}.128r.life1} and @file{@var{file}.135r.life2}.
9f8628ba
PB
4247
4248@item -dg
4249@itemx -fdump-rtl-greg
cd3bb277 4250@opindex dg
9f8628ba 4251@opindex fdump-rtl-greg
c6075909 4252Dump after global register allocation, to @file{@var{file}.139r.greg}.
9f8628ba
PB
4253
4254@item -dG
4255@itemx -fdump-rtl-gcse
4256@itemx -fdump-rtl-bypass
cd3bb277 4257@opindex dG
9f8628ba
PB
4258@opindex fdump-rtl-gcse
4259@opindex fdump-rtl-bypass
4260@option{-dG} and @option{-fdump-rtl-gcse} enable dumping after GCSE, to
c6075909 4261@file{@var{file}.114r.gcse}. @option{-dG} and @option{-fdump-rtl-bypass}
9f8628ba 4262enable dumping after jump bypassing and control flow optimizations, to
c6075909 4263@file{@var{file}.115r.bypass}.
9f8628ba
PB
4264
4265@item -dh
4266@itemx -fdump-rtl-eh
7fedea11 4267@opindex dh
9f8628ba
PB
4268@opindex fdump-rtl-eh
4269Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
4270
4271@item -di
4272@itemx -fdump-rtl-sibling
cd3bb277 4273@opindex di
9f8628ba 4274@opindex fdump-rtl-sibling
c6075909 4275Dump after sibling call optimizations, to @file{@var{file}.106r.sibling}.
9f8628ba
PB
4276
4277@item -dj
4278@itemx -fdump-rtl-jump
cd3bb277 4279@opindex dj
9f8628ba 4280@opindex fdump-rtl-jump
c6075909 4281Dump after the first jump optimization, to @file{@var{file}.112r.jump}.
9f8628ba
PB
4282
4283@item -dk
4284@itemx -fdump-rtl-stack
cd3bb277 4285@opindex dk
9f8628ba 4286@opindex fdump-rtl-stack
78681dbd
RS
4287Dump after conversion from GCC's "flat register file" registers to the
4288x87's stack-like registers, to @file{@var{file}.152r.stack}.
9f8628ba
PB
4289
4290@item -dl
4291@itemx -fdump-rtl-lreg
cd3bb277 4292@opindex dl
9f8628ba 4293@opindex fdump-rtl-lreg
c6075909 4294Dump after local register allocation, to @file{@var{file}.138r.lreg}.
9f8628ba
PB
4295
4296@item -dL
9f8628ba 4297@itemx -fdump-rtl-loop2
cd3bb277 4298@opindex dL
9f8628ba 4299@opindex fdump-rtl-loop2
5abcfa7e
KH
4300@option{-dL} and @option{-fdump-rtl-loop2} enable dumping after the
4301loop optimization pass, to @file{@var{file}.119r.loop2},
4302@file{@var{file}.120r.loop2_init},
c6075909 4303@file{@var{file}.121r.loop2_invariant}, and
5abcfa7e 4304@file{@var{file}.125r.loop2_done}.
9f8628ba
PB
4305
4306@item -dm
4307@itemx -fdump-rtl-sms
e5626198 4308@opindex dm
9f8628ba 4309@opindex fdump-rtl-sms
c6075909 4310Dump after modulo scheduling, to @file{@var{file}.136r.sms}.
9f8628ba
PB
4311
4312@item -dM
4313@itemx -fdump-rtl-mach
cd3bb277 4314@opindex dM
9f8628ba 4315@opindex fdump-rtl-mach
c0478a66 4316Dump after performing the machine dependent reorganization pass, to
c6075909 4317@file{@var{file}.155r.mach}.
9f8628ba
PB
4318
4319@item -dn
4320@itemx -fdump-rtl-rnreg
cd3bb277 4321@opindex dn
9f8628ba 4322@opindex fdump-rtl-rnreg
c6075909 4323Dump after register renumbering, to @file{@var{file}.147r.rnreg}.
9f8628ba
PB
4324
4325@item -dN
4326@itemx -fdump-rtl-regmove
cd3bb277 4327@opindex dN
9f8628ba 4328@opindex fdump-rtl-regmove
c6075909 4329Dump after the register move pass, to @file{@var{file}.132r.regmove}.
9f8628ba
PB
4330
4331@item -do
4332@itemx -fdump-rtl-postreload
7fedea11 4333@opindex do
9f8628ba
PB
4334@opindex fdump-rtl-postreload
4335Dump after post-reload optimizations, to @file{@var{file}.24.postreload}.
4336
4337@item -dr
4338@itemx -fdump-rtl-expand
cd3bb277 4339@opindex dr
9f8628ba 4340@opindex fdump-rtl-expand
c6075909 4341Dump after RTL generation, to @file{@var{file}.104r.expand}.
9f8628ba
PB
4342
4343@item -dR
4344@itemx -fdump-rtl-sched2
cd3bb277 4345@opindex dR
9f8628ba 4346@opindex fdump-rtl-sched2
5c9ab0a6 4347Dump after the second scheduling pass, to @file{@var{file}.149r.sched2}.
9f8628ba
PB
4348
4349@item -ds
4350@itemx -fdump-rtl-cse
cd3bb277 4351@opindex ds
9f8628ba 4352@opindex fdump-rtl-cse
032713aa 4353Dump after CSE (including the jump optimization that sometimes follows
c6075909 4354CSE), to @file{@var{file}.113r.cse}.
9f8628ba
PB
4355
4356@item -dS
5c9ab0a6 4357@itemx -fdump-rtl-sched1
cd3bb277 4358@opindex dS
5c9ab0a6
AP
4359@opindex fdump-rtl-sched1
4360Dump after the first scheduling pass, to @file{@var{file}.136r.sched1}.
9f8628ba
PB
4361
4362@item -dt
4363@itemx -fdump-rtl-cse2
cd3bb277 4364@opindex dt
9f8628ba 4365@opindex fdump-rtl-cse2
032713aa 4366Dump after the second CSE pass (including the jump optimization that
c6075909 4367sometimes follows CSE), to @file{@var{file}.127r.cse2}.
9f8628ba
PB
4368
4369@item -dT
4370@itemx -fdump-rtl-tracer
4319ef2a 4371@opindex dT
9f8628ba 4372@opindex fdump-rtl-tracer
c6075909 4373Dump after running tracer, to @file{@var{file}.118r.tracer}.
9f8628ba
PB
4374
4375@item -dV
4376@itemx -fdump-rtl-vpt
4377@itemx -fdump-rtl-vartrack
9313cfdd 4378@opindex dV
9f8628ba
PB
4379@opindex fdump-rtl-vpt
4380@opindex fdump-rtl-vartrack
4381@option{-dV} and @option{-fdump-rtl-vpt} enable dumping after the value
4382profile transformations, to @file{@var{file}.10.vpt}. @option{-dV}
4383and @option{-fdump-rtl-vartrack} enable dumping after variable tracking,
c6075909 4384to @file{@var{file}.154r.vartrack}.
9f8628ba
PB
4385
4386@item -dw
4387@itemx -fdump-rtl-flow2
cd3bb277 4388@opindex dw
9f8628ba 4389@opindex fdump-rtl-flow2
c6075909 4390Dump after the second flow pass, to @file{@var{file}.142r.flow2}.
9f8628ba
PB
4391
4392@item -dz
4393@itemx -fdump-rtl-peephole2
cd3bb277 4394@opindex dz
9f8628ba 4395@opindex fdump-rtl-peephole2
c6075909 4396Dump after the peephole pass, to @file{@var{file}.145r.peephole2}.
9f8628ba
PB
4397
4398@item -dZ
4399@itemx -fdump-rtl-web
9313cfdd 4400@opindex dZ
9f8628ba 4401@opindex fdump-rtl-web
c6075909 4402Dump after live range splitting, to @file{@var{file}.126r.web}.
9f8628ba
PB
4403
4404@item -da
4405@itemx -fdump-rtl-all
cd3bb277 4406@opindex da
9f8628ba 4407@opindex fdump-rtl-all
74291a4b 4408Produce all the dumps listed above.
9f8628ba
PB
4409
4410@item -dH
886e0865
GK
4411@opindex dH
4412Produce a core dump whenever an error occurs.
9f8628ba
PB
4413
4414@item -dm
cd3bb277 4415@opindex dm
74291a4b
MM
4416Print statistics on memory usage, at the end of the run, to
4417standard error.
9f8628ba
PB
4418
4419@item -dp
cd3bb277 4420@opindex dp
74291a4b 4421Annotate the assembler output with a comment indicating which
f20b5577
MM
4422pattern and alternative was used. The length of each instruction is
4423also printed.
9f8628ba
PB
4424
4425@item -dP
cd3bb277 4426@opindex dP
2856c3e3 4427Dump the RTL in the assembler output as a comment before each instruction.
630d3d5a 4428Also turns on @option{-dp} annotation.
9f8628ba
PB
4429
4430@item -dv
cd3bb277 4431@opindex dv
9f8628ba
PB
4432For each of the other indicated dump files (either with @option{-d} or
4433@option{-fdump-rtl-@var{pass}}), dump a representation of the control flow
4434graph suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
4435
4436@item -dx
cd3bb277 4437@opindex dx
62a1403d 4438Just generate RTL for a function instead of compiling it. Usually used
9f8628ba
PB
4439with @samp{r} (@option{-fdump-rtl-expand}).
4440
4441@item -dy
cd3bb277 4442@opindex dy
032713aa 4443Dump debugging information during parsing, to standard error.
74291a4b
MM
4444@end table
4445
24a7799e
R
4446@item -fdump-noaddr
4447@opindex fdump-noaddr
4448When doing debugging dumps (see @option{-d} option above), suppress
4449address output. This makes it more feasible to use diff on debugging
4450dumps for compiler invocations with different compiler binaries and/or
4451different text / bss / data / heap / stack / dso start locations.
4452
b707b450 4453@item -fdump-unnumbered
cd3bb277 4454@opindex fdump-unnumbered
695ac33f 4455When doing debugging dumps (see @option{-d} option above), suppress instruction
24a7799e 4456numbers, line number note and address output. This makes it more feasible to
b192711e 4457use diff on debugging dumps for compiler invocations with different
695ac33f 4458options, in particular with and without @option{-g}.
b707b450 4459
223dcf1c
AN
4460@item -fdump-translation-unit @r{(C++ only)}
4461@itemx -fdump-translation-unit-@var{options} @r{(C++ only)}
f70a54cb
CR
4462@opindex fdump-translation-unit
4463Dump a representation of the tree structure for the entire translation
4464unit to a file. The file name is made by appending @file{.tu} to the
4465source file name. If the @samp{-@var{options}} form is used, @var{options}
4466controls the details of the dump as described for the
4467@option{-fdump-tree} options.
4468
aee96fe9 4469@item -fdump-class-hierarchy @r{(C++ only)}
22367161 4470@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
cd3bb277 4471@opindex fdump-class-hierarchy
e76b4820 4472Dump a representation of each class's hierarchy and virtual function
767094dd 4473table layout to a file. The file name is made by appending @file{.class}
22367161
NS
4474to the source file name. If the @samp{-@var{options}} form is used,
4475@var{options} controls the details of the dump as described for the
4476@option{-fdump-tree} options.
4477
9b3e897d
PB
4478@item -fdump-ipa-@var{switch}
4479@opindex fdump-ipa
83c99486 4480Control the dumping at various stages of inter-procedural analysis
9b3e897d 4481language tree to a file. The file name is generated by appending a switch
8a36672b 4482specific suffix to the source file name. The following dumps are possible:
9b3e897d
PB
4483
4484@table @samp
4485@item all
4486Enables all inter-procedural analysis dumps; currently the only produced
4487dump is the @samp{cgraph} dump.
4488
4489@item cgraph
4490Dumps information about call-graph optimization, unused function removal,
4491and inlining decisions.
4492@end table
4493
0c8c236b
JJ
4494@item -fdump-tree-@var{switch}
4495@itemx -fdump-tree-@var{switch}-@var{options}
22367161
NS
4496@opindex fdump-tree
4497Control the dumping at various stages of processing the intermediate
4498language tree to a file. The file name is generated by appending a switch
4499specific suffix to the source file name. If the @samp{-@var{options}}
4500form is used, @var{options} is a list of @samp{-} separated options that
8a36672b
JM
4501control the details of the dump. Not all options are applicable to all
4502dumps, those which are not meaningful will be ignored. The following
22367161 4503options are available
f71f87f9 4504
e76b4820 4505@table @samp
22367161 4506@item address
767094dd 4507Print the address of each node. Usually this is not meaningful as it
8a36672b 4508changes according to the environment and source file. Its primary use
22367161
NS
4509is for tying up a dump file with a debug environment.
4510@item slim
4511Inhibit dumping of members of a scope or body of a function merely
6de9cd9a
DN
4512because that scope has been reached. Only dump such items when they
4513are directly reachable by some other path. When dumping pretty-printed
4514trees, this option inhibits dumping the bodies of control structures.
4515@item raw
4516Print a raw representation of the tree. By default, trees are
4517pretty-printed into a C-like representation.
4518@item details
4519Enable more detailed dumps (not honored by every dump option).
4520@item stats
4521Enable dumping various statistics about the pass (not honored by every dump
4522option).
4523@item blocks
4524Enable showing basic block boundaries (disabled in raw dumps).
4525@item vops
4526Enable showing virtual operands for every statement.
4527@item lineno
4528Enable showing line numbers for statements.
4529@item uid
4530Enable showing the unique ID (@code{DECL_UID}) for each variable.
22367161 4531@item all
6de9cd9a 4532Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
e76b4820
NS
4533@end table
4534
4535The following tree dumps are possible:
4536@table @samp
6de9cd9a 4537
e76b4820
NS
4538@item original
4539Dump before any tree based optimization, to @file{@var{file}.original}.
6de9cd9a 4540
e76b4820
NS
4541@item optimized
4542Dump after all tree based optimization, to @file{@var{file}.optimized}.
6de9cd9a 4543
6be77748 4544@item inlined
9c34dbbf 4545Dump after function inlining, to @file{@var{file}.inlined}.
6de9cd9a
DN
4546
4547@item gimple
4548@opindex fdump-tree-gimple
4549Dump each function before and after the gimplification pass to a file. The
4550file name is made by appending @file{.gimple} to the source file name.
4551
4552@item cfg
4553@opindex fdump-tree-cfg
4554Dump the control flow graph of each function to a file. The file name is
4555made by appending @file{.cfg} to the source file name.
4556
4557@item vcg
4558@opindex fdump-tree-vcg
4559Dump the control flow graph of each function to a file in VCG format. The
4560file name is made by appending @file{.vcg} to the source file name. Note
4561that if the file contains more than one function, the generated file cannot
8a36672b 4562be used directly by VCG@. You will need to cut and paste each function's
6de9cd9a
DN
4563graph into its own separate file first.
4564
4565@item ch
4566@opindex fdump-tree-ch
4567Dump each function after copying loop headers. The file name is made by
4568appending @file{.ch} to the source file name.
4569
4570@item ssa
4571@opindex fdump-tree-ssa
4572Dump SSA related information to a file. The file name is made by appending
4573@file{.ssa} to the source file name.
4574
c75ab022
DB
4575@item salias
4576@opindex fdump-tree-salias
4577Dump structure aliasing variable information to a file. This file name
4578is made by appending @file{.salias} to the source file name.
4579
6de9cd9a
DN
4580@item alias
4581@opindex fdump-tree-alias
4582Dump aliasing information for each function. The file name is made by
4583appending @file{.alias} to the source file name.
4584
4585@item ccp
4586@opindex fdump-tree-ccp
8a36672b 4587Dump each function after CCP@. The file name is made by appending
6de9cd9a
DN
4588@file{.ccp} to the source file name.
4589
0bca51f0
DN
4590@item storeccp
4591@opindex fdump-tree-storeccp
4592Dump each function after STORE-CCP. The file name is made by appending
4593@file{.storeccp} to the source file name.
4594
6de9cd9a
DN
4595@item pre
4596@opindex fdump-tree-pre
4597Dump trees after partial redundancy elimination. The file name is made
4598by appending @file{.pre} to the source file name.
4599
ff2ad0f7
DN
4600@item fre
4601@opindex fdump-tree-fre
4602Dump trees after full redundancy elimination. The file name is made
4603by appending @file{.fre} to the source file name.
4604
0bca51f0
DN
4605@item copyprop
4606@opindex fdump-tree-copyprop
4607Dump trees after copy propagation. The file name is made
4608by appending @file{.copyprop} to the source file name.
4609
4610@item store_copyprop
4611@opindex fdump-tree-store_copyprop
4612Dump trees after store copy-propagation. The file name is made
4613by appending @file{.store_copyprop} to the source file name.
4614
6de9cd9a
DN
4615@item dce
4616@opindex fdump-tree-dce
4617Dump each function after dead code elimination. The file name is made by
4618appending @file{.dce} to the source file name.
4619
4620@item mudflap
4621@opindex fdump-tree-mudflap
4622Dump each function after adding mudflap instrumentation. The file name is
4623made by appending @file{.mudflap} to the source file name.
4624
4625@item sra
4626@opindex fdump-tree-sra
4627Dump each function after performing scalar replacement of aggregates. The
4628file name is made by appending @file{.sra} to the source file name.
4629
fa555252
DB
4630@item sink
4631@opindex fdump-tree-sink
4632Dump each function after performing code sinking. The file name is made
cb7ad97b 4633by appending @file{.sink} to the source file name.
fa555252 4634
6de9cd9a
DN
4635@item dom
4636@opindex fdump-tree-dom
4637Dump each function after applying dominator tree optimizations. The file
4638name is made by appending @file{.dom} to the source file name.
4639
4640@item dse
4641@opindex fdump-tree-dse
4642Dump each function after applying dead store elimination. The file
4643name is made by appending @file{.dse} to the source file name.
4644
4645@item phiopt
4646@opindex fdump-tree-phiopt
4647Dump each function after optimizing PHI nodes into straightline code. The file
4648name is made by appending @file{.phiopt} to the source file name.
4649
4650@item forwprop
4651@opindex fdump-tree-forwprop
4652Dump each function after forward propagating single use variables. The file
4653name is made by appending @file{.forwprop} to the source file name.
4654
4655@item copyrename
4656@opindex fdump-tree-copyrename
4657Dump each function after applying the copy rename optimization. The file
4658name is made by appending @file{.copyrename} to the source file name.
4659
4660@item nrv
4661@opindex fdump-tree-nrv
4662Dump each function after applying the named return value optimization on
4663generic trees. The file name is made by appending @file{.nrv} to the source
4664file name.
4665
79fe1b3b
DN
4666@item vect
4667@opindex fdump-tree-vect
f0eb93a8 4668Dump each function after applying vectorization of loops. The file name is
79fe1b3b
DN
4669made by appending @file{.vect} to the source file name.
4670
08873e96
DN
4671@item vrp
4672@opindex fdump-tree-vrp
4673Dump each function after Value Range Propagation (VRP). The file name
4674is made by appending @file{.vrp} to the source file name.
4675
6de9cd9a
DN
4676@item all
4677@opindex fdump-tree-all
4678Enable all the available tree dumps with the flags provided in this option.
e76b4820 4679@end table
9965d119 4680
c866976a
LB
4681@item -ftree-vectorizer-verbose=@var{n}
4682@opindex ftree-vectorizer-verbose
4683This option controls the amount of debugging output the vectorizer prints.
cb7ad97b
EC
4684This information is written to standard error, unless
4685@option{-fdump-tree-all} or @option{-fdump-tree-vect} is specified,
7ffe0f0d
DN
4686in which case it is output to the usual dump listing file, @file{.vect}.
4687For @var{n}=0 no diagnostic information is reported.
cb7ad97b 4688If @var{n}=1 the vectorizer reports each loop that got vectorized,
7ffe0f0d 4689and the total number of loops that got vectorized.
cb7ad97b
EC
4690If @var{n}=2 the vectorizer also reports non-vectorized loops that passed
4691the first analysis phase (vect_analyze_loop_form) - i.e. countable,
4692inner-most, single-bb, single-entry/exit loops. This is the same verbosity
7ffe0f0d 4693level that @option{-fdump-tree-vect-stats} uses.
cb7ad97b 4694Higher verbosity levels mean either more information dumped for each
7ffe0f0d
DN
4695reported loop, or same amount of information reported for more loops:
4696If @var{n}=3, alignment related information is added to the reports.
cb7ad97b 4697If @var{n}=4, data-references related information (e.g. memory dependences,
7ffe0f0d 4698memory access-patterns) is added to the reports.
cb7ad97b
EC
4699If @var{n}=5, the vectorizer reports also non-vectorized inner-most loops
4700that did not pass the first analysis phase (i.e. may not be countable, or
7ffe0f0d
DN
4701may have complicated control-flow).
4702If @var{n}=6, the vectorizer reports also non-vectorized nested loops.
cb7ad97b 4703For @var{n}=7, all the information the vectorizer generates during its
7ffe0f0d
DN
4704analysis and transformation is reported. This is the same verbosity level
4705that @option{-fdump-tree-vect-details} uses.
c866976a 4706
a37db56b
GK
4707@item -frandom-seed=@var{string}
4708@opindex frandom-string
4709This option provides a seed that GCC uses when it would otherwise use
e61a2eb7 4710random numbers. It is used to generate certain symbol names
8a36672b 4711that have to be different in every compiled file. It is also used to
e61a2eb7 4712place unique stamps in coverage data files and the object files that
8a36672b 4713produce them. You can use the @option{-frandom-seed} option to produce
e61a2eb7 4714reproducibly identical object files.
a37db56b
GK
4715
4716The @var{string} should be different for every file you compile.
4717
e03b7153
RS
4718@item -fsched-verbose=@var{n}
4719@opindex fsched-verbose
4720On targets that use instruction scheduling, this option controls the
4721amount of debugging output the scheduler prints. This information is
4722written to standard error, unless @option{-dS} or @option{-dR} is
4723specified, in which case it is output to the usual dump
4724listing file, @file{.sched} or @file{.sched2} respectively. However
4725for @var{n} greater than nine, the output is always printed to standard
4726error.
4727
4728For @var{n} greater than zero, @option{-fsched-verbose} outputs the
4729same information as @option{-dRS}. For @var{n} greater than one, it
4730also output basic block probabilities, detailed ready list information
4731and unit/insn info. For @var{n} greater than two, it includes RTL
4732at abort point, control-flow and regions info. And for @var{n} over
4733four, @option{-fsched-verbose} also includes dependence info.
4734
74291a4b 4735@item -save-temps
cd3bb277 4736@opindex save-temps
74291a4b
MM
4737Store the usual ``temporary'' intermediate files permanently; place them
4738in the current directory and name them based on the source file. Thus,
4739compiling @file{foo.c} with @samp{-c -save-temps} would produce files
f2ecb02d
JM
4740@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
4741preprocessed @file{foo.i} output file even though the compiler now
4742normally uses an integrated preprocessor.
74291a4b 4743
1f7edb8b
RS
4744When used in combination with the @option{-x} command line option,
4745@option{-save-temps} is sensible enough to avoid over writing an
4746input source file with the same extension as an intermediate file.
4747The corresponding intermediate file may be obtained by renaming the
4748source file before using @option{-save-temps}.
4749
03c41c05 4750@item -time
cd3bb277 4751@opindex time
03c41c05 4752Report the CPU time taken by each subprocess in the compilation
f2ecb02d
JM
4753sequence. For C source files, this is the compiler proper and assembler
4754(plus the linker if linking is done). The output looks like this:
03c41c05
ZW
4755
4756@smallexample
03c41c05
ZW
4757# cc1 0.12 0.01
4758# as 0.00 0.01
4759@end smallexample
4760
d78aa55c
JM
4761The first number on each line is the ``user time'', that is time spent
4762executing the program itself. The second number is ``system time'',
03c41c05
ZW
4763time spent executing operating system routines on behalf of the program.
4764Both numbers are in seconds.
4765
014a1138
JZ
4766@item -fvar-tracking
4767@opindex fvar-tracking
8a36672b
JM
4768Run variable tracking pass. It computes where variables are stored at each
4769position in code. Better debugging information is then generated
014a1138
JZ
4770(if the debugging information format supports this information).
4771
4772It is enabled by default when compiling with optimization (@option{-Os},
4773@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
4774the debug info format supports it.
4775
74291a4b 4776@item -print-file-name=@var{library}
cd3bb277 4777@opindex print-file-name
74291a4b
MM
4778Print the full absolute name of the library file @var{library} that
4779would be used when linking---and don't do anything else. With this
0c2d1a2a 4780option, GCC does not compile or link anything; it just prints the
74291a4b
MM
4781file name.
4782
b1018de6
AO
4783@item -print-multi-directory
4784@opindex print-multi-directory
4785Print the directory name corresponding to the multilib selected by any
4786other switches present in the command line. This directory is supposed
4787to exist in @env{GCC_EXEC_PREFIX}.
4788
4789@item -print-multi-lib
4790@opindex print-multi-lib
4791Print the mapping from multilib directory names to compiler switches
4792that enable them. The directory name is separated from the switches by
4793@samp{;}, and each switch starts with an @samp{@@} instead of the
4794@samp{-}, without spaces between multiple switches. This is supposed to
4795ease shell-processing.
4796
74291a4b 4797@item -print-prog-name=@var{program}
cd3bb277 4798@opindex print-prog-name
630d3d5a 4799Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
74291a4b
MM
4800
4801@item -print-libgcc-file-name
cd3bb277 4802@opindex print-libgcc-file-name
630d3d5a 4803Same as @option{-print-file-name=libgcc.a}.
74291a4b 4804
630d3d5a 4805This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
74291a4b
MM
4806but you do want to link with @file{libgcc.a}. You can do
4807
3ab51846 4808@smallexample
74291a4b 4809gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3ab51846 4810@end smallexample
74291a4b
MM
4811
4812@item -print-search-dirs
cd3bb277 4813@opindex print-search-dirs
74291a4b 4814Print the name of the configured installation directory and a list of
2dd76960 4815program and library directories @command{gcc} will search---and don't do anything else.
74291a4b 4816
2dd76960 4817This is useful when @command{gcc} prints the error message
3c0b7970
JM
4818@samp{installation problem, cannot exec cpp0: No such file or directory}.
4819To resolve this you either need to put @file{cpp0} and the other compiler
2dd76960 4820components where @command{gcc} expects to find them, or you can set the environment
bedc7537 4821variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
78466c0e 4822Don't forget the trailing @samp{/}.
74291a4b 4823@xref{Environment Variables}.
1f0c3120 4824
14da6073
JM
4825@item -print-sysroot-headers-suffix
4826@opindex print-sysroot-headers-suffix
4827Print the suffix added to the target sysroot when searching for
4828headers, or give an error if the compiler is not configured with such
4829a suffix---and don't do anything else.
4830
1f0c3120 4831@item -dumpmachine
cd3bb277 4832@opindex dumpmachine
1f0c3120
JM
4833Print the compiler's target machine (for example,
4834@samp{i686-pc-linux-gnu})---and don't do anything else.
4835
4836@item -dumpversion
cd3bb277 4837@opindex dumpversion
1f0c3120
JM
4838Print the compiler version (for example, @samp{3.0})---and don't do
4839anything else.
4840
4841@item -dumpspecs
cd3bb277 4842@opindex dumpspecs
1f0c3120
JM
4843Print the compiler's built-in specs---and don't do anything else. (This
4844is used when GCC itself is being built.) @xref{Spec Files}.
73c68f61
SS
4845
4846@item -feliminate-unused-debug-types
4847@opindex feliminate-unused-debug-types
4848Normally, when producing DWARF2 output, GCC will emit debugging
4849information for all types declared in a compilation
4850unit, regardless of whether or not they are actually used
4851in that compilation unit. Sometimes this is useful, such as
4852if, in the debugger, you want to cast a value to a type that is
4853not actually used in your program (but is declared). More often,
4854however, this results in a significant amount of wasted space.
4855With this option, GCC will avoid producing debug symbol output
4856for types that are nowhere used in the source file being compiled.
74291a4b
MM
4857@end table
4858
4859@node Optimize Options
4860@section Options That Control Optimization
4861@cindex optimize options
4862@cindex options, optimization
4863
147d1cd3
JQ
4864These options control various sorts of optimizations.
4865
4866Without any optimization option, the compiler's goal is to reduce the
4867cost of compilation and to make debugging produce the expected
4868results. Statements are independent: if you stop the program with a
4869breakpoint between statements, you can then assign a new value to any
4870variable or change the program counter to any other statement in the
4871function and get exactly the results you would expect from the source
4872code.
4873
4874Turning on optimization flags makes the compiler attempt to improve
4875the performance and/or code size at the expense of compilation time
4876and possibly the ability to debug the program.
4877
a451b0bd 4878The compiler performs optimization based on the knowledge it has of
c539d463 4879the program. Optimization levels @option{-O} and above, in
7797ff53
PB
4880particular, enable @emph{unit-at-a-time} mode, which allows the
4881compiler to consider information gained from later functions in
4882the file when compiling a function. Compiling multiple files at
4883once to a single output file in @emph{unit-at-a-time} mode allows
d1bd0ded
GK
4884the compiler to use information gained from all of the files when
4885compiling each of them.
4886
147d1cd3
JQ
4887Not all optimizations are controlled directly by a flag. Only
4888optimizations that have a flag are listed.
74291a4b 4889
2642624b 4890@table @gcctabopt
74291a4b
MM
4891@item -O
4892@itemx -O1
cd3bb277
JM
4893@opindex O
4894@opindex O1
74291a4b
MM
4895Optimize. Optimizing compilation takes somewhat more time, and a lot
4896more memory for a large function.
4897
630d3d5a 4898With @option{-O}, the compiler tries to reduce code size and execution
9c34dbbf
ZW
4899time, without performing any optimizations that take a great deal of
4900compilation time.
74291a4b 4901
daf2f129 4902@option{-O} turns on the following optimization flags:
9a94f7f3 4903@gccoptlist{-fdefer-pop @gol
08711fdf
SB
4904-fdelayed-branch @gol
4905-fguess-branch-probability @gol
4906-fcprop-registers @gol
9a94f7f3
JM
4907-fif-conversion @gol
4908-fif-conversion2 @gol
e53a16e7 4909-fsplit-wide-types @gol
08711fdf
SB
4910-ftree-ccp @gol
4911-ftree-dce @gol
ec7dea0a 4912-ftree-dominator-opts @gol
08711fdf
SB
4913-ftree-dse @gol
4914-ftree-ter @gol
08711fdf
SB
4915-ftree-sra @gol
4916-ftree-copyrename @gol
4917-ftree-fre @gol
4918-ftree-ch @gol
c539d463 4919-funit-at-a-time @gol
08711fdf 4920-fmerge-constants}
fad893da
JQ
4921
4922@option{-O} also turns on @option{-fomit-frame-pointer} on machines
4923where doing so does not interfere with debugging.
4924
74291a4b 4925@item -O2
cd3bb277 4926@opindex O2
0c2d1a2a 4927Optimize even more. GCC performs nearly all supported optimizations
74291a4b 4928that do not involve a space-speed tradeoff. The compiler does not
630d3d5a
JM
4929perform loop unrolling or function inlining when you specify @option{-O2}.
4930As compared to @option{-O}, this option increases both compilation time
74291a4b
MM
4931and the performance of the generated code.
4932
fad893da
JQ
4933@option{-O2} turns on all optimization flags specified by @option{-O}. It
4934also turns on the following optimization flags:
08711fdf
SB
4935@gccoptlist{-fthread-jumps @gol
4936-fcrossjumping @gol
9a94f7f3 4937-foptimize-sibling-calls @gol
9a94f7f3 4938-fcse-follow-jumps -fcse-skip-blocks @gol
08711fdf 4939-fgcse -fgcse-lm @gol
9a94f7f3 4940-fexpensive-optimizations @gol
efa1cdf0 4941-frerun-cse-after-loop @gol
9a94f7f3
JM
4942-fcaller-saves @gol
4943-fpeephole2 @gol
08711fdf
SB
4944-fschedule-insns -fschedule-insns2 @gol
4945-fsched-interblock -fsched-spec @gol
4946-fregmove @gol
eeef0e45 4947-fstrict-aliasing -fstrict-overflow @gol
08711fdf
SB
4948-fdelete-null-pointer-checks @gol
4949-freorder-blocks -freorder-functions @gol
9a94f7f3 4950-falign-functions -falign-jumps @gol
b684a3df 4951-falign-loops -falign-labels @gol
08873e96 4952-ftree-vrp @gol
08711fdf 4953-ftree-pre}
74291a4b 4954
081ca317
BL
4955Please note the warning under @option{-fgcse} about
4956invoking @option{-O2} on programs that use computed gotos.
4957
74291a4b 4958@item -O3
cd3bb277 4959@opindex O3
630d3d5a 4960Optimize yet more. @option{-O3} turns on all optimizations specified by
dafc5b82 4961@option{-O2} and also turns on the @option{-finline-functions},
08711fdf 4962@option{-funswitch-loops} and @option{-fgcse-after-reload} options.
74291a4b
MM
4963
4964@item -O0
cd3bb277 4965@opindex O0
e0f7e748
GK
4966Reduce compilation time and make debugging produce the expected
4967results. This is the default.
74291a4b 4968
c6aded7c 4969@item -Os
cd3bb277 4970@opindex Os
630d3d5a 4971Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
c6aded7c
AG
4972do not typically increase code size. It also performs further
4973optimizations designed to reduce code size.
4974
fad893da 4975@option{-Os} disables the following optimization flags:
9a94f7f3 4976@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
c12cc930
KB
4977-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
4978-fprefetch-loop-arrays -ftree-vect-loop-version}
fad893da 4979
630d3d5a 4980If you use multiple @option{-O} options, with or without level numbers,
74291a4b
MM
4981the last such option is the one that is effective.
4982@end table
4983
630d3d5a 4984Options of the form @option{-f@var{flag}} specify machine-independent
74291a4b 4985flags. Most flags have both positive and negative forms; the negative
147d1cd3
JQ
4986form of @option{-ffoo} would be @option{-fno-foo}. In the table
4987below, only one of the forms is listed---the one you typically will
4988use. You can figure out the other form by either removing @samp{no-}
4989or adding it.
4990
4991The following options control specific optimizations. They are either
4992activated by @option{-O} options or are related to ones that are. You
4993can use the following flags in the rare cases when ``fine-tuning'' of
4994optimizations to be performed is desired.
74291a4b 4995
2642624b 4996@table @gcctabopt
74291a4b 4997@item -fno-default-inline
cd3bb277 4998@opindex fno-default-inline
74291a4b
MM
4999Do not make member functions inline by default merely because they are
5000defined inside the class scope (C++ only). Otherwise, when you specify
630d3d5a 5001@w{@option{-O}}, member functions defined inside class scope are compiled
74291a4b
MM
5002inline by default; i.e., you don't need to add @samp{inline} in front of
5003the member function name.
5004
5005@item -fno-defer-pop
cd3bb277 5006@opindex fno-defer-pop
74291a4b
MM
5007Always pop the arguments to each function call as soon as that function
5008returns. For machines which must pop arguments after a function call,
5009the compiler normally lets arguments accumulate on the stack for several
5010function calls and pops them all at once.
5011
38df970e
JQ
5012Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5013
74291a4b 5014@item -fforce-addr
cd3bb277 5015@opindex fforce-addr
74291a4b 5016Force memory address constants to be copied into registers before
1d8eeb63 5017doing arithmetic on them.
74291a4b 5018
a52b023a
PB
5019@item -fforward-propagate
5020@opindex fforward-propagate
5021Perform a forward propagation pass on RTL. The pass tries to combine two
5022instructions and checks if the result can be simplified. If loop unrolling
5023is active, two passes are performed and the second is scheduled after
5024loop unrolling.
5025
5026This option is enabled by default at optimization levels @option{-O2},
5027@option{-O3}, @option{-Os}.
5028
74291a4b 5029@item -fomit-frame-pointer
cd3bb277 5030@opindex fomit-frame-pointer
74291a4b
MM
5031Don't keep the frame pointer in a register for functions that
5032don't need one. This avoids the instructions to save, set up and
5033restore frame pointers; it also makes an extra register available
5034in many functions. @strong{It also makes debugging impossible on
5035some machines.}
5036
8aeea6e6 5037On some machines, such as the VAX, this flag has no effect, because
74291a4b
MM
5038the standard calling sequence automatically handles the frame pointer
5039and nothing is saved by pretending it doesn't exist. The
5040machine-description macro @code{FRAME_POINTER_REQUIRED} controls
5041whether a target machine supports this flag. @xref{Registers,,Register
b11cc610 5042Usage, gccint, GNU Compiler Collection (GCC) Internals}.
74291a4b 5043
38df970e
JQ
5044Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5045
1aaef9c1 5046@item -foptimize-sibling-calls
cd3bb277 5047@opindex foptimize-sibling-calls
1aaef9c1
JH
5048Optimize sibling and tail recursive calls.
5049
38df970e
JQ
5050Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5051
74291a4b 5052@item -fno-inline
cd3bb277 5053@opindex fno-inline
74291a4b
MM
5054Don't pay attention to the @code{inline} keyword. Normally this option
5055is used to keep the compiler from expanding any functions inline.
5056Note that if you are not optimizing, no functions can be expanded inline.
5057
5058@item -finline-functions
cd3bb277 5059@opindex finline-functions
74291a4b
MM
5060Integrate all simple functions into their callers. The compiler
5061heuristically decides which functions are simple enough to be worth
5062integrating in this way.
5063
5064If all calls to a given function are integrated, and the function is
5065declared @code{static}, then the function is normally not output as
5066assembler code in its own right.
5067
38df970e 5068Enabled at level @option{-O3}.
355866de
RG
5069
5070@item -finline-functions-called-once
5071@opindex finline-functions-called-once
5072Consider all @code{static} functions called once for inlining into their
5073caller even if they are not marked @code{inline}. If a call to a given
5074function is integrated, then the function is not output as assembler code
5075in its own right.
5076
5077Enabled if @option{-funit-at-a-time} is enabled.
38df970e 5078
d63db217
JH
5079@item -fearly-inlining
5080@opindex fearly-inlining
5081Inline functions marked by @code{always_inline} and functions whose body seems
5082smaller than the function call overhead early before doing
5083@option{-fprofile-generate} instrumentation and real inlining pass. Doing so
5084makes profiling significantly cheaper and usually inlining faster on programs
5085having large chains of nested wrapper functions.
5086
5087Enabled by default.
5088
efa3896a 5089@item -finline-limit=@var{n}
cd3bb277 5090@opindex finline-limit
2dd76960 5091By default, GCC limits the size of functions that can be inlined. This flag
f9e814f1 5092allows the control of this limit for functions that are explicitly marked as
3364c33b 5093inline (i.e., marked with the inline keyword or defined within the class
02f52e19 5094definition in c++). @var{n} is the size of functions that can be inlined in
f9e814f1 5095number of pseudo instructions (not counting parameter handling). The default
93ee12c4
GP
5096value of @var{n} is 600.
5097Increasing this value can result in more inlined code at
f9e814f1 5098the cost of compilation time and memory consumption. Decreasing usually makes
02f52e19
AJ
5099the compilation faster and less code will be inlined (which presumably
5100means slower programs). This option is particularly useful for programs that
aee96fe9 5101use inlining heavily such as those based on recursive templates with C++.
f9e814f1 5102
bc522472
KG
5103Inlining is actually controlled by a number of parameters, which may be
5104specified individually by using @option{--param @var{name}=@var{value}}.
daf2f129 5105The @option{-finline-limit=@var{n}} option sets some of these parameters
bc522472
KG
5106as follows:
5107
5108@table @gcctabopt
dc5abe77
TM
5109@item max-inline-insns-single
5110 is set to @var{n}/2.
5111@item max-inline-insns-auto
5112 is set to @var{n}/2.
5113@item min-inline-insns
5114 is set to 130 or @var{n}/4, whichever is smaller.
5115@item max-inline-insns-rtl
5116 is set to @var{n}.
bc522472
KG
5117@end table
5118
f7a01847 5119See below for a documentation of the individual
bc522472
KG
5120parameters controlling inlining.
5121
f9e814f1 5122@emph{Note:} pseudo instruction represents, in this particular context, an
0fa2e4df 5123abstract measurement of function's size. In no way does it represent a count
f9e814f1
TP
5124of assembly instructions and as such its exact meaning might change from one
5125release to an another.
5126
74291a4b 5127@item -fkeep-inline-functions
cd3bb277 5128@opindex fkeep-inline-functions
1a10290c
MM
5129In C, emit @code{static} functions that are declared @code{inline}
5130into the object file, even if the function has been inlined into all
5131of its callers. This switch does not affect functions using the
4a574196 5132@code{extern inline} extension in GNU C89@. In C++, emit any and all
1a10290c 5133inline functions into the object file.
74291a4b
MM
5134
5135@item -fkeep-static-consts
cd3bb277 5136@opindex fkeep-static-consts
74291a4b
MM
5137Emit variables declared @code{static const} when optimization isn't turned
5138on, even if the variables aren't referenced.
5139
0c2d1a2a 5140GCC enables this option by default. If you want to force the compiler to
74291a4b 5141check if the variable was referenced, regardless of whether or not
630d3d5a 5142optimization is turned on, use the @option{-fno-keep-static-consts} option.
74291a4b 5143
201556f0
JJ
5144@item -fmerge-constants
5145Attempt to merge identical constants (string constants and floating point
3364c33b 5146constants) across compilation units.
201556f0 5147
3364c33b
JQ
5148This option is the default for optimized compilation if the assembler and
5149linker support it. Use @option{-fno-merge-constants} to inhibit this
5150behavior.
201556f0 5151
38df970e
JQ
5152Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5153
201556f0
JJ
5154@item -fmerge-all-constants
5155Attempt to merge identical constants and identical variables.
5156
5157This option implies @option{-fmerge-constants}. In addition to
431ae0bf 5158@option{-fmerge-constants} this considers e.g.@: even constant initialized
201556f0
JJ
5159arrays or initialized constant variables with integral or floating point
5160types. Languages like C or C++ require each non-automatic variable to
5161have distinct location, so using this option will result in non-conforming
c21cd8b1 5162behavior.
201556f0 5163
e5626198
AZ
5164@item -fmodulo-sched
5165@opindex fmodulo-sched
5166Perform swing modulo scheduling immediately before the first scheduling
5167pass. This pass looks at innermost loops and reorders their
5168instructions by overlapping different iterations.
5169
e03b7153
RS
5170@item -fno-branch-count-reg
5171@opindex fno-branch-count-reg
5172Do not use ``decrement and branch'' instructions on a count register,
5173but instead generate a sequence of instructions that decrement a
5174register, compare it against zero, then branch based upon the result.
5175This option is only meaningful on architectures that support such
5176instructions, which include x86, PowerPC, IA-64 and S/390.
5177
efa1cdf0 5178The default is @option{-fbranch-count-reg}.
38df970e 5179
74291a4b 5180@item -fno-function-cse
cd3bb277 5181@opindex fno-function-cse
74291a4b
MM
5182Do not put function addresses in registers; make each instruction that
5183calls a constant function contain the function's address explicitly.
5184
5185This option results in less efficient code, but some strange hacks
5186that alter the assembler output may be confused by the optimizations
5187performed when this option is not used.
5188
38df970e
JQ
5189The default is @option{-ffunction-cse}
5190
27b41650
KG
5191@item -fno-zero-initialized-in-bss
5192@opindex fno-zero-initialized-in-bss
5193If the target supports a BSS section, GCC by default puts variables that
5194are initialized to zero into BSS@. This can save space in the resulting
5195code.
5196
5197This option turns off this behavior because some programs explicitly
5198rely on variables going to the data section. E.g., so that the
5199resulting executable can find the beginning of that section and/or make
5200assumptions based on that.
5201
5202The default is @option{-fzero-initialized-in-bss}.
e03b7153 5203
6de9cd9a
DN
5204@item -fbounds-check
5205@opindex fbounds-check
5206For front-ends that support it, generate additional code to check that
5207indices used to access arrays are within the declared range. This is
5208currently only supported by the Java and Fortran front-ends, where
5209this option defaults to true and false respectively.
5210
5211@item -fmudflap -fmudflapth -fmudflapir
5212@opindex fmudflap
5213@opindex fmudflapth
5214@opindex fmudflapir
5215@cindex bounds checking
5216@cindex mudflap
5217For front-ends that support it (C and C++), instrument all risky
5218pointer/array dereferencing operations, some standard library
5219string/heap functions, and some other associated constructs with
5220range/validity tests. Modules so instrumented should be immune to
5221buffer overflows, invalid heap use, and some other classes of C/C++
5222programming errors. The instrumentation relies on a separate runtime
5223library (@file{libmudflap}), which will be linked into a program if
5224@option{-fmudflap} is given at link time. Run-time behavior of the
5225instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
5226environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
5227for its options.
5228
5229Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
5230link if your program is multi-threaded. Use @option{-fmudflapir}, in
5231addition to @option{-fmudflap} or @option{-fmudflapth}, if
5232instrumentation should ignore pointer reads. This produces less
5233instrumentation (and therefore faster execution) and still provides
5234some protection against outright memory corrupting writes, but allows
5235erroneously read data to propagate within a program.
5236
74291a4b 5237@item -fthread-jumps
cd3bb277 5238@opindex fthread-jumps
74291a4b
MM
5239Perform optimizations where we check to see if a jump branches to a
5240location where another comparison subsumed by the first is found. If
5241so, the first branch is redirected to either the destination of the
5242second branch or a point immediately following it, depending on whether
5243the condition is known to be true or false.
5244
08711fdf 5245Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
38df970e 5246
e53a16e7 5247@item -fsplit-wide-types
edc5f63b 5248@opindex fsplit-wide-types
e53a16e7
ILT
5249When using a type that occupies multiple registers, such as @code{long
5250long} on a 32-bit system, split the registers apart and allocate them
5251independently. This normally generates better code for those types,
5252but may make debugging more difficult.
5253
5254Enabled at levels @option{-O}, @option{-O2}, @option{-O3},
5255@option{-Os}.
5256
74291a4b 5257@item -fcse-follow-jumps
cd3bb277 5258@opindex fcse-follow-jumps
74291a4b
MM
5259In common subexpression elimination, scan through jump instructions
5260when the target of the jump is not reached by any other path. For
5261example, when CSE encounters an @code{if} statement with an
5262@code{else} clause, CSE will follow the jump when the condition
5263tested is false.
5264
38df970e
JQ
5265Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5266
74291a4b 5267@item -fcse-skip-blocks
cd3bb277 5268@opindex fcse-skip-blocks
630d3d5a 5269This is similar to @option{-fcse-follow-jumps}, but causes CSE to
74291a4b
MM
5270follow jumps which conditionally skip over blocks. When CSE
5271encounters a simple @code{if} statement with no else clause,
630d3d5a 5272@option{-fcse-skip-blocks} causes CSE to follow the jump around the
74291a4b
MM
5273body of the @code{if}.
5274
38df970e
JQ
5275Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5276
74291a4b 5277@item -frerun-cse-after-loop
cd3bb277 5278@opindex frerun-cse-after-loop
74291a4b
MM
5279Re-run common subexpression elimination after loop optimizations has been
5280performed.
5281
38df970e
JQ
5282Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5283
7506f491 5284@item -fgcse
cd3bb277 5285@opindex fgcse
7506f491
DE
5286Perform a global common subexpression elimination pass.
5287This pass also performs global constant and copy propagation.
5288
081ca317
BL
5289@emph{Note:} When compiling a program using computed gotos, a GCC
5290extension, you may get better runtime performance if you disable
3364c33b 5291the global common subexpression elimination pass by adding
081ca317
BL
5292@option{-fno-gcse} to the command line.
5293
38df970e
JQ
5294Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5295
a13d4ebf 5296@item -fgcse-lm
cd3bb277 5297@opindex fgcse-lm
695ac33f 5298When @option{-fgcse-lm} is enabled, global common subexpression elimination will
767094dd 5299attempt to move loads which are only killed by stores into themselves. This
a13d4ebf 5300allows a loop containing a load/store sequence to be changed to a load outside
02f52e19 5301the loop, and a copy/store within the loop.
a13d4ebf 5302
38df970e
JQ
5303Enabled by default when gcse is enabled.
5304
a13d4ebf 5305@item -fgcse-sm
cd3bb277 5306@opindex fgcse-sm
f5f2e3cd
MH
5307When @option{-fgcse-sm} is enabled, a store motion pass is run after
5308global common subexpression elimination. This pass will attempt to move
5309stores out of loops. When used in conjunction with @option{-fgcse-lm},
5310loops containing a load/store sequence can be changed to a load before
5311the loop and a store after the loop.
5312
08711fdf 5313Not enabled at any optimization level.
f5f2e3cd
MH
5314
5315@item -fgcse-las
5316@opindex fgcse-las
5317When @option{-fgcse-las} is enabled, the global common subexpression
5318elimination pass eliminates redundant loads that come after stores to the
2206e783 5319same memory location (both partial and full redundancies).
a13d4ebf 5320
08711fdf 5321Not enabled at any optimization level.
38df970e 5322
db643b91
SH
5323@item -fgcse-after-reload
5324@opindex fgcse-after-reload
5325When @option{-fgcse-after-reload} is enabled, a redundant load elimination
8a36672b 5326pass is performed after reload. The purpose of this pass is to cleanup
db643b91
SH
5327redundant spilling.
5328
f9cc1a70
PB
5329@item -funsafe-loop-optimizations
5330@opindex funsafe-loop-optimizations
5331If given, the loop optimizer will assume that loop indices do not
5332overflow, and that the loops with nontrivial exit condition are not
5333infinite. This enables a wider range of loop optimizations even if
5334the loop optimizer itself cannot prove that these assumptions are valid.
5335Using @option{-Wunsafe-loop-optimizations}, the compiler will warn you
5336if it finds this kind of loop.
5337
96327cdc
JH
5338@item -fcrossjumping
5339@opindex crossjumping
8a36672b 5340Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
96327cdc
JH
5341resulting code may or may not perform better than without cross-jumping.
5342
53071270 5343Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
38df970e 5344
2c4b77f3
JH
5345@item -fif-conversion
5346@opindex if-conversion
5347Attempt to transform conditional jumps into branch-less equivalents. This
5348include use of conditional moves, min, max, set flags and abs instructions, and
5349some tricks doable by standard arithmetics. The use of conditional execution
5350on chips where it is available is controlled by @code{if-conversion2}.
5351
38df970e
JQ
5352Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5353
2c4b77f3
JH
5354@item -fif-conversion2
5355@opindex if-conversion2
5356Use conditional execution (where available) to transform conditional jumps into
5357branch-less equivalents.
5358
38df970e
JQ
5359Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5360
b6d24183 5361@item -fdelete-null-pointer-checks
cd3bb277 5362@opindex fdelete-null-pointer-checks
9c34dbbf
ZW
5363Use global dataflow analysis to identify and eliminate useless checks
5364for null pointers. The compiler assumes that dereferencing a null
5365pointer would have halted the program. If a pointer is checked after
5366it has already been dereferenced, it cannot be null.
5367
5368In some environments, this assumption is not true, and programs can
5369safely dereference null pointers. Use
5370@option{-fno-delete-null-pointer-checks} to disable this optimization
5371for programs which depend on that behavior.
b6d24183 5372
38df970e
JQ
5373Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5374
74291a4b 5375@item -fexpensive-optimizations
cd3bb277 5376@opindex fexpensive-optimizations
74291a4b
MM
5377Perform a number of minor optimizations that are relatively expensive.
5378
38df970e
JQ
5379Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5380
639726ba 5381@item -foptimize-register-move
59d40964 5382@itemx -fregmove
cd3bb277
JM
5383@opindex foptimize-register-move
5384@opindex fregmove
9ec36da5
JL
5385Attempt to reassign register numbers in move instructions and as
5386operands of other simple instructions in order to maximize the amount of
56159047 5387register tying. This is especially helpful on machines with two-operand
38df970e 5388instructions.
9ec36da5 5389
bedc7537 5390Note @option{-fregmove} and @option{-foptimize-register-move} are the same
9ec36da5
JL
5391optimization.
5392
38df970e
JQ
5393Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5394
74291a4b 5395@item -fdelayed-branch
cd3bb277 5396@opindex fdelayed-branch
74291a4b
MM
5397If supported for the target machine, attempt to reorder instructions
5398to exploit instruction slots available after delayed branch
5399instructions.
5400
38df970e
JQ
5401Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5402
74291a4b 5403@item -fschedule-insns
cd3bb277 5404@opindex fschedule-insns
74291a4b
MM
5405If supported for the target machine, attempt to reorder instructions to
5406eliminate execution stalls due to required data being unavailable. This
5407helps machines that have slow floating point or memory load instructions
5408by allowing other instructions to be issued until the result of the load
5409or floating point instruction is required.
5410
38df970e
JQ
5411Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5412
74291a4b 5413@item -fschedule-insns2
cd3bb277 5414@opindex fschedule-insns2
630d3d5a 5415Similar to @option{-fschedule-insns}, but requests an additional pass of
74291a4b
MM
5416instruction scheduling after register allocation has been done. This is
5417especially useful on machines with a relatively small number of
5418registers and where memory load instructions take more than one cycle.
5419
38df970e
JQ
5420Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5421
e03b7153
RS
5422@item -fno-sched-interblock
5423@opindex fno-sched-interblock
5424Don't schedule instructions across basic blocks. This is normally
5425enabled by default when scheduling before register allocation, i.e.@:
5426with @option{-fschedule-insns} or at @option{-O2} or higher.
5427
5428@item -fno-sched-spec
5429@opindex fno-sched-spec
5430Don't allow speculative motion of non-load instructions. This is normally
5431enabled by default when scheduling before register allocation, i.e.@:
5432with @option{-fschedule-insns} or at @option{-O2} or higher.
5433
5434@item -fsched-spec-load
5435@opindex fsched-spec-load
5436Allow speculative motion of some load instructions. This only makes
5437sense when scheduling before register allocation, i.e.@: with
5438@option{-fschedule-insns} or at @option{-O2} or higher.
5439
5440@item -fsched-spec-load-dangerous
5441@opindex fsched-spec-load-dangerous
5442Allow speculative motion of more load instructions. This only makes
5443sense when scheduling before register allocation, i.e.@: with
5444@option{-fschedule-insns} or at @option{-O2} or higher.
5445
569fa502
DN
5446@item -fsched-stalled-insns=@var{n}
5447@opindex fsched-stalled-insns
5448Define how many insns (if any) can be moved prematurely from the queue
5449of stalled insns into the ready list, during the second scheduling pass.
5450
5451@item -fsched-stalled-insns-dep=@var{n}
5452@opindex fsched-stalled-insns-dep
daf2f129
JM
5453Define how many insn groups (cycles) will be examined for a dependency
5454on a stalled insn that is candidate for premature removal from the queue
5455of stalled insns. Has an effect only during the second scheduling pass,
569fa502
DN
5456and only if @option{-fsched-stalled-insns} is used and its value is not zero.
5457
b9422b69
JH
5458@item -fsched2-use-superblocks
5459@opindex fsched2-use-superblocks
61aeb06f 5460When scheduling after register allocation, do use superblock scheduling
62b9c42c 5461algorithm. Superblock scheduling allows motion across basic block boundaries
b9422b69 5462resulting on faster schedules. This option is experimental, as not all machine
62b9c42c 5463descriptions used by GCC model the CPU closely enough to avoid unreliable
daf2f129 5464results from the algorithm.
b9422b69
JH
5465
5466This only makes sense when scheduling after register allocation, i.e.@: with
5467@option{-fschedule-insns2} or at @option{-O2} or higher.
5468
5469@item -fsched2-use-traces
5470@opindex fsched2-use-traces
5471Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
5472allocation and additionally perform code duplication in order to increase the
5473size of superblocks using tracer pass. See @option{-ftracer} for details on
5474trace formation.
5475
62b9c42c 5476This mode should produce faster but significantly longer programs. Also
4ec7afd7
KH
5477without @option{-fbranch-probabilities} the traces constructed may not
5478match the reality and hurt the performance. This only makes
b9422b69
JH
5479sense when scheduling after register allocation, i.e.@: with
5480@option{-fschedule-insns2} or at @option{-O2} or higher.
5481
8cd37d0b
RL
5482@item -fsee
5483@opindex fsee
5484Eliminates redundant extension instructions and move the non redundant
5485ones to optimal placement using LCM.
8cd37d0b 5486
d72372e4
MH
5487@item -freschedule-modulo-scheduled-loops
5488@opindex fscheduling-in-modulo-scheduled-loops
5489The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
5490we may want to prevent the later scheduling passes from changing its schedule, we use this
5491option to control that.
5492
74291a4b 5493@item -fcaller-saves
cd3bb277 5494@opindex fcaller-saves
74291a4b
MM
5495Enable values to be allocated in registers that will be clobbered by
5496function calls, by emitting extra instructions to save and restore the
5497registers around such calls. Such allocation is done only when it
5498seems to result in better code than would otherwise be produced.
5499
81610a0d
HPN
5500This option is always enabled by default on certain machines, usually
5501those which have no call-preserved registers to use instead.
5502
38df970e 5503Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
74291a4b 5504
6de9cd9a
DN
5505@item -ftree-pre
5506Perform Partial Redundancy Elimination (PRE) on trees. This flag is
08711fdf 5507enabled by default at @option{-O2} and @option{-O3}.
ff2ad0f7
DN
5508
5509@item -ftree-fre
5510Perform Full Redundancy Elimination (FRE) on trees. The difference
5511between FRE and PRE is that FRE only considers expressions
5512that are computed on all paths leading to the redundant computation.
06e2b6a0 5513This analysis is faster than PRE, though it exposes fewer redundancies.
4ec7afd7 5514This flag is enabled by default at @option{-O} and higher.
6de9cd9a 5515
0bca51f0
DN
5516@item -ftree-copy-prop
5517Perform copy propagation on trees. This pass eliminates unnecessary
5518copy operations. This flag is enabled by default at @option{-O} and
5519higher.
5520
5521@item -ftree-store-copy-prop
5522Perform copy propagation of memory loads and stores. This pass
5523eliminates unnecessary copy operations in memory references
5524(structures, global variables, arrays, etc). This flag is enabled by
5525default at @option{-O2} and higher.
5526
c75ab022
DB
5527@item -ftree-salias
5528Perform structural alias analysis on trees. This flag
5529is enabled by default at @option{-O} and higher.
5530
4cf4d6a3
DB
5531@item -fipa-pta
5532Perform interprocedural pointer analysis.
5533
fa555252
DB
5534@item -ftree-sink
5535Perform forward store motion on trees. This flag is
5536enabled by default at @option{-O} and higher.
5537
6de9cd9a 5538@item -ftree-ccp
0bca51f0
DN
5539Perform sparse conditional constant propagation (CCP) on trees. This
5540pass only operates on local scalar variables and is enabled by default
5541at @option{-O} and higher.
5542
5543@item -ftree-store-ccp
5544Perform sparse conditional constant propagation (CCP) on trees. This
5545pass operates on both local scalar variables and memory stores and
5546loads (global variables, structures, arrays, etc). This flag is
5547enabled by default at @option{-O2} and higher.
6de9cd9a
DN
5548
5549@item -ftree-dce
5550Perform dead code elimination (DCE) on trees. This flag is enabled by
4ec7afd7 5551default at @option{-O} and higher.
6de9cd9a
DN
5552
5553@item -ftree-dominator-opts
5c1c631e
DN
5554Perform a variety of simple scalar cleanups (constant/copy
5555propagation, redundancy elimination, range propagation and expression
5556simplification) based on a dominator tree traversal. This also
5557performs jump threading (to reduce jumps to jumps). This flag is
5558enabled by default at @option{-O} and higher.
6de9cd9a
DN
5559
5560@item -ftree-ch
5561Perform loop header copying on trees. This is beneficial since it increases
83c99486 5562effectiveness of code motion optimizations. It also saves one jump. This flag
4ec7afd7
KH
5563is enabled by default at @option{-O} and higher. It is not enabled
5564for @option{-Os}, since it usually increases code size.
6de9cd9a 5565
c66b6c66 5566@item -ftree-loop-optimize
4ec7afd7
KH
5567Perform loop optimizations on trees. This flag is enabled by default
5568at @option{-O} and higher.
c66b6c66 5569
599eabdb 5570@item -ftree-loop-linear
8a36672b 5571Perform linear loop transformations on tree. This flag can improve cache
599eabdb
DB
5572performance and allow further loop optimizations to take place.
5573
3d8864c0
SP
5574@item -fcheck-data-deps
5575Compare the results of several data dependence analyzers. This option
5576is used for debugging the data dependence analyzers.
5577
3450cbc4
DJ
5578@item -ftree-loop-im
5579Perform loop invariant motion on trees. This pass moves only invariants that
ec7dea0a 5580would be hard to handle at RTL level (function calls, operations that expand to
a7e5372d
ZD
5581nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
5582operands of conditions that are invariant out of the loop, so that we can use
5583just trivial invariantness analysis in loop unswitching. The pass also includes
5584store motion.
5585
3450cbc4 5586@item -ftree-loop-ivcanon
82b85a85
ZD
5587Create a canonical counter for number of iterations in the loop for that
5588determining number of iterations requires complicated analysis. Later
5589optimizations then may determine the number easily. Useful especially
5590in connection with unrolling.
5591
8b11a64c
ZD
5592@item -fivopts
5593Perform induction variable optimizations (strength reduction, induction
5594variable merging and induction variable elimination) on trees.
5595
6de9cd9a
DN
5596@item -ftree-sra
5597Perform scalar replacement of aggregates. This pass replaces structure
5598references with scalars to prevent committing structures to memory too
4ec7afd7 5599early. This flag is enabled by default at @option{-O} and higher.
6de9cd9a
DN
5600
5601@item -ftree-copyrename
f26c1794
EC
5602Perform copy renaming on trees. This pass attempts to rename compiler
5603temporaries to other variables at copy locations, usually resulting in
5604variable names which more closely resemble the original variables. This flag
4ec7afd7 5605is enabled by default at @option{-O} and higher.
6de9cd9a
DN
5606
5607@item -ftree-ter
5608Perform temporary expression replacement during the SSA->normal phase. Single
f26c1794
EC
5609use/single def temporaries are replaced at their use location with their
5610defining expression. This results in non-GIMPLE code, but gives the expanders
6de9cd9a 5611much more complex trees to work on resulting in better RTL generation. This is
4ec7afd7 5612enabled by default at @option{-O} and higher.
6de9cd9a 5613
79fe1b3b
DN
5614@item -ftree-vectorize
5615Perform loop vectorization on trees.
5616
c12cc930
KB
5617@item -ftree-vect-loop-version
5618@opindex ftree-vect-loop-version
5619Perform loop versioning when doing loop vectorization on trees. When a loop
5620appears to be vectorizable except that data alignment or data dependence cannot
5621be determined at compile time then vectorized and non-vectorized versions of
5622the loop are generated along with runtime checks for alignment or dependence
5623to control which version is executed. This option is enabled by default
5624except at level @option{-Os} where it is disabled.
5625
08873e96
DN
5626@item -ftree-vrp
5627Perform Value Range Propagation on trees. This is similar to the
5628constant propagation pass, but instead of values, ranges of values are
5629propagated. This allows the optimizers to remove unnecessary range
5630checks like array bound checks and null pointer checks. This is
5631enabled by default at @option{-O2} and higher. Null pointer check
5632elimination is only done if @option{-fdelete-null-pointer-checks} is
5633enabled.
5634
6de9cd9a
DN
5635@item -ftracer
5636@opindex ftracer
8a36672b 5637Perform tail duplication to enlarge superblock size. This transformation
6de9cd9a
DN
5638simplifies the control flow of the function allowing other optimizations to do
5639better job.
5640
5641@item -funroll-loops
5642@opindex funroll-loops
5643Unroll loops whose number of iterations can be determined at compile
efa1cdf0
ZD
5644time or upon entry to the loop. @option{-funroll-loops} implies
5645@option{-frerun-cse-after-loop}. This option makes code larger,
5646and may or may not make it run faster.
6de9cd9a
DN
5647
5648@item -funroll-all-loops
5649@opindex funroll-all-loops
5650Unroll all loops, even if their number of iterations is uncertain when
5651the loop is entered. This usually makes programs run more slowly.
5652@option{-funroll-all-loops} implies the same options as
5653@option{-funroll-loops},
5654
113d659a 5655@item -fsplit-ivs-in-unroller
edc5f63b 5656@opindex fsplit-ivs-in-unroller
113d659a
ZD
5657Enables expressing of values of induction variables in later iterations
5658of the unrolled loop using the value in the first iteration. This breaks
7869fe47 5659long dependency chains, thus improving efficiency of the scheduling passes.
113d659a
ZD
5660
5661Combination of @option{-fweb} and CSE is often sufficient to obtain the
8a36672b 5662same effect. However in cases the loop body is more complicated than
113d659a
ZD
5663a single basic block, this is not reliable. It also does not work at all
5664on some of the architectures due to restrictions in the CSE pass.
5665
5666This optimization is enabled by default.
5667
f37a4f14 5668@item -fvariable-expansion-in-unroller
edc5f63b 5669@opindex fvariable-expansion-in-unroller
f0eb93a8 5670With this option, the compiler will create multiple copies of some
f37a4f14
RE
5671local variables when unrolling a loop which can result in superior code.
5672
6de9cd9a
DN
5673@item -fprefetch-loop-arrays
5674@opindex fprefetch-loop-arrays
5675If supported by the target machine, generate instructions to prefetch
5676memory to improve the performance of loops that access large arrays.
5677
efa1cdf0 5678This option may generate better or worse code; results are highly
e5eb27e5
JL
5679dependent on the structure of loops within the source code.
5680
efa1cdf0
ZD
5681Disabled at level @option{-Os}.
5682
74291a4b 5683@item -fno-peephole
6cfc0341 5684@itemx -fno-peephole2
cd3bb277 5685@opindex fno-peephole
6cfc0341
RH
5686@opindex fno-peephole2
5687Disable any machine-specific peephole optimizations. The difference
630d3d5a 5688between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6cfc0341
RH
5689are implemented in the compiler; some targets use one, some use the
5690other, a few use both.
861bb6c1 5691
38df970e
JQ
5692@option{-fpeephole} is enabled by default.
5693@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5694
454d0cc7 5695@item -fno-guess-branch-probability
cd3bb277 5696@opindex fno-guess-branch-probability
ddd8e3ca
JW
5697Do not guess branch probabilities using heuristics.
5698
5699GCC will use heuristics to guess branch probabilities if they are
5700not provided by profiling feedback (@option{-fprofile-arcs}). These
5701heuristics are based on the control flow graph. If some branch probabilities
5702are specified by @samp{__builtin_expect}, then the heuristics will be
5703used to guess branch probabilities for the rest of the control flow graph,
5704taking the @samp{__builtin_expect} info into account. The interactions
5705between the heuristics and @samp{__builtin_expect} can be complex, and in
5706some cases, it may be useful to disable the heuristics so that the effects
5707of @samp{__builtin_expect} are easier to understand.
454d0cc7 5708
38df970e
JQ
5709The default is @option{-fguess-branch-probability} at levels
5710@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5711
194734e9
JH
5712@item -freorder-blocks
5713@opindex freorder-blocks
5714Reorder basic blocks in the compiled function in order to reduce number of
5715taken branches and improve code locality.
5716
3f8b659d 5717Enabled at levels @option{-O2}, @option{-O3}.
38df970e 5718
750054a2
CT
5719@item -freorder-blocks-and-partition
5720@opindex freorder-blocks-and-partition
5721In addition to reordering basic blocks in the compiled function, in order
5722to reduce number of taken branches, partitions hot and cold basic blocks
5723into separate sections of the assembly and .o files, to improve
5724paging and cache locality performance.
5725
8e8d5162
CT
5726This optimization is automatically turned off in the presence of
5727exception handling, for linkonce sections, for functions with a user-defined
5728section attribute and on any architecture that does not support named
5729sections.
5730
194734e9
JH
5731@item -freorder-functions
5732@opindex freorder-functions
3e8cb558
JM
5733Reorder functions in the object file in order to
5734improve code locality. This is implemented by using special
3a4bdd05
RH
5735subsections @code{.text.hot} for most frequently executed functions and
5736@code{.text.unlikely} for unlikely executed functions. Reordering is done by
194734e9 5737the linker so object file format must support named sections and linker must
3364c33b 5738place them in a reasonable way.
194734e9
JH
5739
5740Also profile feedback must be available in to make this option effective. See
5741@option{-fprofile-arcs} for details.
5742
38df970e
JQ
5743Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
5744
41472af8 5745@item -fstrict-aliasing
cd3bb277 5746@opindex fstrict-aliasing
41472af8
MM
5747Allows the compiler to assume the strictest aliasing rules applicable to
5748the language being compiled. For C (and C++), this activates
5749optimizations based on the type of expressions. In particular, an
5750object of one type is assumed never to reside at the same address as an
5751object of a different type, unless the types are almost the same. For
5752example, an @code{unsigned int} can alias an @code{int}, but not a
5753@code{void*} or a @code{double}. A character type may alias any other
02f52e19 5754type.
41472af8
MM
5755
5756Pay special attention to code like this:
3ab51846 5757@smallexample
02f52e19 5758union a_union @{
41472af8
MM
5759 int i;
5760 double d;
5761@};
5762
5763int f() @{
5764 a_union t;
5765 t.d = 3.0;
5766 return t.i;
5767@}
3ab51846 5768@end smallexample
41472af8
MM
5769The practice of reading from a different union member than the one most
5770recently written to (called ``type-punning'') is common. Even with
630d3d5a 5771@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
41472af8
MM
5772is accessed through the union type. So, the code above will work as
5773expected. However, this code might not:
3ab51846 5774@smallexample
02f52e19 5775int f() @{
41472af8
MM
5776 a_union t;
5777 int* ip;
5778 t.d = 3.0;
5779 ip = &t.i;
5780 return *ip;
5781@}
3ab51846 5782@end smallexample
41472af8 5783
38df970e 5784Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
852b81bb 5785
eeef0e45
ILT
5786@item -fstrict-overflow
5787@opindex fstrict-overflow
5788Allow the compiler to assume strict signed overflow rules, depending
5789on the language being compiled. For C (and C++) this means that
5790overflow when doing arithmetic with signed numbers is undefined, which
5791means that the compiler may assume that it will not happen. This
5792permits various optimizations. For example, the compiler will assume
5793that an expression like @code{i + 10 > i} will always be true for
5794signed @code{i}. This assumption is only valid if signed overflow is
5795undefined, as the expression is false if @code{i + 10} overflows when
5796using twos complement arithmetic. When this option is in effect any
5797attempt to determine whether an operation on signed numbers will
5798overflow must be written carefully to not actually involve overflow.
5799
5800See also the @option{-fwrapv} option. Using @option{-fwrapv} means
5801that signed overflow is fully defined: it wraps. When
5802@option{-fwrapv} is used, there is no difference between
5803@option{-fstrict-overflow} and @option{-fno-strict-overflow}. With
5804@option{-fwrapv} certain types of overflow are permitted. For
5805example, if the compiler gets an overflow when doing arithmetic on
5806constants, the overflowed value can still be used with
5807@option{-fwrapv}, but not otherwise.
5808
5809The @option{-fstrict-overflow} option is enabled at levels
5810@option{-O2}, @option{-O3}, @option{-Os}.
5811
efa3896a
GK
5812@item -falign-functions
5813@itemx -falign-functions=@var{n}
cd3bb277 5814@opindex falign-functions
efa3896a
GK
5815Align the start of functions to the next power-of-two greater than
5816@var{n}, skipping up to @var{n} bytes. For instance,
630d3d5a
JM
5817@option{-falign-functions=32} aligns functions to the next 32-byte
5818boundary, but @option{-falign-functions=24} would align to the next
efa3896a
GK
581932-byte boundary only if this can be done by skipping 23 bytes or less.
5820
630d3d5a 5821@option{-fno-align-functions} and @option{-falign-functions=1} are
efa3896a
GK
5822equivalent and mean that functions will not be aligned.
5823
5824Some assemblers only support this flag when @var{n} is a power of two;
5825in that case, it is rounded up.
5826
561913cb 5827If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 5828
38df970e
JQ
5829Enabled at levels @option{-O2}, @option{-O3}.
5830
efa3896a
GK
5831@item -falign-labels
5832@itemx -falign-labels=@var{n}
cd3bb277 5833@opindex falign-labels
efa3896a 5834Align all branch targets to a power-of-two boundary, skipping up to
630d3d5a 5835@var{n} bytes like @option{-falign-functions}. This option can easily
efa3896a
GK
5836make code slower, because it must insert dummy operations for when the
5837branch target is reached in the usual flow of the code.
5838
561913cb
AP
5839@option{-fno-align-labels} and @option{-falign-labels=1} are
5840equivalent and mean that labels will not be aligned.
5841
630d3d5a 5842If @option{-falign-loops} or @option{-falign-jumps} are applicable and
efa3896a
GK
5843are greater than this value, then their values are used instead.
5844
561913cb
AP
5845If @var{n} is not specified or is zero, use a machine-dependent default
5846which is very likely to be @samp{1}, meaning no alignment.
efa3896a 5847
38df970e
JQ
5848Enabled at levels @option{-O2}, @option{-O3}.
5849
efa3896a
GK
5850@item -falign-loops
5851@itemx -falign-loops=@var{n}
cd3bb277 5852@opindex falign-loops
efa3896a 5853Align loops to a power-of-two boundary, skipping up to @var{n} bytes
630d3d5a 5854like @option{-falign-functions}. The hope is that the loop will be
efa3896a
GK
5855executed many times, which will make up for any execution of the dummy
5856operations.
5857
561913cb
AP
5858@option{-fno-align-loops} and @option{-falign-loops=1} are
5859equivalent and mean that loops will not be aligned.
5860
5861If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 5862
38df970e
JQ
5863Enabled at levels @option{-O2}, @option{-O3}.
5864
efa3896a
GK
5865@item -falign-jumps
5866@itemx -falign-jumps=@var{n}
cd3bb277 5867@opindex falign-jumps
efa3896a
GK
5868Align branch targets to a power-of-two boundary, for branch targets
5869where the targets can only be reached by jumping, skipping up to @var{n}
630d3d5a 5870bytes like @option{-falign-functions}. In this case, no dummy operations
efa3896a
GK
5871need be executed.
5872
561913cb
AP
5873@option{-fno-align-jumps} and @option{-falign-jumps=1} are
5874equivalent and mean that loops will not be aligned.
5875
5876If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 5877
38df970e
JQ
5878Enabled at levels @option{-O2}, @option{-O3}.
5879
7797ff53
PB
5880@item -funit-at-a-time
5881@opindex funit-at-a-time
5882Parse the whole compilation unit before starting to produce code.
5883This allows some extra optimizations to take place but consumes
5884more memory (in general). There are some compatibility issues
474eccc6 5885with @emph{unit-at-a-time} mode:
7797ff53
PB
5886@itemize @bullet
5887@item
5888enabling @emph{unit-at-a-time} mode may change the order
5889in which functions, variables, and top-level @code{asm} statements
5890are emitted, and will likely break code relying on some particular
5891ordering. The majority of such top-level @code{asm} statements,
474eccc6
ILT
5892though, can be replaced by @code{section} attributes. The
5893@option{fno-toplevel-reorder} option may be used to keep the ordering
5894used in the input file, at the cost of some optimizations.
7797ff53
PB
5895
5896@item
5897@emph{unit-at-a-time} mode removes unreferenced static variables
60d436c9 5898and functions. This may result in undefined references
7797ff53
PB
5899when an @code{asm} statement refers directly to variables or functions
5900that are otherwise unused. In that case either the variable/function
5901shall be listed as an operand of the @code{asm} statement operand or,
5902in the case of top-level @code{asm} statements the attribute @code{used}
5903shall be used on the declaration.
5904
5905@item
5906Static functions now can use non-standard passing conventions that
8a36672b 5907may break @code{asm} statements calling functions directly. Again,
7797ff53
PB
5908attribute @code{used} will prevent this behavior.
5909@end itemize
5910
5911As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
8a36672b 5912but this scheme may not be supported by future releases of GCC@.
7797ff53 5913
c539d463 5914Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
7797ff53 5915
474eccc6
ILT
5916@item -fno-toplevel-reorder
5917Do not reorder top-level functions, variables, and @code{asm}
5918statements. Output them in the same order that they appear in the
5919input file. When this option is used, unreferenced static variables
5920will not be removed. This option is intended to support existing code
5921which relies on a particular ordering. For new code, it is better to
5922use attributes.
5923
7260e9a0
JH
5924@item -fweb
5925@opindex fweb
5926Constructs webs as commonly used for register allocation purposes and assign
962e6e00 5927each web individual pseudo register. This allows the register allocation pass
7260e9a0
JH
5928to operate on pseudos directly, but also strengthens several other optimization
5929passes, such as CSE, loop optimizer and trivial dead code remover. It can,
5930however, make debugging impossible, since variables will no longer stay in a
5931``home register''.
5932
7869fe47 5933Enabled by default with @option{-funroll-loops}.
d4463dfc 5934
ce91e74c
JH
5935@item -fwhole-program
5936@opindex fwhole-program
5937Assume that the current compilation unit represents whole program being
5938compiled. All public functions and variables with the exception of @code{main}
f341de7b
KH
5939and those merged by attribute @code{externally_visible} become static functions
5940and in a affect gets more aggressively optimized by interprocedural optimizers.
ce91e74c 5941While this option is equivalent to proper use of @code{static} keyword for
f341de7b 5942programs consisting of single file, in combination with option
ce91e74c
JH
5943@option{--combine} this flag can be used to compile most of smaller scale C
5944programs since the functions and variables become local for the whole combined
5945compilation unit, not for the single source file itself.
5946
5947
d4463dfc
JQ
5948@item -fno-cprop-registers
5949@opindex fno-cprop-registers
5950After register allocation and post-register allocation instruction splitting,
5951we perform a copy-propagation pass to try to reduce scheduling dependencies
5952and occasionally eliminate the copy.
5953
5954Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
5955
a8a5f53a
JH
5956@item -fprofile-generate
5957@opindex fprofile-generate
a8a5f53a 5958
33adcb6c
MM
5959Enable options usually used for instrumenting application to produce
5960profile useful for later recompilation with profile feedback based
4ec7afd7 5961optimization. You must use @option{-fprofile-generate} both when
33adcb6c
MM
5962compiling and when linking your program.
5963
5964The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
a8a5f53a
JH
5965
5966@item -fprofile-use
5967@opindex fprofile-use
5968Enable profile feedback directed optimizations, and optimizations
5969generally profitable only with profile feedback available.
5970
8a76829c 5971The following options are enabled: @code{-fbranch-probabilities}, @code{-fvpt},
37818e7c 5972@code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}
a8a5f53a 5973
16c1c158
RG
5974By default, GCC emits an error message if the feedback profiles do not
5975match the source code. This error can be turned into a warning by using
5976@option{-Wcoverage-mismatch}. Note this may result in poorly optimized
5977code.
d4463dfc
JQ
5978@end table
5979
5980The following options control compiler behavior regarding floating
5981point arithmetic. These options trade off between speed and
5982correctness. All must be specifically enabled.
5983
5984@table @gcctabopt
5985@item -ffloat-store
5986@opindex ffloat-store
5987Do not store floating point variables in registers, and inhibit other
5988options that might change whether a floating point value is taken from a
5989register or memory.
5990
5991@cindex floating point precision
5992This option prevents undesirable excess precision on machines such as
5993the 68000 where the floating registers (of the 68881) keep more
5994precision than a @code{double} is supposed to have. Similarly for the
5995x86 architecture. For most programs, the excess precision does only
5996good, but a few programs rely on the precise definition of IEEE floating
5997point. Use @option{-ffloat-store} for such programs, after modifying
5998them to store all pertinent intermediate computations into variables.
5999
6000@item -ffast-math
6001@opindex ffast-math
6002Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
039c3d42 6003@option{-fno-trapping-math}, @option{-ffinite-math-only},
db02da79
RS
6004@option{-fno-rounding-math}, @option{-fno-signaling-nans},
6005@option{-fno-signed-zeros} and @option{fcx-limited-range}.
d4463dfc
JQ
6006
6007This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
6008
c9516c38 6009This option is not turned on by any @option{-O} option since
d4463dfc
JQ
6010it can result in incorrect output for programs which depend on
6011an exact implementation of IEEE or ISO rules/specifications for
c9516c38
WB
6012math functions. It may, however, yield faster code for programs
6013that do not require the guarantees of these specifications.
d4463dfc
JQ
6014
6015@item -fno-math-errno
6016@opindex fno-math-errno
6017Do not set ERRNO after calling math functions that are executed
6018with a single instruction, e.g., sqrt. A program that relies on
6019IEEE exceptions for math error handling may want to use this flag
6020for speed while maintaining IEEE arithmetic compatibility.
6021
c9516c38 6022This option is not turned on by any @option{-O} option since
d4463dfc
JQ
6023it can result in incorrect output for programs which depend on
6024an exact implementation of IEEE or ISO rules/specifications for
c9516c38
WB
6025math functions. It may, however, yield faster code for programs
6026that do not require the guarantees of these specifications.
d4463dfc
JQ
6027
6028The default is @option{-fmath-errno}.
6029
db02da79
RS
6030On Darwin systems, the math library never sets @code{errno}. There is
6031therefore no reason for the compiler to consider the possibility that
6032it might, and @option{-fno-math-errno} is the default.
2e3f0db6 6033
d4463dfc
JQ
6034@item -funsafe-math-optimizations
6035@opindex funsafe-math-optimizations
6036Allow optimizations for floating-point arithmetic that (a) assume
6037that arguments and results are valid and (b) may violate IEEE or
6038ANSI standards. When used at link-time, it may include libraries
6039or startup files that change the default FPU control word or other
6040similar optimizations.
6041
c9516c38 6042This option is not turned on by any @option{-O} option since
d4463dfc
JQ
6043it can result in incorrect output for programs which depend on
6044an exact implementation of IEEE or ISO rules/specifications for
c9516c38
WB
6045math functions. It may, however, yield faster code for programs
6046that do not require the guarantees of these specifications.
d4463dfc
JQ
6047
6048The default is @option{-fno-unsafe-math-optimizations}.
6049
6050@item -ffinite-math-only
6051@opindex ffinite-math-only
6052Allow optimizations for floating-point arithmetic that assume
6053that arguments and results are not NaNs or +-Infs.
6054
c9516c38 6055This option is not turned on by any @option{-O} option since
d4463dfc 6056it can result in incorrect output for programs which depend on
c9516c38
WB
6057an exact implementation of IEEE or ISO rules/specifications for
6058math functions. It may, however, yield faster code for programs
6059that do not require the guarantees of these specifications.
d4463dfc
JQ
6060
6061The default is @option{-fno-finite-math-only}.
6062
db02da79
RS
6063@item -fno-signed-zeros
6064@opindex fno-signed-zeros
6065Allow optimizations for floating point arithmetic that ignore the
6066signedness of zero. IEEE arithmetic specifies the behavior of
78681dbd
RS
6067distinct +0.0 and @minus{}0.0 values, which then prohibits simplification
6068of expressions such as x+0.0 or 0.0*x (even with @option{-ffinite-math-only}).
db02da79
RS
6069This option implies that the sign of a zero result isn't significant.
6070
6071The default is @option{-fsigned-zeros}.
6072
d4463dfc
JQ
6073@item -fno-trapping-math
6074@opindex fno-trapping-math
6075Compile code assuming that floating-point operations cannot generate
6076user-visible traps. These traps include division by zero, overflow,
6077underflow, inexact result and invalid operation. This option implies
6078@option{-fno-signaling-nans}. Setting this option may allow faster
6079code if one relies on ``non-stop'' IEEE arithmetic, for example.
6080
6081This option should never be turned on by any @option{-O} option since
6082it can result in incorrect output for programs which depend on
6083an exact implementation of IEEE or ISO rules/specifications for
6084math functions.
6085
6086The default is @option{-ftrapping-math}.
6087
039c3d42
RS
6088@item -frounding-math
6089@opindex frounding-math
6090Disable transformations and optimizations that assume default floating
6091point rounding behavior. This is round-to-zero for all floating point
6092to integer conversions, and round-to-nearest for all other arithmetic
6093truncations. This option should be specified for programs that change
6094the FP rounding mode dynamically, or that may be executed with a
6095non-default rounding mode. This option disables constant folding of
6096floating point expressions at compile-time (which may be affected by
6097rounding mode) and arithmetic transformations that are unsafe in the
6098presence of sign-dependent rounding modes.
6099
6100The default is @option{-fno-rounding-math}.
6101
6102This option is experimental and does not currently guarantee to
6103disable all GCC optimizations that are affected by rounding mode.
2dd76960 6104Future versions of GCC may provide finer control of this setting
039c3d42
RS
6105using C99's @code{FENV_ACCESS} pragma. This command line option
6106will be used to specify the default state for @code{FENV_ACCESS}.
6107
38109dab
GL
6108@item -frtl-abstract-sequences
6109@opindex frtl-abstract-sequences
6110It is a size optimization method. This option is to find identical
6111sequences of code, which can be turned into pseudo-procedures and
6112then replace all occurrences with calls to the newly created
6113subroutine. It is kind of an opposite of @option{-finline-functions}.
6114This optimization runs at RTL level.
6115
d4463dfc
JQ
6116@item -fsignaling-nans
6117@opindex fsignaling-nans
6118Compile code assuming that IEEE signaling NaNs may generate user-visible
6119traps during floating-point operations. Setting this option disables
6120optimizations that may change the number of exceptions visible with
6121signaling NaNs. This option implies @option{-ftrapping-math}.
6122
6123This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
6124be defined.
6125
6126The default is @option{-fno-signaling-nans}.
6127
6128This option is experimental and does not currently guarantee to
6129disable all GCC optimizations that affect signaling NaN behavior.
6130
6131@item -fsingle-precision-constant
6132@opindex fsingle-precision-constant
6133Treat floating point constant as single precision constant instead of
6134implicitly converting it to double precision constant.
6135
c7463669
RH
6136@item -fcx-limited-range
6137@itemx -fno-cx-limited-range
6138@opindex fcx-limited-range
6139@opindex fno-cx-limited-range
6140When enabled, this option states that a range reduction step is not
6141needed when performing complex division. The default is
6142@option{-fno-cx-limited-range}, but is enabled by @option{-ffast-math}.
6143
cb7ad97b 6144This option controls the default setting of the ISO C99
c7463669
RH
6145@code{CX_LIMITED_RANGE} pragma. Nevertheless, the option applies to
6146all languages.
d4463dfc
JQ
6147
6148@end table
6149
6150The following options control optimizations that may improve
6151performance, but are not enabled by any @option{-O} options. This
6152section includes experimental options that may produce broken code.
6153
6154@table @gcctabopt
6155@item -fbranch-probabilities
6156@opindex fbranch-probabilities
6157After running a program compiled with @option{-fprofile-arcs}
6158(@pxref{Debugging Options,, Options for Debugging Your Program or
6159@command{gcc}}), you can compile it a second time using
6160@option{-fbranch-probabilities}, to improve optimizations based on
6161the number of times each branch was taken. When the program
6162compiled with @option{-fprofile-arcs} exits it saves arc execution
a4878735 6163counts to a file called @file{@var{sourcename}.gcda} for each source
bbd29fdc 6164file. The information in this data file is very dependent on the
d4463dfc
JQ
6165structure of the generated code, so you must use the same source code
6166and the same optimization options for both compilations.
6167
daf2f129 6168With @option{-fbranch-probabilities}, GCC puts a
d4463dfc
JQ
6169@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
6170These can be used to improve optimization. Currently, they are only
6171used in one place: in @file{reorg.c}, instead of guessing which path a
6172branch is mostly to take, the @samp{REG_BR_PROB} values are used to
6173exactly determine which path is taken more often.
6174
fc5eb4a1
ZD
6175@item -fprofile-values
6176@opindex fprofile-values
6177If combined with @option{-fprofile-arcs}, it adds code so that some
6178data about values of expressions in the program is gathered.
6179
6e885ee3
ZD
6180With @option{-fbranch-probabilities}, it reads back the data gathered
6181from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
6182notes to instructions for their later usage in optimizations.
6183
7797ff53 6184Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8d3b3fb7 6185
fca9dc00
ZD
6186@item -fvpt
6187@opindex fvpt
6188If combined with @option{-fprofile-arcs}, it instructs the compiler to add
6189a code to gather information about values of expressions.
6190
6191With @option{-fbranch-probabilities}, it reads back the data gathered
6192and actually performs the optimizations based on them.
6193Currently the optimizations include specialization of division operation
6194using the knowledge about the value of the denominator.
6195
a7b1dc36
PB
6196@item -frename-registers
6197@opindex frename-registers
6198Attempt to avoid false dependencies in scheduled code by making use
6199of registers left over after register allocation. This optimization
6200will most benefit processors with lots of registers. Depending on the
6201debug information format adopted by the target, however, it can
6202make debugging impossible, since variables will no longer stay in
6203a ``home register''.
6204
7869fe47 6205Enabled by default with @option{-funroll-loops}.
a7b1dc36 6206
d4463dfc
JQ
6207@item -ftracer
6208@opindex ftracer
8a36672b 6209Perform tail duplication to enlarge superblock size. This transformation
d4463dfc
JQ
6210simplifies the control flow of the function allowing other optimizations to do
6211better job.
6212
7797ff53 6213Enabled with @option{-fprofile-use}.
8d3b3fb7 6214
d4463dfc
JQ
6215@item -funroll-loops
6216@opindex funroll-loops
b17d5d7c
ZD
6217Unroll loops whose number of iterations can be determined at compile time or
6218upon entry to the loop. @option{-funroll-loops} implies
cb7ad97b 6219@option{-frerun-cse-after-loop}, @option{-fweb} and @option{-frename-registers}.
7869fe47
ZD
6220It also turns on complete loop peeling (i.e.@: complete removal of loops with
6221small constant number of iterations). This option makes code larger, and may
6222or may not make it run faster.
d4463dfc 6223
7797ff53 6224Enabled with @option{-fprofile-use}.
8d3b3fb7 6225
d4463dfc
JQ
6226@item -funroll-all-loops
6227@opindex funroll-all-loops
6228Unroll all loops, even if their number of iterations is uncertain when
6229the loop is entered. This usually makes programs run more slowly.
6230@option{-funroll-all-loops} implies the same options as
b17d5d7c
ZD
6231@option{-funroll-loops}.
6232
6233@item -fpeel-loops
6234@opindex fpeel-loops
6235Peels the loops for that there is enough information that they do not
6236roll much (from profile feedback). It also turns on complete loop peeling
431ae0bf 6237(i.e.@: complete removal of loops with small constant number of iterations).
b17d5d7c 6238
7797ff53 6239Enabled with @option{-fprofile-use}.
8d3b3fb7 6240
5e962776
ZD
6241@item -fmove-loop-invariants
6242@opindex fmove-loop-invariants
37818e7c 6243Enables the loop invariant motion pass in the RTL loop optimizer. Enabled
5e962776
ZD
6244at level @option{-O1}
6245
b17d5d7c
ZD
6246@item -funswitch-loops
6247@opindex funswitch-loops
6248Move branches with loop invariant conditions out of the loop, with duplicates
6249of the loop on both branches (modified according to result of the condition).
6250
d4463dfc
JQ
6251@item -ffunction-sections
6252@itemx -fdata-sections
6253@opindex ffunction-sections
6254@opindex fdata-sections
6255Place each function or data item into its own section in the output
6256file if the target supports arbitrary sections. The name of the
6257function or the name of the data item determines the section's name
6258in the output file.
6259
6260Use these options on systems where the linker can perform optimizations
f401d0f5
JDA
6261to improve locality of reference in the instruction space. Most systems
6262using the ELF object format and SPARC processors running Solaris 2 have
6263linkers with such optimizations. AIX may have these optimizations in
6264the future.
d4463dfc
JQ
6265
6266Only use these options when there are significant benefits from doing
6267so. When you specify these options, the assembler and linker will
6268create larger object and executable files and will also be slower.
6269You will not be able to use @code{gprof} on all systems if you
6270specify this option and you may have problems with debugging if
6271you specify both this option and @option{-g}.
6272
fe3ad572
SC
6273@item -fbranch-target-load-optimize
6274@opindex fbranch-target-load-optimize
6275Perform branch target register load optimization before prologue / epilogue
6276threading.
6277The use of target registers can typically be exposed only during reload,
6278thus hoisting loads out of loops and doing inter-block scheduling needs
6279a separate optimization pass.
6280
6281@item -fbranch-target-load-optimize2
6282@opindex fbranch-target-load-optimize2
6283Perform branch target register load optimization after prologue / epilogue
6284threading.
6285
1194fc79
R
6286@item -fbtr-bb-exclusive
6287@opindex fbtr-bb-exclusive
8d3b3fb7 6288When performing branch target register load optimization, don't reuse
1194fc79
R
6289branch target registers in within any basic block.
6290
0aca9021
JW
6291@item -fstack-protector
6292Emit extra code to check for buffer overflows, such as stack smashing
6293attacks. This is done by adding a guard variable to functions with
6294vulnerable objects. This includes functions that call alloca, and
6295functions with buffers larger than 8 bytes. The guards are initialized
6296when a function is entered and then checked when the function exits.
6297If a guard check fails, an error message is printed and the program exits.
6298
6299@item -fstack-protector-all
6300Like @option{-fstack-protector} except that all functions are protected.
6301
aacd3885
RS
6302@item -fsection-anchors
6303@opindex fsection-anchors
6304Try to reduce the number of symbolic address calculations by using
6305shared ``anchor'' symbols to address nearby objects. This transformation
6306can help to reduce the number of GOT entries and GOT accesses on some
6307targets.
6308
6309For example, the implementation of the following function @code{foo}:
6310
6311@smallexample
6312static int a, b, c;
6313int foo (void) @{ return a + b + c; @}
6314@end smallexample
6315
6316would usually calculate the addresses of all three variables, but if you
6317compile it with @option{-fsection-anchors}, it will access the variables
6318from a common anchor point instead. The effect is similar to the
6319following pseudocode (which isn't valid C):
6320
6321@smallexample
6322int foo (void)
6323@{
6324 register int *xr = &x;
6325 return xr[&a - &x] + xr[&b - &x] + xr[&c - &x];
6326@}
6327@end smallexample
6328
6329Not all targets support this option.
6330
3af64fd6 6331@item --param @var{name}=@var{value}
cd3bb277 6332@opindex param
3af64fd6
MM
6333In some places, GCC uses various constants to control the amount of
6334optimization that is done. For example, GCC will not inline functions
6335that contain more that a certain number of instructions. You can
6336control some of these constants on the command-line using the
630d3d5a 6337@option{--param} option.
3af64fd6 6338
b00567b0
ILT
6339The names of specific parameters, and the meaning of the values, are
6340tied to the internals of the compiler, and are subject to change
6341without notice in future releases.
6342
4fe9b91c 6343In each case, the @var{value} is an integer. The allowable choices for
3af64fd6
MM
6344@var{name} are given in the following table:
6345
6346@table @gcctabopt
31617ef1
DB
6347@item salias-max-implicit-fields
6348The maximum number of fields in a variable without direct
cb7ad97b 6349structure accesses for which structure aliasing will consider trying
31617ef1
DB
6350to track each field. The default is 5
6351
a916f21d
RG
6352@item salias-max-array-elements
6353The maximum number of elements an array can have and its elements
6354still be tracked individually by structure aliasing. The default is 4
6355
61b58001
BE
6356@item sra-max-structure-size
6357The maximum structure size, in bytes, at which the scalar replacement
6358of aggregates (SRA) optimization will perform block copies. The
6359default value, 0, implies that GCC will select the most appropriate
6360size itself.
6361
6362@item sra-field-structure-ratio
1c170b5e 6363The threshold ratio (as a percentage) between instantiated fields and
61b58001
BE
6364the complete structure size. We say that if the ratio of the number
6365of bytes in instantiated fields to the number of bytes in the complete
6366structure exceeds this parameter, then block copies are not used. The
6367default is 75.
6368
5f24e0dc
RH
6369@item max-crossjump-edges
6370The maximum number of incoming edges to consider for crossjumping.
d203738b 6371The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5f24e0dc
RH
6372the number of edges incoming to each block. Increasing values mean
6373more aggressive optimization, making the compile time increase with
6374probably small improvement in executable size.
6375
12183e0f
PH
6376@item min-crossjump-insns
6377The minimum number of instructions which must be matched at the end
6378of two blocks before crossjumping will be performed on them. This
6379value is ignored in the case where all instructions in the block being
6380crossjumped from are matched. The default value is 5.
6381
f935b9e0
DE
6382@item max-grow-copy-bb-insns
6383The maximum code size expansion factor when copying basic blocks
6384instead of jumping. The expansion is relative to a jump instruction.
6385The default value is 8.
6386
bbcb0c05
SB
6387@item max-goto-duplication-insns
6388The maximum number of instructions to duplicate to a block that jumps
6389to a computed goto. To avoid @math{O(N^2)} behavior in a number of
6390passes, GCC factors computed gotos early in the compilation process,
6391and unfactors them as late as possible. Only computed jumps at the
6392end of a basic blocks with no more than max-goto-duplication-insns are
6393unfactored. The default value is 8.
6394
1c4c47db
JO
6395@item max-delay-slot-insn-search
6396The maximum number of instructions to consider when looking for an
6397instruction to fill a delay slot. If more than this arbitrary number of
6398instructions is searched, the time savings from filling the delay slot
6399will be minimal so stop searching. Increasing values mean more
6400aggressive optimization, making the compile time increase with probably
6401small improvement in executable run time.
6402
6403@item max-delay-slot-live-search
6404When trying to fill delay slots, the maximum number of instructions to
6405consider when searching for a block with valid live register
6406information. Increasing this arbitrarily chosen value means more
6407aggressive optimization, increasing the compile time. This parameter
6408should be removed when the delay slot code is rewritten to maintain the
6409control-flow graph.
33d3b05b
MM
6410
6411@item max-gcse-memory
6412The approximate maximum amount of memory that will be allocated in
6413order to perform the global common subexpression elimination
6414optimization. If more memory than specified is required, the
6415optimization will not be done.
3af64fd6 6416
740f35a0 6417@item max-gcse-passes
8d3b3fb7 6418The maximum number of passes of GCSE to run. The default is 1.
740f35a0 6419
4a121cc3 6420@item max-pending-list-length
0c688a7d 6421The maximum number of pending dependencies scheduling will allow
4a121cc3
AM
6422before flushing the current state and starting over. Large functions
6423with few branches or calls can create excessively large lists which
6424needlessly consume memory and resources.
6425
bc522472
KG
6426@item max-inline-insns-single
6427Several parameters control the tree inliner used in gcc.
2dd76960 6428This number sets the maximum number of instructions (counted in GCC's
daf2f129 6429internal representation) in a single function that the tree inliner
bc522472
KG
6430will consider for inlining. This only affects functions declared
6431inline and methods implemented in a class declaration (C++).
e5c4f28a 6432The default value is 450.
bc522472
KG
6433
6434@item max-inline-insns-auto
6435When you use @option{-finline-functions} (included in @option{-O3}),
6436a lot of functions that would otherwise not be considered for inlining
6437by the compiler will be investigated. To those functions, a different
6438(more restrictive) limit compared to functions declared inline can
6439be applied.
e5c4f28a 6440The default value is 90.
bc522472 6441
b58b1157 6442@item large-function-insns
74515a0a
RG
6443The limit specifying really large functions. For functions larger than this
6444limit after inlining inlining is constrained by
6445@option{--param large-function-growth}. This parameter is useful primarily
6446to avoid extreme compilation time caused by non-linear algorithms used by the
6447backend.
b58b1157 6448This parameter is ignored when @option{-funit-at-a-time} is not used.
e5c4f28a 6449The default value is 2700.
b58b1157
JH
6450
6451@item large-function-growth
e53e0c56 6452Specifies maximal growth of large function caused by inlining in percents.
b58b1157 6453This parameter is ignored when @option{-funit-at-a-time} is not used.
74515a0a
RG
6454The default value is 100 which limits large function growth to 2.0 times
6455the original size.
b58b1157 6456
b4f32d07
JH
6457@item large-unit-insns
6458The limit specifying large translation unit. Growth caused by inlining of
6459units larger than this limit is limited by @option{--param inline-unit-growth}.
6460For small units this might be too tight (consider unit consisting of function A
6461that is inline and B that just calls A three time. If B is small relative to
6462A, the growth of unit is 300\% and yet such inlining is very sane. For very
6463large units consisting of small inlininable functions however the overall unit
6464growth limit is needed to avoid exponential explosion of code size. Thus for
6465smaller units, the size is increased to @option{--param large-unit-insns}
6416ae7f 6466before applying @option{--param inline-unit-growth}. The default is 10000
b4f32d07 6467
b58b1157
JH
6468@item inline-unit-growth
6469Specifies maximal overall growth of the compilation unit caused by inlining.
6470This parameter is ignored when @option{-funit-at-a-time} is not used.
d562c668 6471The default value is 30 which limits unit growth to 1.3 times the original
74515a0a 6472size.
b58b1157 6473
ff28a94d
JH
6474@item large-stack-frame
6475The limit specifying large stack frames. While inlining the algorithm is trying
6476to not grow past this limit too much. Default value is 256 bytes.
6477
6478@item large-stack-frame-growth
6479Specifies maximal growth of large stack frames caused by inlining in percents.
6480The default value is 1000 which limits large stack frame growth to 11 times
6481the original size.
6482
6de9cd9a
DN
6483@item max-inline-insns-recursive
6484@itemx max-inline-insns-recursive-auto
6485Specifies maximum number of instructions out-of-line copy of self recursive inline
6486function can grow into by performing recursive inlining.
6487
6488For functions declared inline @option{--param max-inline-insns-recursive} is
37470119 6489taken into account. For function not declared inline, recursive inlining
6de9cd9a
DN
6490happens only when @option{-finline-functions} (included in @option{-O3}) is
6491enabled and @option{--param max-inline-insns-recursive-auto} is used. The
e5c4f28a 6492default value is 450.
6de9cd9a
DN
6493
6494@item max-inline-recursive-depth
6495@itemx max-inline-recursive-depth-auto
6496Specifies maximum recursion depth used by the recursive inlining.
6497
6498For functions declared inline @option{--param max-inline-recursive-depth} is
37470119 6499taken into account. For function not declared inline, recursive inlining
6de9cd9a
DN
6500happens only when @option{-finline-functions} (included in @option{-O3}) is
6501enabled and @option{--param max-inline-recursive-depth-auto} is used. The
e5c4f28a
RG
6502default value is 450.
6503
c5a4444c
JH
6504@item min-inline-recursive-probability
6505Recursive inlining is profitable only for function having deep recursion
6506in average and can hurt for function having little recursion depth by
6507increasing the prologue size or complexity of function body to other
6508optimizers.
6509
6510When profile feedback is available (see @option{-fprofile-generate}) the actual
6511recursion depth can be guessed from probability that function will recurse via
6512given call expression. This parameter limits inlining only to call expression
6513whose probability exceeds given threshold (in percents). The default value is
651410.
6515
e5c4f28a
RG
6516@item inline-call-cost
6517Specify cost of call instruction relative to simple arithmetics operations
2e0ea515
KH
6518(having cost of 1). Increasing this cost disqualifies inlining of non-leaf
6519functions and at the same time increases size of leaf function that is believed to
6520reduce function size by being inlined. In effect it increases amount of
e5c4f28a 6521inlining for code having large abstraction penalty (many functions that just
2e0ea515
KH
6522pass the arguments to other functions) and decrease inlining for code with low
6523abstraction penalty. The default value is 16.
6de9cd9a 6524
acdc40df 6525@item min-vect-loop-bound
cb7ad97b
EC
6526The minimum number of iterations under which a loop will not get vectorized
6527when @option{-ftree-vectorize} is used. The number of iterations after
acdc40df
DN
6528vectorization needs to be greater than the value specified by this option
6529to allow vectorization. The default value is 0.
6530
03e9dbc9
MM
6531@item max-unrolled-insns
6532The maximum number of instructions that a loop should have if that loop
6533is unrolled, and if the loop is unrolled, it determines how many times
6534the loop code is unrolled.
6535
b17d5d7c
ZD
6536@item max-average-unrolled-insns
6537The maximum number of instructions biased by probabilities of their execution
6538that a loop should have if that loop is unrolled, and if the loop is unrolled,
6539it determines how many times the loop code is unrolled.
6540
6541@item max-unroll-times
6542The maximum number of unrollings of a single loop.
6543
6544@item max-peeled-insns
6545The maximum number of instructions that a loop should have if that loop
6546is peeled, and if the loop is peeled, it determines how many times
6547the loop code is peeled.
6548
6549@item max-peel-times
6550The maximum number of peelings of a single loop.
6551
6552@item max-completely-peeled-insns
6553The maximum number of insns of a completely peeled loop.
6554
6555@item max-completely-peel-times
6556The maximum number of iterations of a loop to be suitable for complete peeling.
6557
01a132bb
ZD
6558@item max-unswitch-insns
6559The maximum number of insns of an unswitched loop.
6560
6561@item max-unswitch-level
6562The maximum number of branches unswitched in a single loop.
6563
a7e5372d
ZD
6564@item lim-expensive
6565The minimum cost of an expensive expression in the loop invariant motion.
6566
8b11a64c
ZD
6567@item iv-consider-all-candidates-bound
6568Bound on number of candidates for induction variables below that
6569all candidates are considered for each use in induction variable
6570optimizations. Only the most relevant candidates are considered
6571if there are more candidates, to avoid quadratic time complexity.
6572
6573@item iv-max-considered-uses
6574The induction variable optimizations give up on loops that contain more
6575induction variable uses.
6576
36f5ada1
ZD
6577@item iv-always-prune-cand-set-bound
6578If number of candidates in the set is smaller than this value,
6579we always try to remove unnecessary ivs from the set during its
6580optimization when a new iv is added to the set.
6581
2412d35c
SP
6582@item scev-max-expr-size
6583Bound on size of expressions used in the scalar evolutions analyzer.
6584Large expressions slow the analyzer.
6585
3d8864c0
SP
6586@item omega-max-vars
6587The maximum number of variables in an Omega constraint system.
6588The default value is 128.
6589
6590@item omega-max-geqs
6591The maximum number of inequalities in an Omega constraint system.
6592The default value is 256.
6593
6594@item omega-max-eqs
6595The maximum number of equalities in an Omega constraint system.
6596The default value is 128.
6597
6598@item omega-max-wild-cards
6599The maximum number of wildcard variables that the Omega solver will
6600be able to insert. The default value is 18.
6601
6602@item omega-hash-table-size
6603The size of the hash table in the Omega solver. The default value is
6604550.
6605
6606@item omega-max-keys
6607The maximal number of keys used by the Omega solver. The default
6608value is 500.
6609
6610@item omega-eliminate-redundant-constraints
6611When set to 1, use expensive methods to eliminate all redundant
6612constraints. The default value is 0.
6613
c12cc930 6614@item vect-max-version-checks
5116a5d2 6615The maximum number of runtime checks that can be performed when doing
c12cc930
KB
6616loop versioning in the vectorizer. See option ftree-vect-loop-version
6617for more information.
6618
e9eb809d
ZD
6619@item max-iterations-to-track
6620
6621The maximum number of iterations of a loop the brute force algorithm
6622for analysis of # of iterations of the loop tries to evaluate.
6623
194734e9
JH
6624@item hot-bb-count-fraction
6625Select fraction of the maximal count of repetitions of basic block in program
6626given basic block needs to have to be considered hot.
6627
6628@item hot-bb-frequency-fraction
6629Select fraction of the maximal frequency of executions of basic block in
6630function given basic block needs to have to be considered hot
5c856b23 6631
95b9a3a5
JH
6632@item max-predicted-iterations
6633The maximum number of loop iterations we predict statically. This is useful
6634in cases where function contain single loop with known bound and other loop
6635with unknown. We predict the known number of iterations correctly, while
c83eecad
KH
6636the unknown number of iterations average to roughly 10. This means that the
6637loop without bounds would appear artificially cold relative to the other one.
95b9a3a5 6638
5c856b23
JH
6639@item tracer-dynamic-coverage
6640@itemx tracer-dynamic-coverage-feedback
6641
3364c33b
JQ
6642This value is used to limit superblock formation once the given percentage of
6643executed instructions is covered. This limits unnecessary code size
6644expansion.
5c856b23
JH
6645
6646The @option{tracer-dynamic-coverage-feedback} is used only when profile
6647feedback is available. The real profiles (as opposed to statically estimated
6648ones) are much less balanced allowing the threshold to be larger value.
6649
6650@item tracer-max-code-growth
6651Stop tail duplication once code growth has reached given percentage. This is
3364c33b 6652rather hokey argument, as most of the duplicates will be eliminated later in
5c856b23
JH
6653cross jumping, so it may be set to much higher values than is the desired code
6654growth.
6655
6656@item tracer-min-branch-ratio
6657
6658Stop reverse growth when the reverse probability of best edge is less than this
6659threshold (in percent).
6660
6661@item tracer-min-branch-ratio
6662@itemx tracer-min-branch-ratio-feedback
6663
6664Stop forward growth if the best edge do have probability lower than this
6665threshold.
6666
3364c33b 6667Similarly to @option{tracer-dynamic-coverage} two values are present, one for
5c856b23
JH
6668compilation for profile feedback and one for compilation without. The value
6669for compilation with profile feedback needs to be more conservative (higher) in
6670order to make tracer effective.
6671
c48ec590
ZD
6672@item max-cse-path-length
6673
8d3b3fb7 6674Maximum number of basic blocks on path that cse considers. The default is 10.
c48ec590 6675
95b9a3a5
JH
6676@item max-cse-insns
6677The maximum instructions CSE process before flushing. The default is 1000.
6678
6de9cd9a
DN
6679@item max-aliased-vops
6680
e9e0aa2c
DN
6681Maximum number of virtual operands per function allowed to represent
6682aliases before triggering the alias partitioning heuristic. Alias
6683partitioning reduces compile times and memory consumption needed for
6684aliasing at the expense of precision loss in alias information. The
6685default value for this parameter is 100 for -O1, 500 for -O2 and 1000
6686for -O3.
6687
6688Notice that if a function contains more memory statements than the
6689value of this parameter, it is not really possible to achieve this
6690reduction. In this case, the compiler will use the number of memory
6691statements as the value for @option{max-aliased-vops}.
6692
6693@item avg-aliased-vops
6694
6695Average number of virtual operands per statement allowed to represent
6696aliases before triggering the alias partitioning heuristic. This
6697works in conjunction with @option{max-aliased-vops}. If a function
6698contains more than @option{max-aliased-vops} virtual operators, then
6699memory symbols will be grouped into memory partitions until either the
6700total number of virtual operators is below @option{max-aliased-vops}
6701or the average number of virtual operators per memory statement is
6702below @option{avg-aliased-vops}. The default value for this parameter
6703is 1 for -O1 and -O2, and 3 for -O3.
6de9cd9a 6704
3788cc17
ZW
6705@item ggc-min-expand
6706
6707GCC uses a garbage collector to manage its own memory allocation. This
6708parameter specifies the minimum percentage by which the garbage
6709collector's heap should be allowed to expand between collections.
6710Tuning this may improve compilation speed; it has no effect on code
6711generation.
6712
9ac121af 6713The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
8a36672b
JM
6714RAM >= 1GB@. If @code{getrlimit} is available, the notion of "RAM" is
6715the smallest of actual RAM and @code{RLIMIT_DATA} or @code{RLIMIT_AS}. If
16226f1e
KG
6716GCC is not able to calculate RAM on a particular platform, the lower
6717bound of 30% is used. Setting this parameter and
737c38d1
GK
6718@option{ggc-min-heapsize} to zero causes a full collection to occur at
6719every opportunity. This is extremely slow, but can be useful for
6720debugging.
3788cc17
ZW
6721
6722@item ggc-min-heapsize
6723
6724Minimum size of the garbage collector's heap before it begins bothering
6725to collect garbage. The first collection occurs after the heap expands
6726by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
6727tuning this may improve compilation speed, and has no effect on code
6728generation.
6729
d37e6b50
GK
6730The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
6731tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
6732with a lower bound of 4096 (four megabytes) and an upper bound of
6733131072 (128 megabytes). If GCC is not able to calculate RAM on a
6734particular platform, the lower bound is used. Setting this parameter
6735very large effectively disables garbage collection. Setting this
6736parameter and @option{ggc-min-expand} to zero causes a full collection
6737to occur at every opportunity.
3788cc17 6738
0bcf8261
JH
6739@item max-reload-search-insns
6740The maximum number of instruction reload should look backward for equivalent
6741register. Increasing values mean more aggressive optimization, making the
6742compile time increase with probably slightly better performance. The default
6743value is 100.
6744
60ee1fe3 6745@item max-cselib-memory-locations
37470119 6746The maximum number of memory locations cselib should take into account.
c65ecebc
JH
6747Increasing values mean more aggressive optimization, making the compile time
6748increase with probably slightly better performance. The default value is 500.
6749
60ee1fe3
JW
6750@item max-flow-memory-locations
6751Similar as @option{max-cselib-memory-locations} but for dataflow liveness.
95b9a3a5
JH
6752The default value is 100.
6753
26f74aa3
JH
6754@item reorder-blocks-duplicate
6755@itemx reorder-blocks-duplicate-feedback
6756
65d2d764 6757Used by basic block reordering pass to decide whether to use unconditional
b222f49a 6758branch or duplicate the code on its destination. Code is duplicated when its
26f74aa3 6759estimated size is smaller than this value multiplied by the estimated size of
65d2d764 6760unconditional jump in the hot spots of the program.
26f74aa3
JH
6761
6762The @option{reorder-block-duplicate-feedback} is used only when profile
6763feedback is available and may be set to higher values than
6764@option{reorder-block-duplicate} since information about the hot spots is more
6765accurate.
f72c6b56 6766
6f8dd94b
EB
6767@item max-sched-ready-insns
6768The maximum number of instructions ready to be issued the scheduler should
6769consider at any given time during the first scheduling pass. Increasing
6770values mean more thorough searches, making the compilation time increase
6771with probably little benefit. The default value is 100.
6772
f72c6b56
DE
6773@item max-sched-region-blocks
6774The maximum number of blocks in a region to be considered for
6775interblock scheduling. The default value is 10.
6776
fbce7685 6777@item max-sched-region-insns
f72c6b56
DE
6778The maximum number of insns in a region to be considered for
6779interblock scheduling. The default value is 100.
31ebd7c8 6780
36968131
PS
6781@item min-spec-prob
6782The minimum probability (in percents) of reaching a source block
6783for interblock speculative scheduling. The default value is 40.
6f48c21a 6784
d08eefb9
MK
6785@item max-sched-extend-regions-iters
6786The maximum number of iterations through CFG to extend regions.
67870 - disable region extension,
6788N - do at most N iterations.
bb83aa4b 6789The default value is 0.
d08eefb9 6790
496d7bb0
MK
6791@item max-sched-insn-conflict-delay
6792The maximum conflict delay for an insn to be considered for speculative motion.
6793The default value is 3.
6794
6795@item sched-spec-prob-cutoff
6796The minimal probability of speculation success (in percents), so that
6797speculative insn will be scheduled.
6798The default value is 40.
6799
49c3b9a8
JJ
6800@item max-last-value-rtl
6801
6802The maximum size measured as number of RTLs that can be recorded in an expression
6803in combiner for a pseudo register as last known value of that register. The default
6804is 10000.
6805
31ebd7c8
NS
6806@item integer-share-limit
6807Small integer constants can use a shared data structure, reducing the
6808compiler's memory usage and increasing its speed. This sets the maximum
6809value of a shared integer constant's. The default value is 256.
6810
84d65814
DN
6811@item min-virtual-mappings
6812Specifies the minimum number of virtual mappings in the incremental
6813SSA updater that should be registered to trigger the virtual mappings
6814heuristic defined by virtual-mappings-ratio. The default value is
6815100.
6816
6817@item virtual-mappings-ratio
6818If the number of virtual mappings is virtual-mappings-ratio bigger
6819than the number of virtual symbols to be updated, then the incremental
6820SSA updater switches to a full update for those symbols. The default
6821ratio is 3.
6822
0aca9021
JW
6823@item ssp-buffer-size
6824The minimum size of buffers (i.e. arrays) that will receive stack smashing
6825protection when @option{-fstack-protection} is used.
6826
43f31be5
JL
6827@item max-jump-thread-duplication-stmts
6828Maximum number of statements allowed in a block that needs to be
6829duplicated when threading jumps.
98035a75
DB
6830
6831@item max-fields-for-field-sensitive
6832Maximum number of fields in a structure we will treat in
6833a field sensitive manner during pointer analysis.
6834
47eb5b32
ZD
6835@item prefetch-latency
6836Estimate on average number of instructions that are executed before
6837prefetch finishes. The distance we prefetch ahead is proportional
6838to this constant. Increasing this number may also lead to less
6839streams being prefetched (see @option{simultaneous-prefetches}).
6840
6841@item simultaneous-prefetches
6842Maximum number of prefetches that can run at the same time.
6843
6844@item l1-cache-line-size
6845The size of cache line in L1 cache, in bytes.
6846
6847@item l1-cache-size
6848The number of cache lines in L1 cache.
6849
06d40de8
DG
6850@item verify-canonical-types
6851Whether the compiler should verify the ``canonical'' types used for
6852type equality comparisons within the C++ and Objective-C++ front
6853ends. Set to 1 (the default when GCC is configured with
6854--enable-checking) to enable verification, 0 to disable verification
6855(the default when GCC is configured with --disable-checking).
6856
1c4c47db 6857@end table
74291a4b
MM
6858@end table
6859
6860@node Preprocessor Options
6861@section Options Controlling the Preprocessor
6862@cindex preprocessor options
6863@cindex options, preprocessor
6864
6865These options control the C preprocessor, which is run on each C source
6866file before actual compilation.
6867
630d3d5a
JM
6868If you use the @option{-E} option, nothing is done except preprocessing.
6869Some of these options make sense only together with @option{-E} because
74291a4b
MM
6870they cause the preprocessor output to be unsuitable for actual
6871compilation.
6872
4977bab6 6873@table @gcctabopt
cd3bb277 6874@opindex Wp
40adaa27
NB
6875You can use @option{-Wp,@var{option}} to bypass the compiler driver
6876and pass @var{option} directly through to the preprocessor. If
6877@var{option} contains commas, it is split into multiple options at the
6878commas. However, many options are modified, translated or interpreted
6879by the compiler driver before being passed to the preprocessor, and
6880@option{-Wp} forcibly bypasses this phase. The preprocessor's direct
6881interface is undocumented and subject to change, so whenever possible
6882you should avoid using @option{-Wp} and let the driver handle the
6883options instead.
6884
4977bab6
ZW
6885@item -Xpreprocessor @var{option}
6886@opindex preprocessor
6887Pass @var{option} as an option to the preprocessor. You can use this to
6888supply system-specific preprocessor options which GCC does not know how to
6889recognize.
6890
6891If you want to pass an option that takes an argument, you must use
6892@option{-Xpreprocessor} twice, once for the option and once for the argument.
6893@end table
6894
40adaa27 6895@include cppopts.texi
74291a4b
MM
6896
6897@node Assembler Options
6898@section Passing Options to the Assembler
6899
6900@c prevent bad page break with this line
6901You can pass options to the assembler.
6902
2642624b 6903@table @gcctabopt
aee96fe9 6904@item -Wa,@var{option}
cd3bb277 6905@opindex Wa
74291a4b
MM
6906Pass @var{option} as an option to the assembler. If @var{option}
6907contains commas, it is split into multiple options at the commas.
4977bab6
ZW
6908
6909@item -Xassembler @var{option}
6910@opindex Xassembler
6911Pass @var{option} as an option to the assembler. You can use this to
6912supply system-specific assembler options which GCC does not know how to
6913recognize.
6914
6915If you want to pass an option that takes an argument, you must use
6916@option{-Xassembler} twice, once for the option and once for the argument.
6917
74291a4b
MM
6918@end table
6919
6920@node Link Options
6921@section Options for Linking
6922@cindex link options
6923@cindex options, linking
6924
6925These options come into play when the compiler links object files into
6926an executable output file. They are meaningless if the compiler is
6927not doing a link step.
6928
2642624b 6929@table @gcctabopt
74291a4b
MM
6930@cindex file names
6931@item @var{object-file-name}
6932A file name that does not end in a special recognized suffix is
6933considered to name an object file or library. (Object files are
6934distinguished from libraries by the linker according to the file
6935contents.) If linking is done, these object files are used as input
6936to the linker.
6937
6938@item -c
6939@itemx -S
6940@itemx -E
cd3bb277
JM
6941@opindex c
6942@opindex S
6943@opindex E
74291a4b
MM
6944If any of these options is used, then the linker is not run, and
6945object file names should not be used as arguments. @xref{Overall
6946Options}.
6947
6948@cindex Libraries
6949@item -l@var{library}
4275c4c4 6950@itemx -l @var{library}
cd3bb277 6951@opindex l
4275c4c4
JS
6952Search the library named @var{library} when linking. (The second
6953alternative with the library as a separate argument is only for
6954POSIX compliance and is not recommended.)
74291a4b
MM
6955
6956It makes a difference where in the command you write this option; the
4275c4c4 6957linker searches and processes libraries and object files in the order they
74291a4b
MM
6958are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
6959after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
6960to functions in @samp{z}, those functions may not be loaded.
6961
6962The linker searches a standard list of directories for the library,
6963which is actually a file named @file{lib@var{library}.a}. The linker
6964then uses this file as if it had been specified precisely by name.
6965
6966The directories searched include several standard system directories
630d3d5a 6967plus any that you specify with @option{-L}.
74291a4b
MM
6968
6969Normally the files found this way are library files---archive files
6970whose members are object files. The linker handles an archive file by
6971scanning through it for members which define symbols that have so far
6972been referenced but not defined. But if the file that is found is an
6973ordinary object file, it is linked in the usual fashion. The only
630d3d5a
JM
6974difference between using an @option{-l} option and specifying a file name
6975is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
74291a4b
MM
6976and searches several directories.
6977
6978@item -lobjc
cd3bb277 6979@opindex lobjc
630d3d5a 6980You need this special case of the @option{-l} option in order to
46e34f96 6981link an Objective-C or Objective-C++ program.
74291a4b
MM
6982
6983@item -nostartfiles
cd3bb277 6984@opindex nostartfiles
74291a4b 6985Do not use the standard system startup files when linking.
bedc7537
NC
6986The standard system libraries are used normally, unless @option{-nostdlib}
6987or @option{-nodefaultlibs} is used.
74291a4b
MM
6988
6989@item -nodefaultlibs
cd3bb277 6990@opindex nodefaultlibs
74291a4b
MM
6991Do not use the standard system libraries when linking.
6992Only the libraries you specify will be passed to the linker.
bedc7537 6993The standard startup files are used normally, unless @option{-nostartfiles}
8f99553f
JM
6994is used. The compiler may generate calls to @code{memcmp},
6995@code{memset}, @code{memcpy} and @code{memmove}.
6996These entries are usually resolved by entries in
4754172c
CM
6997libc. These entry points should be supplied through some other
6998mechanism when this option is specified.
74291a4b
MM
6999
7000@item -nostdlib
cd3bb277 7001@opindex nostdlib
74291a4b
MM
7002Do not use the standard system startup files or libraries when linking.
7003No startup files and only the libraries you specify will be passed to
8f99553f
JM
7004the linker. The compiler may generate calls to @code{memcmp}, @code{memset},
7005@code{memcpy} and @code{memmove}.
7006These entries are usually resolved by entries in
4754172c
CM
7007libc. These entry points should be supplied through some other
7008mechanism when this option is specified.
74291a4b 7009
630d3d5a
JM
7010@cindex @option{-lgcc}, use with @option{-nostdlib}
7011@cindex @option{-nostdlib} and unresolved references
7012@cindex unresolved references and @option{-nostdlib}
7013@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
7014@cindex @option{-nodefaultlibs} and unresolved references
7015@cindex unresolved references and @option{-nodefaultlibs}
7016One of the standard libraries bypassed by @option{-nostdlib} and
7017@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
0c2d1a2a 7018that GCC uses to overcome shortcomings of particular machines, or special
74291a4b 7019needs for some languages.
b11cc610
JM
7020(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
7021Collection (GCC) Internals},
74291a4b 7022for more discussion of @file{libgcc.a}.)
74291a4b 7023In most cases, you need @file{libgcc.a} even when you want to avoid
630d3d5a
JM
7024other standard libraries. In other words, when you specify @option{-nostdlib}
7025or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
0c2d1a2a 7026This ensures that you have no unresolved references to internal GCC
74291a4b 7027library subroutines. (For example, @samp{__main}, used to ensure C++
b11cc610
JM
7028constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
7029GNU Compiler Collection (GCC) Internals}.)
74291a4b 7030
24a4dd31
JJ
7031@item -pie
7032@opindex pie
7033Produce a position independent executable on targets which support it.
7034For predictable results, you must also specify the same set of options
7035that were used to generate code (@option{-fpie}, @option{-fPIE},
7036or model suboptions) when you specify this option.
7037
0cbc4d77
WB
7038@item -rdynamic
7039@opindex rdynamic
7040Pass the flag @option{-export-dynamic} to the ELF linker, on targets
7041that support it. This instructs the linker to add all symbols, not
7042only used ones, to the dynamic symbol table. This option is needed
7043for some uses of @code{dlopen} or to allow obtaining backtraces
7044from within a program.
7045
74291a4b 7046@item -s
cd3bb277 7047@opindex s
74291a4b
MM
7048Remove all symbol table and relocation information from the executable.
7049
7050@item -static
cd3bb277 7051@opindex static
74291a4b
MM
7052On systems that support dynamic linking, this prevents linking with the shared
7053libraries. On other systems, this option has no effect.
7054
7055@item -shared
cd3bb277 7056@opindex shared
74291a4b 7057Produce a shared object which can then be linked with other objects to
1d3b0e2c 7058form an executable. Not all systems support this option. For predictable
02f52e19 7059results, you must also specify the same set of options that were used to
630d3d5a 7060generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
2642624b 7061when you specify this option.@footnote{On some systems, @samp{gcc -shared}
767094dd 7062needs to build supplementary stub code for constructors to work. On
2642624b 7063multi-libbed systems, @samp{gcc -shared} must select the correct support
1d3b0e2c 7064libraries to link against. Failing to supply the correct flags may lead
767094dd 7065to subtle defects. Supplying them in cases where they are not necessary
1d3b0e2c 7066is innocuous.}
74291a4b 7067
9db0819e
RH
7068@item -shared-libgcc
7069@itemx -static-libgcc
cd3bb277
JM
7070@opindex shared-libgcc
7071@opindex static-libgcc
9db0819e
RH
7072On systems that provide @file{libgcc} as a shared library, these options
7073force the use of either the shared or static version respectively.
7074If no shared version of @file{libgcc} was built when the compiler was
7075configured, these options have no effect.
7076
7077There are several situations in which an application should use the
7078shared @file{libgcc} instead of the static version. The most common
7079of these is when the application wishes to throw and catch exceptions
7080across different shared libraries. In that case, each of the libraries
7081as well as the application itself should use the shared @file{libgcc}.
7082
5c181756
AO
7083Therefore, the G++ and GCJ drivers automatically add
7084@option{-shared-libgcc} whenever you build a shared library or a main
7085executable, because C++ and Java programs typically use exceptions, so
7086this is the right thing to do.
7087
7088If, instead, you use the GCC driver to create shared libraries, you may
7089find that they will not always be linked with the shared @file{libgcc}.
d3144423
EB
7090If GCC finds, at its configuration time, that you have a non-GNU linker
7091or a GNU linker that does not support option @option{--eh-frame-hdr},
7092it will link the shared version of @file{libgcc} into shared libraries
7093by default. Otherwise, it will take advantage of the linker and optimize
7094away the linking with the shared version of @file{libgcc}, linking with
7095the static version of libgcc by default. This allows exceptions to
7096propagate through such shared libraries, without incurring relocation
7097costs at library load time.
5c181756
AO
7098
7099However, if a library or main executable is supposed to throw or catch
7100exceptions, you must link it using the G++ or GCJ driver, as appropriate
7101for the languages used in the program, or using the option
7102@option{-shared-libgcc}, such that it is linked with the shared
049f6ec9 7103@file{libgcc}.
9db0819e 7104
74291a4b 7105@item -symbolic
cd3bb277 7106@opindex symbolic
74291a4b
MM
7107Bind references to global symbols when building a shared object. Warn
7108about any unresolved references (unless overridden by the link editor
7109option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
7110this option.
7111
7112@item -Xlinker @var{option}
cd3bb277 7113@opindex Xlinker
74291a4b 7114Pass @var{option} as an option to the linker. You can use this to
0c2d1a2a 7115supply system-specific linker options which GCC does not know how to
74291a4b
MM
7116recognize.
7117
7118If you want to pass an option that takes an argument, you must use
630d3d5a
JM
7119@option{-Xlinker} twice, once for the option and once for the argument.
7120For example, to pass @option{-assert definitions}, you must write
74291a4b 7121@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
630d3d5a 7122@option{-Xlinker "-assert definitions"}, because this passes the entire
74291a4b
MM
7123string as a single argument, which is not what the linker expects.
7124
aee96fe9 7125@item -Wl,@var{option}
cd3bb277 7126@opindex Wl
74291a4b
MM
7127Pass @var{option} as an option to the linker. If @var{option} contains
7128commas, it is split into multiple options at the commas.
7129
7130@item -u @var{symbol}
cd3bb277 7131@opindex u
74291a4b 7132Pretend the symbol @var{symbol} is undefined, to force linking of
630d3d5a 7133library modules to define it. You can use @option{-u} multiple times with
74291a4b
MM
7134different symbols to force loading of additional library modules.
7135@end table
7136
7137@node Directory Options
7138@section Options for Directory Search
7139@cindex directory options
7140@cindex options, directory search
7141@cindex search path
7142
7143These options specify directories to search for header files, for
7144libraries and for parts of the compiler:
7145
2642624b 7146@table @gcctabopt
74291a4b 7147@item -I@var{dir}
cd3bb277 7148@opindex I
861bb6c1
JL
7149Add the directory @var{dir} to the head of the list of directories to be
7150searched for header files. This can be used to override a system header
7151file, substituting your own version, since these directories are
d0a5eb32
RK
7152searched before the system header file directories. However, you should
7153not use this option to add directories that contain vendor-supplied
767094dd 7154system header files (use @option{-isystem} for that). If you use more than
630d3d5a 7155one @option{-I} option, the directories are scanned in left-to-right
74291a4b
MM
7156order; the standard system directories come after.
7157
dbead49c 7158If a standard system include directory, or a directory specified with
48209ce5
JDA
7159@option{-isystem}, is also specified with @option{-I}, the @option{-I}
7160option will be ignored. The directory will still be searched but as a
7161system directory at its normal position in the system include chain.
7162This is to ensure that GCC's procedure to fix buggy system headers and
3364c33b 7163the ordering for the include_next directive are not inadvertently changed.
48209ce5
JDA
7164If you really need to change the search order for system directories,
7165use the @option{-nostdinc} and/or @option{-isystem} options.
dbead49c 7166
4bed3787
MS
7167@item -iquote@var{dir}
7168@opindex iquote
7169Add the directory @var{dir} to the head of the list of directories to
7170be searched for header files only for the case of @samp{#include
7171"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
7172otherwise just like @option{-I}.
74291a4b
MM
7173
7174@item -L@var{dir}
cd3bb277 7175@opindex L
74291a4b 7176Add directory @var{dir} to the list of directories to be searched
630d3d5a 7177for @option{-l}.
74291a4b
MM
7178
7179@item -B@var{prefix}
cd3bb277 7180@opindex B
74291a4b
MM
7181This option specifies where to find the executables, libraries,
7182include files, and data files of the compiler itself.
7183
7184The compiler driver program runs one or more of the subprograms
7185@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
7186@var{prefix} as a prefix for each program it tries to run, both with and
7187without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
7188
7189For each subprogram to be run, the compiler driver first tries the
630d3d5a 7190@option{-B} prefix, if any. If that name is not found, or if @option{-B}
74291a4b 7191was not specified, the driver tries two standard prefixes, which are
8e5f33ff 7192@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
74291a4b
MM
7193those results in a file name that is found, the unmodified program
7194name is searched for using the directories specified in your
bedc7537 7195@env{PATH} environment variable.
74291a4b 7196
07804c3b
NC
7197The compiler will check to see if the path provided by the @option{-B}
7198refers to a directory, and if necessary it will add a directory
7199separator character at the end of the path.
7200
630d3d5a 7201@option{-B} prefixes that effectively specify directory names also apply
74291a4b 7202to libraries in the linker, because the compiler translates these
630d3d5a 7203options into @option{-L} options for the linker. They also apply to
74291a4b 7204includes files in the preprocessor, because the compiler translates these
630d3d5a 7205options into @option{-isystem} options for the preprocessor. In this case,
74291a4b
MM
7206the compiler appends @samp{include} to the prefix.
7207
7208The run-time support file @file{libgcc.a} can also be searched for using
630d3d5a 7209the @option{-B} prefix, if needed. If it is not found there, the two
74291a4b
MM
7210standard prefixes above are tried, and that is all. The file is left
7211out of the link if it is not found by those means.
7212
630d3d5a 7213Another way to specify a prefix much like the @option{-B} prefix is to use
bedc7537 7214the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
74291a4b 7215Variables}.
861bb6c1 7216
07804c3b 7217As a special kludge, if the path provided by @option{-B} is
bf4eebe0
NC
7218@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
72199, then it will be replaced by @file{[dir/]include}. This is to help
7dac2f89 7220with boot-strapping the compiler.
07804c3b 7221
861bb6c1 7222@item -specs=@var{file}
cd3bb277 7223@opindex specs
861bb6c1
JL
7224Process @var{file} after the compiler reads in the standard @file{specs}
7225file, in order to override the defaults that the @file{gcc} driver
7226program uses when determining what switches to pass to @file{cc1},
7227@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
630d3d5a 7228@option{-specs=@var{file}} can be specified on the command line, and they
861bb6c1 7229are processed in order, from left to right.
4bed3787 7230
160633c6
MM
7231@item --sysroot=@var{dir}
7232@opindex sysroot
7233Use @var{dir} as the logical root directory for headers and libraries.
7234For example, if the compiler would normally search for headers in
7235@file{/usr/include} and libraries in @file{/usr/lib}, it will instead
cb7ad97b 7236search @file{@var{dir}/usr/include} and @file{@var{dir}/usr/lib}.
160633c6
MM
7237
7238If you use both this option and the @option{-isysroot} option, then
7239the @option{--sysroot} option will apply to libraries, but the
7240@option{-isysroot} option will apply to header files.
7241
7242The GNU linker (beginning with version 2.16) has the necessary support
7243for this option. If your linker does not support this option, the
7244header file aspect of @option{--sysroot} will still work, but the
7245library aspect will not.
7246
4bed3787
MS
7247@item -I-
7248@opindex I-
7249This option has been deprecated. Please use @option{-iquote} instead for
7250@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
7251Any directories you specify with @option{-I} options before the @option{-I-}
7252option are searched only for the case of @samp{#include "@var{file}"};
7253they are not searched for @samp{#include <@var{file}>}.
7254
7255If additional directories are specified with @option{-I} options after
7256the @option{-I-}, these directories are searched for all @samp{#include}
7257directives. (Ordinarily @emph{all} @option{-I} directories are used
7258this way.)
7259
7260In addition, the @option{-I-} option inhibits the use of the current
7261directory (where the current input file came from) as the first search
7262directory for @samp{#include "@var{file}"}. There is no way to
7263override this effect of @option{-I-}. With @option{-I.} you can specify
7264searching the directory which was current when the compiler was
7265invoked. That is not exactly the same as what the preprocessor does
7266by default, but it is often satisfactory.
7267
7268@option{-I-} does not inhibit the use of the standard system directories
7269for header files. Thus, @option{-I-} and @option{-nostdinc} are
7270independent.
74291a4b
MM
7271@end table
7272
ee457005
JM
7273@c man end
7274
a743d340
NC
7275@node Spec Files
7276@section Specifying subprocesses and the switches to pass to them
7277@cindex Spec Files
d2d42a91 7278
bedc7537 7279@command{gcc} is a driver program. It performs its job by invoking a
a743d340
NC
7280sequence of other programs to do the work of compiling, assembling and
7281linking. GCC interprets its command-line parameters and uses these to
7282deduce which programs it should invoke, and which command-line options
c21cd8b1 7283it ought to place on their command lines. This behavior is controlled
a743d340
NC
7284by @dfn{spec strings}. In most cases there is one spec string for each
7285program that GCC can invoke, but a few programs have multiple spec
c21cd8b1 7286strings to control their behavior. The spec strings built into GCC can
630d3d5a 7287be overridden by using the @option{-specs=} command-line switch to specify
a743d340
NC
7288a spec file.
7289
7290@dfn{Spec files} are plaintext files that are used to construct spec
7291strings. They consist of a sequence of directives separated by blank
7292lines. The type of directive is determined by the first non-whitespace
7293character on the line and it can be one of the following:
7294
7295@table @code
7296@item %@var{command}
7297Issues a @var{command} to the spec file processor. The commands that can
02f52e19 7298appear here are:
a743d340
NC
7299
7300@table @code
7301@item %include <@var{file}>
7302@cindex %include
7303Search for @var{file} and insert its text at the current point in the
7304specs file.
7305
7306@item %include_noerr <@var{file}>
7307@cindex %include_noerr
7308Just like @samp{%include}, but do not generate an error message if the include
7309file cannot be found.
7310
7311@item %rename @var{old_name} @var{new_name}
7312@cindex %rename
7313Rename the spec string @var{old_name} to @var{new_name}.
7314
7315@end table
7316
7317@item *[@var{spec_name}]:
7318This tells the compiler to create, override or delete the named spec
7319string. All lines after this directive up to the next directive or
7320blank line are considered to be the text for the spec string. If this
7321results in an empty string then the spec will be deleted. (Or, if the
7322spec did not exist, then nothing will happened.) Otherwise, if the spec
7323does not currently exist a new spec will be created. If the spec does
7324exist then its contents will be overridden by the text of this
7325directive, unless the first character of that text is the @samp{+}
7326character, in which case the text will be appended to the spec.
7327
7328@item [@var{suffix}]:
7329Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
7330and up to the next directive or blank line are considered to make up the
02f52e19 7331spec string for the indicated suffix. When the compiler encounters an
a743d340
NC
7332input file with the named suffix, it will processes the spec string in
7333order to work out how to compile that file. For example:
7334
7335@smallexample
7336.ZZ:
7337z-compile -input %i
7338@end smallexample
7339
7340This says that any input file whose name ends in @samp{.ZZ} should be
7341passed to the program @samp{z-compile}, which should be invoked with the
630d3d5a 7342command-line switch @option{-input} and with the result of performing the
a743d340
NC
7343@samp{%i} substitution. (See below.)
7344
7345As an alternative to providing a spec string, the text that follows a
7346suffix directive can be one of the following:
7347
7348@table @code
7349@item @@@var{language}
7350This says that the suffix is an alias for a known @var{language}. This is
bedc7537 7351similar to using the @option{-x} command-line switch to GCC to specify a
a743d340
NC
7352language explicitly. For example:
7353
7354@smallexample
7355.ZZ:
7356@@c++
7357@end smallexample
7358
7359Says that .ZZ files are, in fact, C++ source files.
7360
7361@item #@var{name}
7362This causes an error messages saying:
7363
7364@smallexample
7365@var{name} compiler not installed on this system.
7366@end smallexample
7367@end table
7368
7369GCC already has an extensive list of suffixes built into it.
7370This directive will add an entry to the end of the list of suffixes, but
7371since the list is searched from the end backwards, it is effectively
7372possible to override earlier entries using this technique.
7373
7374@end table
7375
7376GCC has the following spec strings built into it. Spec files can
7377override these strings or create their own. Note that individual
02f52e19 7378targets can also add their own spec strings to this list.
a743d340
NC
7379
7380@smallexample
7381asm Options to pass to the assembler
7382asm_final Options to pass to the assembler post-processor
7383cpp Options to pass to the C preprocessor
7384cc1 Options to pass to the C compiler
7385cc1plus Options to pass to the C++ compiler
7386endfile Object files to include at the end of the link
7387link Options to pass to the linker
7388lib Libraries to include on the command line to the linker
7389libgcc Decides which GCC support library to pass to the linker
7390linker Sets the name of the linker
7391predefines Defines to be passed to the C preprocessor
310668e8
JM
7392signed_char Defines to pass to CPP to say whether @code{char} is signed
7393 by default
a743d340
NC
7394startfile Object files to include at the start of the link
7395@end smallexample
7396
7397Here is a small example of a spec file:
7398
7399@smallexample
7400%rename lib old_lib
7401
7402*lib:
7403--start-group -lgcc -lc -leval1 --end-group %(old_lib)
7404@end smallexample
7405
7406This example renames the spec called @samp{lib} to @samp{old_lib} and
7407then overrides the previous definition of @samp{lib} with a new one.
7408The new definition adds in some extra command-line options before
7409including the text of the old definition.
7410
7411@dfn{Spec strings} are a list of command-line options to be passed to their
7412corresponding program. In addition, the spec strings can contain
7413@samp{%}-prefixed sequences to substitute variable text or to
7414conditionally insert text into the command line. Using these constructs
7415it is possible to generate quite complex command lines.
7416
7417Here is a table of all defined @samp{%}-sequences for spec
7418strings. Note that spaces are not generated automatically around the
7419results of expanding these sequences. Therefore you can concatenate them
02f52e19 7420together or combine them with constant text in a single argument.
a743d340
NC
7421
7422@table @code
7423@item %%
7424Substitute one @samp{%} into the program name or argument.
7425
7426@item %i
7427Substitute the name of the input file being processed.
7428
7429@item %b
7430Substitute the basename of the input file being processed.
7431This is the substring up to (and not including) the last period
7432and not including the directory.
7433
371e300b
NC
7434@item %B
7435This is the same as @samp{%b}, but include the file suffix (text after
7436the last period).
7437
a743d340
NC
7438@item %d
7439Marks the argument containing or following the @samp{%d} as a
7440temporary file name, so that that file will be deleted if GCC exits
7441successfully. Unlike @samp{%g}, this contributes no text to the
02f52e19 7442argument.
a743d340
NC
7443
7444@item %g@var{suffix}
7445Substitute a file name that has suffix @var{suffix} and is chosen
7446once per compilation, and mark the argument in the same way as
7447@samp{%d}. To reduce exposure to denial-of-service attacks, the file
02f52e19 7448name is now chosen in a way that is hard to predict even when previously
695ac33f 7449chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
a743d340
NC
7450might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
7451the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
7452treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
7453was simply substituted with a file name chosen once per compilation,
7454without regard to any appended suffix (which was therefore treated
7455just like ordinary text), making such attacks more likely to succeed.
7456
7457@item %u@var{suffix}
7458Like @samp{%g}, but generates a new temporary file name even if
7459@samp{%u@var{suffix}} was already seen.
7460
7461@item %U@var{suffix}
7462Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
7463new one if there is no such last file name. In the absence of any
7464@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
695ac33f 7465the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
a743d340
NC
7466would involve the generation of two distinct file names, one
7467for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
7468simply substituted with a file name chosen for the previous @samp{%u},
7469without regard to any appended suffix.
7470
4977bab6 7471@item %j@var{suffix}
aee96fe9 7472Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
371e300b
NC
7473writable, and if save-temps is off; otherwise, substitute the name
7474of a temporary file, just like @samp{%u}. This temporary file is not
7475meant for communication between processes, but rather as a junk
7476disposal mechanism.
7477
4977bab6
ZW
7478@item %|@var{suffix}
7479@itemx %m@var{suffix}
7480Like @samp{%g}, except if @option{-pipe} is in effect. In that case
7481@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
7482all. These are the two most common ways to instruct a program that it
7483should read from standard input or write to standard output. If you
7484need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
7485construct: see for example @file{f/lang-specs.h}.
7486
371e300b
NC
7487@item %.@var{SUFFIX}
7488Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
767094dd 7489when it is subsequently output with @samp{%*}. @var{SUFFIX} is
371e300b
NC
7490terminated by the next space or %.
7491
a743d340
NC
7492@item %w
7493Marks the argument containing or following the @samp{%w} as the
7494designated output file of this compilation. This puts the argument
7495into the sequence of arguments that @samp{%o} will substitute later.
7496
7497@item %o
7498Substitutes the names of all the output files, with spaces
7499automatically placed around them. You should write spaces
7500around the @samp{%o} as well or the results are undefined.
7501@samp{%o} is for use in the specs for running the linker.
7502Input files whose names have no recognized suffix are not compiled
7503at all, but they are included among the output files, so they will
7504be linked.
7505
7506@item %O
7507Substitutes the suffix for object files. Note that this is
7508handled specially when it immediately follows @samp{%g, %u, or %U},
7509because of the need for those to form complete file names. The
7510handling is such that @samp{%O} is treated exactly as if it had already
7511been substituted, except that @samp{%g, %u, and %U} do not currently
7512support additional @var{suffix} characters following @samp{%O} as they would
7513following, for example, @samp{.o}.
7514
7515@item %p
7516Substitutes the standard macro predefinitions for the
7517current target machine. Use this when running @code{cpp}.
7518
7519@item %P
7520Like @samp{%p}, but puts @samp{__} before and after the name of each
7521predefined macro, except for macros that start with @samp{__} or with
c1030c7c 7522@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
161d7b59 7523C@.
a743d340
NC
7524
7525@item %I
047d636f 7526Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
2b6dd222 7527@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}),
047d636f 7528@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
2b6dd222 7529and @option{-imultilib} as necessary.
a743d340
NC
7530
7531@item %s
7532Current argument is the name of a library or startup file of some sort.
7533Search for that file in a standard list of directories and substitute
02f52e19 7534the full name found.
a743d340
NC
7535
7536@item %e@var{str}
7537Print @var{str} as an error message. @var{str} is terminated by a newline.
7538Use this when inconsistent options are detected.
7539
a743d340
NC
7540@item %(@var{name})
7541Substitute the contents of spec string @var{name} at this point.
7542
7543@item %[@var{name}]
630d3d5a 7544Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
a743d340
NC
7545
7546@item %x@{@var{option}@}
7547Accumulate an option for @samp{%X}.
7548
7549@item %X
630d3d5a 7550Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
a743d340
NC
7551spec string.
7552
7553@item %Y
630d3d5a 7554Output the accumulated assembler options specified by @option{-Wa}.
a743d340
NC
7555
7556@item %Z
630d3d5a 7557Output the accumulated preprocessor options specified by @option{-Wp}.
a743d340 7558
a743d340
NC
7559@item %a
7560Process the @code{asm} spec. This is used to compute the
7561switches to be passed to the assembler.
7562
7563@item %A
7564Process the @code{asm_final} spec. This is a spec string for
7565passing switches to an assembler post-processor, if such a program is
7566needed.
7567
7568@item %l
7569Process the @code{link} spec. This is the spec for computing the
7570command line passed to the linker. Typically it will make use of the
7571@samp{%L %G %S %D and %E} sequences.
7572
7573@item %D
630d3d5a 7574Dump out a @option{-L} option for each directory that GCC believes might
a743d340 7575contain startup files. If the target supports multilibs then the
02f52e19 7576current multilib directory will be prepended to each of these paths.
a743d340
NC
7577
7578@item %L
7579Process the @code{lib} spec. This is a spec string for deciding which
02f52e19 7580libraries should be included on the command line to the linker.
a743d340
NC
7581
7582@item %G
7583Process the @code{libgcc} spec. This is a spec string for deciding
02f52e19 7584which GCC support library should be included on the command line to the linker.
a743d340
NC
7585
7586@item %S
7587Process the @code{startfile} spec. This is a spec for deciding which
7588object files should be the first ones passed to the linker. Typically
02f52e19 7589this might be a file named @file{crt0.o}.
a743d340
NC
7590
7591@item %E
7592Process the @code{endfile} spec. This is a spec string that specifies
02f52e19 7593the last object files that will be passed to the linker.
a743d340
NC
7594
7595@item %C
7596Process the @code{cpp} spec. This is used to construct the arguments
7597to be passed to the C preprocessor.
7598
a743d340
NC
7599@item %1
7600Process the @code{cc1} spec. This is used to construct the options to be
7601passed to the actual C compiler (@samp{cc1}).
7602
7603@item %2
7604Process the @code{cc1plus} spec. This is used to construct the options to be
7605passed to the actual C++ compiler (@samp{cc1plus}).
7606
7607@item %*
7608Substitute the variable part of a matched option. See below.
7609Note that each comma in the substituted string is replaced by
7610a single space.
7611
4977bab6
ZW
7612@item %<@code{S}
7613Remove all occurrences of @code{-S} from the command line. Note---this
7614command is position dependent. @samp{%} commands in the spec string
7615before this one will see @code{-S}, @samp{%} commands in the spec string
7616after this one will not.
7617
f3226a90
JT
7618@item %:@var{function}(@var{args})
7619Call the named function @var{function}, passing it @var{args}.
7620@var{args} is first processed as a nested spec string, then split
7621into an argument vector in the usual fashion. The function returns
7622a string which is processed as if it had appeared literally as part
7623of the current spec.
7624
7625The following built-in spec functions are provided:
7626
7627@table @code
03d12b64
MM
7628@item @code{getenv}
7629The @code{getenv} spec function takes two arguments: an environment
7630variable name and a string. If the environment variable is not
7631defined, a fatal error is issued. Otherwise, the return value is the
7632value of the environment variable concatenated with the string. For
7633example, if @env{TOPDIR} is defined as @file{/path/to/top}, then:
7634
7635@smallexample
7636%:getenv(TOPDIR /include)
7637@end smallexample
7638
7639expands to @file{/path/to/top/include}.
7640
f3226a90
JT
7641@item @code{if-exists}
7642The @code{if-exists} spec function takes one argument, an absolute
7643pathname to a file. If the file exists, @code{if-exists} returns the
7644pathname. Here is a small example of its usage:
7645
7646@smallexample
7647*startfile:
7648crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
7649@end smallexample
152a5a9c
JT
7650
7651@item @code{if-exists-else}
7652The @code{if-exists-else} spec function is similar to the @code{if-exists}
7653spec function, except that it takes two arguments. The first argument is
7654an absolute pathname to a file. If the file exists, @code{if-exists-else}
7655returns the pathname. If it does not exist, it returns the second argument.
7656This way, @code{if-exists-else} can be used to select one file or another,
7657based on the existence of the first. Here is a small example of its usage:
7658
daf2f129 7659@smallexample
152a5a9c 7660*startfile:
f5034c5e
JM
7661crt0%O%s %:if-exists(crti%O%s) \
7662%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
152a5a9c 7663@end smallexample
3dd53121
AP
7664
7665@item @code{replace-outfile}
7666The @code{replace-outfile} spec function takes two arguments. It looks for the
7667first argument in the outfiles array and replaces it with the second argument. Here
7668is a small example of its usage:
7669
7670@smallexample
7671%@{fgnu-runtime:%:replace-outfile(-lobjc -lobjc-gnu)@}
7672@end smallexample
7673
a0f87454
RS
7674@item @code{print-asm-header}
7675The @code{print-asm-header} function takes no arguments and simply
7676prints a banner like:
7677
7678@smallexample
7679Assember options
7680================
7681
7682Use "-Wa,OPTION" to pass "OPTION" to the assembler.
7683@end smallexample
7684
7685It is used to separate compiler options from assembler options
7686in the @option{--target-help} output.
daf2f129 7687@end table
f3226a90 7688
a743d340 7689@item %@{@code{S}@}
161d7b59 7690Substitutes the @code{-S} switch, if that switch was given to GCC@.
a743d340
NC
7691If that switch was not specified, this substitutes nothing. Note that
7692the leading dash is omitted when specifying this option, and it is
7693automatically inserted if the substitution is performed. Thus the spec
630d3d5a
JM
7694string @samp{%@{foo@}} would match the command-line option @option{-foo}
7695and would output the command line option @option{-foo}.
a743d340
NC
7696
7697@item %W@{@code{S}@}
7698Like %@{@code{S}@} but mark last argument supplied within as a file to be
02f52e19 7699deleted on failure.
a743d340
NC
7700
7701@item %@{@code{S}*@}
7702Substitutes all the switches specified to GCC whose names start
7703with @code{-S}, but which also take an argument. This is used for
695ac33f 7704switches like @option{-o}, @option{-D}, @option{-I}, etc.
630d3d5a 7705GCC considers @option{-o foo} as being
a743d340 7706one switch whose names starts with @samp{o}. %@{o*@} would substitute this
02f52e19 7707text, including the space. Thus two arguments would be generated.
a743d340 7708
371e300b
NC
7709@item %@{@code{S}*&@code{T}*@}
7710Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
7711(the order of @code{S} and @code{T} in the spec is not significant).
7712There can be any number of ampersand-separated variables; for each the
7713wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
7714
a743d340 7715@item %@{@code{S}:@code{X}@}
4977bab6 7716Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
a743d340
NC
7717
7718@item %@{!@code{S}:@code{X}@}
4977bab6 7719Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
a743d340 7720
4977bab6
ZW
7721@item %@{@code{S}*:@code{X}@}
7722Substitutes @code{X} if one or more switches whose names start with
7723@code{-S} are specified to GCC@. Normally @code{X} is substituted only
7724once, no matter how many such switches appeared. However, if @code{%*}
7725appears somewhere in @code{X}, then @code{X} will be substituted once
7726for each matching switch, with the @code{%*} replaced by the part of
7727that switch that matched the @code{*}.
a743d340
NC
7728
7729@item %@{.@code{S}:@code{X}@}
4977bab6 7730Substitutes @code{X}, if processing a file with suffix @code{S}.
a743d340
NC
7731
7732@item %@{!.@code{S}:@code{X}@}
4977bab6 7733Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
a743d340 7734
98312a9b
GK
7735@item %@{,@code{S}:@code{X}@}
7736Substitutes @code{X}, if processing a file for language @code{S}.
7737
7738@item %@{!,@code{S}:@code{X}@}
7739Substitutes @code{X}, if not processing a file for language @code{S}.
7740
a743d340 7741@item %@{@code{S}|@code{P}:@code{X}@}
98312a9b
GK
7742Substitutes @code{X} if either @code{-S} or @code{-P} was given to
7743GCC@. This may be combined with @samp{!}, @samp{.}, @samp{,}, and
7744@code{*} sequences as well, although they have a stronger binding than
7745the @samp{|}. If @code{%*} appears in @code{X}, all of the
7746alternatives must be starred, and only the first matching alternative
7747is substituted.
4977bab6
ZW
7748
7749For example, a spec string like this:
a743d340
NC
7750
7751@smallexample
7752%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
7753@end smallexample
7754
7755will output the following command-line options from the following input
7756command-line options:
7757
7758@smallexample
7759fred.c -foo -baz
7760jim.d -bar -boggle
7761-d fred.c -foo -baz -boggle
7762-d jim.d -bar -baz -boggle
7763@end smallexample
7764
4977bab6
ZW
7765@item %@{S:X; T:Y; :D@}
7766
c0cbdbd9
KH
7767If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
7768given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
daf2f129 7769be as many clauses as you need. This may be combined with @code{.},
98312a9b 7770@code{,}, @code{!}, @code{|}, and @code{*} as needed.
4977bab6
ZW
7771
7772
a743d340
NC
7773@end table
7774
4977bab6
ZW
7775The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
7776construct may contain other nested @samp{%} constructs or spaces, or
7777even newlines. They are processed as usual, as described above.
7778Trailing white space in @code{X} is ignored. White space may also
7779appear anywhere on the left side of the colon in these constructs,
7780except between @code{.} or @code{*} and the corresponding word.
a743d340 7781
4977bab6
ZW
7782The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
7783handled specifically in these constructs. If another value of
7784@option{-O} or the negated form of a @option{-f}, @option{-m}, or
7785@option{-W} switch is found later in the command line, the earlier
7786switch value is ignored, except with @{@code{S}*@} where @code{S} is
7787just one letter, which passes all matching options.
a743d340 7788
4977bab6
ZW
7789The character @samp{|} at the beginning of the predicate text is used to
7790indicate that a command should be piped to the following command, but
7791only if @option{-pipe} is specified.
a743d340
NC
7792
7793It is built into GCC which switches take arguments and which do not.
7794(You might think it would be useful to generalize this to allow each
7795compiler's spec to say which switches take arguments. But this cannot
7796be done in a consistent fashion. GCC cannot even decide which input
7797files have been specified without knowing which switches take arguments,
7798and it must know which input files to compile in order to tell which
02f52e19 7799compilers to run).
a743d340 7800
630d3d5a 7801GCC also knows implicitly that arguments starting in @option{-l} are to be
a743d340
NC
7802treated as compiler output files, and passed to the linker in their
7803proper position among the other output files.
7804
ee457005
JM
7805@c man begin OPTIONS
7806
74291a4b
MM
7807@node Target Options
7808@section Specifying Target Machine and Compiler Version
7809@cindex target options
7810@cindex cross compiling
7811@cindex specifying machine version
7812@cindex specifying compiler version and target machine
7813@cindex compiler version, specifying
7814@cindex target machine, specifying
7815
37a4aa31
GK
7816The usual way to run GCC is to run the executable called @file{gcc}, or
7817@file{<machine>-gcc} when cross-compiling, or
7818@file{<machine>-gcc-<version>} to run a version other than the one that
7819was installed last. Sometimes this is inconvenient, so GCC provides
7820options that will switch to another cross-compiler or version.
74291a4b 7821
2642624b 7822@table @gcctabopt
74291a4b 7823@item -b @var{machine}
cd3bb277 7824@opindex b
74291a4b 7825The argument @var{machine} specifies the target machine for compilation.
74291a4b
MM
7826
7827The value to use for @var{machine} is the same as was specified as the
0c2d1a2a 7828machine type when configuring GCC as a cross-compiler. For
74291a4b 7829example, if a cross-compiler was configured with @samp{configure
3300bf07
PG
7830arm-elf}, meaning to compile for an arm processor with elf binaries,
7831then you would specify @option{-b arm-elf} to run that cross compiler.
7832Because there are other options beginning with @option{-b}, the
cb7ad97b 7833configuration must contain a hyphen.
74291a4b 7834
37a4aa31
GK
7835@item -V @var{version}
7836@opindex V
7837The argument @var{version} specifies which version of GCC to run.
7838This is useful when multiple versions are installed. For example,
3300bf07 7839@var{version} might be @samp{4.0}, meaning to run GCC version 4.0.
74291a4b
MM
7840@end table
7841
37a4aa31
GK
7842The @option{-V} and @option{-b} options work by running the
7843@file{<machine>-gcc-<version>} executable, so there's no real reason to
7844use them if you can just run that directly.
74291a4b
MM
7845
7846@node Submodel Options
7847@section Hardware Models and Configurations
7848@cindex submodel options
7849@cindex specifying hardware config
7850@cindex hardware models and configurations, specifying
7851@cindex machine dependent options
7852
630d3d5a 7853Earlier we discussed the standard option @option{-b} which chooses among
74291a4b 7854different installed compilers for completely different target
8aeea6e6 7855machines, such as VAX vs.@: 68000 vs.@: 80386.
74291a4b
MM
7856
7857In addition, each of these target machine types can have its own
7858special options, starting with @samp{-m}, to choose among various
7859hardware models or configurations---for example, 68010 vs 68020,
7860floating coprocessor or none. A single installed version of the
7861compiler can compile for any model or configuration, according to the
7862options specified.
7863
7864Some configurations of the compiler also support additional special
7865options, usually for compatibility with other compilers on the same
7866platform.
7867
39bc1876
NS
7868@c This list is ordered alphanumerically by subsection name.
7869@c It should be the same order and spelling as these options are listed
7870@c in Machine Dependent Options
7871
74291a4b 7872@menu
39bc1876 7873* ARC Options::
74291a4b 7874* ARM Options::
39bc1876 7875* AVR Options::
0d4a78eb 7876* Blackfin Options::
39bc1876 7877* CRIS Options::
53054e77 7878* CRX Options::
48aec0bc 7879* Darwin Options::
74291a4b 7880* DEC Alpha Options::
d7c23cdc 7881* DEC Alpha/VMS Options::
39bc1876 7882* FRV Options::
464aea98 7883* GNU/Linux Options::
74291a4b 7884* H8/300 Options::
39bc1876
NS
7885* HPPA Options::
7886* i386 and x86-64 Options::
7887* IA-64 Options::
38b2d076 7888* M32C Options::
39bc1876
NS
7889* M32R/D Options::
7890* M680x0 Options::
7891* M68hc1x Options::
7892* MCore Options::
7893* MIPS Options::
7894* MMIX Options::
7895* MN10300 Options::
6c9ac67a 7896* MT Options::
39bc1876
NS
7897* PDP-11 Options::
7898* PowerPC Options::
7899* RS/6000 and PowerPC Options::
7900* S/390 and zSeries Options::
93ef7c1f 7901* Score Options::
74291a4b 7902* SH Options::
39bc1876 7903* SPARC Options::
85d9c13c 7904* SPU Options::
74291a4b 7905* System V Options::
282a61e6 7906* TMS320C3x/C4x Options::
f84271d9 7907* V850 Options::
39bc1876 7908* VAX Options::
cd773ac4 7909* VxWorks Options::
39bc1876 7910* x86-64 Options::
69a0611f 7911* Xstormy16 Options::
03984308 7912* Xtensa Options::
39bc1876 7913* zSeries Options::
74291a4b
MM
7914@end menu
7915
39bc1876
NS
7916@node ARC Options
7917@subsection ARC Options
7918@cindex ARC Options
74291a4b 7919
39bc1876 7920These options are defined for ARC implementations:
74291a4b 7921
2642624b 7922@table @gcctabopt
39bc1876
NS
7923@item -EL
7924@opindex EL
7925Compile code for little endian mode. This is the default.
74cf1c6d 7926
39bc1876
NS
7927@item -EB
7928@opindex EB
7929Compile code for big endian mode.
74291a4b 7930
39bc1876
NS
7931@item -mmangle-cpu
7932@opindex mmangle-cpu
7933Prepend the name of the cpu to all public symbol names.
7934In multiple-processor systems, there are many ARC variants with different
7935instruction and register set characteristics. This flag prevents code
7936compiled for one cpu to be linked with code compiled for another.
7937No facility exists for handling variants that are ``almost identical''.
7938This is an all or nothing option.
74291a4b 7939
39bc1876
NS
7940@item -mcpu=@var{cpu}
7941@opindex mcpu
7942Compile code for ARC variant @var{cpu}.
7943Which variants are supported depend on the configuration.
7944All variants support @option{-mcpu=base}, this is the default.
74291a4b 7945
39bc1876
NS
7946@item -mtext=@var{text-section}
7947@itemx -mdata=@var{data-section}
7948@itemx -mrodata=@var{readonly-data-section}
7949@opindex mtext
7950@opindex mdata
7951@opindex mrodata
7952Put functions, data, and readonly data in @var{text-section},
7953@var{data-section}, and @var{readonly-data-section} respectively
7954by default. This can be overridden with the @code{section} attribute.
7955@xref{Variable Attributes}.
74291a4b 7956
39bc1876 7957@end table
74291a4b 7958
39bc1876
NS
7959@node ARM Options
7960@subsection ARM Options
7961@cindex ARM options
74291a4b 7962
39bc1876
NS
7963These @samp{-m} options are defined for Advanced RISC Machines (ARM)
7964architectures:
74cf1c6d 7965
39bc1876
NS
7966@table @gcctabopt
7967@item -mabi=@var{name}
7968@opindex mabi
8a36672b 7969Generate code for the specified ABI@. Permissible values are: @samp{apcs-gnu},
077fc835 7970@samp{atpcs}, @samp{aapcs}, @samp{aapcs-linux} and @samp{iwmmxt}.
74cf1c6d 7971
39bc1876
NS
7972@item -mapcs-frame
7973@opindex mapcs-frame
7974Generate a stack frame that is compliant with the ARM Procedure Call
7975Standard for all functions, even if this is not strictly necessary for
7976correct execution of the code. Specifying @option{-fomit-frame-pointer}
7977with this option will cause the stack frames not to be generated for
7978leaf functions. The default is @option{-mno-apcs-frame}.
74291a4b 7979
39bc1876
NS
7980@item -mapcs
7981@opindex mapcs
7982This is a synonym for @option{-mapcs-frame}.
74291a4b 7983
39bc1876
NS
7984@ignore
7985@c not currently implemented
7986@item -mapcs-stack-check
7987@opindex mapcs-stack-check
7988Generate code to check the amount of stack space available upon entry to
7989every function (that actually uses some stack space). If there is
7990insufficient space available then either the function
7991@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
7992called, depending upon the amount of stack space required. The run time
7993system is required to provide these functions. The default is
7994@option{-mno-apcs-stack-check}, since this produces smaller code.
74cf1c6d 7995
39bc1876
NS
7996@c not currently implemented
7997@item -mapcs-float
7998@opindex mapcs-float
7999Pass floating point arguments using the float point registers. This is
8000one of the variants of the APCS@. This option is recommended if the
8001target hardware has a floating point unit or if a lot of floating point
8002arithmetic is going to be performed by the code. The default is
8003@option{-mno-apcs-float}, since integer only code is slightly increased in
8004size if @option{-mapcs-float} is used.
74291a4b 8005
39bc1876
NS
8006@c not currently implemented
8007@item -mapcs-reentrant
8008@opindex mapcs-reentrant
8009Generate reentrant, position independent code. The default is
8010@option{-mno-apcs-reentrant}.
8011@end ignore
74291a4b 8012
39bc1876
NS
8013@item -mthumb-interwork
8014@opindex mthumb-interwork
8015Generate code which supports calling between the ARM and Thumb
8016instruction sets. Without this option the two instruction sets cannot
8017be reliably used inside one program. The default is
8018@option{-mno-thumb-interwork}, since slightly larger code is generated
8019when @option{-mthumb-interwork} is specified.
8020
8021@item -mno-sched-prolog
8022@opindex mno-sched-prolog
8023Prevent the reordering of instructions in the function prolog, or the
8024merging of those instruction with the instructions in the function's
8025body. This means that all functions will start with a recognizable set
8026of instructions (or in fact one of a choice from a small set of
8027different function prologues), and this information can be used to
8028locate the start if functions inside an executable piece of code. The
8029default is @option{-msched-prolog}.
8030
8031@item -mhard-float
8032@opindex mhard-float
8033Generate output containing floating point instructions. This is the
8034default.
861bb6c1 8035
74291a4b 8036@item -msoft-float
cd3bb277 8037@opindex msoft-float
74291a4b 8038Generate output containing library calls for floating point.
39bc1876 8039@strong{Warning:} the requisite libraries are not available for all ARM
74291a4b 8040targets. Normally the facilities of the machine's usual C compiler are
39bc1876
NS
8041used, but this cannot be done directly in cross-compilation. You must make
8042your own arrangements to provide suitable library functions for
8043cross-compilation.
74291a4b 8044
39bc1876
NS
8045@option{-msoft-float} changes the calling convention in the output file;
8046therefore, it is only useful if you compile @emph{all} of a program with
8047this option. In particular, you need to compile @file{libgcc.a}, the
8048library that comes with GCC, with @option{-msoft-float} in order for
8049this to work.
74291a4b 8050
39bc1876
NS
8051@item -mfloat-abi=@var{name}
8052@opindex mfloat-abi
8053Specifies which ABI to use for floating point values. Permissible values
8054are: @samp{soft}, @samp{softfp} and @samp{hard}.
74291a4b 8055
39bc1876
NS
8056@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
8057and @option{-mhard-float} respectively. @samp{softfp} allows the generation
8058of floating point instructions, but still uses the soft-float calling
8059conventions.
74291a4b 8060
39bc1876
NS
8061@item -mlittle-endian
8062@opindex mlittle-endian
8063Generate code for a processor running in little-endian mode. This is
8064the default for all standard configurations.
74291a4b 8065
39bc1876
NS
8066@item -mbig-endian
8067@opindex mbig-endian
8068Generate code for a processor running in big-endian mode; the default is
8069to compile code for a little-endian processor.
74291a4b 8070
39bc1876
NS
8071@item -mwords-little-endian
8072@opindex mwords-little-endian
8073This option only applies when generating code for big-endian processors.
8074Generate code for a little-endian word order but a big-endian byte
8075order. That is, a byte order of the form @samp{32107654}. Note: this
8076option should only be used if you require compatibility with code for
8077big-endian ARM processors generated by versions of the compiler prior to
80782.8.
74291a4b 8079
39bc1876
NS
8080@item -mcpu=@var{name}
8081@opindex mcpu
8082This specifies the name of the target ARM processor. GCC uses this name
8083to determine what kind of instructions it can emit when generating
8084assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
8085@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
8086@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
8087@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
8088@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
d98a72fd
RE
8089@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm7tdmi-s},
8090@samp{arm8}, @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
39bc1876 8091@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
d98a72fd
RE
8092@samp{arm920t}, @samp{arm922t}, @samp{arm946e-s}, @samp{arm966e-s},
8093@samp{arm968e-s}, @samp{arm926ej-s}, @samp{arm940t}, @samp{arm9tdmi},
8094@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ej-s},
f9e8581a 8095@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
fa91adc6 8096@samp{arm1136j-s}, @samp{arm1136jf-s}, @samp{mpcore}, @samp{mpcorenovfp},
5b3e6663
PB
8097@samp{arm1156t2-s}, @samp{arm1176jz-s}, @samp{arm1176jzf-s},
8098@samp{cortex-a8}, @samp{cortex-r4}, @samp{cortex-m3},
8099@samp{xscale}, @samp{iwmmxt}, @samp{ep9312}.
74291a4b 8100
39bc1876
NS
8101@itemx -mtune=@var{name}
8102@opindex mtune
8103This option is very similar to the @option{-mcpu=} option, except that
8104instead of specifying the actual target processor type, and hence
8105restricting which instructions can be used, it specifies that GCC should
8106tune the performance of the code as if the target were of the type
8107specified in this option, but still choosing the instructions that it
8108will generate based on the cpu specified by a @option{-mcpu=} option.
8109For some ARM implementations better performance can be obtained by using
8110this option.
861bb6c1 8111
39bc1876
NS
8112@item -march=@var{name}
8113@opindex march
8114This specifies the name of the target ARM architecture. GCC uses this
8115name to determine what kind of instructions it can emit when generating
8116assembly code. This option can be used in conjunction with or instead
8117of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
8118@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
8119@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
5b3e6663
PB
8120@samp{armv6t2}, @samp{armv6z}, @samp{armv6zk}, @samp{armv7}, @samp{armv7-a},
8121@samp{armv7-r}, @samp{armv7-m}, @samp{iwmmxt}, @samp{ep9312}.
861bb6c1 8122
39bc1876
NS
8123@item -mfpu=@var{name}
8124@itemx -mfpe=@var{number}
8125@itemx -mfp=@var{number}
8126@opindex mfpu
8127@opindex mfpe
8128@opindex mfp
8129This specifies what floating point hardware (or hardware emulation) is
8130available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
8131@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe}
8132are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
8133with older versions of GCC@.
861bb6c1 8134
39bc1876
NS
8135If @option{-msoft-float} is specified this specifies the format of
8136floating point values.
fb868474 8137
39bc1876
NS
8138@item -mstructure-size-boundary=@var{n}
8139@opindex mstructure-size-boundary
8140The size of all structures and unions will be rounded up to a multiple
8141of the number of bits set by this option. Permissible values are 8, 32
8142and 64. The default value varies for different toolchains. For the COFF
8143targeted toolchain the default value is 8. A value of 64 is only allowed
8144if the underlying ABI supports it.
b71733d5 8145
39bc1876
NS
8146Specifying the larger number can produce faster, more efficient code, but
8147can also increase the size of the program. Different values are potentially
8148incompatible. Code compiled with one value cannot necessarily expect to
8149work with code or libraries compiled with another value, if they exchange
8150information using structures or unions.
24f9c4df 8151
39bc1876
NS
8152@item -mabort-on-noreturn
8153@opindex mabort-on-noreturn
8154Generate a call to the function @code{abort} at the end of a
8155@code{noreturn} function. It will be executed if the function tries to
8156return.
24f9c4df 8157
39bc1876
NS
8158@item -mlong-calls
8159@itemx -mno-long-calls
8160@opindex mlong-calls
8161@opindex mno-long-calls
8162Tells the compiler to perform function calls by first loading the
8163address of the function into a register and then performing a subroutine
8164call on this register. This switch is needed if the target function
8165will lie outside of the 64 megabyte addressing range of the offset based
8166version of subroutine call instruction.
24f9c4df 8167
39bc1876
NS
8168Even if this switch is enabled, not all function calls will be turned
8169into long calls. The heuristic is that static functions, functions
8170which have the @samp{short-call} attribute, functions that are inside
8171the scope of a @samp{#pragma no_long_calls} directive and functions whose
8172definitions have already been compiled within the current compilation
8173unit, will not be turned into long calls. The exception to this rule is
8174that weak function definitions, functions with the @samp{long-call}
8175attribute or the @samp{section} attribute, and functions that are within
8176the scope of a @samp{#pragma long_calls} directive, will always be
8177turned into long calls.
24f9c4df 8178
39bc1876
NS
8179This feature is not enabled by default. Specifying
8180@option{-mno-long-calls} will restore the default behavior, as will
8181placing the function calls within the scope of a @samp{#pragma
8182long_calls_off} directive. Note these switches have no effect on how
8183the compiler generates code to handle function calls via function
8184pointers.
24f9c4df 8185
39bc1876
NS
8186@item -mnop-fun-dllimport
8187@opindex mnop-fun-dllimport
8188Disable support for the @code{dllimport} attribute.
74291a4b 8189
39bc1876
NS
8190@item -msingle-pic-base
8191@opindex msingle-pic-base
8192Treat the register used for PIC addressing as read-only, rather than
8193loading it in the prologue for each function. The run-time system is
8194responsible for initializing this register with an appropriate value
8195before execution begins.
2856c3e3 8196
39bc1876
NS
8197@item -mpic-register=@var{reg}
8198@opindex mpic-register
8199Specify the register to be used for PIC addressing. The default is R10
8200unless stack-checking is enabled, when R9 is used.
2856c3e3 8201
39bc1876
NS
8202@item -mcirrus-fix-invalid-insns
8203@opindex mcirrus-fix-invalid-insns
8204@opindex mno-cirrus-fix-invalid-insns
8205Insert NOPs into the instruction stream to in order to work around
8206problems with invalid Maverick instruction combinations. This option
8207is only valid if the @option{-mcpu=ep9312} option has been used to
8208enable generation of instructions for the Cirrus Maverick floating
8209point co-processor. This option is not enabled by default, since the
8210problem is only present in older Maverick implementations. The default
8211can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
8212switch.
2856c3e3 8213
39bc1876
NS
8214@item -mpoke-function-name
8215@opindex mpoke-function-name
8216Write the name of each function into the text section, directly
8217preceding the function prologue. The generated code is similar to this:
2856c3e3 8218
39bc1876
NS
8219@smallexample
8220 t0
8221 .ascii "arm_poke_function_name", 0
8222 .align
8223 t1
8224 .word 0xff000000 + (t1 - t0)
8225 arm_poke_function_name
8226 mov ip, sp
8227 stmfd sp!, @{fp, ip, lr, pc@}
8228 sub fp, ip, #4
8229@end smallexample
f077f169 8230
39bc1876
NS
8231When performing a stack backtrace, code can inspect the value of
8232@code{pc} stored at @code{fp + 0}. If the trace function then looks at
8233location @code{pc - 12} and the top 8 bits are set, then we know that
8234there is a function name embedded immediately preceding this location
8235and has length @code{((pc[-3]) & 0xff000000)}.
2856c3e3 8236
39bc1876
NS
8237@item -mthumb
8238@opindex mthumb
5b3e6663 8239Generate code for the Thumb instruction set. The default is to
39bc1876 8240use the 32-bit ARM instruction set.
5b3e6663
PB
8241This option automatically enables either 16-bit Thumb-1 or
8242mixed 16/32-bit Thumb-2 instructions based on the @option{-mcpu=@var{name}}
8243and @option{-march=@var{name}} options.
8a0b86f5 8244
39bc1876
NS
8245@item -mtpcs-frame
8246@opindex mtpcs-frame
8247Generate a stack frame that is compliant with the Thumb Procedure Call
8248Standard for all non-leaf functions. (A leaf function is one that does
8249not call any other functions.) The default is @option{-mno-tpcs-frame}.
058edcdb 8250
39bc1876
NS
8251@item -mtpcs-leaf-frame
8252@opindex mtpcs-leaf-frame
8253Generate a stack frame that is compliant with the Thumb Procedure Call
8254Standard for all leaf functions. (A leaf function is one that does
8255not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
2856c3e3 8256
39bc1876
NS
8257@item -mcallee-super-interworking
8258@opindex mcallee-super-interworking
8259Gives all externally visible functions in the file being compiled an ARM
8260instruction set header which switches to Thumb mode before executing the
8261rest of the function. This allows these functions to be called from
8262non-interworking code.
8263
8264@item -mcaller-super-interworking
8265@opindex mcaller-super-interworking
8266Allows calls via function pointers (including virtual functions) to
8267execute correctly regardless of whether the target code has been
8268compiled for interworking or not. There is a small overhead in the cost
8269of executing a function pointer if this option is enabled.
2856c3e3 8270
d3585b76
DJ
8271@item -mtp=@var{name}
8272@opindex mtp
8273Specify the access model for the thread local storage pointer. The valid
8274models are @option{soft}, which generates calls to @code{__aeabi_read_tp},
8275@option{cp15}, which fetches the thread pointer from @code{cp15} directly
8276(supported in the arm6k architecture), and @option{auto}, which uses the
8277best available method for the selected processor. The default setting is
8278@option{auto}.
8279
2856c3e3
SC
8280@end table
8281
39bc1876
NS
8282@node AVR Options
8283@subsection AVR Options
8284@cindex AVR Options
74291a4b 8285
39bc1876 8286These options are defined for AVR implementations:
74291a4b 8287
2642624b 8288@table @gcctabopt
39bc1876
NS
8289@item -mmcu=@var{mcu}
8290@opindex mmcu
8291Specify ATMEL AVR instruction set or MCU type.
74291a4b 8292
39bc1876
NS
8293Instruction set avr1 is for the minimal AVR core, not supported by the C
8294compiler, only for assembler programs (MCU types: at90s1200, attiny10,
8295attiny11, attiny12, attiny15, attiny28).
74291a4b 8296
39bc1876
NS
8297Instruction set avr2 (default) is for the classic AVR core with up to
82988K program memory space (MCU types: at90s2313, at90s2323, attiny22,
8299at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
8300at90c8534, at90s8535).
74291a4b 8301
39bc1876
NS
8302Instruction set avr3 is for the classic AVR core with up to 128K program
8303memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
74291a4b 8304
39bc1876
NS
8305Instruction set avr4 is for the enhanced AVR core with up to 8K program
8306memory space (MCU types: atmega8, atmega83, atmega85).
74291a4b 8307
39bc1876
NS
8308Instruction set avr5 is for the enhanced AVR core with up to 128K program
8309memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
8310atmega64, atmega128, at43usb355, at94k).
74291a4b 8311
39bc1876
NS
8312@item -msize
8313@opindex msize
8314Output instruction sizes to the asm file.
74291a4b 8315
39bc1876
NS
8316@item -minit-stack=@var{N}
8317@opindex minit-stack
8318Specify the initial stack address, which may be a symbol or numeric value,
8319@samp{__stack} is the default.
74291a4b 8320
39bc1876
NS
8321@item -mno-interrupts
8322@opindex mno-interrupts
8323Generated code is not compatible with hardware interrupts.
8324Code size will be smaller.
74291a4b 8325
39bc1876
NS
8326@item -mcall-prologues
8327@opindex mcall-prologues
8328Functions prologues/epilogues expanded as call to appropriate
8329subroutines. Code size will be smaller.
74291a4b 8330
39bc1876
NS
8331@item -mno-tablejump
8332@opindex mno-tablejump
8333Do not generate tablejump insns which sometimes increase code size.
74291a4b 8334
39bc1876
NS
8335@item -mtiny-stack
8336@opindex mtiny-stack
8337Change only the low 8 bits of the stack pointer.
74291a4b 8338
39bc1876
NS
8339@item -mint8
8340@opindex mint8
8a36672b 8341Assume int to be 8 bit integer. This affects the sizes of all types: A
39bc1876 8342char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
8a36672b 8343and long long will be 4 bytes. Please note that this option does not
39bc1876
NS
8344comply to the C standards, but it will provide you with smaller code
8345size.
8346@end table
74291a4b 8347
0d4a78eb
BS
8348@node Blackfin Options
8349@subsection Blackfin Options
8350@cindex Blackfin Options
8351
8352@table @gcctabopt
28f601ff
JZ
8353@item -mcpu=@var{cpu}
8354@opindex mcpu=
8355Specifies the name of the target Blackfin processor. Currently, @var{cpu}
8356can be one of @samp{bf531}, @samp{bf532}, @samp{bf533},
8357@samp{bf534}, @samp{bf536}, @samp{bf537}, @samp{bf561}.
8358Without this option, @samp{bf532} is used as the processor by default.
8359The corresponding predefined processor macros for @var{cpu} is to
8360be defined. For the @samp{bfin-elf} toolchain, this causes the hardware
8361BSP provided by libgloss to be linked in if @samp{-msim} is not given.
8362Support for @samp{bf561} is incomplete; only the processor macro is defined.
8363
8364@item -msim
8365@opindex msim
8366Specifies that the program will be run on the simulator. This causes
8367the simulator BSP provided by libgloss to be linked in. This option
8368has effect only for @samp{bfin-elf} toolchain.
8369
0d4a78eb
BS
8370@item -momit-leaf-frame-pointer
8371@opindex momit-leaf-frame-pointer
8372Don't keep the frame pointer in a register for leaf functions. This
8373avoids the instructions to save, set up and restore frame pointers and
8374makes an extra register available in leaf functions. The option
8375@option{-fomit-frame-pointer} removes the frame pointer for all functions
8376which might make debugging harder.
8377
3fb192d2
BS
8378@item -mspecld-anomaly
8379@opindex mspecld-anomaly
0d4a78eb
BS
8380When enabled, the compiler will ensure that the generated code does not
8381contain speculative loads after jump instructions. This option is enabled
8382by default.
8383
3fb192d2
BS
8384@item -mno-specld-anomaly
8385@opindex mno-specld-anomaly
0d4a78eb
BS
8386Don't generate extra code to prevent speculative loads from occurring.
8387
3fb192d2 8388@item -mcsync-anomaly
161c21b6 8389@opindex mcsync-anomaly
3fb192d2
BS
8390When enabled, the compiler will ensure that the generated code does not
8391contain CSYNC or SSYNC instructions too soon after conditional branches.
8392This option is enabled by default.
8393
8394@item -mno-csync-anomaly
161c21b6 8395@opindex mno-csync-anomaly
3fb192d2
BS
8396Don't generate extra code to prevent CSYNC or SSYNC instructions from
8397occurring too soon after a conditional branch.
8398
0d4a78eb 8399@item -mlow-64k
9821b257 8400@opindex mlow-64k
0d4a78eb
BS
8401When enabled, the compiler is free to take advantage of the knowledge that
8402the entire program fits into the low 64k of memory.
8403
8404@item -mno-low-64k
8405@opindex mno-low-64k
8406Assume that the program is arbitrarily large. This is the default.
8407
d6eb07dc
BS
8408@item -mstack-check-l1
8409@opindex mstack-check-l1
8410Do stack checking using information placed into L1 scratchpad memory by the
8411uClinux kernel.
8412
0d4a78eb
BS
8413@item -mid-shared-library
8414@opindex mid-shared-library
8415Generate code that supports shared libraries via the library ID method.
8416This allows for execute in place and shared libraries in an environment
8417without virtual memory management. This option implies @option{-fPIC}.
8418
8419@item -mno-id-shared-library
8420@opindex mno-id-shared-library
8421Generate code that doesn't assume ID based shared libraries are being used.
8422This is the default.
8423
d6eb07dc
BS
8424@item -mleaf-id-shared-library
8425@opindex mleaf-id-shared-library
8426Generate code that supports shared libraries via the library ID method,
8427but assumes that this library or executable won't link against any other
8428ID shared libraries. That allows the compiler to use faster code for jumps
8429and calls.
8430
8431@item -mno-leaf-id-shared-library
8432@opindex mno-leaf-id-shared-library
8433Do not assume that the code being compiled won't link against any ID shared
8434libraries. Slower code will be generated for jump and call insns.
8435
0d4a78eb
BS
8436@item -mshared-library-id=n
8437@opindex mshared-library-id
8438Specified the identification number of the ID based shared library being
8439compiled. Specifying a value of 0 will generate more compact code, specifying
8440other values will force the allocation of that number to the current
8441library but is no more space or time efficient than omitting this option.
b6877196 8442
d6eb07dc
BS
8443@item -msep-data
8444@opindex msep-data
8445Generate code that allows the data segment to be located in a different
8446area of memory from the text segment. This allows for execute in place in
8447an environment without virtual memory management by eliminating relocations
8448against the text section.
8449
8450@item -mno-sep-data
8451@opindex mno-sep-data
8452Generate code that assumes that the data segment follows the text segment.
8453This is the default.
8454
b6877196
BS
8455@item -mlong-calls
8456@itemx -mno-long-calls
8457@opindex mlong-calls
8458@opindex mno-long-calls
8459Tells the compiler to perform function calls by first loading the
8460address of the function into a register and then performing a subroutine
8461call on this register. This switch is needed if the target function
8462will lie outside of the 24 bit addressing range of the offset based
8463version of subroutine call instruction.
8464
8465This feature is not enabled by default. Specifying
8466@option{-mno-long-calls} will restore the default behavior. Note these
8467switches have no effect on how the compiler generates code to handle
8468function calls via function pointers.
0d4a78eb
BS
8469@end table
8470
39bc1876
NS
8471@node CRIS Options
8472@subsection CRIS Options
8473@cindex CRIS Options
74291a4b 8474
39bc1876 8475These options are defined specifically for the CRIS ports.
74291a4b 8476
39bc1876
NS
8477@table @gcctabopt
8478@item -march=@var{architecture-type}
8479@itemx -mcpu=@var{architecture-type}
8480@opindex march
8481@opindex mcpu
8482Generate code for the specified architecture. The choices for
8483@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
8a36672b 8484respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX@.
39bc1876
NS
8485Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
8486@samp{v10}.
c219ddf7 8487
39bc1876
NS
8488@item -mtune=@var{architecture-type}
8489@opindex mtune
8490Tune to @var{architecture-type} everything applicable about the generated
8491code, except for the ABI and the set of available instructions. The
8492choices for @var{architecture-type} are the same as for
8493@option{-march=@var{architecture-type}}.
54284728 8494
39bc1876
NS
8495@item -mmax-stack-frame=@var{n}
8496@opindex mmax-stack-frame
8497Warn when the stack frame of a function exceeds @var{n} bytes.
54284728 8498
39bc1876
NS
8499@item -melinux-stacksize=@var{n}
8500@opindex melinux-stacksize
8501Only available with the @samp{cris-axis-aout} target. Arranges for
8502indications in the program to the kernel loader that the stack of the
8503program should be set to @var{n} bytes.
54284728 8504
39bc1876
NS
8505@item -metrax4
8506@itemx -metrax100
8507@opindex metrax4
8508@opindex metrax100
8509The options @option{-metrax4} and @option{-metrax100} are synonyms for
8510@option{-march=v3} and @option{-march=v8} respectively.
c0498f43 8511
39bc1876
NS
8512@item -mmul-bug-workaround
8513@itemx -mno-mul-bug-workaround
8514@opindex mmul-bug-workaround
8515@opindex mno-mul-bug-workaround
8516Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
8517models where it applies. This option is active by default.
c0498f43 8518
39bc1876
NS
8519@item -mpdebug
8520@opindex mpdebug
8521Enable CRIS-specific verbose debug-related information in the assembly
8522code. This option also has the effect to turn off the @samp{#NO_APP}
8523formatted-code indicator to the assembler at the beginning of the
8524assembly file.
c0498f43 8525
39bc1876
NS
8526@item -mcc-init
8527@opindex mcc-init
8528Do not use condition-code results from previous instruction; always emit
8529compare and test instructions before use of condition codes.
74291a4b 8530
39bc1876
NS
8531@item -mno-side-effects
8532@opindex mno-side-effects
8533Do not emit instructions with side-effects in addressing modes other than
8534post-increment.
238b11b5 8535
39bc1876
NS
8536@item -mstack-align
8537@itemx -mno-stack-align
8538@itemx -mdata-align
8539@itemx -mno-data-align
8540@itemx -mconst-align
8541@itemx -mno-const-align
8542@opindex mstack-align
8543@opindex mno-stack-align
8544@opindex mdata-align
8545@opindex mno-data-align
8546@opindex mconst-align
8547@opindex mno-const-align
8548These options (no-options) arranges (eliminate arrangements) for the
8549stack-frame, individual data and constants to be aligned for the maximum
8550single data access size for the chosen CPU model. The default is to
8551arrange for 32-bit alignment. ABI details such as structure layout are
8552not affected by these options.
238b11b5 8553
39bc1876
NS
8554@item -m32-bit
8555@itemx -m16-bit
8556@itemx -m8-bit
8557@opindex m32-bit
8558@opindex m16-bit
8559@opindex m8-bit
8560Similar to the stack- data- and const-align options above, these options
8561arrange for stack-frame, writable data and constants to all be 32-bit,
856216-bit or 8-bit aligned. The default is 32-bit alignment.
238b11b5 8563
39bc1876
NS
8564@item -mno-prologue-epilogue
8565@itemx -mprologue-epilogue
8566@opindex mno-prologue-epilogue
8567@opindex mprologue-epilogue
8568With @option{-mno-prologue-epilogue}, the normal function prologue and
8569epilogue that sets up the stack-frame are omitted and no return
8570instructions or return sequences are generated in the code. Use this
8571option only together with visual inspection of the compiled code: no
8572warnings or errors are generated when call-saved registers must be saved,
8573or storage for local variable needs to be allocated.
238b11b5 8574
39bc1876
NS
8575@item -mno-gotplt
8576@itemx -mgotplt
8577@opindex mno-gotplt
8578@opindex mgotplt
8579With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
8580instruction sequences that load addresses for functions from the PLT part
8581of the GOT rather than (traditional on other architectures) calls to the
8a36672b 8582PLT@. The default is @option{-mgotplt}.
238b11b5 8583
39bc1876
NS
8584@item -maout
8585@opindex maout
8586Legacy no-op option only recognized with the cris-axis-aout target.
c0498f43 8587
39bc1876
NS
8588@item -melf
8589@opindex melf
8590Legacy no-op option only recognized with the cris-axis-elf and
8591cris-axis-linux-gnu targets.
74291a4b 8592
39bc1876
NS
8593@item -melinux
8594@opindex melinux
8595Only recognized with the cris-axis-aout target, where it selects a
8596GNU/linux-like multilib, include files and instruction set for
8597@option{-march=v8}.
ded17aad 8598
39bc1876
NS
8599@item -mlinux
8600@opindex mlinux
8601Legacy no-op option only recognized with the cris-axis-linux-gnu target.
ded17aad 8602
39bc1876
NS
8603@item -sim
8604@opindex sim
8605This option, recognized for the cris-axis-aout and cris-axis-elf arranges
8606to link with input-output functions from a simulator library. Code,
8607initialized data and zero-initialized data are allocated consecutively.
74291a4b 8608
39bc1876
NS
8609@item -sim2
8610@opindex sim2
8611Like @option{-sim}, but pass linker options to locate initialized data at
86120x40000000 and zero-initialized data at 0x80000000.
74291a4b
MM
8613@end table
8614
53054e77
PW
8615@node CRX Options
8616@subsection CRX Options
8617@cindex CRX Options
8618
8619These options are defined specifically for the CRX ports.
8620
8621@table @gcctabopt
8622
8623@item -mmac
8624@opindex mmac
8625Enable the use of multiply-accumulate instructions. Disabled by default.
8626
8627@item -mpush-args
8628@opindex mpush-args
8629Push instructions will be used to pass outgoing arguments when functions
8630are called. Enabled by default.
8631@end table
8632
39bc1876
NS
8633@node Darwin Options
8634@subsection Darwin Options
8635@cindex Darwin options
74291a4b 8636
39bc1876 8637These options are defined for all architectures running the Darwin operating
965a7e90
GK
8638system.
8639
8640FSF GCC on Darwin does not create ``fat'' object files; it will create
8641an object file for the single architecture that it was built to
8642target. Apple's GCC on Darwin does create ``fat'' files if multiple
46bfe5e3
GK
8643@option{-arch} options are used; it does so by running the compiler or
8644linker multiple times and joining the results together with
8645@file{lipo}.
965a7e90 8646
46bfe5e3
GK
8647The subtype of the file created (like @samp{ppc7400} or @samp{ppc970} or
8648@samp{i686}) is determined by the flags that specify the ISA
8649that GCC is targetting, like @option{-mcpu} or @option{-march}. The
965a7e90 8650@option{-force_cpusubtype_ALL} option can be used to override this.
74291a4b 8651
38b974a6 8652The Darwin tools vary in their behavior when presented with an ISA
46bfe5e3
GK
8653mismatch. The assembler, @file{as}, will only permit instructions to
8654be used that are valid for the subtype of the file it is generating,
8655so you cannot put 64-bit instructions in an @samp{ppc750} object file.
8656The linker for shared libraries, @file{/usr/bin/libtool}, will fail
8657and print an error if asked to create a shared library with a less
8658restrictive subtype than its input files (for instance, trying to put
8659a @samp{ppc970} object file in a @samp{ppc7400} library). The linker
8660for executables, @file{ld}, will quietly give the executable the most
8661restrictive subtype of any of its input files.
8662
2642624b 8663@table @gcctabopt
39bc1876
NS
8664@item -F@var{dir}
8665@opindex F
8666Add the framework directory @var{dir} to the head of the list of
8667directories to be searched for header files. These directories are
8668interleaved with those specified by @option{-I} options and are
8669scanned in a left-to-right order.
5848830f 8670
39bc1876
NS
8671A framework directory is a directory with frameworks in it. A
8672framework is a directory with a @samp{"Headers"} and/or
8673@samp{"PrivateHeaders"} directory contained directly in it that ends
8674in @samp{".framework"}. The name of a framework is the name of this
8675directory excluding the @samp{".framework"}. Headers associated with
8676the framework are found in one of those two directories, with
8677@samp{"Headers"} being searched first. A subframework is a framework
8678directory that is in a framework's @samp{"Frameworks"} directory.
8679Includes of subframework headers can only appear in a header of a
8680framework that contains the subframework, or in a sibling subframework
8681header. Two subframeworks are siblings if they occur in the same
8682framework. A subframework should not have the same name as a
8683framework, a warning will be issued if this is violated. Currently a
8684subframework cannot have subframeworks, in the future, the mechanism
8685may be extended to support this. The standard frameworks can be found
3e558e80
MS
8686in @samp{"/System/Library/Frameworks"} and
8687@samp{"/Library/Frameworks"}. An example include looks like
39bc1876
NS
8688@code{#include <Framework/header.h>}, where @samp{Framework} denotes
8689the name of the framework and header.h is found in the
8690@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
157a620e 8691
1f1d5130
MS
8692@item -iframework@var{dir}
8693@opindex iframework
8694Like @option{-F} except the directory is a treated as a system
8695directory. The main difference between this @option{-iframework} and
8696@option{-F} is that with @option{-iframework} the compiler does not
8697warn about constructs contained within header files found via
8698@var{dir}. This option is valid only for the C family of languages.
8699
7aded944 8700@item -gused
edc5f63b 8701@opindex gused
8a36672b 8702Emit debugging information for symbols that are used. For STABS
7aded944 8703debugging format, this enables @option{-feliminate-unused-debug-symbols}.
8a36672b 8704This is by default ON@.
7aded944
DP
8705
8706@item -gfull
edc5f63b 8707@opindex gfull
7aded944
DP
8708Emit debugging information for all symbols and types.
8709
ed5b9f96
GK
8710@item -mmacosx-version-min=@var{version}
8711The earliest version of MacOS X that this executable will run on
8712is @var{version}. Typical values of @var{version} include @code{10.1},
8713@code{10.2}, and @code{10.3.9}.
8714
8715The default for this option is to make choices that seem to be most
cb7ad97b 8716useful.
ed5b9f96 8717
57164024
MS
8718@item -mkernel
8719@opindex mkernel
b5d713b9 8720Enable kernel development mode. The @option{-mkernel} option sets
57164024
MS
8721@option{-static}, @option{-fno-common}, @option{-fno-cxa-atexit},
8722@option{-fno-exceptions}, @option{-fno-non-call-exceptions},
8723@option{-fapple-kext}, @option{-fno-weak} and @option{-fno-rtti} where
8724applicable. This mode also sets @option{-mno-altivec},
8725@option{-msoft-float}, @option{-fno-builtin} and
8726@option{-mlong-branch} for PowerPC targets.
8727
8f4220dc 8728@item -mone-byte-bool
edc5f63b 8729@opindex mone-byte-bool
8f4220dc 8730Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
f0eb93a8 8731By default @samp{sizeof(bool)} is @samp{4} when compiling for
8f4220dc
MA
8732Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
8733option has no effect on x86.
8734
8735@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
8736to generate code that is not binary compatible with code generated
8737without that switch. Using this switch may require recompiling all
f0eb93a8 8738other modules in a program, including system libraries. Use this
8f4220dc
MA
8739switch to conform to a non-default data model.
8740
699c914a
MS
8741@item -mfix-and-continue
8742@itemx -ffix-and-continue
8743@itemx -findirect-data
8744@opindex mfix-and-continue
8745@opindex ffix-and-continue
8746@opindex findirect-data
8747Generate code suitable for fast turn around development. Needed to
8748enable gdb to dynamically load @code{.o} files into already running
8749programs. @option{-findirect-data} and @option{-ffix-and-continue}
8750are provided for backwards compatibility.
8751
39bc1876
NS
8752@item -all_load
8753@opindex all_load
8754Loads all members of static archive libraries.
8755See man ld(1) for more information.
74291a4b 8756
39bc1876
NS
8757@item -arch_errors_fatal
8758@opindex arch_errors_fatal
8759Cause the errors having to do with files that have the wrong architecture
8760to be fatal.
157a620e 8761
39bc1876
NS
8762@item -bind_at_load
8763@opindex bind_at_load
8764Causes the output file to be marked such that the dynamic linker will
8765bind all undefined references when the file is loaded or launched.
157a620e 8766
39bc1876
NS
8767@item -bundle
8768@opindex bundle
8769Produce a Mach-o bundle format file.
8770See man ld(1) for more information.
157a620e 8771
39bc1876
NS
8772@item -bundle_loader @var{executable}
8773@opindex bundle_loader
965a7e90 8774This option specifies the @var{executable} that will be loading the build
8a36672b 8775output file being linked. See man ld(1) for more information.
157a620e 8776
965a7e90 8777@item -dynamiclib
edc5f63b 8778@opindex dynamiclib
965a7e90
GK
8779When passed this option, GCC will produce a dynamic library instead of
8780an executable when linking, using the Darwin @file{libtool} command.
157a620e 8781
965a7e90 8782@item -force_cpusubtype_ALL
edc5f63b 8783@opindex force_cpusubtype_ALL
965a7e90
GK
8784This causes GCC's output file to have the @var{ALL} subtype, instead of
8785one controlled by the @option{-mcpu} or @option{-march} option.
8786
8787@item -allowable_client @var{client_name}
39bc1876
NS
8788@itemx -client_name
8789@itemx -compatibility_version
8790@itemx -current_version
5079843a 8791@itemx -dead_strip
39bc1876
NS
8792@itemx -dependency-file
8793@itemx -dylib_file
8794@itemx -dylinker_install_name
8795@itemx -dynamic
39bc1876
NS
8796@itemx -exported_symbols_list
8797@itemx -filelist
8798@itemx -flat_namespace
39bc1876
NS
8799@itemx -force_flat_namespace
8800@itemx -headerpad_max_install_names
8801@itemx -image_base
8802@itemx -init
8803@itemx -install_name
8804@itemx -keep_private_externs
8805@itemx -multi_module
8806@itemx -multiply_defined
8807@itemx -multiply_defined_unused
8808@itemx -noall_load
89aa5a20 8809@itemx -no_dead_strip_inits_and_terms
39bc1876
NS
8810@itemx -nofixprebinding
8811@itemx -nomultidefs
8812@itemx -noprebind
8813@itemx -noseglinkedit
8814@itemx -pagezero_size
8815@itemx -prebind
8816@itemx -prebind_all_twolevel_modules
8817@itemx -private_bundle
8818@itemx -read_only_relocs
8819@itemx -sectalign
8820@itemx -sectobjectsymbols
8821@itemx -whyload
8822@itemx -seg1addr
8823@itemx -sectcreate
8824@itemx -sectobjectsymbols
8825@itemx -sectorder
5826770c
DP
8826@itemx -segaddr
8827@itemx -segs_read_only_addr
8828@itemx -segs_read_write_addr
39bc1876
NS
8829@itemx -seg_addr_table
8830@itemx -seg_addr_table_filename
8831@itemx -seglinkedit
8832@itemx -segprot
8833@itemx -segs_read_only_addr
8834@itemx -segs_read_write_addr
8835@itemx -single_module
8836@itemx -static
8837@itemx -sub_library
8838@itemx -sub_umbrella
8839@itemx -twolevel_namespace
8840@itemx -umbrella
8841@itemx -undefined
8842@itemx -unexported_symbols_list
8843@itemx -weak_reference_mismatches
8844@itemx -whatsloaded
74291a4b 8845
39bc1876 8846@opindex allowable_client
39bc1876
NS
8847@opindex client_name
8848@opindex compatibility_version
8849@opindex current_version
5079843a 8850@opindex dead_strip
39bc1876
NS
8851@opindex dependency-file
8852@opindex dylib_file
8853@opindex dylinker_install_name
8854@opindex dynamic
39bc1876
NS
8855@opindex exported_symbols_list
8856@opindex filelist
8857@opindex flat_namespace
39bc1876
NS
8858@opindex force_flat_namespace
8859@opindex headerpad_max_install_names
8860@opindex image_base
8861@opindex init
8862@opindex install_name
8863@opindex keep_private_externs
8864@opindex multi_module
8865@opindex multiply_defined
8866@opindex multiply_defined_unused
8867@opindex noall_load
5079843a 8868@opindex no_dead_strip_inits_and_terms
39bc1876
NS
8869@opindex nofixprebinding
8870@opindex nomultidefs
8871@opindex noprebind
8872@opindex noseglinkedit
8873@opindex pagezero_size
8874@opindex prebind
8875@opindex prebind_all_twolevel_modules
8876@opindex private_bundle
8877@opindex read_only_relocs
8878@opindex sectalign
8879@opindex sectobjectsymbols
8880@opindex whyload
8881@opindex seg1addr
8882@opindex sectcreate
8883@opindex sectobjectsymbols
8884@opindex sectorder
5826770c
DP
8885@opindex segaddr
8886@opindex segs_read_only_addr
8887@opindex segs_read_write_addr
39bc1876
NS
8888@opindex seg_addr_table
8889@opindex seg_addr_table_filename
8890@opindex seglinkedit
8891@opindex segprot
8892@opindex segs_read_only_addr
8893@opindex segs_read_write_addr
8894@opindex single_module
8895@opindex static
8896@opindex sub_library
8897@opindex sub_umbrella
8898@opindex twolevel_namespace
8899@opindex umbrella
8900@opindex undefined
8901@opindex unexported_symbols_list
8902@opindex weak_reference_mismatches
8903@opindex whatsloaded
8904
965a7e90 8905These options are passed to the Darwin linker. The Darwin linker man page
39bc1876
NS
8906describes them in detail.
8907@end table
8908
8909@node DEC Alpha Options
8910@subsection DEC Alpha Options
8911
8912These @samp{-m} options are defined for the DEC Alpha implementations:
8913
8914@table @gcctabopt
8915@item -mno-soft-float
8916@itemx -msoft-float
8917@opindex mno-soft-float
cd3bb277 8918@opindex msoft-float
39bc1876
NS
8919Use (do not use) the hardware floating-point instructions for
8920floating-point operations. When @option{-msoft-float} is specified,
8921functions in @file{libgcc.a} will be used to perform floating-point
8922operations. Unless they are replaced by routines that emulate the
8923floating-point operations, or compiled in such a way as to call such
8924emulations routines, these routines will issue floating-point
8925operations. If you are compiling for an Alpha without floating-point
8926operations, you must ensure that the library is built so as not to call
8927them.
74291a4b 8928
39bc1876
NS
8929Note that Alpha implementations without floating-point operations are
8930required to have floating-point registers.
74291a4b 8931
39bc1876
NS
8932@item -mfp-reg
8933@itemx -mno-fp-regs
8934@opindex mfp-reg
8935@opindex mno-fp-regs
8936Generate code that uses (does not use) the floating-point register set.
8937@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
8938register set is not used, floating point operands are passed in integer
8939registers as if they were integers and floating-point results are passed
8940in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
8941so any function with a floating-point argument or return value called by code
8942compiled with @option{-mno-fp-regs} must also be compiled with that
8943option.
9b66ebb1 8944
39bc1876
NS
8945A typical use of this option is building a kernel that does not use,
8946and hence need not save and restore, any floating-point registers.
9b66ebb1 8947
39bc1876
NS
8948@item -mieee
8949@opindex mieee
8950The Alpha architecture implements floating-point hardware optimized for
8951maximum performance. It is mostly compliant with the IEEE floating
8952point standard. However, for full compliance, software assistance is
8953required. This option generates code fully IEEE compliant code
8954@emph{except} that the @var{inexact-flag} is not maintained (see below).
8955If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8956defined during compilation. The resulting code is less efficient but is
8957able to correctly support denormalized numbers and exceptional IEEE
8958values such as not-a-number and plus/minus infinity. Other Alpha
8959compilers call this option @option{-ieee_with_no_inexact}.
74291a4b 8960
39bc1876
NS
8961@item -mieee-with-inexact
8962@opindex mieee-with-inexact
8963This is like @option{-mieee} except the generated code also maintains
8964the IEEE @var{inexact-flag}. Turning on this option causes the
8965generated code to implement fully-compliant IEEE math. In addition to
8966@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8967macro. On some Alpha implementations the resulting code may execute
8968significantly slower than the code generated by default. Since there is
8969very little code that depends on the @var{inexact-flag}, you should
8970normally not specify this option. Other Alpha compilers call this
8971option @option{-ieee_with_inexact}.
74291a4b 8972
39bc1876
NS
8973@item -mfp-trap-mode=@var{trap-mode}
8974@opindex mfp-trap-mode
8975This option controls what floating-point related traps are enabled.
8976Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8977The trap mode can be set to one of four values:
74291a4b 8978
39bc1876
NS
8979@table @samp
8980@item n
8981This is the default (normal) setting. The only traps that are enabled
8982are the ones that cannot be disabled in software (e.g., division by zero
8983trap).
62b10bbc 8984
39bc1876
NS
8985@item u
8986In addition to the traps enabled by @samp{n}, underflow traps are enabled
8987as well.
157a620e 8988
39bc1876 8989@item su
90150441 8990Like @samp{u}, but the instructions are marked to be safe for software
39bc1876 8991completion (see Alpha architecture manual for details).
157a620e 8992
39bc1876
NS
8993@item sui
8994Like @samp{su}, but inexact traps are enabled as well.
8995@end table
9b66ebb1 8996
39bc1876
NS
8997@item -mfp-rounding-mode=@var{rounding-mode}
8998@opindex mfp-rounding-mode
8999Selects the IEEE rounding mode. Other Alpha compilers call this option
9000@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
9001of:
157a620e 9002
39bc1876
NS
9003@table @samp
9004@item n
9005Normal IEEE rounding mode. Floating point numbers are rounded towards
9006the nearest machine number or towards the even machine number in case
9007of a tie.
5848830f 9008
39bc1876
NS
9009@item m
9010Round towards minus infinity.
157a620e 9011
39bc1876
NS
9012@item c
9013Chopped rounding mode. Floating point numbers are rounded towards zero.
f5a1b0d2 9014
39bc1876
NS
9015@item d
9016Dynamic rounding mode. A field in the floating point control register
9017(@var{fpcr}, see Alpha architecture reference manual) controls the
9018rounding mode in effect. The C library initializes this register for
9019rounding towards plus infinity. Thus, unless your program modifies the
9020@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
9021@end table
c27ba912 9022
39bc1876
NS
9023@item -mtrap-precision=@var{trap-precision}
9024@opindex mtrap-precision
9025In the Alpha architecture, floating point traps are imprecise. This
9026means without software assistance it is impossible to recover from a
9027floating trap and program execution normally needs to be terminated.
9028GCC can generate code that can assist operating system trap handlers
9029in determining the exact location that caused a floating point trap.
9030Depending on the requirements of an application, different levels of
9031precisions can be selected:
c27ba912 9032
39bc1876
NS
9033@table @samp
9034@item p
9035Program precision. This option is the default and means a trap handler
9036can only identify which program caused a floating point exception.
c27ba912 9037
39bc1876
NS
9038@item f
9039Function precision. The trap handler can determine the function that
9040caused a floating point exception.
62b10bbc 9041
39bc1876
NS
9042@item i
9043Instruction precision. The trap handler can determine the exact
9044instruction that caused a floating point exception.
9045@end table
ed0e6530 9046
39bc1876
NS
9047Other Alpha compilers provide the equivalent options called
9048@option{-scope_safe} and @option{-resumption_safe}.
ed0e6530 9049
39bc1876
NS
9050@item -mieee-conformant
9051@opindex mieee-conformant
9052This option marks the generated code as IEEE conformant. You must not
9053use this option unless you also specify @option{-mtrap-precision=i} and either
9054@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
9055is to emit the line @samp{.eflag 48} in the function prologue of the
9056generated assembly file. Under DEC Unix, this has the effect that
9057IEEE-conformant math library routines will be linked in.
9b6b54e2 9058
39bc1876
NS
9059@item -mbuild-constants
9060@opindex mbuild-constants
9061Normally GCC examines a 32- or 64-bit integer constant to
9062see if it can construct it from smaller constants in two or three
9063instructions. If it cannot, it will output the constant as a literal and
9064generate code to load it from the data segment at runtime.
74291a4b 9065
39bc1876
NS
9066Use this option to require GCC to construct @emph{all} integer constants
9067using code, even if it takes more instructions (the maximum is six).
157a620e 9068
39bc1876
NS
9069You would typically use this option to build a shared library dynamic
9070loader. Itself a shared library, it must relocate itself in memory
9071before it can find the variables and constants in its own data segment.
9072
9073@item -malpha-as
9074@itemx -mgas
9075@opindex malpha-as
9076@opindex mgas
9077Select whether to generate code to be assembled by the vendor-supplied
9078assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
9079
9080@item -mbwx
9081@itemx -mno-bwx
9082@itemx -mcix
9083@itemx -mno-cix
9084@itemx -mfix
9085@itemx -mno-fix
9086@itemx -mmax
9087@itemx -mno-max
9088@opindex mbwx
9089@opindex mno-bwx
9090@opindex mcix
9091@opindex mno-cix
9092@opindex mfix
9093@opindex mno-fix
9094@opindex mmax
9095@opindex mno-max
9096Indicate whether GCC should generate code to use the optional BWX,
9097CIX, FIX and MAX instruction sets. The default is to use the instruction
9098sets supported by the CPU type specified via @option{-mcpu=} option or that
9099of the CPU on which GCC was built if none was specified.
157a620e 9100
39bc1876
NS
9101@item -mfloat-vax
9102@itemx -mfloat-ieee
9103@opindex mfloat-vax
9104@opindex mfloat-ieee
9105Generate code that uses (does not use) VAX F and G floating point
9106arithmetic instead of IEEE single and double precision.
157a620e 9107
39bc1876
NS
9108@item -mexplicit-relocs
9109@itemx -mno-explicit-relocs
9110@opindex mexplicit-relocs
9111@opindex mno-explicit-relocs
9112Older Alpha assemblers provided no way to generate symbol relocations
9113except via assembler macros. Use of these macros does not allow
9114optimal instruction scheduling. GNU binutils as of version 2.12
9115supports a new syntax that allows the compiler to explicitly mark
9116which relocations should apply to which instructions. This option
9117is mostly useful for debugging, as GCC detects the capabilities of
9118the assembler when it is built and sets the default accordingly.
157a620e 9119
39bc1876
NS
9120@item -msmall-data
9121@itemx -mlarge-data
9122@opindex msmall-data
9123@opindex mlarge-data
9124When @option{-mexplicit-relocs} is in effect, static data is
9125accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
9126is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
9127(the @code{.sdata} and @code{.sbss} sections) and are accessed via
912816-bit relocations off of the @code{$gp} register. This limits the
9129size of the small data area to 64KB, but allows the variables to be
9130directly accessed via a single instruction.
62b10bbc 9131
39bc1876 9132The default is @option{-mlarge-data}. With this option the data area
8a36672b 9133is limited to just below 2GB@. Programs that require more than 2GB of
39bc1876
NS
9134data must use @code{malloc} or @code{mmap} to allocate the data in the
9135heap instead of in the program's data segment.
62b10bbc 9136
39bc1876
NS
9137When generating code for shared libraries, @option{-fpic} implies
9138@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
4bdc1ac7 9139
39bc1876
NS
9140@item -msmall-text
9141@itemx -mlarge-text
9142@opindex msmall-text
9143@opindex mlarge-text
9144When @option{-msmall-text} is used, the compiler assumes that the
9145code of the entire program (or shared library) fits in 4MB, and is
9146thus reachable with a branch instruction. When @option{-msmall-data}
9147is used, the compiler can assume that all local symbols share the
9148same @code{$gp} value, and thus reduce the number of instructions
9149required for a function call from 4 to 1.
157a620e 9150
39bc1876 9151The default is @option{-mlarge-text}.
d2d42a91 9152
39bc1876
NS
9153@item -mcpu=@var{cpu_type}
9154@opindex mcpu
9155Set the instruction set and instruction scheduling parameters for
9156machine type @var{cpu_type}. You can specify either the @samp{EV}
9157style name or the corresponding chip number. GCC supports scheduling
9158parameters for the EV4, EV5 and EV6 family of processors and will
9159choose the default values for the instruction set from the processor
9160you specify. If you do not specify a processor type, GCC will default
9161to the processor on which the compiler was built.
6d6d0fa0 9162
39bc1876 9163Supported values for @var{cpu_type} are
6d6d0fa0 9164
39bc1876
NS
9165@table @samp
9166@item ev4
9167@itemx ev45
9168@itemx 21064
9169Schedules as an EV4 and has no instruction set extensions.
ecff22ab 9170
39bc1876
NS
9171@item ev5
9172@itemx 21164
9173Schedules as an EV5 and has no instruction set extensions.
705ac34f 9174
39bc1876
NS
9175@item ev56
9176@itemx 21164a
9177Schedules as an EV5 and supports the BWX extension.
705ac34f 9178
39bc1876
NS
9179@item pca56
9180@itemx 21164pc
9181@itemx 21164PC
9182Schedules as an EV5 and supports the BWX and MAX extensions.
c474f76b 9183
39bc1876
NS
9184@item ev6
9185@itemx 21264
9186Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
ecff22ab 9187
39bc1876
NS
9188@item ev67
9189@itemx 21264a
9190Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
6d6d0fa0
JL
9191@end table
9192
39bc1876
NS
9193@item -mtune=@var{cpu_type}
9194@opindex mtune
9195Set only the instruction scheduling parameters for machine type
9196@var{cpu_type}. The instruction set is not changed.
ecff22ab 9197
39bc1876
NS
9198@item -mmemory-latency=@var{time}
9199@opindex mmemory-latency
9200Sets the latency the scheduler should assume for typical memory
9201references as seen by the application. This number is highly
9202dependent on the memory access patterns used by the application
9203and the size of the external cache on the machine.
861bb6c1 9204
39bc1876 9205Valid options for @var{time} are
6975bd2c 9206
39bc1876
NS
9207@table @samp
9208@item @var{number}
9209A decimal number representing clock cycles.
98180123 9210
39bc1876
NS
9211@item L1
9212@itemx L2
9213@itemx L3
9214@itemx main
9215The compiler contains estimates of the number of clock cycles for
9216``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
9217(also called Dcache, Scache, and Bcache), as well as to main memory.
9218Note that L3 is only valid for EV5.
de41e41c 9219
39bc1876
NS
9220@end table
9221@end table
861bb6c1 9222
39bc1876
NS
9223@node DEC Alpha/VMS Options
9224@subsection DEC Alpha/VMS Options
861bb6c1 9225
39bc1876 9226These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
861bb6c1 9227
39bc1876
NS
9228@table @gcctabopt
9229@item -mvms-return-codes
9230@opindex mvms-return-codes
9231Return VMS condition codes from main. The default is to return POSIX
9232style condition (e.g.@ error) codes.
9233@end table
861bb6c1 9234
39bc1876
NS
9235@node FRV Options
9236@subsection FRV Options
9237@cindex FRV Options
861bb6c1 9238
39bc1876
NS
9239@table @gcctabopt
9240@item -mgpr-32
9241@opindex mgpr-32
861bb6c1 9242
39bc1876 9243Only use the first 32 general purpose registers.
861bb6c1 9244
39bc1876
NS
9245@item -mgpr-64
9246@opindex mgpr-64
861bb6c1 9247
39bc1876 9248Use all 64 general purpose registers.
861bb6c1 9249
39bc1876
NS
9250@item -mfpr-32
9251@opindex mfpr-32
861bb6c1 9252
39bc1876 9253Use only the first 32 floating point registers.
ad126521 9254
39bc1876
NS
9255@item -mfpr-64
9256@opindex mfpr-64
ad126521 9257
39bc1876 9258Use all 64 floating point registers
ad126521 9259
39bc1876
NS
9260@item -mhard-float
9261@opindex mhard-float
ad126521 9262
39bc1876 9263Use hardware instructions for floating point operations.
ad126521 9264
39bc1876
NS
9265@item -msoft-float
9266@opindex msoft-float
ad126521 9267
39bc1876 9268Use library routines for floating point operations.
ad126521 9269
39bc1876
NS
9270@item -malloc-cc
9271@opindex malloc-cc
ad126521 9272
39bc1876 9273Dynamically allocate condition code registers.
ad126521 9274
39bc1876
NS
9275@item -mfixed-cc
9276@opindex mfixed-cc
861bb6c1 9277
39bc1876
NS
9278Do not try to dynamically allocate condition code registers, only
9279use @code{icc0} and @code{fcc0}.
74291a4b 9280
39bc1876
NS
9281@item -mdword
9282@opindex mdword
74291a4b 9283
39bc1876 9284Change ABI to use double word insns.
74291a4b 9285
39bc1876
NS
9286@item -mno-dword
9287@opindex mno-dword
74291a4b 9288
39bc1876 9289Do not use double word instructions.
74291a4b 9290
39bc1876
NS
9291@item -mdouble
9292@opindex mdouble
74291a4b 9293
39bc1876 9294Use floating point double instructions.
7fe90e7b 9295
39bc1876
NS
9296@item -mno-double
9297@opindex mno-double
74291a4b 9298
39bc1876 9299Do not use floating point double instructions.
74291a4b 9300
39bc1876
NS
9301@item -mmedia
9302@opindex mmedia
74291a4b 9303
39bc1876 9304Use media instructions.
9c34dbbf 9305
39bc1876
NS
9306@item -mno-media
9307@opindex mno-media
74291a4b 9308
39bc1876 9309Do not use media instructions.
74291a4b 9310
39bc1876
NS
9311@item -mmuladd
9312@opindex mmuladd
9c34dbbf 9313
39bc1876 9314Use multiply and add/subtract instructions.
66188a7e 9315
39bc1876
NS
9316@item -mno-muladd
9317@opindex mno-muladd
74291a4b 9318
39bc1876 9319Do not use multiply and add/subtract instructions.
74291a4b 9320
d711cf67
JDA
9321@item -mfdpic
9322@opindex mfdpic
9323
9324Select the FDPIC ABI, that uses function descriptors to represent
9325pointers to functions. Without any PIC/PIE-related options, it
9326implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
9327assumes GOT entries and small data are within a 12-bit range from the
9328GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
9329are computed with 32 bits.
9330
9331@item -minline-plt
9332@opindex minline-plt
9333
9334Enable inlining of PLT entries in function calls to functions that are
9335not known to bind locally. It has no effect without @option{-mfdpic}.
9336It's enabled by default if optimizing for speed and compiling for
9337shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
9338optimization option such as @option{-O3} or above is present in the
9339command line.
9340
e4dd71de
AH
9341@item -mTLS
9342@opindex TLS
9343
9344Assume a large TLS segment when generating thread-local code.
9345
9346@item -mtls
9347@opindex tls
9348
9349Do not assume a large TLS segment when generating thread-local code.
9350
d711cf67
JDA
9351@item -mgprel-ro
9352@opindex mgprel-ro
9353
9354Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
9355that is known to be in read-only sections. It's enabled by default,
9356except for @option{-fpic} or @option{-fpie}: even though it may help
9357make the global offset table smaller, it trades 1 instruction for 4.
9358With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
9359one of which may be shared by multiple symbols, and it avoids the need
9360for a GOT entry for the referenced symbol, so it's more likely to be a
9361win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
9362
9363@item -multilib-library-pic
9364@opindex multilib-library-pic
9365
9366Link with the (library, not FD) pic libraries. It's implied by
9367@option{-mlibrary-pic}, as well as by @option{-fPIC} and
9368@option{-fpic} without @option{-mfdpic}. You should never have to use
9369it explicitly.
9370
9371@item -mlinked-fp
9372@opindex mlinked-fp
9373
9374Follow the EABI requirement of always creating a frame pointer whenever
9375a stack frame is allocated. This option is enabled by default and can
9376be disabled with @option{-mno-linked-fp}.
9377
c557edf4
RS
9378@item -mlong-calls
9379@opindex mlong-calls
9380
9381Use indirect addressing to call functions outside the current
9382compilation unit. This allows the functions to be placed anywhere
9383within the 32-bit address space.
9384
9385@item -malign-labels
9386@opindex malign-labels
9387
9388Try to align labels to an 8-byte boundary by inserting nops into the
9389previous packet. This option only has an effect when VLIW packing
9390is enabled. It doesn't create new packets; it merely adds nops to
9391existing ones.
9392
39bc1876
NS
9393@item -mlibrary-pic
9394@opindex mlibrary-pic
0ac081f6 9395
39bc1876 9396Generate position-independent EABI code.
6c8875e5 9397
39bc1876
NS
9398@item -macc-4
9399@opindex macc-4
6c8875e5 9400
39bc1876 9401Use only the first four media accumulator registers.
6c8875e5 9402
39bc1876
NS
9403@item -macc-8
9404@opindex macc-8
993f19a8 9405
39bc1876 9406Use all eight media accumulator registers.
5da702b1 9407
39bc1876
NS
9408@item -mpack
9409@opindex mpack
74291a4b 9410
39bc1876 9411Pack VLIW instructions.
74291a4b 9412
39bc1876
NS
9413@item -mno-pack
9414@opindex mno-pack
74291a4b 9415
39bc1876 9416Do not pack VLIW instructions.
7fe90e7b 9417
39bc1876
NS
9418@item -mno-eflags
9419@opindex mno-eflags
74291a4b 9420
39bc1876 9421Do not mark ABI switches in e_flags.
861bb6c1 9422
39bc1876
NS
9423@item -mcond-move
9424@opindex mcond-move
6184e8a4 9425
39bc1876 9426Enable the use of conditional-move instructions (default).
74291a4b 9427
39bc1876
NS
9428This switch is mainly for debugging the compiler and will likely be removed
9429in a future version.
74291a4b 9430
39bc1876
NS
9431@item -mno-cond-move
9432@opindex mno-cond-move
74291a4b 9433
39bc1876 9434Disable the use of conditional-move instructions.
861bb6c1 9435
39bc1876
NS
9436This switch is mainly for debugging the compiler and will likely be removed
9437in a future version.
861bb6c1 9438
39bc1876
NS
9439@item -mscc
9440@opindex mscc
74291a4b 9441
39bc1876 9442Enable the use of conditional set instructions (default).
74291a4b 9443
39bc1876
NS
9444This switch is mainly for debugging the compiler and will likely be removed
9445in a future version.
74291a4b 9446
39bc1876
NS
9447@item -mno-scc
9448@opindex mno-scc
74291a4b 9449
39bc1876 9450Disable the use of conditional set instructions.
74291a4b 9451
39bc1876
NS
9452This switch is mainly for debugging the compiler and will likely be removed
9453in a future version.
74291a4b 9454
39bc1876
NS
9455@item -mcond-exec
9456@opindex mcond-exec
74291a4b 9457
39bc1876 9458Enable the use of conditional execution (default).
74291a4b 9459
39bc1876
NS
9460This switch is mainly for debugging the compiler and will likely be removed
9461in a future version.
ab82a49f 9462
39bc1876
NS
9463@item -mno-cond-exec
9464@opindex mno-cond-exec
79ae11c4 9465
39bc1876 9466Disable the use of conditional execution.
daf2f129 9467
39bc1876
NS
9468This switch is mainly for debugging the compiler and will likely be removed
9469in a future version.
cbe26ab8 9470
39bc1876
NS
9471@item -mvliw-branch
9472@opindex mvliw-branch
9473
9474Run a pass to pack branches into VLIW instructions (default).
9475
9476This switch is mainly for debugging the compiler and will likely be removed
9477in a future version.
9478
9479@item -mno-vliw-branch
9480@opindex mno-vliw-branch
9481
9482Do not run a pass to pack branches into VLIW instructions.
9483
9484This switch is mainly for debugging the compiler and will likely be removed
9485in a future version.
74291a4b 9486
39bc1876
NS
9487@item -mmulti-cond-exec
9488@opindex mmulti-cond-exec
74291a4b 9489
39bc1876
NS
9490Enable optimization of @code{&&} and @code{||} in conditional execution
9491(default).
74291a4b 9492
39bc1876
NS
9493This switch is mainly for debugging the compiler and will likely be removed
9494in a future version.
74291a4b 9495
39bc1876
NS
9496@item -mno-multi-cond-exec
9497@opindex mno-multi-cond-exec
74291a4b 9498
39bc1876 9499Disable optimization of @code{&&} and @code{||} in conditional execution.
48180d68 9500
39bc1876
NS
9501This switch is mainly for debugging the compiler and will likely be removed
9502in a future version.
edf1b3f3 9503
39bc1876
NS
9504@item -mnested-cond-exec
9505@opindex mnested-cond-exec
9904592e 9506
39bc1876 9507Enable nested conditional execution optimizations (default).
9904592e 9508
39bc1876
NS
9509This switch is mainly for debugging the compiler and will likely be removed
9510in a future version.
0ac081f6 9511
39bc1876
NS
9512@item -mno-nested-cond-exec
9513@opindex mno-nested-cond-exec
76a773f3 9514
39bc1876 9515Disable nested conditional execution optimizations.
74291a4b 9516
39bc1876
NS
9517This switch is mainly for debugging the compiler and will likely be removed
9518in a future version.
74291a4b 9519
38c28a25
AH
9520@item -moptimize-membar
9521@opindex moptimize-membar
9522
9523This switch removes redundant @code{membar} instructions from the
9524compiler generated code. It is enabled by default.
9525
9526@item -mno-optimize-membar
9527@opindex mno-optimize-membar
9528
9529This switch disables the automatic removal of redundant @code{membar}
9530instructions from the generated code.
9531
39bc1876
NS
9532@item -mtomcat-stats
9533@opindex mtomcat-stats
e9a25f70 9534
39bc1876 9535Cause gas to print out tomcat statistics.
e9a25f70 9536
39bc1876
NS
9537@item -mcpu=@var{cpu}
9538@opindex mcpu
74291a4b 9539
39bc1876 9540Select the processor type for which to generate code. Possible values are
c557edf4
RS
9541@samp{frv}, @samp{fr550}, @samp{tomcat}, @samp{fr500}, @samp{fr450},
9542@samp{fr405}, @samp{fr400}, @samp{fr300} and @samp{simple}.
bff46771 9543
39bc1876 9544@end table
8d8269fa 9545
464aea98
JM
9546@node GNU/Linux Options
9547@subsection GNU/Linux Options
9548
9549These @samp{-m} options are defined for GNU/Linux targets:
9550
9551@table @gcctabopt
9552@item -mglibc
9553@opindex mglibc
9554Use the GNU C library instead of uClibc. This is the default except
9555on @samp{*-*-linux-*uclibc*} targets.
9556
9557@item -muclibc
9558@opindex muclibc
9559Use uClibc instead of the GNU C library. This is the default on
7bd85ce0 9560@samp{*-*-linux-*uclibc*} targets.
464aea98
JM
9561@end table
9562
39bc1876
NS
9563@node H8/300 Options
9564@subsection H8/300 Options
74291a4b 9565
39bc1876 9566These @samp{-m} options are defined for the H8/300 implementations:
74291a4b 9567
39bc1876
NS
9568@table @gcctabopt
9569@item -mrelax
9570@opindex mrelax
9571Shorten some address references at link time, when possible; uses the
9572linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
9573ld, Using ld}, for a fuller description.
74291a4b 9574
39bc1876
NS
9575@item -mh
9576@opindex mh
9577Generate code for the H8/300H@.
74291a4b 9578
39bc1876
NS
9579@item -ms
9580@opindex ms
9581Generate code for the H8S@.
74291a4b 9582
39bc1876
NS
9583@item -mn
9584@opindex mn
9585Generate code for the H8S and H8/300H in the normal mode. This switch
4ec7afd7 9586must be used either with @option{-mh} or @option{-ms}.
74291a4b 9587
39bc1876
NS
9588@item -ms2600
9589@opindex ms2600
9590Generate code for the H8S/2600. This switch must be used with @option{-ms}.
74291a4b 9591
39bc1876
NS
9592@item -mint32
9593@opindex mint32
9594Make @code{int} data 32 bits by default.
74291a4b 9595
39bc1876
NS
9596@item -malign-300
9597@opindex malign-300
9598On the H8/300H and H8S, use the same alignment rules as for the H8/300.
9599The default for the H8/300H and H8S is to align longs and floats on 4
9600byte boundaries.
9601@option{-malign-300} causes them to be aligned on 2 byte boundaries.
9602This option has no effect on the H8/300.
9603@end table
f5a1b0d2 9604
39bc1876
NS
9605@node HPPA Options
9606@subsection HPPA Options
9607@cindex HPPA Options
a5c76ee6 9608
39bc1876 9609These @samp{-m} options are defined for the HPPA family of computers:
a5c76ee6 9610
39bc1876
NS
9611@table @gcctabopt
9612@item -march=@var{architecture-type}
9613@opindex march
9614Generate code for the specified architecture. The choices for
9615@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
96161.1, and @samp{2.0} for PA 2.0 processors. Refer to
9617@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
9618architecture option for your machine. Code compiled for lower numbered
9619architectures will run on higher numbered architectures, but not the
9620other way around.
9621
39bc1876
NS
9622@item -mpa-risc-1-0
9623@itemx -mpa-risc-1-1
9624@itemx -mpa-risc-2-0
9625@opindex mpa-risc-1-0
9626@opindex mpa-risc-1-1
9627@opindex mpa-risc-2-0
9628Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
5a26b329 9629
39bc1876
NS
9630@item -mbig-switch
9631@opindex mbig-switch
9632Generate code suitable for big switch tables. Use this option only if
9633the assembler/linker complain about out of range branches within a switch
9634table.
efdba735 9635
39bc1876
NS
9636@item -mjump-in-delay
9637@opindex mjump-in-delay
9638Fill delay slots of function calls with unconditional jump instructions
9639by modifying the return pointer for the function call to be the target
9640of the conditional jump.
a5c76ee6 9641
39bc1876
NS
9642@item -mdisable-fpregs
9643@opindex mdisable-fpregs
9644Prevent floating point registers from being used in any manner. This is
9645necessary for compiling kernels which perform lazy context switching of
9646floating point registers. If you use this option and attempt to perform
9647floating point operations, the compiler will abort.
0a379b7a 9648
39bc1876
NS
9649@item -mdisable-indexing
9650@opindex mdisable-indexing
9651Prevent the compiler from using indexing address modes. This avoids some
9652rather obscure problems when compiling MIG generated code under MACH@.
f5a1b0d2 9653
39bc1876
NS
9654@item -mno-space-regs
9655@opindex mno-space-regs
9656Generate code that assumes the target has no space registers. This allows
9657GCC to generate faster indirect calls and use unscaled index address modes.
d2d42a91 9658
39bc1876 9659Such code is suitable for level 0 PA systems and kernels.
d2d42a91 9660
39bc1876
NS
9661@item -mfast-indirect-calls
9662@opindex mfast-indirect-calls
9663Generate code that assumes calls never cross space boundaries. This
9664allows GCC to emit code which performs faster indirect calls.
f08a3544 9665
39bc1876
NS
9666This option will not work in the presence of shared libraries or nested
9667functions.
f08a3544 9668
a2017852
JDA
9669@item -mfixed-range=@var{register-range}
9670@opindex mfixed-range
9671Generate code treating the given register range as fixed registers.
9672A fixed register is one that the register allocator can not use. This is
9673useful when compiling kernel code. A register range is specified as
9674two registers separated by a dash. Multiple register ranges can be
9675specified separated by a comma.
9676
39bc1876
NS
9677@item -mlong-load-store
9678@opindex mlong-load-store
9679Generate 3-instruction load and store sequences as sometimes required by
9680the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
9681the HP compilers.
61c85ff1 9682
39bc1876
NS
9683@item -mportable-runtime
9684@opindex mportable-runtime
9685Use the portable calling conventions proposed by HP for ELF systems.
61c85ff1 9686
39bc1876
NS
9687@item -mgas
9688@opindex mgas
9689Enable the use of assembler directives only GAS understands.
61c85ff1 9690
39bc1876
NS
9691@item -mschedule=@var{cpu-type}
9692@opindex mschedule
9693Schedule code according to the constraints for the machine type
9694@var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
9695@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
9696to @file{/usr/lib/sched.models} on an HP-UX system to determine the
9697proper scheduling option for your machine. The default scheduling is
9698@samp{8000}.
61c85ff1 9699
39bc1876
NS
9700@item -mlinker-opt
9701@opindex mlinker-opt
9702Enable the optimization pass in the HP-UX linker. Note this makes symbolic
9703debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
9704linkers in which they give bogus error messages when linking some programs.
61c85ff1 9705
39bc1876
NS
9706@item -msoft-float
9707@opindex msoft-float
9708Generate output containing library calls for floating point.
9709@strong{Warning:} the requisite libraries are not available for all HPPA
9710targets. Normally the facilities of the machine's usual C compiler are
9711used, but this cannot be done directly in cross-compilation. You must make
9712your own arrangements to provide suitable library functions for
9713cross-compilation. The embedded target @samp{hppa1.1-*-pro}
9714does provide software floating point support.
31775d31 9715
39bc1876
NS
9716@option{-msoft-float} changes the calling convention in the output file;
9717therefore, it is only useful if you compile @emph{all} of a program with
9718this option. In particular, you need to compile @file{libgcc.a}, the
9719library that comes with GCC, with @option{-msoft-float} in order for
9720this to work.
61c85ff1 9721
39bc1876
NS
9722@item -msio
9723@opindex msio
8a36672b 9724Generate the predefine, @code{_SIO}, for server IO@. The default is
39bc1876 9725@option{-mwsio}. This generates the predefines, @code{__hp9000s700},
8a36672b
JM
9726@code{__hp9000s700__} and @code{_WSIO}, for workstation IO@. These
9727options are available under HP-UX and HI-UX@.
39bc1876
NS
9728
9729@item -mgnu-ld
9730@opindex gnu-ld
9731Use GNU ld specific options. This passes @option{-shared} to ld when
9732building a shared library. It is the default when GCC is configured,
9733explicitly or implicitly, with the GNU linker. This option does not
9734have any affect on which ld is called, it only changes what parameters
9735are passed to that ld. The ld that is called is determined by the
9736@option{--with-ld} configure option, GCC's program search path, and
9737finally by the user's @env{PATH}. The linker used by GCC can be printed
a73035ae
SE
9738using @samp{which `gcc -print-prog-name=ld`}. This option is only available
9739on the 64 bit HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
48aec0bc 9740
39bc1876
NS
9741@item -mhp-ld
9742@opindex hp-ld
9743Use HP ld specific options. This passes @option{-b} to ld when building
9744a shared library and passes @option{+Accept TypeMismatch} to ld on all
9745links. It is the default when GCC is configured, explicitly or
9746implicitly, with the HP linker. This option does not have any affect on
9747which ld is called, it only changes what parameters are passed to that
9748ld. The ld that is called is determined by the @option{--with-ld}
9749configure option, GCC's program search path, and finally by the user's
9750@env{PATH}. The linker used by GCC can be printed using @samp{which
a73035ae
SE
9751`gcc -print-prog-name=ld`}. This option is only available on the 64 bit
9752HP-UX GCC, i.e. configured with @samp{hppa*64*-*-hpux*}.
48aec0bc 9753
39bc1876
NS
9754@item -mlong-calls
9755@opindex mno-long-calls
9756Generate code that uses long call sequences. This ensures that a call
9757is always able to reach linker generated stubs. The default is to generate
9758long calls only when the distance from the call site to the beginning
9759of the function or translation unit, as the case may be, exceeds a
9760predefined limit set by the branch type being used. The limits for
9761normal calls are 7,600,000 and 240,000 bytes, respectively for the
9762PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
9763240,000 bytes.
a27fb29b 9764
39bc1876
NS
9765Distances are measured from the beginning of functions when using the
9766@option{-ffunction-sections} option, or when using the @option{-mgas}
9767and @option{-mno-portable-runtime} options together under HP-UX with
9768the SOM linker.
7dac2f89 9769
39bc1876
NS
9770It is normally not desirable to use this option as it will degrade
9771performance. However, it may be useful in large applications,
9772particularly when partial linking is used to build the application.
74291a4b 9773
39bc1876
NS
9774The types of long calls used depends on the capabilities of the
9775assembler and linker, and the type of code being generated. The
9776impact on systems that support long absolute calls, and long pic
9777symbol-difference or pc-relative calls should be relatively small.
9778However, an indirect call is used on 32-bit ELF systems in pic code
9779and it is quite long.
74291a4b 9780
d711cf67
JDA
9781@item -munix=@var{unix-std}
9782@opindex march
9783Generate compiler predefines and select a startfile for the specified
9784UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
9785and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
9786is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
978711.11 and later. The default values are @samp{93} for HP-UX 10.00,
9788@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
9789and later.
9790
9791@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
9792@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
9793and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
9794@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
9795@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
9796@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
9797
9798It is @emph{important} to note that this option changes the interfaces
9799for various library routines. It also affects the operational behavior
9800of the C library. Thus, @emph{extreme} care is needed in using this
9801option.
9802
9803Library code that is intended to operate with more than one UNIX
9804standard must test, set and restore the variable @var{__xpg4_extended_mask}
9805as appropriate. Most GNU software doesn't provide this capability.
9806
39bc1876
NS
9807@item -nolibdld
9808@opindex nolibdld
9809Suppress the generation of link options to search libdld.sl when the
9810@option{-static} option is specified on HP-UX 10 and later.
9811
9812@item -static
9813@opindex static
9814The HP-UX implementation of setlocale in libc has a dependency on
9815libdld.sl. There isn't an archive version of libdld.sl. Thus,
9816when the @option{-static} option is specified, special link options
9817are needed to resolve this dependency.
9818
9819On HP-UX 10 and later, the GCC driver adds the necessary options to
9820link with libdld.sl when the @option{-static} option is specified.
9821This causes the resulting binary to be dynamic. On the 64-bit port,
9822the linkers generate dynamic binaries by default in any case. The
9823@option{-nolibdld} option can be used to prevent the GCC driver from
9824adding these link options.
9825
9826@item -threads
9827@opindex threads
9828Add support for multithreading with the @dfn{dce thread} library
8a36672b 9829under HP-UX@. This option sets flags for both the preprocessor and
39bc1876
NS
9830linker.
9831@end table
9832
9833@node i386 and x86-64 Options
9834@subsection Intel 386 and AMD x86-64 Options
9835@cindex i386 Options
9836@cindex x86-64 Options
9837@cindex Intel 386 Options
9838@cindex AMD x86-64 Options
9839
9840These @samp{-m} options are defined for the i386 and x86-64 family of
9841computers:
9842
9843@table @gcctabopt
9844@item -mtune=@var{cpu-type}
9845@opindex mtune
9846Tune to @var{cpu-type} everything applicable about the generated code, except
9847for the ABI and the set of available instructions. The choices for
9848@var{cpu-type} are:
9849@table @emph
786872fd
JH
9850@item generic
9851Produce code optimized for the most common IA32/AMD64/EM64T processors.
9852If you know the CPU on which your code will run, then you should use
9853the corresponding @option{-mtune} option instead of
9854@option{-mtune=generic}. But, if you do not know exactly what CPU users
9855of your application will have, then you should use this option.
9856
9857As new processors are deployed in the marketplace, the behavior of this
9858option will change. Therefore, if you upgrade to a newer version of
9859GCC, the code generated option will change to reflect the processors
9860that were most common when that version of GCC was released.
9861
9862There is no @option{-march=generic} option because @option{-march}
9863indicates the instruction set the compiler can use, and there is no
9864generic instruction set applicable to all processors. In contrast,
9865@option{-mtune} indicates the processor (or, in this case, collection of
9866processors) for which the code is optimized.
fa959ce4
MM
9867@item native
9868This selects the CPU to tune for at compilation time by determining
9869the processor type of the compiling machine. Using @option{-mtune=native}
9870will produce code optimized for the local machine under the constraints
9871of the selected instruction set. Using @option{-march=native} will
9872enable all instruction subsets supported by the local machine (hence
9873the result might not run on different machines).
39bc1876 9874@item i386
8a36672b 9875Original Intel's i386 CPU@.
39bc1876 9876@item i486
8a36672b 9877Intel's i486 CPU@. (No scheduling is implemented for this chip.)
39bc1876
NS
9878@item i586, pentium
9879Intel Pentium CPU with no MMX support.
9880@item pentium-mmx
9881Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
786872fd 9882@item pentiumpro
8a36672b 9883Intel PentiumPro CPU@.
786872fd
JH
9884@item i686
9885Same as @code{generic}, but when used as @code{march} option, PentiumPro
917f1b7e 9886instruction set will be used, so the code will run on all i686 family chips.
39bc1876
NS
9887@item pentium2
9888Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
9889@item pentium3, pentium3m
9890Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
9891support.
9892@item pentium-m
9893Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
9894support. Used by Centrino notebooks.
9895@item pentium4, pentium4m
9896Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
9897@item prescott
9898Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
9899set support.
9900@item nocona
9901Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
9902SSE2 and SSE3 instruction set support.
05f85dbb
VM
9903@item core2
9904Intel Core2 CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3 and SSSE3
9905instruction set support.
39bc1876
NS
9906@item k6
9907AMD K6 CPU with MMX instruction set support.
9908@item k6-2, k6-3
9909Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
9910@item athlon, athlon-tbird
9911AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
9912support.
9913@item athlon-4, athlon-xp, athlon-mp
9914Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
9915instruction set support.
9916@item k8, opteron, athlon64, athlon-fx
9917AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
9918MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
ed99bffc
DR
9919@item k8-sse3, opteron-sse3, athlon64-sse3
9920Improved versions of k8, opteron and athlon64 with SSE3 instruction set support.
aafc814c 9921@item amdfam10, barcelona
d8f52b02 9922AMD Family 10h core based CPUs with x86-64 instruction set support. (This
21efb4d4
HJ
9923supersets MMX, SSE, SSE2, SSE3, SSE4A, 3dNOW!, enhanced 3dNOW!, ABM and 64-bit
9924instruction set extensions.)
39bc1876
NS
9925@item winchip-c6
9926IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
9927set support.
9928@item winchip2
9929IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
9930instruction set support.
9931@item c3
8a36672b 9932Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is
39bc1876
NS
9933implemented for this chip.)
9934@item c3-2
9935Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
9936implemented for this chip.)
cfe1b18f
VM
9937@item geode
9938Embedded AMD CPU with MMX and 3dNOW! instruction set support.
39bc1876
NS
9939@end table
9940
9941While picking a specific @var{cpu-type} will schedule things appropriately
9942for that particular chip, the compiler will not generate any code that
9943does not run on the i386 without the @option{-march=@var{cpu-type}} option
9944being used.
9945
9946@item -march=@var{cpu-type}
9947@opindex march
9948Generate instructions for the machine type @var{cpu-type}. The choices
9949for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
9950specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
74291a4b 9951
39bc1876
NS
9952@item -mcpu=@var{cpu-type}
9953@opindex mcpu
9954A deprecated synonym for @option{-mtune}.
3398f47f 9955
39bc1876
NS
9956@item -mfpmath=@var{unit}
9957@opindex march
9958Generate floating point arithmetics for selected unit @var{unit}. The choices
9959for @var{unit} are:
2d2a50c3 9960
39bc1876
NS
9961@table @samp
9962@item 387
9963Use the standard 387 floating point coprocessor present majority of chips and
9964emulated otherwise. Code compiled with this option will run almost everywhere.
9965The temporary results are computed in 80bit precision instead of precision
9966specified by the type resulting in slightly different results compared to most
8a36672b 9967of other chips. See @option{-ffloat-store} for more detailed description.
74291a4b 9968
39bc1876 9969This is the default choice for i386 compiler.
74291a4b 9970
39bc1876
NS
9971@item sse
9972Use scalar floating point instructions present in the SSE instruction set.
9973This instruction set is supported by Pentium3 and newer chips, in the AMD line
9974by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
9975instruction set supports only single precision arithmetics, thus the double and
9976extended precision arithmetics is still done using 387. Later version, present
9977only in Pentium4 and the future AMD x86-64 chips supports double precision
9978arithmetics too.
a27fb29b 9979
c2b43d7a
UB
9980For the i386 compiler, you need to use @option{-march=@var{cpu-type}}, @option{-msse}
9981or @option{-msse2} switches to enable SSE extensions and make this option
9982effective. For the x86-64 compiler, these extensions are enabled by default.
3398f47f 9983
39bc1876
NS
9984The resulting code should be considerably faster in the majority of cases and avoid
9985the numerical instability problems of 387 code, but may break some existing
9986code that expects temporaries to be 80bit.
cd3f11a6 9987
39bc1876 9988This is the default choice for the x86-64 compiler.
74291a4b 9989
39bc1876
NS
9990@item sse,387
9991Attempt to utilize both instruction sets at once. This effectively double the
9992amount of available registers and on chips with separate execution units for
9993387 and SSE the execution resources too. Use this option with care, as it is
9994still experimental, because the GCC register allocator does not model separate
9995functional units well resulting in instable performance.
9996@end table
ee692410 9997
39bc1876
NS
9998@item -masm=@var{dialect}
9999@opindex masm=@var{dialect}
1f4c2c57
MS
10000Output asm instructions using selected @var{dialect}. Supported
10001choices are @samp{intel} or @samp{att} (the default one). Darwin does
13b3c362 10002not support @samp{intel}.
ee692410 10003
39bc1876
NS
10004@item -mieee-fp
10005@itemx -mno-ieee-fp
10006@opindex mieee-fp
10007@opindex mno-ieee-fp
10008Control whether or not the compiler uses IEEE floating point
10009comparisons. These handle correctly the case where the result of a
10010comparison is unordered.
ee692410 10011
39bc1876
NS
10012@item -msoft-float
10013@opindex msoft-float
10014Generate output containing library calls for floating point.
10015@strong{Warning:} the requisite libraries are not part of GCC@.
10016Normally the facilities of the machine's usual C compiler are used, but
10017this can't be done directly in cross-compilation. You must make your
10018own arrangements to provide suitable library functions for
10019cross-compilation.
ee692410 10020
39bc1876
NS
10021On machines where a function returns floating point results in the 80387
10022register stack, some floating point opcodes may be emitted even if
10023@option{-msoft-float} is used.
ee692410 10024
39bc1876
NS
10025@item -mno-fp-ret-in-387
10026@opindex mno-fp-ret-in-387
10027Do not use the FPU registers for return values of functions.
ee692410 10028
39bc1876
NS
10029The usual calling convention has functions return values of types
10030@code{float} and @code{double} in an FPU register, even if there
10031is no FPU@. The idea is that the operating system should emulate
10032an FPU@.
5a4b3afd 10033
39bc1876
NS
10034The option @option{-mno-fp-ret-in-387} causes such values to be returned
10035in ordinary CPU registers instead.
5a4b3afd 10036
39bc1876
NS
10037@item -mno-fancy-math-387
10038@opindex mno-fancy-math-387
10039Some 387 emulators do not support the @code{sin}, @code{cos} and
10040@code{sqrt} instructions for the 387. Specify this option to avoid
10041generating those instructions. This option is the default on FreeBSD,
10042OpenBSD and NetBSD@. This option is overridden when @option{-march}
10043indicates that the target cpu will always have an FPU and so the
10044instruction will not need emulation. As of revision 2.6.1, these
10045instructions are not generated unless you also use the
10046@option{-funsafe-math-optimizations} switch.
5a4b3afd 10047
39bc1876
NS
10048@item -malign-double
10049@itemx -mno-align-double
10050@opindex malign-double
10051@opindex mno-align-double
10052Control whether GCC aligns @code{double}, @code{long double}, and
10053@code{long long} variables on a two word boundary or a one word
10054boundary. Aligning @code{double} variables on a two word boundary will
10055produce code that runs somewhat faster on a @samp{Pentium} at the
10056expense of more memory.
5a4b3afd 10057
dc5abe77
TM
10058On x86-64, @option{-malign-double} is enabled by default.
10059
39bc1876
NS
10060@strong{Warning:} if you use the @option{-malign-double} switch,
10061structures containing the above types will be aligned differently than
10062the published application binary interface specifications for the 386
10063and will not be binary compatible with structures in code compiled
10064without that switch.
5a4b3afd 10065
39bc1876
NS
10066@item -m96bit-long-double
10067@itemx -m128bit-long-double
10068@opindex m96bit-long-double
10069@opindex m128bit-long-double
8a36672b 10070These switches control the size of @code{long double} type. The i386
39bc1876
NS
10071application binary interface specifies the size to be 96 bits,
10072so @option{-m96bit-long-double} is the default in 32 bit mode.
5a4b3afd 10073
39bc1876
NS
10074Modern architectures (Pentium and newer) would prefer @code{long double}
10075to be aligned to an 8 or 16 byte boundary. In arrays or structures
10076conforming to the ABI, this would not be possible. So specifying a
10077@option{-m128bit-long-double} will align @code{long double}
10078to a 16 byte boundary by padding the @code{long double} with an additional
1007932 bit zero.
5a4b3afd 10080
39bc1876
NS
10081In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
10082its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
5a4b3afd 10083
39bc1876
NS
10084Notice that neither of these options enable any extra precision over the x87
10085standard of 80 bits for a @code{long double}.
5a4b3afd 10086
39bc1876
NS
10087@strong{Warning:} if you override the default value for your target ABI, the
10088structures and arrays containing @code{long double} variables will change
10089their size as well as function calling convention for function taking
10090@code{long double} will be modified. Hence they will not be binary
10091compatible with arrays or structures in code compiled without that switch.
5a4b3afd 10092
7dcbf659
JH
10093@item -mmlarge-data-threshold=@var{number}
10094@opindex mlarge-data-threshold=@var{number}
10095When @option{-mcmodel=medium} is specified, the data greater than
10096@var{threshold} are placed in large data section. This value must be the
a4d05547 10097same across all object linked into the binary and defaults to 65535.
5a4b3afd 10098
39bc1876
NS
10099@item -mrtd
10100@opindex mrtd
10101Use a different function-calling convention, in which functions that
10102take a fixed number of arguments return with the @code{ret} @var{num}
10103instruction, which pops their arguments while returning. This saves one
10104instruction in the caller since there is no need to pop the arguments
10105there.
5a4b3afd 10106
39bc1876
NS
10107You can specify that an individual function is called with this calling
10108sequence with the function attribute @samp{stdcall}. You can also
10109override the @option{-mrtd} option by using the function attribute
10110@samp{cdecl}. @xref{Function Attributes}.
74291a4b 10111
39bc1876
NS
10112@strong{Warning:} this calling convention is incompatible with the one
10113normally used on Unix, so you cannot use it if you need to call
10114libraries compiled with the Unix compiler.
74291a4b 10115
39bc1876
NS
10116Also, you must provide function prototypes for all functions that
10117take variable numbers of arguments (including @code{printf});
10118otherwise incorrect code will be generated for calls to those
10119functions.
02f52e19 10120
39bc1876
NS
10121In addition, seriously incorrect code will result if you call a
10122function with too many arguments. (Normally, extra arguments are
10123harmlessly ignored.)
1cf959cb 10124
39bc1876
NS
10125@item -mregparm=@var{num}
10126@opindex mregparm
10127Control how many registers are used to pass integer arguments. By
10128default, no registers are used to pass arguments, and at most 3
10129registers can be used. You can control this behavior for a specific
10130function by using the function attribute @samp{regparm}.
10131@xref{Function Attributes}.
1cf959cb 10132
39bc1876
NS
10133@strong{Warning:} if you use this switch, and
10134@var{num} is nonzero, then you must build all modules with the same
10135value, including any libraries. This includes the system libraries and
10136startup modules.
5a4b3afd 10137
1f97667f
RG
10138@item -msseregparm
10139@opindex msseregparm
10140Use SSE register passing conventions for float and double arguments
10141and return values. You can control this behavior for a specific
10142function by using the function attribute @samp{sseregparm}.
10143@xref{Function Attributes}.
10144
10145@strong{Warning:} if you use this switch then you must build all
10146modules with the same value, including any libraries. This includes
10147the system libraries and startup modules.
10148
577565f9
UB
10149@item -mpc32
10150@itemx -mpc64
10151@itemx -mpc80
10152@opindex mpc32
10153@opindex mpc64
10154@opindex mpc80
10155
10156Set 80387 floating-point precision to 32, 64 or 80 bits. When @option{-mpc32}
80b9cbc9
BL
10157is specified, the significands of results of floating-point operations are
10158rounded to 24 bits (single precision); @option{-mpc64} rounds the the
10159significands of results of floating-point operations to 53 bits (double
10160precision) and @option{-mpc80} rounds the significands of results of
10161floating-point operations to 64 bits (extended double precision), which is
10162the default. When this option is used, floating-point operations in higher
10163precisions are not available to the programmer without setting the FPU
10164control word explicitly.
10165
10166Setting the rounding of floating-point operations to less than the default
1016780 bits can speed some programs by 2% or more. Note that some mathematical
10168libraries assume that extended precision (80 bit) floating-point operations
10169are enabled by default; routines in such libraries could suffer significant
10170loss of accuracy, typically through so-called "catastrophic cancellation",
10171when this option is used to set the precision to less than extended precision.
577565f9 10172
33932946
SH
10173@item -mstackrealign
10174@opindex mstackrealign
10175Realign the stack at entry. On the Intel x86, the
10176@option{-mstackrealign} option will generate an alternate prologue and
10177epilogue that realigns the runtime stack. This supports mixing legacy
10178codes that keep a 4-byte aligned stack with modern codes that keep a
1017916-byte stack for SSE compatibility. The alternate prologue and
10180epilogue are slower and bigger than the regular ones, and the
10181alternate prologue requires an extra scratch register; this lowers the
10182number of registers available if used in conjunction with the
10183@code{regparm} attribute. The @option{-mstackrealign} option is
10184incompatible with the nested function prologue; this is considered a
10185hard error. See also the attribute @code{force_align_arg_pointer},
10186applicable to individual functions.
10187
39bc1876
NS
10188@item -mpreferred-stack-boundary=@var{num}
10189@opindex mpreferred-stack-boundary
10190Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
10191byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
04df96dd 10192the default is 4 (16 bytes or 128 bits).
5a4b3afd 10193
39bc1876
NS
10194On Pentium and PentiumPro, @code{double} and @code{long double} values
10195should be aligned to an 8 byte boundary (see @option{-malign-double}) or
10196suffer significant run time performance penalties. On Pentium III, the
04df96dd
L
10197Streaming SIMD Extension (SSE) data type @code{__m128} may not work
10198properly if it is not 16 byte aligned.
5a4b3afd 10199
39bc1876
NS
10200To ensure proper alignment of this values on the stack, the stack boundary
10201must be as aligned as that required by any value stored on the stack.
10202Further, every function must be generated such that it keeps the stack
10203aligned. Thus calling a function compiled with a higher preferred
10204stack boundary from a function compiled with a lower preferred stack
10205boundary will most likely misalign the stack. It is recommended that
10206libraries that use callbacks always use the default setting.
5a4b3afd 10207
39bc1876
NS
10208This extra alignment does consume extra stack space, and generally
10209increases code size. Code that is sensitive to stack space usage, such
10210as embedded systems and operating system kernels, may want to reduce the
10211preferred alignment to @option{-mpreferred-stack-boundary=2}.
5a4b3afd 10212
39bc1876
NS
10213@item -mmmx
10214@itemx -mno-mmx
10215@item -msse
10216@itemx -mno-sse
10217@item -msse2
10218@itemx -mno-sse2
10219@item -msse3
10220@itemx -mno-sse3
b1875f52
L
10221@item -mssse3
10222@itemx -mno-ssse3
21efb4d4
HJ
10223@item -msse4a
10224@item -mno-sse4a
39bc1876
NS
10225@item -m3dnow
10226@itemx -mno-3dnow
21efb4d4
HJ
10227@item -mpopcnt
10228@itemx -mno-popcnt
10229@item -mabm
10230@itemx -mno-abm
39bc1876
NS
10231@opindex mmmx
10232@opindex mno-mmx
10233@opindex msse
10234@opindex mno-sse
10235@opindex m3dnow
10236@opindex mno-3dnow
75576871 10237These switches enable or disable the use of instructions in the MMX,
21efb4d4 10238SSE, SSE2, SSE3, SSSE3, SSE4A, ABM or 3DNow! extended instruction sets.
b1875f52
L
10239These extensions are also available as built-in functions: see
10240@ref{X86 Built-in Functions}, for details of the functions enabled and
10241disabled by these switches.
74291a4b 10242
39bc1876 10243To have SSE/SSE2 instructions generated automatically from floating-point
75576871
BB
10244code (as opposed to 387 instructions), see @option{-mfpmath=sse}.
10245
10246These options will enable GCC to use these extended instructions in
10247generated code, even without @option{-mfpmath=sse}. Applications which
10248perform runtime CPU detection must compile separate files for each
10249supported architecture, using the appropriate flags. In particular,
10250the file containing the CPU detection code should be compiled without
10251these options.
74291a4b 10252
5be6cb59 10253@item -mcx16
edc5f63b 10254@opindex mcx16
5be6cb59
UB
10255This option will enable GCC to use CMPXCHG16B instruction in generated code.
10256CMPXCHG16B allows for atomic operations on 128-bit double quadword (or oword)
10257data types. This is useful for high resolution counters that could be updated
10258by multiple processors (or cores). This instruction is generated as part of
10259atomic built-in functions: see @ref{Atomic Builtins} for details.
10260
10261@item -msahf
edc5f63b 10262@opindex msahf
8c5fd59f
UB
10263This option will enable GCC to use SAHF instruction in generated 64-bit code.
10264Early Intel CPUs with Intel 64 lacked LAHF and SAHF instructions supported
10265by AMD64 until introduction of Pentium 4 G1 step in December 2005. LAHF and
10266SAHF are load and store instructions, respectively, for certain status flags.
10267In 64-bit mode, SAHF instruction is used to optimize @code{fmod}, @code{drem}
10268or @code{remainder} built-in functions: see @ref{Other Builtins} for details.
5be6cb59 10269
39bc1876
NS
10270@item -mpush-args
10271@itemx -mno-push-args
10272@opindex mpush-args
10273@opindex mno-push-args
10274Use PUSH operations to store outgoing parameters. This method is shorter
10275and usually equally fast as method using SUB/MOV operations and is enabled
10276by default. In some cases disabling it may improve performance because of
10277improved scheduling and reduced dependencies.
74291a4b 10278
39bc1876
NS
10279@item -maccumulate-outgoing-args
10280@opindex maccumulate-outgoing-args
10281If enabled, the maximum amount of space required for outgoing arguments will be
10282computed in the function prologue. This is faster on most modern CPUs
10283because of reduced dependencies, improved scheduling and reduced stack usage
10284when preferred stack boundary is not equal to 2. The drawback is a notable
10285increase in code size. This switch implies @option{-mno-push-args}.
63357d93 10286
39bc1876
NS
10287@item -mthreads
10288@opindex mthreads
10289Support thread-safe exception handling on @samp{Mingw32}. Code that relies
10290on thread-safe exception handling must compile and link all code with the
10291@option{-mthreads} option. When compiling, @option{-mthreads} defines
10292@option{-D_MT}; when linking, it links in a special thread helper library
10293@option{-lmingwthrd} which cleans up per thread exception handling data.
5ef1a99d 10294
39bc1876
NS
10295@item -mno-align-stringops
10296@opindex mno-align-stringops
10297Do not align destination of inlined string operations. This switch reduces
10298code size and improves performance in case the destination is already aligned,
10299but GCC doesn't know about it.
46490403 10300
39bc1876
NS
10301@item -minline-all-stringops
10302@opindex minline-all-stringops
10303By default GCC inlines string operations only when destination is known to be
10304aligned at least to 4 byte boundary. This enables more inlining, increase code
10305size, but may improve performance of code that depends on fast memcpy, strlen
10306and memset for short lengths.
c235ddf2 10307
8c996513
JH
10308@item -minline-stringops-dynamically
10309@opindex minline-stringops-dynamically
10310For string operation of unknown size, inline runtime checks so for small
5681c208 10311blocks inline code is used, while for large blocks library call is used.
8c996513
JH
10312
10313@item -mstringop-strategy=@var{alg}
dbdbfff1 10314@opindex mstringop-strategy=@var{alg}
8c996513 10315Overwrite internal decision heuristic about particular algorithm to inline
5681c208 10316string operation with. The allowed values are @code{rep_byte},
8c996513 10317@code{rep_4byte}, @code{rep_8byte} for expanding using i386 @code{rep} prefix
5db74c32
UB
10318of specified size, @code{byte_loop}, @code{loop}, @code{unrolled_loop} for
10319expanding inline loop, @code{libcall} for always expanding library call.
8c996513 10320
39bc1876
NS
10321@item -momit-leaf-frame-pointer
10322@opindex momit-leaf-frame-pointer
10323Don't keep the frame pointer in a register for leaf functions. This
10324avoids the instructions to save, set up and restore frame pointers and
10325makes an extra register available in leaf functions. The option
10326@option{-fomit-frame-pointer} removes the frame pointer for all functions
10327which might make debugging harder.
c235ddf2 10328
39bc1876
NS
10329@item -mtls-direct-seg-refs
10330@itemx -mno-tls-direct-seg-refs
10331@opindex mtls-direct-seg-refs
10332Controls whether TLS variables may be accessed with offsets from the
10333TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
10334or whether the thread base pointer must be added. Whether or not this
10335is legal depends on the operating system, and whether it maps the
10336segment to cover the entire TLS area.
beadc644 10337
39bc1876
NS
10338For systems that use GNU libc, the default is on.
10339@end table
af34e51e 10340
39bc1876
NS
10341These @samp{-m} switches are supported in addition to the above
10342on AMD x86-64 processors in 64-bit environments.
50d32cf6 10343
39bc1876
NS
10344@table @gcctabopt
10345@item -m32
10346@itemx -m64
10347@opindex m32
10348@opindex m64
10349Generate code for a 32-bit or 64-bit environment.
10350The 32-bit environment sets int, long and pointer to 32 bits and
10351generates code that runs on any i386 system.
10352The 64-bit environment sets int to 32 bits and long and pointer
cb7ad97b
EC
10353to 64 bits and generates code for AMD's x86-64 architecture. For
10354darwin only the -m64 option turns off the @option{-fno-pic} and
10355@option{-mdynamic-no-pic} options.
50d32cf6 10356
39bc1876
NS
10357@item -mno-red-zone
10358@opindex no-red-zone
10359Do not use a so called red zone for x86-64 code. The red zone is mandated
10360by the x86-64 ABI, it is a 128-byte area beyond the location of the
10361stack pointer that will not be modified by signal or interrupt handlers
10362and therefore can be used for temporary data without adjusting the stack
10363pointer. The flag @option{-mno-red-zone} disables this red zone.
dc884a86 10364
39bc1876
NS
10365@item -mcmodel=small
10366@opindex mcmodel=small
10367Generate code for the small code model: the program and its symbols must
10368be linked in the lower 2 GB of the address space. Pointers are 64 bits.
10369Programs can be statically or dynamically linked. This is the default
10370code model.
dc884a86 10371
39bc1876
NS
10372@item -mcmodel=kernel
10373@opindex mcmodel=kernel
10374Generate code for the kernel code model. The kernel runs in the
10375negative 2 GB of the address space.
10376This model has to be used for Linux kernel code.
10377
10378@item -mcmodel=medium
10379@opindex mcmodel=medium
10380Generate code for the medium model: The program is linked in the lower 2
10381GB of the address space but symbols can be located anywhere in the
10382address space. Programs can be statically or dynamically linked, but
10383building of shared libraries are not supported with the medium model.
10384
10385@item -mcmodel=large
10386@opindex mcmodel=large
10387Generate code for the large model: This model makes no assumptions
cb7ad97b 10388about addresses and sizes of sections.
74291a4b
MM
10389@end table
10390
39bc1876
NS
10391@node IA-64 Options
10392@subsection IA-64 Options
10393@cindex IA-64 Options
74291a4b 10394
39bc1876 10395These are the @samp{-m} options defined for the Intel IA-64 architecture.
74291a4b 10396
2642624b 10397@table @gcctabopt
39bc1876
NS
10398@item -mbig-endian
10399@opindex mbig-endian
10400Generate code for a big endian target. This is the default for HP-UX@.
6f670fde 10401
39bc1876
NS
10402@item -mlittle-endian
10403@opindex mlittle-endian
10404Generate code for a little endian target. This is the default for AIX5
10405and GNU/Linux.
a9f3e1a4 10406
39bc1876
NS
10407@item -mgnu-as
10408@itemx -mno-gnu-as
10409@opindex mgnu-as
10410@opindex mno-gnu-as
10411Generate (or don't) code for the GNU assembler. This is the default.
10412@c Also, this is the default if the configure option @option{--with-gnu-as}
10413@c is used.
9d913bbf 10414
39bc1876
NS
10415@item -mgnu-ld
10416@itemx -mno-gnu-ld
10417@opindex mgnu-ld
10418@opindex mno-gnu-ld
10419Generate (or don't) code for the GNU linker. This is the default.
10420@c Also, this is the default if the configure option @option{--with-gnu-ld}
10421@c is used.
a9f3e1a4 10422
39bc1876
NS
10423@item -mno-pic
10424@opindex mno-pic
10425Generate code that does not use a global pointer register. The result
10426is not position independent code, and violates the IA-64 ABI@.
74291a4b 10427
39bc1876
NS
10428@item -mvolatile-asm-stop
10429@itemx -mno-volatile-asm-stop
10430@opindex mvolatile-asm-stop
10431@opindex mno-volatile-asm-stop
10432Generate (or don't) a stop bit immediately before and after volatile asm
10433statements.
965f5423 10434
39bc1876
NS
10435@item -mregister-names
10436@itemx -mno-register-names
10437@opindex mregister-names
10438@opindex mno-register-names
10439Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
10440the stacked registers. This may make assembler output more readable.
965f5423 10441
39bc1876
NS
10442@item -mno-sdata
10443@itemx -msdata
10444@opindex mno-sdata
10445@opindex msdata
10446Disable (or enable) optimizations that use the small data section. This may
10447be useful for working around optimizer bugs.
10448
10449@item -mconstant-gp
10450@opindex mconstant-gp
10451Generate code that uses a single constant global pointer value. This is
10452useful when compiling kernel code.
10453
10454@item -mauto-pic
10455@opindex mauto-pic
10456Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
10457This is useful when compiling firmware code.
10458
10459@item -minline-float-divide-min-latency
10460@opindex minline-float-divide-min-latency
10461Generate code for inline divides of floating point values
10462using the minimum latency algorithm.
965f5423 10463
39bc1876
NS
10464@item -minline-float-divide-max-throughput
10465@opindex minline-float-divide-max-throughput
10466Generate code for inline divides of floating point values
10467using the maximum throughput algorithm.
965f5423 10468
39bc1876
NS
10469@item -minline-int-divide-min-latency
10470@opindex minline-int-divide-min-latency
10471Generate code for inline divides of integer values
10472using the minimum latency algorithm.
965f5423 10473
39bc1876
NS
10474@item -minline-int-divide-max-throughput
10475@opindex minline-int-divide-max-throughput
10476Generate code for inline divides of integer values
10477using the maximum throughput algorithm.
965f5423 10478
28b43def
SE
10479@item -minline-sqrt-min-latency
10480@opindex minline-sqrt-min-latency
10481Generate code for inline square roots
10482using the minimum latency algorithm.
10483
10484@item -minline-sqrt-max-throughput
10485@opindex minline-sqrt-max-throughput
10486Generate code for inline square roots
10487using the maximum throughput algorithm.
10488
39bc1876
NS
10489@item -mno-dwarf2-asm
10490@itemx -mdwarf2-asm
10491@opindex mno-dwarf2-asm
10492@opindex mdwarf2-asm
10493Don't (or do) generate assembler code for the DWARF2 line number debugging
10494info. This may be useful when not using the GNU assembler.
965f5423 10495
28b43def
SE
10496@item -mearly-stop-bits
10497@itemx -mno-early-stop-bits
10498@opindex mearly-stop-bits
10499@opindex mno-early-stop-bits
10500Allow stop bits to be placed earlier than immediately preceding the
10501instruction that triggered the stop bit. This can improve instruction
10502scheduling, but does not always do so.
10503
39bc1876
NS
10504@item -mfixed-range=@var{register-range}
10505@opindex mfixed-range
10506Generate code treating the given register range as fixed registers.
10507A fixed register is one that the register allocator can not use. This is
10508useful when compiling kernel code. A register range is specified as
10509two registers separated by a dash. Multiple register ranges can be
10510specified separated by a comma.
04e149ab 10511
28b43def
SE
10512@item -mtls-size=@var{tls-size}
10513@opindex mtls-size
10514Specify bit size of immediate TLS offsets. Valid values are 14, 22, and
1051564.
10516
7f9dc823
JW
10517@item -mtune=@var{cpu-type}
10518@opindex mtune
28b43def
SE
10519Tune the instruction scheduling for a particular CPU, Valid values are
10520itanium, itanium1, merced, itanium2, and mckinley.
10521
10522@item -mt
10523@itemx -pthread
10524@opindex mt
10525@opindex pthread
10526Add support for multithreading using the POSIX threads library. This
10527option sets flags for both the preprocessor and linker. It does
10528not affect the thread safety of object code produced by the compiler or
10529that of libraries supplied with it. These are HP-UX specific flags.
10530
10531@item -milp32
10532@itemx -mlp64
10533@opindex milp32
10534@opindex mlp64
10535Generate code for a 32-bit or 64-bit environment.
10536The 32-bit environment sets int, long and pointer to 32 bits.
10537The 64-bit environment sets int to 32 bits and long and pointer
10538to 64 bits. These are HP-UX specific flags.
10539
048d0d36
MK
10540@item -mno-sched-br-data-spec
10541@itemx -msched-br-data-spec
edc5f63b
DF
10542@opindex mno-sched-br-data-spec
10543@opindex msched-br-data-spec
048d0d36
MK
10544(Dis/En)able data speculative scheduling before reload.
10545This will result in generation of the ld.a instructions and
10546the corresponding check instructions (ld.c / chk.a).
10547The default is 'disable'.
10548
10549@item -msched-ar-data-spec
10550@itemx -mno-sched-ar-data-spec
edc5f63b
DF
10551@opindex msched-ar-data-spec
10552@opindex mno-sched-ar-data-spec
048d0d36
MK
10553(En/Dis)able data speculative scheduling after reload.
10554This will result in generation of the ld.a instructions and
10555the corresponding check instructions (ld.c / chk.a).
10556The default is 'enable'.
10557
10558@item -mno-sched-control-spec
10559@itemx -msched-control-spec
edc5f63b
DF
10560@opindex mno-sched-control-spec
10561@opindex msched-control-spec
048d0d36
MK
10562(Dis/En)able control speculative scheduling. This feature is
10563available only during region scheduling (i.e. before reload).
10564This will result in generation of the ld.s instructions and
10565the corresponding check instructions chk.s .
10566The default is 'disable'.
10567
10568@item -msched-br-in-data-spec
10569@itemx -mno-sched-br-in-data-spec
edc5f63b
DF
10570@opindex msched-br-in-data-spec
10571@opindex mno-sched-br-in-data-spec
048d0d36
MK
10572(En/Dis)able speculative scheduling of the instructions that
10573are dependent on the data speculative loads before reload.
10574This is effective only with @option{-msched-br-data-spec} enabled.
10575The default is 'enable'.
10576
10577@item -msched-ar-in-data-spec
10578@itemx -mno-sched-ar-in-data-spec
edc5f63b
DF
10579@opindex msched-ar-in-data-spec
10580@opindex mno-sched-ar-in-data-spec
048d0d36
MK
10581(En/Dis)able speculative scheduling of the instructions that
10582are dependent on the data speculative loads after reload.
10583This is effective only with @option{-msched-ar-data-spec} enabled.
10584The default is 'enable'.
10585
10586@item -msched-in-control-spec
10587@itemx -mno-sched-in-control-spec
edc5f63b
DF
10588@opindex msched-in-control-spec
10589@opindex mno-sched-in-control-spec
048d0d36
MK
10590(En/Dis)able speculative scheduling of the instructions that
10591are dependent on the control speculative loads.
10592This is effective only with @option{-msched-control-spec} enabled.
10593The default is 'enable'.
10594
10595@item -msched-ldc
10596@itemx -mno-sched-ldc
edc5f63b
DF
10597@opindex msched-ldc
10598@opindex mno-sched-ldc
048d0d36
MK
10599(En/Dis)able use of simple data speculation checks ld.c .
10600If disabled, only chk.a instructions will be emitted to check
10601data speculative loads.
10602The default is 'enable'.
10603
10604@item -mno-sched-control-ldc
10605@itemx -msched-control-ldc
edc5f63b
DF
10606@opindex mno-sched-control-ldc
10607@opindex msched-control-ldc
048d0d36
MK
10608(Dis/En)able use of ld.c instructions to check control speculative loads.
10609If enabled, in case of control speculative load with no speculatively
10610scheduled dependent instructions this load will be emitted as ld.sa and
10611ld.c will be used to check it.
10612The default is 'disable'.
10613
10614@item -mno-sched-spec-verbose
10615@itemx -msched-spec-verbose
edc5f63b
DF
10616@opindex mno-sched-spec-verbose
10617@opindex msched-spec-verbose
048d0d36
MK
10618(Dis/En)able printing of the information about speculative motions.
10619
10620@item -mno-sched-prefer-non-data-spec-insns
10621@itemx -msched-prefer-non-data-spec-insns
edc5f63b
DF
10622@opindex mno-sched-prefer-non-data-spec-insns
10623@opindex msched-prefer-non-data-spec-insns
917f1b7e 10624If enabled, data speculative instructions will be chosen for schedule
048d0d36
MK
10625only if there are no other choices at the moment. This will make
10626the use of the data speculation much more conservative.
10627The default is 'disable'.
10628
10629@item -mno-sched-prefer-non-control-spec-insns
10630@itemx -msched-prefer-non-control-spec-insns
edc5f63b
DF
10631@opindex mno-sched-prefer-non-control-spec-insns
10632@opindex msched-prefer-non-control-spec-insns
917f1b7e 10633If enabled, control speculative instructions will be chosen for schedule
048d0d36
MK
10634only if there are no other choices at the moment. This will make
10635the use of the control speculation much more conservative.
10636The default is 'disable'.
10637
10638@item -mno-sched-count-spec-in-critical-path
10639@itemx -msched-count-spec-in-critical-path
edc5f63b
DF
10640@opindex mno-sched-count-spec-in-critical-path
10641@opindex msched-count-spec-in-critical-path
917f1b7e 10642If enabled, speculative dependencies will be considered during
048d0d36
MK
10643computation of the instructions priorities. This will make the use of the
10644speculation a bit more conservative.
10645The default is 'disable'.
10646
39bc1876 10647@end table
74291a4b 10648
38b2d076
DD
10649@node M32C Options
10650@subsection M32C Options
10651@cindex M32C options
10652
10653@table @gcctabopt
10654@item -mcpu=@var{name}
10655@opindex mcpu=
10656Select the CPU for which code is generated. @var{name} may be one of
10657@samp{r8c} for the R8C/Tiny series, @samp{m16c} for the M16C (up to
10658/60) series, @samp{m32cm} for the M16C/80 series, or @samp{m32c} for
10659the M32C/80 series.
10660
10661@item -msim
10662@opindex msim
10663Specifies that the program will be run on the simulator. This causes
10664an alternate runtime library to be linked in which supports, for
10665example, file I/O. You must not use this option when generating
10666programs that will run on real hardware; you must provide your own
10667runtime library for whatever I/O functions are needed.
10668
10669@item -memregs=@var{number}
10670@opindex memregs=
10671Specifies the number of memory-based pseudo-registers GCC will use
10672during code generation. These pseudo-registers will be used like real
10673registers, so there is a tradeoff between GCC's ability to fit the
10674code into available registers, and the performance penalty of using
10675memory instead of registers. Note that all modules in a program must
10676be compiled with the same value for this option. Because of that, you
10677must not use this option with the default runtime libraries gcc
10678builds.
10679
10680@end table
10681
39bc1876
NS
10682@node M32R/D Options
10683@subsection M32R/D Options
10684@cindex M32R/D options
74291a4b 10685
39bc1876 10686These @option{-m} options are defined for Renesas M32R/D architectures:
74291a4b 10687
39bc1876
NS
10688@table @gcctabopt
10689@item -m32r2
10690@opindex m32r2
10691Generate code for the M32R/2@.
74291a4b 10692
39bc1876
NS
10693@item -m32rx
10694@opindex m32rx
10695Generate code for the M32R/X@.
74291a4b 10696
39bc1876
NS
10697@item -m32r
10698@opindex m32r
10699Generate code for the M32R@. This is the default.
74291a4b 10700
39bc1876
NS
10701@item -mmodel=small
10702@opindex mmodel=small
10703Assume all objects live in the lower 16MB of memory (so that their addresses
10704can be loaded with the @code{ld24} instruction), and assume all subroutines
10705are reachable with the @code{bl} instruction.
10706This is the default.
74291a4b 10707
39bc1876
NS
10708The addressability of a particular object can be set with the
10709@code{model} attribute.
74291a4b 10710
39bc1876
NS
10711@item -mmodel=medium
10712@opindex mmodel=medium
10713Assume objects may be anywhere in the 32-bit address space (the compiler
10714will generate @code{seth/add3} instructions to load their addresses), and
10715assume all subroutines are reachable with the @code{bl} instruction.
194734e9 10716
39bc1876
NS
10717@item -mmodel=large
10718@opindex mmodel=large
10719Assume objects may be anywhere in the 32-bit address space (the compiler
10720will generate @code{seth/add3} instructions to load their addresses), and
10721assume subroutines may not be reachable with the @code{bl} instruction
10722(the compiler will generate the much slower @code{seth/add3/jl}
10723instruction sequence).
a5f3dd66 10724
39bc1876
NS
10725@item -msdata=none
10726@opindex msdata=none
10727Disable use of the small data area. Variables will be put into
10728one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
10729@code{section} attribute has been specified).
10730This is the default.
a5f3dd66 10731
39bc1876
NS
10732The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
10733Objects may be explicitly put in the small data area with the
10734@code{section} attribute using one of these sections.
daf2f129 10735
39bc1876
NS
10736@item -msdata=sdata
10737@opindex msdata=sdata
10738Put small global and static data in the small data area, but do not
10739generate special code to reference them.
2b589241 10740
39bc1876
NS
10741@item -msdata=use
10742@opindex msdata=use
10743Put small global and static data in the small data area, and generate
10744special instructions to reference them.
2b589241 10745
39bc1876
NS
10746@item -G @var{num}
10747@opindex G
10748@cindex smaller data references
10749Put global and static objects less than or equal to @var{num} bytes
10750into the small data or bss sections instead of the normal data or bss
10751sections. The default value of @var{num} is 8.
10752The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
10753for this option to have any effect.
74291a4b 10754
39bc1876
NS
10755All modules should be compiled with the same @option{-G @var{num}} value.
10756Compiling with different values of @var{num} may or may not work; if it
10757doesn't the linker will give an error message---incorrect code will not be
10758generated.
74291a4b 10759
39bc1876
NS
10760@item -mdebug
10761@opindex mdebug
10762Makes the M32R specific code in the compiler display some statistics
10763that might help in debugging programs.
74291a4b 10764
39bc1876
NS
10765@item -malign-loops
10766@opindex malign-loops
10767Align all loops to a 32-byte boundary.
74291a4b 10768
39bc1876
NS
10769@item -mno-align-loops
10770@opindex mno-align-loops
10771Do not enforce a 32-byte alignment for loops. This is the default.
74291a4b 10772
39bc1876
NS
10773@item -missue-rate=@var{number}
10774@opindex missue-rate=@var{number}
10775Issue @var{number} instructions per cycle. @var{number} can only be 1
10776or 2.
74291a4b 10777
39bc1876
NS
10778@item -mbranch-cost=@var{number}
10779@opindex mbranch-cost=@var{number}
10780@var{number} can only be 1 or 2. If it is 1 then branches will be
10781preferred over conditional code, if it is 2, then the opposite will
10782apply.
74291a4b 10783
39bc1876
NS
10784@item -mflush-trap=@var{number}
10785@opindex mflush-trap=@var{number}
10786Specifies the trap number to use to flush the cache. The default is
1078712. Valid numbers are between 0 and 15 inclusive.
74291a4b 10788
39bc1876
NS
10789@item -mno-flush-trap
10790@opindex mno-flush-trap
10791Specifies that the cache cannot be flushed by using a trap.
74291a4b 10792
39bc1876
NS
10793@item -mflush-func=@var{name}
10794@opindex mflush-func=@var{name}
10795Specifies the name of the operating system function to call to flush
10796the cache. The default is @emph{_flush_cache}, but a function call
10797will only be used if a trap is not available.
3af4bd89 10798
39bc1876
NS
10799@item -mno-flush-func
10800@opindex mno-flush-func
10801Indicates that there is no OS function for flushing the cache.
3af4bd89 10802
39bc1876 10803@end table
3af4bd89 10804
39bc1876
NS
10805@node M680x0 Options
10806@subsection M680x0 Options
10807@cindex M680x0 options
f22a97d2 10808
900ec02d
JB
10809These are the @samp{-m} options defined for M680x0 and ColdFire processors.
10810The default settings depend on which architecture was selected when
10811the compiler was configured; the defaults for the most common choices
10812are given below.
1255c85c 10813
39bc1876 10814@table @gcctabopt
900ec02d
JB
10815@item -march=@var{arch}
10816@opindex march
10817Generate code for a specific M680x0 or ColdFire instruction set
10818architecture. Permissible values of @var{arch} for M680x0
10819architectures are: @samp{68000}, @samp{68010}, @samp{68020},
10820@samp{68030}, @samp{68040}, @samp{68060} and @samp{cpu32}. ColdFire
10821architectures are selected according to Freescale's ISA classification
10822and the permissible values are: @samp{isaa}, @samp{isaaplus},
10823@samp{isab} and @samp{isac}.
10824
10825gcc defines a macro @samp{__mcf@var{arch}__} whenever it is generating
10826code for a ColdFire target. The @var{arch} in this macro is one of the
10827@option{-march} arguments given above.
10828
10829When used together, @option{-march} and @option{-mtune} select code
10830that runs on a family of similar processors but that is optimized
10831for a particular microarchitecture.
10832
10833@item -mcpu=@var{cpu}
10834@opindex mcpu
10835Generate code for a specific M680x0 or ColdFire processor.
10836The M680x0 @var{cpu}s are: @samp{68000}, @samp{68010}, @samp{68020},
10837@samp{68030}, @samp{68040}, @samp{68060}, @samp{68302}, @samp{68332}
10838and @samp{cpu32}. The ColdFire @var{cpu}s are given by the table
10839below, which also classifies the CPUs into families:
10840
10841@multitable @columnfractions 0.20 0.80
1cbe999f 10842@item @strong{Family} @tab @strong{@samp{-mcpu} arguments}
900ec02d
JB
10843@item @samp{5206} @tab @samp{5202} @samp{5204} @samp{5206}
10844@item @samp{5206e} @tab @samp{5206e}
10845@item @samp{5208} @tab @samp{5207} @samp{5208}
10846@item @samp{5211a} @tab @samp{5210a} @samp{5211a}
10847@item @samp{5213} @tab @samp{5211} @samp{5212} @samp{5213}
10848@item @samp{5216} @tab @samp{5214} @samp{5216}
10849@item @samp{52235} @tab @samp{52230} @samp{52231} @samp{52232} @samp{52233} @samp{52234} @samp{52235}
10850@item @samp{5225} @tab @samp{5224} @samp{5225}
10851@item @samp{5235} @tab @samp{5232} @samp{5233} @samp{5234} @samp{5235} @samp{523x}
10852@item @samp{5249} @tab @samp{5249}
10853@item @samp{5250} @tab @samp{5250}
10854@item @samp{5271} @tab @samp{5270} @samp{5271}
10855@item @samp{5272} @tab @samp{5272}
10856@item @samp{5275} @tab @samp{5274} @samp{5275}
10857@item @samp{5282} @tab @samp{5280} @samp{5281} @samp{5282} @samp{528x}
10858@item @samp{5307} @tab @samp{5307}
10859@item @samp{5329} @tab @samp{5327} @samp{5328} @samp{5329} @samp{532x}
10860@item @samp{5373} @tab @samp{5372} @samp{5373} @samp{537x}
10861@item @samp{5407} @tab @samp{5407}
10862@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}
10863@end multitable
10864
10865@option{-mcpu=@var{cpu}} overrides @option{-march=@var{arch}} if
10866@var{arch} is compatible with @var{cpu}. Other combinations of
10867@option{-mcpu} and @option{-march} are rejected.
10868
7eb4f044
NS
10869gcc defines the macro @samp{__mcf_cpu_@var{cpu}} when ColdFire target
10870@var{cpu} is selected. It also defines @samp{__mcf_family_@var{family}},
10871where the value of @var{family} is given by the table above.
10872
900ec02d
JB
10873@item -mtune=@var{tune}
10874@opindex mtune
10875Tune the code for a particular microarchitecture, within the
10876constraints set by @option{-march} and @option{-mcpu}.
10877The M680x0 microarchitectures are: @samp{68000}, @samp{68010},
10878@samp{68020}, @samp{68030}, @samp{68040}, @samp{68060}
10879and @samp{cpu32}. The ColdFire microarchitectures
10880are: @samp{cfv2}, @samp{cfv3}, @samp{cfv4} and @samp{cfv4e}.
10881
10882You can also use @option{-mtune=68020-40} for code that needs
10883to run relatively well on 68020, 68030 and 68040 targets.
10884@option{-mtune=68020-60} is similar but includes 68060 targets
10885as well. These two options select the same tuning decisions as
10886@option{-m68020-40} and @option{-m68020-60} respectively.
10887
7eb4f044
NS
10888gcc defines the macros @samp{__mc@var{arch}} and @samp{__mc@var{arch}__}
10889when tuning for 680x0 architecture @var{arch}. It also defines
10890@samp{mc@var{arch}} unless either @option{-ansi} or a non-GNU @option{-std}
10891option is used. If gcc is tuning for a range of architectures,
10892as selected by @option{-mtune=68020-40} or @option{-mtune=68020-60},
10893it defines the macros for every architecture in the range.
10894
10895gcc also defines the macro @samp{__m@var{uarch}__} when tuning for
10896ColdFire microarchitecture @var{uarch}, where @var{uarch} is one
10897of the arguments given above.
10898
39bc1876
NS
10899@item -m68000
10900@itemx -mc68000
10901@opindex m68000
10902@opindex mc68000
10903Generate output for a 68000. This is the default
10904when the compiler is configured for 68000-based systems.
900ec02d 10905It is equivalent to @option{-march=68000}.
1255c85c 10906
39bc1876
NS
10907Use this option for microcontrollers with a 68000 or EC000 core,
10908including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
7eafc329 10909
3197c489
RS
10910@item -m68010
10911@opindex m68010
10912Generate output for a 68010. This is the default
10913when the compiler is configured for 68010-based systems.
900ec02d 10914It is equivalent to @option{-march=68010}.
3197c489 10915
39bc1876
NS
10916@item -m68020
10917@itemx -mc68020
10918@opindex m68020
10919@opindex mc68020
10920Generate output for a 68020. This is the default
10921when the compiler is configured for 68020-based systems.
900ec02d 10922It is equivalent to @option{-march=68020}.
f73ad30e 10923
39bc1876
NS
10924@item -m68030
10925@opindex m68030
10926Generate output for a 68030. This is the default when the compiler is
900ec02d
JB
10927configured for 68030-based systems. It is equivalent to
10928@option{-march=68030}.
79f05c19 10929
39bc1876
NS
10930@item -m68040
10931@opindex m68040
10932Generate output for a 68040. This is the default when the compiler is
900ec02d
JB
10933configured for 68040-based systems. It is equivalent to
10934@option{-march=68040}.
79f05c19 10935
39bc1876
NS
10936This option inhibits the use of 68881/68882 instructions that have to be
10937emulated by software on the 68040. Use this option if your 68040 does not
10938have code to emulate those instructions.
762e166b 10939
39bc1876
NS
10940@item -m68060
10941@opindex m68060
10942Generate output for a 68060. This is the default when the compiler is
900ec02d
JB
10943configured for 68060-based systems. It is equivalent to
10944@option{-march=68060}.
74dc3e94 10945
39bc1876
NS
10946This option inhibits the use of 68020 and 68881/68882 instructions that
10947have to be emulated by software on the 68060. Use this option if your 68060
10948does not have code to emulate those instructions.
74dc3e94 10949
39bc1876
NS
10950@item -mcpu32
10951@opindex mcpu32
10952Generate output for a CPU32. This is the default
10953when the compiler is configured for CPU32-based systems.
900ec02d 10954It is equivalent to @option{-march=cpu32}.
3af4bd89 10955
39bc1876
NS
10956Use this option for microcontrollers with a
10957CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
1095868336, 68340, 68341, 68349 and 68360.
14f73b5a 10959
39bc1876
NS
10960@item -m5200
10961@opindex m5200
900ec02d 10962Generate output for a 520X ColdFire CPU. This is the default
39bc1876 10963when the compiler is configured for 520X-based systems.
900ec02d
JB
10964It is equivalent to @option{-mcpu=5206}, and is now deprecated
10965in favor of that option.
14f73b5a 10966
39bc1876 10967Use this option for microcontroller with a 5200 core, including
900ec02d
JB
10968the MCF5202, MCF5203, MCF5204 and MCF5206.
10969
10970@item -m5206e
10971@opindex m5206e
10972Generate output for a 5206e ColdFire CPU. The option is now
10973deprecated in favor of the equivalent @option{-mcpu=5206e}.
10974
10975@item -m528x
10976@opindex m528x
10977Generate output for a member of the ColdFire 528X family.
10978The option is now deprecated in favor of the equivalent
10979@option{-mcpu=528x}.
10980
10981@item -m5307
10982@opindex m5307
10983Generate output for a ColdFire 5307 CPU. The option is now deprecated
10984in favor of the equivalent @option{-mcpu=5307}.
10985
10986@item -m5407
10987@opindex m5407
10988Generate output for a ColdFire 5407 CPU. The option is now deprecated
10989in favor of the equivalent @option{-mcpu=5407}.
a7701995 10990
dcc21c4c
PB
10991@item -mcfv4e
10992@opindex mcfv4e
900ec02d 10993Generate output for a ColdFire V4e family CPU (e.g.@: 547x/548x).
dcc21c4c 10994This includes use of hardware floating point instructions.
900ec02d
JB
10995The option is equivalent to @option{-mcpu=547x}, and is now
10996deprecated in favor of that option.
a7701995 10997
39bc1876
NS
10998@item -m68020-40
10999@opindex m68020-40
11000Generate output for a 68040, without using any of the new instructions.
11001This results in code which can run relatively efficiently on either a
1100268020/68881 or a 68030 or a 68040. The generated code does use the
1100368881 instructions that are emulated on the 68040.
a7701995 11004
900ec02d
JB
11005The option is equivalent to @option{-march=68020} @option{-mtune=68020-40}.
11006
39bc1876
NS
11007@item -m68020-60
11008@opindex m68020-60
11009Generate output for a 68060, without using any of the new instructions.
11010This results in code which can run relatively efficiently on either a
1101168020/68881 or a 68030 or a 68040. The generated code does use the
1101268881 instructions that are emulated on the 68060.
a7701995 11013
900ec02d
JB
11014The option is equivalent to @option{-march=68020} @option{-mtune=68020-60}.
11015
11016@item -mhard-float
11017@itemx -m68881
11018@opindex mhard-float
11019@opindex m68881
11020Generate floating-point instructions. This is the default for 68020
7eb4f044
NS
11021and above, and for ColdFire devices that have an FPU. It defines the
11022macro @samp{__HAVE_68881__} on M680x0 targets and @samp{__mcffpu__}
11023on ColdFire targets.
900ec02d 11024
39bc1876
NS
11025@item -msoft-float
11026@opindex msoft-float
900ec02d
JB
11027Do not generate floating-point instructions; use library calls instead.
11028This is the default for 68000, 68010, and 68832 targets. It is also
11029the default for ColdFire devices that have no FPU.
11030
11031@item -mdiv
11032@itemx -mno-div
11033@opindex mdiv
11034@opindex mno-div
11035Generate (do not generate) ColdFire hardware divide and remainder
11036instructions. If @option{-march} is used without @option{-mcpu},
11037the default is ``on'' for ColdFire architectures and ``off'' for M680x0
11038architectures. Otherwise, the default is taken from the target CPU
11039(either the default CPU, or the one specified by @option{-mcpu}). For
11040example, the default is ``off'' for @option{-mcpu=5206} and ``on'' for
11041@option{-mcpu=5206e}.
11042
11043gcc defines the macro @samp{__mcfhwdiv__} when this option is enabled.
14f73b5a 11044
39bc1876
NS
11045@item -mshort
11046@opindex mshort
11047Consider type @code{int} to be 16 bits wide, like @code{short int}.
11048Additionally, parameters passed on the stack are also aligned to a
1104916-bit boundary even on targets whose API mandates promotion to 32-bit.
74291a4b 11050
64826589 11051@item -mno-short
edc5f63b 11052@opindex mno-short
64826589
NS
11053Do not consider type @code{int} to be 16 bits wide. This is the default.
11054
39bc1876 11055@item -mnobitfield
64826589 11056@itemx -mno-bitfield
39bc1876 11057@opindex mnobitfield
64826589 11058@opindex mno-bitfield
39bc1876
NS
11059Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
11060and @option{-m5200} options imply @w{@option{-mnobitfield}}.
74291a4b 11061
39bc1876
NS
11062@item -mbitfield
11063@opindex mbitfield
11064Do use the bit-field instructions. The @option{-m68020} option implies
11065@option{-mbitfield}. This is the default if you use a configuration
11066designed for a 68020.
11067
11068@item -mrtd
11069@opindex mrtd
11070Use a different function-calling convention, in which functions
11071that take a fixed number of arguments return with the @code{rtd}
11072instruction, which pops their arguments while returning. This
11073saves one instruction in the caller since there is no need to pop
11074the arguments there.
ea3bfbfe 11075
39bc1876
NS
11076This calling convention is incompatible with the one normally
11077used on Unix, so you cannot use it if you need to call libraries
11078compiled with the Unix compiler.
74291a4b 11079
39bc1876
NS
11080Also, you must provide function prototypes for all functions that
11081take variable numbers of arguments (including @code{printf});
11082otherwise incorrect code will be generated for calls to those
11083functions.
861bb6c1 11084
39bc1876
NS
11085In addition, seriously incorrect code will result if you call a
11086function with too many arguments. (Normally, extra arguments are
11087harmlessly ignored.)
74291a4b 11088
39bc1876
NS
11089The @code{rtd} instruction is supported by the 68010, 68020, 68030,
1109068040, 68060 and CPU32 processors, but not by the 68000 or 5200.
74291a4b 11091
64826589
NS
11092@item -mno-rtd
11093@opindex mno-rtd
11094Do not use the calling conventions selected by @option{-mrtd}.
11095This is the default.
11096
39bc1876
NS
11097@item -malign-int
11098@itemx -mno-align-int
11099@opindex malign-int
11100@opindex mno-align-int
11101Control whether GCC aligns @code{int}, @code{long}, @code{long long},
11102@code{float}, @code{double}, and @code{long double} variables on a 32-bit
11103boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
11104Aligning variables on 32-bit boundaries produces code that runs somewhat
11105faster on processors with 32-bit busses at the expense of more memory.
74291a4b 11106
39bc1876
NS
11107@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
11108align structures containing the above types differently than
11109most published application binary interface specifications for the m68k.
74291a4b 11110
39bc1876
NS
11111@item -mpcrel
11112@opindex mpcrel
11113Use the pc-relative addressing mode of the 68000 directly, instead of
11114using a global offset table. At present, this option implies @option{-fpic},
11115allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
11116not presently supported with @option{-mpcrel}, though this could be supported for
1111768020 and higher processors.
74291a4b 11118
39bc1876
NS
11119@item -mno-strict-align
11120@itemx -mstrict-align
11121@opindex mno-strict-align
11122@opindex mstrict-align
11123Do not (do) assume that unaligned memory references will be handled by
11124the system.
74291a4b 11125
39bc1876
NS
11126@item -msep-data
11127Generate code that allows the data segment to be located in a different
11128area of memory from the text segment. This allows for execute in place in
4ec7afd7
KH
11129an environment without virtual memory management. This option implies
11130@option{-fPIC}.
74291a4b 11131
39bc1876
NS
11132@item -mno-sep-data
11133Generate code that assumes that the data segment follows the text segment.
11134This is the default.
74291a4b 11135
39bc1876
NS
11136@item -mid-shared-library
11137Generate code that supports shared libraries via the library ID method.
11138This allows for execute in place and shared libraries in an environment
4ec7afd7 11139without virtual memory management. This option implies @option{-fPIC}.
74291a4b 11140
39bc1876
NS
11141@item -mno-id-shared-library
11142Generate code that doesn't assume ID based shared libraries are being used.
11143This is the default.
74291a4b 11144
39bc1876
NS
11145@item -mshared-library-id=n
11146Specified the identification number of the ID based shared library being
11147compiled. Specifying a value of 0 will generate more compact code, specifying
11148other values will force the allocation of that number to the current
11149library but is no more space or time efficient than omitting this option.
74291a4b 11150
39bc1876 11151@end table
74291a4b 11152
39bc1876
NS
11153@node M68hc1x Options
11154@subsection M68hc1x Options
11155@cindex M68hc1x options
74291a4b 11156
39bc1876
NS
11157These are the @samp{-m} options defined for the 68hc11 and 68hc12
11158microcontrollers. The default values for these options depends on
11159which style of microcontroller was selected when the compiler was configured;
11160the defaults for the most common choices are given below.
c219e1da 11161
39bc1876
NS
11162@table @gcctabopt
11163@item -m6811
11164@itemx -m68hc11
11165@opindex m6811
11166@opindex m68hc11
11167Generate output for a 68HC11. This is the default
11168when the compiler is configured for 68HC11-based systems.
c5d3d49b 11169
39bc1876
NS
11170@item -m6812
11171@itemx -m68hc12
11172@opindex m6812
11173@opindex m68hc12
11174Generate output for a 68HC12. This is the default
11175when the compiler is configured for 68HC12-based systems.
c5d3d49b 11176
39bc1876
NS
11177@item -m68S12
11178@itemx -m68hcs12
11179@opindex m68S12
11180@opindex m68hcs12
11181Generate output for a 68HCS12.
c5d3d49b 11182
39bc1876
NS
11183@item -mauto-incdec
11184@opindex mauto-incdec
11185Enable the use of 68HC12 pre and post auto-increment and auto-decrement
11186addressing modes.
34208acf 11187
39bc1876
NS
11188@item -minmax
11189@itemx -nominmax
11190@opindex minmax
11191@opindex mnominmax
11192Enable the use of 68HC12 min and max instructions.
34208acf 11193
39bc1876
NS
11194@item -mlong-calls
11195@itemx -mno-long-calls
11196@opindex mlong-calls
11197@opindex mno-long-calls
11198Treat all calls as being far away (near). If calls are assumed to be
11199far away, the compiler will use the @code{call} instruction to
11200call a function and the @code{rtc} instruction for returning.
34208acf 11201
39bc1876
NS
11202@item -mshort
11203@opindex mshort
11204Consider type @code{int} to be 16 bits wide, like @code{short int}.
34208acf 11205
39bc1876
NS
11206@item -msoft-reg-count=@var{count}
11207@opindex msoft-reg-count
11208Specify the number of pseudo-soft registers which are used for the
11209code generation. The maximum number is 32. Using more pseudo-soft
11210register may or may not result in better code depending on the program.
11211The default is 4 for 68HC11 and 2 for 68HC12.
34208acf 11212
39bc1876 11213@end table
34208acf 11214
39bc1876
NS
11215@node MCore Options
11216@subsection MCore Options
11217@cindex MCore options
34208acf 11218
39bc1876
NS
11219These are the @samp{-m} options defined for the Motorola M*Core
11220processors.
34208acf 11221
39bc1876 11222@table @gcctabopt
34208acf 11223
39bc1876
NS
11224@item -mhardlit
11225@itemx -mno-hardlit
11226@opindex mhardlit
11227@opindex mno-hardlit
11228Inline constants into the code stream if it can be done in two
11229instructions or less.
34208acf 11230
39bc1876
NS
11231@item -mdiv
11232@itemx -mno-div
11233@opindex mdiv
11234@opindex mno-div
11235Use the divide instruction. (Enabled by default).
a02aa5b0 11236
39bc1876
NS
11237@item -mrelax-immediate
11238@itemx -mno-relax-immediate
11239@opindex mrelax-immediate
11240@opindex mno-relax-immediate
11241Allow arbitrary sized immediates in bit operations.
a02aa5b0 11242
39bc1876
NS
11243@item -mwide-bitfields
11244@itemx -mno-wide-bitfields
11245@opindex mwide-bitfields
11246@opindex mno-wide-bitfields
11247Always treat bit-fields as int-sized.
a02aa5b0 11248
39bc1876
NS
11249@item -m4byte-functions
11250@itemx -mno-4byte-functions
11251@opindex m4byte-functions
11252@opindex mno-4byte-functions
11253Force all functions to be aligned to a four byte boundary.
a02aa5b0 11254
39bc1876
NS
11255@item -mcallgraph-data
11256@itemx -mno-callgraph-data
11257@opindex mcallgraph-data
11258@opindex mno-callgraph-data
11259Emit callgraph information.
f401d0f5 11260
39bc1876
NS
11261@item -mslow-bytes
11262@itemx -mno-slow-bytes
11263@opindex mslow-bytes
11264@opindex mno-slow-bytes
11265Prefer word access when reading byte quantities.
f401d0f5 11266
39bc1876
NS
11267@item -mlittle-endian
11268@itemx -mbig-endian
11269@opindex mlittle-endian
11270@opindex mbig-endian
11271Generate code for a little endian target.
f401d0f5 11272
39bc1876
NS
11273@item -m210
11274@itemx -m340
11275@opindex m210
11276@opindex m340
11277Generate code for the 210 processor.
74291a4b
MM
11278@end table
11279
39bc1876
NS
11280@node MIPS Options
11281@subsection MIPS Options
11282@cindex MIPS options
74291a4b 11283
2642624b 11284@table @gcctabopt
74291a4b 11285
39bc1876
NS
11286@item -EB
11287@opindex EB
11288Generate big-endian code.
74291a4b 11289
39bc1876
NS
11290@item -EL
11291@opindex EL
11292Generate little-endian code. This is the default for @samp{mips*el-*-*}
11293configurations.
74291a4b 11294
39bc1876
NS
11295@item -march=@var{arch}
11296@opindex march
11297Generate code that will run on @var{arch}, which can be the name of a
11298generic MIPS ISA, or the name of a particular processor.
11299The ISA names are:
11300@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
11301@samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
11302The processor names are:
79dad081 11303@samp{4kc}, @samp{4km}, @samp{4kp},
a55808a7 11304@samp{4kec}, @samp{4kem}, @samp{4kep},
79dad081
DU
11305@samp{5kc}, @samp{5kf},
11306@samp{20kc},
a55808a7
DU
11307@samp{24kc}, @samp{24kf}, @samp{24kx},
11308@samp{24kec}, @samp{24kef}, @samp{24kex},
11309@samp{34kc}, @samp{34kf}, @samp{34kx},
8dd58f01 11310@samp{74kc}, @samp{74kf}, @samp{74kx},
39bc1876 11311@samp{m4k},
39bc1876 11312@samp{orion},
79dad081
DU
11313@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
11314@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000},
11315@samp{rm7000}, @samp{rm9000},
39bc1876 11316@samp{sb1},
79dad081 11317@samp{sr71000},
39bc1876
NS
11318@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
11319@samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
11320The special value @samp{from-abi} selects the
11321most compatible architecture for the selected ABI (that is,
11322@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
74291a4b 11323
39bc1876
NS
11324In processor names, a final @samp{000} can be abbreviated as @samp{k}
11325(for example, @samp{-march=r2k}). Prefixes are optional, and
11326@samp{vr} may be written @samp{r}.
74291a4b 11327
39bc1876
NS
11328GCC defines two macros based on the value of this option. The first
11329is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
11330a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
11331where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
11332For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
11333to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
74291a4b 11334
39bc1876
NS
11335Note that the @samp{_MIPS_ARCH} macro uses the processor names given
11336above. In other words, it will have the full prefix and will not
11337abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
11338the macro names the resolved architecture (either @samp{"mips1"} or
11339@samp{"mips3"}). It names the default architecture when no
11340@option{-march} option is given.
74291a4b 11341
39bc1876
NS
11342@item -mtune=@var{arch}
11343@opindex mtune
11344Optimize for @var{arch}. Among other things, this option controls
11345the way instructions are scheduled, and the perceived cost of arithmetic
11346operations. The list of @var{arch} values is the same as for
11347@option{-march}.
74291a4b 11348
39bc1876
NS
11349When this option is not used, GCC will optimize for the processor
11350specified by @option{-march}. By using @option{-march} and
11351@option{-mtune} together, it is possible to generate code that will
11352run on a family of processors, but optimize the code for one
11353particular member of that family.
74291a4b 11354
39bc1876
NS
11355@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
11356@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
11357@samp{-march} ones described above.
74291a4b 11358
39bc1876
NS
11359@item -mips1
11360@opindex mips1
11361Equivalent to @samp{-march=mips1}.
74291a4b 11362
39bc1876
NS
11363@item -mips2
11364@opindex mips2
11365Equivalent to @samp{-march=mips2}.
74291a4b 11366
39bc1876
NS
11367@item -mips3
11368@opindex mips3
11369Equivalent to @samp{-march=mips3}.
74291a4b 11370
39bc1876
NS
11371@item -mips4
11372@opindex mips4
11373Equivalent to @samp{-march=mips4}.
11374
11375@item -mips32
11376@opindex mips32
11377Equivalent to @samp{-march=mips32}.
74291a4b 11378
39bc1876
NS
11379@item -mips32r2
11380@opindex mips32r2
11381Equivalent to @samp{-march=mips32r2}.
74291a4b 11382
39bc1876
NS
11383@item -mips64
11384@opindex mips64
11385Equivalent to @samp{-march=mips64}.
74291a4b 11386
39bc1876
NS
11387@item -mips16
11388@itemx -mno-mips16
11389@opindex mips16
11390@opindex mno-mips16
7cc63a88 11391Generate (do not generate) MIPS16 code. If GCC is targetting a
71cb39e6 11392MIPS32 or MIPS64 architecture, it will make use of the MIPS16e ASE@.
74291a4b 11393
39bc1876
NS
11394@item -mabi=32
11395@itemx -mabi=o64
11396@itemx -mabi=n32
11397@itemx -mabi=64
11398@itemx -mabi=eabi
11399@opindex mabi=32
11400@opindex mabi=o64
11401@opindex mabi=n32
11402@opindex mabi=64
11403@opindex mabi=eabi
11404Generate code for the given ABI@.
74291a4b 11405
39bc1876
NS
11406Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
11407generates 64-bit code when you select a 64-bit architecture, but you
11408can use @option{-mgp32} to get 32-bit code instead.
74291a4b 11409
39bc1876
NS
11410For information about the O64 ABI, see
11411@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
74291a4b 11412
6f428062
DU
11413GCC supports a variant of the o32 ABI in which floating-point registers
11414are 64 rather than 32 bits wide. You can select this combination with
11415@option{-mabi=32} @option{-mfp64}. This ABI relies on the @samp{mthc1}
11416and @samp{mfhc1} instructions and is therefore only supported for
11417MIPS32R2 processors.
11418
11419The register assignments for arguments and return values remain the
11420same, but each scalar value is passed in a single 64-bit register
11421rather than a pair of 32-bit registers. For example, scalar
11422floating-point values are returned in @samp{$f0} only, not a
11423@samp{$f0}/@samp{$f1} pair. The set of call-saved registers also
11424remains the same, but all 64 bits are saved.
11425
39bc1876
NS
11426@item -mabicalls
11427@itemx -mno-abicalls
11428@opindex mabicalls
11429@opindex mno-abicalls
567b3b82
RS
11430Generate (do not generate) code that is suitable for SVR4-style
11431dynamic objects. @option{-mabicalls} is the default for SVR4-based
11432systems.
11433
11434@item -mshared
11435@itemx -mno-shared
bc4a3483
RS
11436Generate (do not generate) code that is fully position-independent,
11437and that can therefore be linked into shared libraries. This option
11438only affects @option{-mabicalls}.
567b3b82
RS
11439
11440All @option{-mabicalls} code has traditionally been position-independent,
11441regardless of options like @option{-fPIC} and @option{-fpic}. However,
11442as an extension, the GNU toolchain allows executables to use absolute
11443accesses for locally-binding symbols. It can also use shorter GP
11444initialization sequences and generate direct calls to locally-defined
11445functions. This mode is selected by @option{-mno-shared}.
11446
11447@option{-mno-shared} depends on binutils 2.16 or higher and generates
11448objects that can only be linked by the GNU linker. However, the option
11449does not affect the ABI of the final executable; it only affects the ABI
11450of relocatable objects. Using @option{-mno-shared} will generally make
11451executables both smaller and quicker.
11452
11453@option{-mshared} is the default.
74291a4b 11454
39bc1876
NS
11455@item -mxgot
11456@itemx -mno-xgot
11457@opindex mxgot
11458@opindex mno-xgot
11459Lift (do not lift) the usual restrictions on the size of the global
11460offset table.
74291a4b 11461
8a36672b 11462GCC normally uses a single instruction to load values from the GOT@.
39bc1876
NS
11463While this is relatively efficient, it will only work if the GOT
11464is smaller than about 64k. Anything larger will cause the linker
11465to report an error such as:
74291a4b 11466
39bc1876
NS
11467@cindex relocation truncated to fit (MIPS)
11468@smallexample
11469relocation truncated to fit: R_MIPS_GOT16 foobar
11470@end smallexample
74291a4b 11471
39bc1876
NS
11472If this happens, you should recompile your code with @option{-mxgot}.
11473It should then work with very large GOTs, although it will also be
11474less efficient, since it will take three instructions to fetch the
11475value of a global symbol.
956d6950 11476
39bc1876
NS
11477Note that some linkers can create multiple GOTs. If you have such a
11478linker, you should only need to use @option{-mxgot} when a single object
11479file accesses more than 64k's worth of GOT entries. Very few do.
956d6950 11480
39bc1876
NS
11481These options have no effect unless GCC is generating position
11482independent code.
956d6950 11483
39bc1876
NS
11484@item -mgp32
11485@opindex mgp32
11486Assume that general-purpose registers are 32 bits wide.
58605ba0 11487
39bc1876
NS
11488@item -mgp64
11489@opindex mgp64
11490Assume that general-purpose registers are 64 bits wide.
58605ba0 11491
39bc1876
NS
11492@item -mfp32
11493@opindex mfp32
11494Assume that floating-point registers are 32 bits wide.
58605ba0 11495
39bc1876
NS
11496@item -mfp64
11497@opindex mfp64
11498Assume that floating-point registers are 64 bits wide.
58605ba0 11499
39bc1876
NS
11500@item -mhard-float
11501@opindex mhard-float
11502Use floating-point coprocessor instructions.
58605ba0 11503
39bc1876
NS
11504@item -msoft-float
11505@opindex msoft-float
11506Do not use floating-point coprocessor instructions. Implement
11507floating-point calculations using library calls instead.
3094247f 11508
39bc1876
NS
11509@item -msingle-float
11510@opindex msingle-float
11511Assume that the floating-point coprocessor only supports single-precision
11512operations.
3094247f 11513
500fc425 11514@item -mdouble-float
39bc1876
NS
11515@opindex mdouble-float
11516Assume that the floating-point coprocessor supports double-precision
11517operations. This is the default.
956d6950 11518
500fc425 11519@item -mdsp
118ea793
CF
11520@itemx -mno-dsp
11521@opindex mdsp
11522@opindex mno-dsp
11523Use (do not use) the MIPS DSP ASE. @xref{MIPS DSP Built-in Functions}.
11524
500fc425 11525@item -mdspr2
32041385
CF
11526@itemx -mno-dspr2
11527@opindex mdspr2
11528@opindex mno-dspr2
11529Use (do not use) the MIPS DSP ASE REV 2. @xref{MIPS DSP Built-in Functions}.
11530The option @option{-mdspr2} implies @option{-mdsp}.
11531
500fc425 11532@item -mpaired-single
06a4ab70
CF
11533@itemx -mno-paired-single
11534@opindex mpaired-single
11535@opindex mno-paired-single
d840bfd3
CF
11536Use (do not use) paired-single floating-point instructions.
11537@xref{MIPS Paired-Single Support}. This option can only be used
11538when generating 64-bit code and requires hardware floating-point
11539support to be enabled.
06a4ab70 11540
500fc425
TS
11541@item -mdmx
11542@itemx -mno-mdmx
11543@opindex mdmx
11544@opindex mno-mdmx
11545Use (do not use) MIPS Digital Media Extension instructions.
11546This option can only be used when generating 64-bit code and requires
11547hardware floating-point support to be enabled.
11548
11549@item -mips3d
06a4ab70
CF
11550@itemx -mno-mips3d
11551@opindex mips3d
11552@opindex mno-mips3d
8a36672b 11553Use (do not use) the MIPS-3D ASE@. @xref{MIPS-3D Built-in Functions}.
d840bfd3 11554The option @option{-mips3d} implies @option{-mpaired-single}.
06a4ab70 11555
500fc425
TS
11556@item -mmt
11557@itemx -mno-mt
11558@opindex mmt
11559@opindex mno-mt
11560Use (do not use) MT Multithreading instructions.
11561
39bc1876
NS
11562@item -mlong64
11563@opindex mlong64
11564Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
11565an explanation of the default and the way that the pointer size is
11566determined.
956d6950 11567
39bc1876
NS
11568@item -mlong32
11569@opindex mlong32
11570Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
956d6950 11571
39bc1876
NS
11572The default size of @code{int}s, @code{long}s and pointers depends on
11573the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
11574uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
1157532-bit @code{long}s. Pointers are the same size as @code{long}s,
11576or the same size as integer registers, whichever is smaller.
956d6950 11577
acda0e26
RS
11578@item -msym32
11579@itemx -mno-sym32
11580@opindex msym32
11581@opindex mno-sym32
11582Assume (do not assume) that all symbols have 32-bit values, regardless
11583of the selected ABI@. This option is useful in combination with
11584@option{-mabi=64} and @option{-mno-abicalls} because it allows GCC
11585to generate shorter and faster references to symbolic addresses.
11586
39bc1876
NS
11587@item -G @var{num}
11588@opindex G
11589@cindex smaller data references (MIPS)
11590@cindex gp-relative references (MIPS)
11591Put global and static items less than or equal to @var{num} bytes into
11592the small data or bss section instead of the normal data or bss section.
11593This allows the data to be accessed using a single instruction.
11594
11595All modules should be compiled with the same @option{-G @var{num}}
11596value.
956d6950 11597
39bc1876
NS
11598@item -membedded-data
11599@itemx -mno-embedded-data
11600@opindex membedded-data
11601@opindex mno-embedded-data
11602Allocate variables to the read-only data section first if possible, then
11603next in the small data section if possible, otherwise in data. This gives
11604slightly slower code than the default, but reduces the amount of RAM required
11605when executing, and thus may be preferred for some embedded systems.
58605ba0 11606
39bc1876
NS
11607@item -muninit-const-in-rodata
11608@itemx -mno-uninit-const-in-rodata
11609@opindex muninit-const-in-rodata
11610@opindex mno-uninit-const-in-rodata
11611Put uninitialized @code{const} variables in the read-only data section.
11612This option is only meaningful in conjunction with @option{-membedded-data}.
4f69985c 11613
39bc1876
NS
11614@item -msplit-addresses
11615@itemx -mno-split-addresses
11616@opindex msplit-addresses
11617@opindex mno-split-addresses
11618Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
38b974a6 11619relocation operators. This option has been superseded by
39bc1876 11620@option{-mexplicit-relocs} but is retained for backwards compatibility.
58605ba0 11621
39bc1876
NS
11622@item -mexplicit-relocs
11623@itemx -mno-explicit-relocs
11624@opindex mexplicit-relocs
11625@opindex mno-explicit-relocs
11626Use (do not use) assembler relocation operators when dealing with symbolic
11627addresses. The alternative, selected by @option{-mno-explicit-relocs},
11628is to use assembler macros instead.
4f69985c 11629
12e4afe4
RS
11630@option{-mexplicit-relocs} is the default if GCC was configured
11631to use an assembler that supports relocation operators.
4f69985c 11632
39bc1876
NS
11633@item -mcheck-zero-division
11634@itemx -mno-check-zero-division
11635@opindex mcheck-zero-division
11636@opindex mno-check-zero-division
78681dbd
RS
11637Trap (do not trap) on integer division by zero.
11638
11639The default is @option{-mcheck-zero-division}.
4f69985c 11640
9f0df97a
DD
11641@item -mdivide-traps
11642@itemx -mdivide-breaks
11643@opindex mdivide-traps
11644@opindex mdivide-breaks
11645MIPS systems check for division by zero by generating either a
11646conditional trap or a break instruction. Using traps results in
11647smaller code, but is only supported on MIPS II and later. Also, some
11648versions of the Linux kernel have a bug that prevents trap from
8a36672b 11649generating the proper signal (@code{SIGFPE}). Use @option{-mdivide-traps} to
9f0df97a
DD
11650allow conditional traps on architectures that support them and
11651@option{-mdivide-breaks} to force the use of breaks.
11652
11653The default is usually @option{-mdivide-traps}, but this can be
11654overridden at configure time using @option{--with-divide=breaks}.
11655Divide-by-zero checks can be completely disabled using
11656@option{-mno-check-zero-division}.
11657
39bc1876
NS
11658@item -mmemcpy
11659@itemx -mno-memcpy
11660@opindex mmemcpy
11661@opindex mno-memcpy
11662Force (do not force) the use of @code{memcpy()} for non-trivial block
11663moves. The default is @option{-mno-memcpy}, which allows GCC to inline
11664most constant-sized copies.
74291a4b 11665
39bc1876
NS
11666@item -mlong-calls
11667@itemx -mno-long-calls
11668@opindex mlong-calls
11669@opindex mno-long-calls
11670Disable (do not disable) use of the @code{jal} instruction. Calling
11671functions using @code{jal} is more efficient but requires the caller
11672and callee to be in the same 256 megabyte segment.
d7c23cdc 11673
39bc1876
NS
11674This option has no effect on abicalls code. The default is
11675@option{-mno-long-calls}.
d7c23cdc 11676
39bc1876
NS
11677@item -mmad
11678@itemx -mno-mad
11679@opindex mmad
11680@opindex mno-mad
11681Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
8a36672b 11682instructions, as provided by the R4650 ISA@.
d7c23cdc 11683
39bc1876
NS
11684@item -mfused-madd
11685@itemx -mno-fused-madd
11686@opindex mfused-madd
11687@opindex mno-fused-madd
11688Enable (disable) use of the floating point multiply-accumulate
11689instructions, when they are available. The default is
11690@option{-mfused-madd}.
74291a4b 11691
39bc1876
NS
11692When multiply-accumulate instructions are used, the intermediate
11693product is calculated to infinite precision and is not subject to
11694the FCSR Flush to Zero bit. This may be undesirable in some
11695circumstances.
74291a4b 11696
39bc1876
NS
11697@item -nocpp
11698@opindex nocpp
11699Tell the MIPS assembler to not run its preprocessor over user
11700assembler files (with a @samp{.s} suffix) when assembling them.
74291a4b 11701
39bc1876
NS
11702@item -mfix-r4000
11703@itemx -mno-fix-r4000
11704@opindex mfix-r4000
11705@opindex mno-fix-r4000
11706Work around certain R4000 CPU errata:
11707@itemize @minus
11708@item
11709A double-word or a variable shift may give an incorrect result if executed
11710immediately after starting an integer division.
11711@item
11712A double-word or a variable shift may give an incorrect result if executed
11713while an integer multiplication is in progress.
11714@item
11715An integer division may give an incorrect result if started in a delay slot
11716of a taken branch or a jump.
11717@end itemize
74291a4b 11718
39bc1876
NS
11719@item -mfix-r4400
11720@itemx -mno-fix-r4400
11721@opindex mfix-r4400
11722@opindex mno-fix-r4400
11723Work around certain R4400 CPU errata:
11724@itemize @minus
11725@item
11726A double-word or a variable shift may give an incorrect result if executed
11727immediately after starting an integer division.
11728@end itemize
dcb9d1f0 11729
39bc1876
NS
11730@item -mfix-vr4120
11731@itemx -mno-fix-vr4120
11732@opindex mfix-vr4120
11733Work around certain VR4120 errata:
11734@itemize @minus
11735@item
11736@code{dmultu} does not always produce the correct result.
11737@item
11738@code{div} and @code{ddiv} do not always produce the correct result if one
11739of the operands is negative.
11740@end itemize
11741The workarounds for the division errata rely on special functions in
11742@file{libgcc.a}. At present, these functions are only provided by
11743the @code{mips64vr*-elf} configurations.
39ba95b5 11744
39bc1876
NS
11745Other VR4120 errata require a nop to be inserted between certain pairs of
11746instructions. These errata are handled by the assembler, not by GCC itself.
17f0f8fa 11747
0ac40e7a
RS
11748@item -mfix-vr4130
11749@opindex mfix-vr4130
11750Work around the VR4130 @code{mflo}/@code{mfhi} errata. The
11751workarounds are implemented by the assembler rather than by GCC,
11752although GCC will avoid using @code{mflo} and @code{mfhi} if the
11753VR4130 @code{macc}, @code{macchi}, @code{dmacc} and @code{dmacchi}
11754instructions are available instead.
11755
39bc1876
NS
11756@item -mfix-sb1
11757@itemx -mno-fix-sb1
11758@opindex mfix-sb1
11759Work around certain SB-1 CPU core errata.
11760(This flag currently works around the SB-1 revision 2
11761``F1'' and ``F2'' floating point errata.)
74291a4b 11762
39bc1876
NS
11763@item -mflush-func=@var{func}
11764@itemx -mno-flush-func
11765@opindex mflush-func
11766Specifies the function to call to flush the I and D caches, or to not
11767call any such function. If called, the function must take the same
11768arguments as the common @code{_flush_func()}, that is, the address of the
11769memory range for which the cache is being flushed, the size of the
11770memory range, and the number 3 (to flush both caches). The default
11771depends on the target GCC was configured for, but commonly is either
11772@samp{_flush_func} or @samp{__cpu_flush}.
74291a4b 11773
39bc1876
NS
11774@item -mbranch-likely
11775@itemx -mno-branch-likely
11776@opindex mbranch-likely
11777@opindex mno-branch-likely
11778Enable or disable use of Branch Likely instructions, regardless of the
11779default for the selected architecture. By default, Branch Likely
11780instructions may be generated if they are supported by the selected
11781architecture. An exception is for the MIPS32 and MIPS64 architectures
11782and processors which implement those architectures; for those, Branch
11783Likely instructions will not be generated by default because the MIPS32
11784and MIPS64 architectures specifically deprecate their use.
74291a4b 11785
39bc1876
NS
11786@item -mfp-exceptions
11787@itemx -mno-fp-exceptions
11788@opindex mfp-exceptions
11789Specifies whether FP exceptions are enabled. This affects how we schedule
11790FP instructions for some processors. The default is that FP exceptions are
11791enabled.
74291a4b 11792
39bc1876
NS
11793For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
1179464-bit code, then we can use both FP pipes. Otherwise, we can only use one
11795FP pipe.
74291a4b 11796
39bc1876
NS
11797@item -mvr4130-align
11798@itemx -mno-vr4130-align
11799@opindex mvr4130-align
11800The VR4130 pipeline is two-way superscalar, but can only issue two
11801instructions together if the first one is 8-byte aligned. When this
11802option is enabled, GCC will align pairs of instructions that it
11803thinks should execute in parallel.
74291a4b 11804
39bc1876
NS
11805This option only has an effect when optimizing for the VR4130.
11806It normally makes code faster, but at the expense of making it bigger.
11807It is enabled by default at optimization level @option{-O3}.
11808@end table
3a8699c7 11809
39bc1876
NS
11810@node MMIX Options
11811@subsection MMIX Options
11812@cindex MMIX Options
74291a4b 11813
39bc1876 11814These options are defined for the MMIX:
74291a4b 11815
39bc1876
NS
11816@table @gcctabopt
11817@item -mlibfuncs
11818@itemx -mno-libfuncs
11819@opindex mlibfuncs
11820@opindex mno-libfuncs
11821Specify that intrinsic library functions are being compiled, passing all
11822values in registers, no matter the size.
3cadd778 11823
39bc1876
NS
11824@item -mepsilon
11825@itemx -mno-epsilon
11826@opindex mepsilon
11827@opindex mno-epsilon
11828Generate floating-point comparison instructions that compare with respect
11829to the @code{rE} epsilon register.
3cadd778 11830
39bc1876
NS
11831@item -mabi=mmixware
11832@itemx -mabi=gnu
11833@opindex mabi-mmixware
11834@opindex mabi=gnu
11835Generate code that passes function parameters and return values that (in
11836the called function) are seen as registers @code{$0} and up, as opposed to
11837the GNU ABI which uses global registers @code{$231} and up.
3cadd778 11838
39bc1876
NS
11839@item -mzero-extend
11840@itemx -mno-zero-extend
11841@opindex mzero-extend
11842@opindex mno-zero-extend
11843When reading data from memory in sizes shorter than 64 bits, use (do not
11844use) zero-extending load instructions by default, rather than
11845sign-extending ones.
3cadd778 11846
39bc1876
NS
11847@item -mknuthdiv
11848@itemx -mno-knuthdiv
11849@opindex mknuthdiv
11850@opindex mno-knuthdiv
11851Make the result of a division yielding a remainder have the same sign as
11852the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
11853remainder follows the sign of the dividend. Both methods are
11854arithmetically valid, the latter being almost exclusively used.
74291a4b 11855
39bc1876
NS
11856@item -mtoplevel-symbols
11857@itemx -mno-toplevel-symbols
11858@opindex mtoplevel-symbols
11859@opindex mno-toplevel-symbols
11860Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
11861code can be used with the @code{PREFIX} assembly directive.
74291a4b 11862
39bc1876
NS
11863@item -melf
11864@opindex melf
11865Generate an executable in the ELF format, rather than the default
11866@samp{mmo} format used by the @command{mmix} simulator.
3d5a0820 11867
39bc1876
NS
11868@item -mbranch-predict
11869@itemx -mno-branch-predict
11870@opindex mbranch-predict
11871@opindex mno-branch-predict
11872Use (do not use) the probable-branch instructions, when static branch
11873prediction indicates a probable branch.
3cadd778 11874
39bc1876
NS
11875@item -mbase-addresses
11876@itemx -mno-base-addresses
11877@opindex mbase-addresses
11878@opindex mno-base-addresses
11879Generate (do not generate) code that uses @emph{base addresses}. Using a
11880base address automatically generates a request (handled by the assembler
11881and the linker) for a constant to be set up in a global register. The
11882register is used for one or more base address requests within the range 0
11883to 255 from the value held in the register. The generally leads to short
11884and fast code, but the number of different data items that can be
11885addressed is limited. This means that a program that uses lots of static
11886data may require @option{-mno-base-addresses}.
3cadd778 11887
39bc1876
NS
11888@item -msingle-exit
11889@itemx -mno-single-exit
11890@opindex msingle-exit
11891@opindex mno-single-exit
11892Force (do not force) generated code to have a single exit point in each
11893function.
11894@end table
3cadd778 11895
39bc1876
NS
11896@node MN10300 Options
11897@subsection MN10300 Options
11898@cindex MN10300 options
3cadd778 11899
39bc1876 11900These @option{-m} options are defined for Matsushita MN10300 architectures:
3cadd778 11901
39bc1876
NS
11902@table @gcctabopt
11903@item -mmult-bug
11904@opindex mmult-bug
11905Generate code to avoid bugs in the multiply instructions for the MN10300
11906processors. This is the default.
c474f76b 11907
39bc1876
NS
11908@item -mno-mult-bug
11909@opindex mno-mult-bug
11910Do not generate code to avoid bugs in the multiply instructions for the
11911MN10300 processors.
3cadd778 11912
39bc1876
NS
11913@item -mam33
11914@opindex mam33
11915Generate code which uses features specific to the AM33 processor.
3cadd778 11916
39bc1876
NS
11917@item -mno-am33
11918@opindex mno-am33
11919Do not generate code which uses features specific to the AM33 processor. This
11920is the default.
1a66cd67 11921
b1eb8119
DD
11922@item -mreturn-pointer-on-d0
11923@opindex mreturn-pointer-on-d0
11924When generating a function which returns a pointer, return the pointer
11925in both @code{a0} and @code{d0}. Otherwise, the pointer is returned
11926only in a0, and attempts to call such functions without a prototype
11927would result in errors. Note that this option is on by default; use
11928@option{-mno-return-pointer-on-d0} to disable it.
11929
39bc1876
NS
11930@item -mno-crt0
11931@opindex mno-crt0
11932Do not link in the C run-time initialization object file.
93ca1662 11933
39bc1876
NS
11934@item -mrelax
11935@opindex mrelax
11936Indicate to the linker that it should perform a relaxation optimization pass
11937to shorten branches, calls and absolute memory addresses. This option only
11938has an effect when used on the command line for the final link step.
11939
11940This option makes symbolic debugging impossible.
74291a4b
MM
11941@end table
11942
6c9ac67a
NS
11943@node MT Options
11944@subsection MT Options
11945@cindex MT options
c85ba4fb 11946
6c9ac67a 11947These @option{-m} options are defined for Morpho MT architectures:
c85ba4fb
AH
11948
11949@table @gcctabopt
11950
11951@item -march=@var{cpu-type}
11952@opindex march
11953Generate code that will run on @var{cpu-type}, which is the name of a system
11954representing a certain processor type. Possible values for
6c9ac67a
NS
11955@var{cpu-type} are @samp{ms1-64-001}, @samp{ms1-16-002},
11956@samp{ms1-16-003} and @samp{ms2}.
c85ba4fb 11957
6c9ac67a 11958When this option is not used, the default is @option{-march=ms1-16-002}.
c85ba4fb
AH
11959
11960@item -mbacc
11961@opindex mbacc
11962Use byte loads and stores when generating code.
11963
11964@item -mno-bacc
11965@opindex mno-bacc
11966Do not use byte loads and stores when generating code.
11967
11968@item -msim
11969@opindex msim
11970Use simulator runtime
11971
11972@item -mno-crt0
11973@opindex mno-crt0
11974Do not link in the C run-time initialization object file
57b51d4d 11975@file{crti.o}. Other run-time initialization and termination files
c85ba4fb
AH
11976such as @file{startup.o} and @file{exit.o} are still included on the
11977linker command line.
11978
11979@end table
11980
39bc1876
NS
11981@node PDP-11 Options
11982@subsection PDP-11 Options
11983@cindex PDP-11 Options
f84271d9 11984
39bc1876 11985These options are defined for the PDP-11:
f84271d9 11986
2642624b 11987@table @gcctabopt
39bc1876
NS
11988@item -mfpu
11989@opindex mfpu
11990Use hardware FPP floating point. This is the default. (FIS floating
11991point on the PDP-11/40 is not supported.)
f84271d9 11992
39bc1876
NS
11993@item -msoft-float
11994@opindex msoft-float
11995Do not use hardware floating point.
f84271d9 11996
39bc1876
NS
11997@item -mac0
11998@opindex mac0
11999Return floating-point results in ac0 (fr0 in Unix assembler syntax).
f84271d9 12000
39bc1876
NS
12001@item -mno-ac0
12002@opindex mno-ac0
12003Return floating-point results in memory. This is the default.
12004
12005@item -m40
12006@opindex m40
12007Generate code for a PDP-11/40.
12008
12009@item -m45
12010@opindex m45
12011Generate code for a PDP-11/45. This is the default.
f84271d9 12012
39bc1876
NS
12013@item -m10
12014@opindex m10
12015Generate code for a PDP-11/10.
f84271d9 12016
39bc1876
NS
12017@item -mbcopy-builtin
12018@opindex bcopy-builtin
70128ad9 12019Use inline @code{movmemhi} patterns for copying memory. This is the
39bc1876 12020default.
f84271d9 12021
39bc1876
NS
12022@item -mbcopy
12023@opindex mbcopy
70128ad9 12024Do not use inline @code{movmemhi} patterns for copying memory.
02f52e19 12025
39bc1876
NS
12026@item -mint16
12027@itemx -mno-int32
12028@opindex mint16
12029@opindex mno-int32
12030Use 16-bit @code{int}. This is the default.
48f0be1b 12031
39bc1876
NS
12032@item -mint32
12033@itemx -mno-int16
12034@opindex mint32
12035@opindex mno-int16
12036Use 32-bit @code{int}.
b4378319 12037
39bc1876
NS
12038@item -mfloat64
12039@itemx -mno-float32
12040@opindex mfloat64
12041@opindex mno-float32
12042Use 64-bit @code{float}. This is the default.
b4378319 12043
39bc1876
NS
12044@item -mfloat32
12045@itemx -mno-float64
12046@opindex mfloat32
12047@opindex mno-float64
12048Use 32-bit @code{float}.
daf2f129 12049
39bc1876
NS
12050@item -mabshi
12051@opindex mabshi
12052Use @code{abshi2} pattern. This is the default.
232830b7 12053
39bc1876
NS
12054@item -mno-abshi
12055@opindex mno-abshi
12056Do not use @code{abshi2} pattern.
b4378319 12057
39bc1876
NS
12058@item -mbranch-expensive
12059@opindex mbranch-expensive
12060Pretend that branches are expensive. This is for experimenting with
12061code generation only.
b4378319 12062
39bc1876
NS
12063@item -mbranch-cheap
12064@opindex mbranch-cheap
12065Do not pretend that branches are expensive. This is the default.
b4378319 12066
39bc1876
NS
12067@item -msplit
12068@opindex msplit
8a36672b 12069Generate code for a system with split I&D@.
b4378319 12070
39bc1876
NS
12071@item -mno-split
12072@opindex mno-split
8a36672b 12073Generate code for a system without split I&D@. This is the default.
f84271d9 12074
39bc1876
NS
12075@item -munix-asm
12076@opindex munix-asm
12077Use Unix assembler syntax. This is the default when configured for
12078@samp{pdp11-*-bsd}.
56b2d7a7 12079
39bc1876
NS
12080@item -mdec-asm
12081@opindex mdec-asm
12082Use DEC assembler syntax. This is the default when configured for any
12083PDP-11 target other than @samp{pdp11-*-bsd}.
12084@end table
56b2d7a7 12085
39bc1876
NS
12086@node PowerPC Options
12087@subsection PowerPC Options
12088@cindex PowerPC options
56b2d7a7 12089
39bc1876 12090These are listed under @xref{RS/6000 and PowerPC Options}.
56b2d7a7 12091
39bc1876
NS
12092@node RS/6000 and PowerPC Options
12093@subsection IBM RS/6000 and PowerPC Options
12094@cindex RS/6000 and PowerPC Options
12095@cindex IBM RS/6000 and PowerPC Options
56b2d7a7 12096
39bc1876
NS
12097These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
12098@table @gcctabopt
12099@item -mpower
12100@itemx -mno-power
12101@itemx -mpower2
12102@itemx -mno-power2
12103@itemx -mpowerpc
12104@itemx -mno-powerpc
12105@itemx -mpowerpc-gpopt
12106@itemx -mno-powerpc-gpopt
12107@itemx -mpowerpc-gfxopt
12108@itemx -mno-powerpc-gfxopt
12109@itemx -mpowerpc64
12110@itemx -mno-powerpc64
9719f3b7
DE
12111@itemx -mmfcrf
12112@itemx -mno-mfcrf
12113@itemx -mpopcntb
12114@itemx -mno-popcntb
12115@itemx -mfprnd
12116@itemx -mno-fprnd
b639c3c2
JJ
12117@itemx -mcmpb
12118@itemx -mno-cmpb
44cd321e
PS
12119@itemx -mmfpgpr
12120@itemx -mno-mfpgpr
b639c3c2
JJ
12121@itemx -mdfp
12122@itemx -mno-dfp
39bc1876
NS
12123@opindex mpower
12124@opindex mno-power
12125@opindex mpower2
12126@opindex mno-power2
12127@opindex mpowerpc
12128@opindex mno-powerpc
12129@opindex mpowerpc-gpopt
12130@opindex mno-powerpc-gpopt
12131@opindex mpowerpc-gfxopt
12132@opindex mno-powerpc-gfxopt
12133@opindex mpowerpc64
12134@opindex mno-powerpc64
9719f3b7
DE
12135@opindex mmfcrf
12136@opindex mno-mfcrf
12137@opindex mpopcntb
12138@opindex mno-popcntb
12139@opindex mfprnd
12140@opindex mno-fprnd
b639c3c2
JJ
12141@opindex mcmpb
12142@opindex mno-cmpb
44cd321e
PS
12143@opindex mmfpgpr
12144@opindex mno-mfpgpr
b639c3c2
JJ
12145@opindex mdfp
12146@opindex mno-dfp
39bc1876
NS
12147GCC supports two related instruction set architectures for the
12148RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
12149instructions supported by the @samp{rios} chip set used in the original
12150RS/6000 systems and the @dfn{PowerPC} instruction set is the
9719f3b7
DE
12151architecture of the Freescale MPC5xx, MPC6xx, MPC8xx microprocessors, and
12152the IBM 4xx, 6xx, and follow-on microprocessors.
56b2d7a7 12153
39bc1876
NS
12154Neither architecture is a subset of the other. However there is a
12155large common subset of instructions supported by both. An MQ
12156register is included in processors supporting the POWER architecture.
56b2d7a7 12157
39bc1876
NS
12158You use these options to specify which instructions are available on the
12159processor you are using. The default value of these options is
12160determined when configuring GCC@. Specifying the
12161@option{-mcpu=@var{cpu_type}} overrides the specification of these
12162options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
12163rather than the options listed above.
56b2d7a7 12164
39bc1876
NS
12165The @option{-mpower} option allows GCC to generate instructions that
12166are found only in the POWER architecture and to use the MQ register.
12167Specifying @option{-mpower2} implies @option{-power} and also allows GCC
12168to generate instructions that are present in the POWER2 architecture but
12169not the original POWER architecture.
83575957 12170
39bc1876
NS
12171The @option{-mpowerpc} option allows GCC to generate instructions that
12172are found only in the 32-bit subset of the PowerPC architecture.
12173Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
12174GCC to use the optional PowerPC architecture instructions in the
12175General Purpose group, including floating-point square root. Specifying
12176@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
12177use the optional PowerPC architecture instructions in the Graphics
12178group, including floating-point select.
83575957 12179
9719f3b7
DE
12180The @option{-mmfcrf} option allows GCC to generate the move from
12181condition register field instruction implemented on the POWER4
12182processor and other processors that support the PowerPC V2.01
12183architecture.
12184The @option{-mpopcntb} option allows GCC to generate the popcount and
12185double precision FP reciprocal estimate instruction implemented on the
12186POWER5 processor and other processors that support the PowerPC V2.02
12187architecture.
12188The @option{-mfprnd} option allows GCC to generate the FP round to
12189integer instructions implemented on the POWER5+ processor and other
12190processors that support the PowerPC V2.03 architecture.
b639c3c2
JJ
12191The @option{-mcmpb} option allows GCC to generate the compare bytes
12192instruction implemented on the POWER6 processor and other processors
12193that support the PowerPC V2.05 architecture.
44cd321e
PS
12194The @option{-mmfpgpr} option allows GCC to generate the FP move to/from
12195general purpose register instructions implemented on the POWER6X
12196processor and other processors that support the extended PowerPC V2.05
12197architecture.
b639c3c2
JJ
12198The @option{-mdfp} option allows GCC to generate the decimal floating
12199point instructions implemented on some POWER processors.
9719f3b7 12200
39bc1876
NS
12201The @option{-mpowerpc64} option allows GCC to generate the additional
1220264-bit instructions that are found in the full PowerPC64 architecture
12203and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
12204@option{-mno-powerpc64}.
83575957 12205
39bc1876
NS
12206If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
12207will use only the instructions in the common subset of both
12208architectures plus some special AIX common-mode calls, and will not use
12209the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
12210permits GCC to use any instruction from either architecture and to
12211allow use of the MQ register; specify this for the Motorola MPC601.
83575957 12212
39bc1876
NS
12213@item -mnew-mnemonics
12214@itemx -mold-mnemonics
12215@opindex mnew-mnemonics
12216@opindex mold-mnemonics
12217Select which mnemonics to use in the generated assembler code. With
12218@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
12219the PowerPC architecture. With @option{-mold-mnemonics} it uses the
12220assembler mnemonics defined for the POWER architecture. Instructions
12221defined in only one architecture have only one mnemonic; GCC uses that
12222mnemonic irrespective of which of these options is specified.
83575957 12223
39bc1876
NS
12224GCC defaults to the mnemonics appropriate for the architecture in
12225use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
12226value of these option. Unless you are building a cross-compiler, you
12227should normally not specify either @option{-mnew-mnemonics} or
12228@option{-mold-mnemonics}, but should instead accept the default.
83575957 12229
39bc1876
NS
12230@item -mcpu=@var{cpu_type}
12231@opindex mcpu
12232Set architecture type, register usage, choice of mnemonics, and
12233instruction scheduling parameters for machine type @var{cpu_type}.
12234Supported values for @var{cpu_type} are @samp{401}, @samp{403},
12235@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
12236@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
12237@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
12238@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
9719f3b7 12239@samp{860}, @samp{970}, @samp{8540}, @samp{ec603e}, @samp{G3},
39bc1876 12240@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
e118597e 12241@samp{power4}, @samp{power5}, @samp{power5+}, @samp{power6},
44cd321e 12242@samp{power6x}, @samp{common}, @samp{powerpc}, @samp{powerpc64},
98c41d98 12243@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64}.
83575957 12244
39bc1876
NS
12245@option{-mcpu=common} selects a completely generic processor. Code
12246generated under this option will run on any POWER or PowerPC processor.
12247GCC will use only the instructions in the common subset of both
12248architectures, and will not use the MQ register. GCC assumes a generic
12249processor model for scheduling purposes.
83575957 12250
39bc1876
NS
12251@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
12252@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
12253PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
12254types, with an appropriate, generic processor model assumed for
12255scheduling purposes.
83575957 12256
39bc1876
NS
12257The other options specify a specific processor. Code generated under
12258those options will run best on that processor, and may not run at all on
12259others.
83575957 12260
39bc1876 12261The @option{-mcpu} options automatically enable or disable the
78681dbd
RS
12262following options:
12263
12264@gccoptlist{-maltivec -mfprnd -mhard-float -mmfcrf -mmultiple @gol
12265-mnew-mnemonics -mpopcntb -mpower -mpower2 -mpowerpc64 @gol
12266-mpowerpc-gpopt -mpowerpc-gfxopt -mstring -mmulhw -mdlmzb -mmfpgpr}
12267
44cd321e
PS
12268The particular options set for any particular CPU will vary between
12269compiler versions, depending on what setting seems to produce optimal
12270code for that CPU; it doesn't necessarily reflect the actual hardware's
12271capabilities. If you wish to set an individual option to a particular
12272value, you may specify it after the @option{-mcpu} option, like
12273@samp{-mcpu=970 -mno-altivec}.
5d7c2819 12274
39bc1876 12275On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
9719f3b7 12276not enabled or disabled by the @option{-mcpu} option at present because
39bc1876
NS
12277AIX does not have full support for these options. You may still
12278enable or disable them individually if you're sure it'll work in your
12279environment.
83575957 12280
39bc1876
NS
12281@item -mtune=@var{cpu_type}
12282@opindex mtune
12283Set the instruction scheduling parameters for machine type
12284@var{cpu_type}, but do not set the architecture type, register usage, or
12285choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
12286values for @var{cpu_type} are used for @option{-mtune} as for
12287@option{-mcpu}. If both are specified, the code generated will use the
12288architecture, registers, and mnemonics set by @option{-mcpu}, but the
12289scheduling parameters set by @option{-mtune}.
83575957 12290
ef765ea9
DE
12291@item -mswdiv
12292@itemx -mno-swdiv
12293@opindex mswdiv
12294@opindex mno-swdiv
12295Generate code to compute division as reciprocal estimate and iterative
12296refinement, creating opportunities for increased throughput. This
12297feature requires: optional PowerPC Graphics instruction set for single
12298precision and FRE instruction for double precision, assuming divides
12299cannot generate user-visible traps, and the domain values not include
12300Infinities, denormals or zero denominator.
12301
39bc1876
NS
12302@item -maltivec
12303@itemx -mno-altivec
12304@opindex maltivec
12305@opindex mno-altivec
7088c6e4
GK
12306Generate code that uses (does not use) AltiVec instructions, and also
12307enable the use of built-in functions that allow more direct access to
12308the AltiVec instruction set. You may also need to set
39bc1876
NS
12309@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
12310enhancements.
83575957 12311
78f5898b
AH
12312@item -mvrsave
12313@item -mno-vrsave
12314@opindex mvrsave
12315@opindex mno-vrsave
12316Generate VRSAVE instructions when generating AltiVec code.
12317
7f970b70
AM
12318@item -msecure-plt
12319@opindex msecure-plt
12320Generate code that allows ld and ld.so to build executables and shared
12321libraries with non-exec .plt and .got sections. This is a PowerPC
1232232-bit SYSV ABI option.
12323
12324@item -mbss-plt
12325@opindex mbss-plt
12326Generate code that uses a BSS .plt section that ld.so fills in, and
12327requires .plt and .got sections that are both writable and executable.
12328This is a PowerPC 32-bit SYSV ABI option.
12329
78f5898b
AH
12330@item -misel
12331@itemx -mno-isel
39bc1876 12332@opindex misel
78f5898b 12333@opindex mno-isel
39bc1876 12334This switch enables or disables the generation of ISEL instructions.
83575957 12335
78f5898b
AH
12336@item -misel=@var{yes/no}
12337This switch has been deprecated. Use @option{-misel} and
12338@option{-mno-isel} instead.
12339
12340@item -mspe
ea574900 12341@itemx -mno-spe
39bc1876 12342@opindex mspe
78f5898b 12343@opindex mno-spe
39bc1876
NS
12344This switch enables or disables the generation of SPE simd
12345instructions.
83575957 12346
78f5898b
AH
12347@item -mspe=@var{yes/no}
12348This option has been deprecated. Use @option{-mspe} and
12349@option{-mno-spe} instead.
12350
4d4cbc0e 12351@item -mfloat-gprs=@var{yes/single/double/no}
39bc1876
NS
12352@itemx -mfloat-gprs
12353@opindex mfloat-gprs
12354This switch enables or disables the generation of floating point
12355operations on the general purpose registers for architectures that
4d4cbc0e
AH
12356support it.
12357
12358The argument @var{yes} or @var{single} enables the use of
12359single-precision floating point operations.
12360
12361The argument @var{double} enables the use of single and
12362double-precision floating point operations.
12363
12364The argument @var{no} disables floating point operations on the
12365general purpose registers.
12366
12367This option is currently only available on the MPC854x.
83575957 12368
49bd1d27
SS
12369@item -m32
12370@itemx -m64
12371@opindex m32
12372@opindex m64
12373Generate code for 32-bit or 64-bit environments of Darwin and SVR4
12374targets (including GNU/Linux). The 32-bit environment sets int, long
12375and pointer to 32 bits and generates code that runs on any PowerPC
12376variant. The 64-bit environment sets int to 32 bits and long and
12377pointer to 64 bits, and generates code for PowerPC64, as for
12378@option{-mpowerpc64}.
12379
39bc1876
NS
12380@item -mfull-toc
12381@itemx -mno-fp-in-toc
12382@itemx -mno-sum-in-toc
12383@itemx -mminimal-toc
12384@opindex mfull-toc
12385@opindex mno-fp-in-toc
12386@opindex mno-sum-in-toc
12387@opindex mminimal-toc
12388Modify generation of the TOC (Table Of Contents), which is created for
12389every executable file. The @option{-mfull-toc} option is selected by
12390default. In that case, GCC will allocate at least one TOC entry for
12391each unique non-automatic variable reference in your program. GCC
12392will also place floating-point constants in the TOC@. However, only
1239316,384 entries are available in the TOC@.
83575957 12394
39bc1876
NS
12395If you receive a linker error message that saying you have overflowed
12396the available TOC space, you can reduce the amount of TOC space used
12397with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
12398@option{-mno-fp-in-toc} prevents GCC from putting floating-point
12399constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
12400generate code to calculate the sum of an address and a constant at
12401run-time instead of putting that sum into the TOC@. You may specify one
12402or both of these options. Each causes GCC to produce very slightly
12403slower and larger code at the expense of conserving TOC space.
83575957 12404
39bc1876
NS
12405If you still run out of space in the TOC even when you specify both of
12406these options, specify @option{-mminimal-toc} instead. This option causes
12407GCC to make only one TOC entry for every file. When you specify this
12408option, GCC will produce code that is slower and larger but which
12409uses extremely little TOC space. You may wish to use this option
12410only on files that contain less frequently executed code.
83575957 12411
39bc1876
NS
12412@item -maix64
12413@itemx -maix32
12414@opindex maix64
12415@opindex maix32
12416Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
12417@code{long} type, and the infrastructure needed to support them.
12418Specifying @option{-maix64} implies @option{-mpowerpc64} and
12419@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
12420implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
83575957 12421
de17c25f
DE
12422@item -mxl-compat
12423@itemx -mno-xl-compat
12424@opindex mxl-compat
12425@opindex mno-xl-compat
8fbe3bb2
DE
12426Produce code that conforms more closely to IBM XL compiler semantics
12427when using AIX-compatible ABI. Pass floating-point arguments to
12428prototyped functions beyond the register save area (RSA) on the stack
12429in addition to argument FPRs. Do not assume that most significant
12430double in 128-bit long double value is properly rounded when comparing
12431values and converting to double. Use XL symbol names for long double
12432support routines.
de17c25f
DE
12433
12434The AIX calling convention was extended but not initially documented to
39bc1876 12435handle an obscure K&R C case of calling a function that takes the
8fbe3bb2 12436address of its arguments with fewer arguments than declared. IBM XL
39bc1876
NS
12437compilers access floating point arguments which do not fit in the
12438RSA from the stack when a subroutine is compiled without
12439optimization. Because always storing floating-point arguments on the
12440stack is inefficient and rarely needed, this option is not enabled by
8fbe3bb2 12441default and only is necessary when calling subroutines compiled by IBM
39bc1876 12442XL compilers without optimization.
83575957 12443
39bc1876
NS
12444@item -mpe
12445@opindex mpe
12446Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
12447application written to use message passing with special startup code to
12448enable the application to run. The system must have PE installed in the
12449standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
12450must be overridden with the @option{-specs=} option to specify the
12451appropriate directory location. The Parallel Environment does not
12452support threads, so the @option{-mpe} option and the @option{-pthread}
12453option are incompatible.
83575957 12454
39bc1876
NS
12455@item -malign-natural
12456@itemx -malign-power
12457@opindex malign-natural
12458@opindex malign-power
d9168963 12459On AIX, 32-bit Darwin, and 64-bit PowerPC GNU/Linux, the option
39bc1876
NS
12460@option{-malign-natural} overrides the ABI-defined alignment of larger
12461types, such as floating-point doubles, on their natural size-based boundary.
12462The option @option{-malign-power} instructs GCC to follow the ABI-specified
8a36672b 12463alignment rules. GCC defaults to the standard alignment defined in the ABI@.
83575957 12464
d9168963
SS
12465On 64-bit Darwin, natural alignment is the default, and @option{-malign-power}
12466is not supported.
12467
39bc1876
NS
12468@item -msoft-float
12469@itemx -mhard-float
12470@opindex msoft-float
12471@opindex mhard-float
12472Generate code that does not use (uses) the floating-point register set.
12473Software floating point emulation is provided if you use the
12474@option{-msoft-float} option, and pass the option to GCC when linking.
83575957 12475
39bc1876
NS
12476@item -mmultiple
12477@itemx -mno-multiple
12478@opindex mmultiple
12479@opindex mno-multiple
12480Generate code that uses (does not use) the load multiple word
12481instructions and the store multiple word instructions. These
12482instructions are generated by default on POWER systems, and not
12483generated on PowerPC systems. Do not use @option{-mmultiple} on little
12484endian PowerPC systems, since those instructions do not work when the
12485processor is in little endian mode. The exceptions are PPC740 and
12486PPC750 which permit the instructions usage in little endian mode.
83575957 12487
39bc1876
NS
12488@item -mstring
12489@itemx -mno-string
12490@opindex mstring
12491@opindex mno-string
12492Generate code that uses (does not use) the load string instructions
12493and the store string word instructions to save multiple registers and
12494do small block moves. These instructions are generated by default on
12495POWER systems, and not generated on PowerPC systems. Do not use
12496@option{-mstring} on little endian PowerPC systems, since those
12497instructions do not work when the processor is in little endian mode.
12498The exceptions are PPC740 and PPC750 which permit the instructions
12499usage in little endian mode.
052a4b28 12500
39bc1876
NS
12501@item -mupdate
12502@itemx -mno-update
12503@opindex mupdate
12504@opindex mno-update
12505Generate code that uses (does not use) the load or store instructions
12506that update the base register to the address of the calculated memory
12507location. These instructions are generated by default. If you use
12508@option{-mno-update}, there is a small window between the time that the
12509stack pointer is updated and the address of the previous frame is
12510stored, which means code that walks the stack frame across interrupts or
12511signals may get corrupted data.
052a4b28 12512
39bc1876
NS
12513@item -mfused-madd
12514@itemx -mno-fused-madd
12515@opindex mfused-madd
12516@opindex mno-fused-madd
12517Generate code that uses (does not use) the floating point multiply and
12518accumulate instructions. These instructions are generated by default if
12519hardware floating is used.
3a69a7d5 12520
131aeb82
JM
12521@item -mmulhw
12522@itemx -mno-mulhw
12523@opindex mmulhw
12524@opindex mno-mulhw
12525Generate code that uses (does not use) the half-word multiply and
12526multiply-accumulate instructions on the IBM 405 and 440 processors.
12527These instructions are generated by default when targetting those
12528processors.
12529
716019c0
JM
12530@item -mdlmzb
12531@itemx -mno-dlmzb
12532@opindex mdlmzb
12533@opindex mno-dlmzb
12534Generate code that uses (does not use) the string-search @samp{dlmzb}
12535instruction on the IBM 405 and 440 processors. This instruction is
12536generated by default when targetting those processors.
12537
39bc1876
NS
12538@item -mno-bit-align
12539@itemx -mbit-align
12540@opindex mno-bit-align
12541@opindex mbit-align
12542On System V.4 and embedded PowerPC systems do not (do) force structures
12543and unions that contain bit-fields to be aligned to the base type of the
12544bit-field.
3a69a7d5 12545
39bc1876
NS
12546For example, by default a structure containing nothing but 8
12547@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
12548boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
12549the structure would be aligned to a 1 byte boundary and be one byte in
12550size.
3a69a7d5 12551
39bc1876
NS
12552@item -mno-strict-align
12553@itemx -mstrict-align
12554@opindex mno-strict-align
12555@opindex mstrict-align
12556On System V.4 and embedded PowerPC systems do not (do) assume that
12557unaligned memory references will be handled by the system.
3a69a7d5 12558
39bc1876
NS
12559@item -mrelocatable
12560@itemx -mno-relocatable
12561@opindex mrelocatable
12562@opindex mno-relocatable
12563On embedded PowerPC systems generate code that allows (does not allow)
12564the program to be relocated to a different address at runtime. If you
12565use @option{-mrelocatable} on any module, all objects linked together must
12566be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
3a69a7d5 12567
39bc1876
NS
12568@item -mrelocatable-lib
12569@itemx -mno-relocatable-lib
12570@opindex mrelocatable-lib
12571@opindex mno-relocatable-lib
12572On embedded PowerPC systems generate code that allows (does not allow)
12573the program to be relocated to a different address at runtime. Modules
12574compiled with @option{-mrelocatable-lib} can be linked with either modules
12575compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
12576with modules compiled with the @option{-mrelocatable} options.
052a4b28 12577
39bc1876
NS
12578@item -mno-toc
12579@itemx -mtoc
12580@opindex mno-toc
12581@opindex mtoc
12582On System V.4 and embedded PowerPC systems do not (do) assume that
12583register 2 contains a pointer to a global area pointing to the addresses
12584used in the program.
052a4b28 12585
39bc1876
NS
12586@item -mlittle
12587@itemx -mlittle-endian
12588@opindex mlittle
12589@opindex mlittle-endian
12590On System V.4 and embedded PowerPC systems compile code for the
12591processor in little endian mode. The @option{-mlittle-endian} option is
12592the same as @option{-mlittle}.
052a4b28 12593
39bc1876
NS
12594@item -mbig
12595@itemx -mbig-endian
12596@opindex mbig
12597@opindex mbig-endian
12598On System V.4 and embedded PowerPC systems compile code for the
12599processor in big endian mode. The @option{-mbig-endian} option is
12600the same as @option{-mbig}.
052a4b28 12601
39bc1876
NS
12602@item -mdynamic-no-pic
12603@opindex mdynamic-no-pic
12604On Darwin and Mac OS X systems, compile code so that it is not
12605relocatable, but that its external references are relocatable. The
12606resulting code is suitable for applications, but not shared
12607libraries.
3a69a7d5 12608
39bc1876
NS
12609@item -mprioritize-restricted-insns=@var{priority}
12610@opindex mprioritize-restricted-insns
12611This option controls the priority that is assigned to
12612dispatch-slot restricted instructions during the second scheduling
12613pass. The argument @var{priority} takes the value @var{0/1/2} to assign
12614@var{no/highest/second-highest} priority to dispatch slot restricted
12615instructions.
3a69a7d5 12616
39bc1876
NS
12617@item -msched-costly-dep=@var{dependence_type}
12618@opindex msched-costly-dep
12619This option controls which dependences are considered costly
12620by the target during instruction scheduling. The argument
12621@var{dependence_type} takes one of the following values:
12622@var{no}: no dependence is costly,
12623@var{all}: all dependences are costly,
12624@var{true_store_to_load}: a true dependence from store to load is costly,
12625@var{store_to_load}: any dependence from store to load is costly,
12626@var{number}: any dependence which latency >= @var{number} is costly.
11338cda 12627
39bc1876
NS
12628@item -minsert-sched-nops=@var{scheme}
12629@opindex minsert-sched-nops
12630This option controls which nop insertion scheme will be used during
8a36672b 12631the second scheduling pass. The argument @var{scheme} takes one of the
39bc1876
NS
12632following values:
12633@var{no}: Don't insert nops.
12634@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
12635according to the scheduler's grouping.
12636@var{regroup_exact}: Insert nops to force costly dependent insns into
12637separate groups. Insert exactly as many nops as needed to force an insn
12638to a new group, according to the estimated processor grouping.
12639@var{number}: Insert nops to force costly dependent insns into
12640separate groups. Insert @var{number} nops to force an insn to a new group.
052a4b28 12641
39bc1876
NS
12642@item -mcall-sysv
12643@opindex mcall-sysv
12644On System V.4 and embedded PowerPC systems compile code using calling
12645conventions that adheres to the March 1995 draft of the System V
12646Application Binary Interface, PowerPC processor supplement. This is the
12647default unless you configured GCC using @samp{powerpc-*-eabiaix}.
789a3090 12648
39bc1876
NS
12649@item -mcall-sysv-eabi
12650@opindex mcall-sysv-eabi
12651Specify both @option{-mcall-sysv} and @option{-meabi} options.
789a3090 12652
39bc1876
NS
12653@item -mcall-sysv-noeabi
12654@opindex mcall-sysv-noeabi
12655Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
789a3090 12656
39bc1876
NS
12657@item -mcall-solaris
12658@opindex mcall-solaris
12659On System V.4 and embedded PowerPC systems compile code for the Solaris
12660operating system.
789a3090 12661
39bc1876
NS
12662@item -mcall-linux
12663@opindex mcall-linux
12664On System V.4 and embedded PowerPC systems compile code for the
12665Linux-based GNU system.
789a3090 12666
39bc1876
NS
12667@item -mcall-gnu
12668@opindex mcall-gnu
12669On System V.4 and embedded PowerPC systems compile code for the
12670Hurd-based GNU system.
789a3090 12671
39bc1876
NS
12672@item -mcall-netbsd
12673@opindex mcall-netbsd
12674On System V.4 and embedded PowerPC systems compile code for the
12675NetBSD operating system.
789a3090 12676
39bc1876
NS
12677@item -maix-struct-return
12678@opindex maix-struct-return
12679Return all structures in memory (as specified by the AIX ABI)@.
789a3090 12680
39bc1876
NS
12681@item -msvr4-struct-return
12682@opindex msvr4-struct-return
12683Return structures smaller than 8 bytes in registers (as specified by the
12684SVR4 ABI)@.
789a3090 12685
78f5898b
AH
12686@item -mabi=@var{abi-type}
12687@opindex mabi
12688Extend the current ABI with a particular extension, or remove such extension.
12689Valid values are @var{altivec}, @var{no-altivec}, @var{spe},
602ea4d3
JJ
12690@var{no-spe}, @var{ibmlongdouble}, @var{ieeelongdouble}@.
12691
12692@item -mabi=spe
12693@opindex mabi=spe
12694Extend the current ABI with SPE ABI extensions. This does not change
12695the default ABI, instead it adds the SPE ABI extensions to the current
12696ABI@.
12697
12698@item -mabi=no-spe
12699@opindex mabi=no-spe
12700Disable Booke SPE ABI extensions for the current ABI@.
12701
12702@item -mabi=ibmlongdouble
12703@opindex mabi=ibmlongdouble
12704Change the current ABI to use IBM extended precision long double.
12705This is a PowerPC 32-bit SYSV ABI option.
12706
12707@item -mabi=ieeelongdouble
12708@opindex mabi=ieeelongdouble
12709Change the current ABI to use IEEE extended precision long double.
12710This is a PowerPC 32-bit Linux ABI option.
789a3090 12711
39bc1876
NS
12712@item -mprototype
12713@itemx -mno-prototype
12714@opindex mprototype
12715@opindex mno-prototype
12716On System V.4 and embedded PowerPC systems assume that all calls to
12717variable argument functions are properly prototyped. Otherwise, the
12718compiler must insert an instruction before every non prototyped call to
12719set or clear bit 6 of the condition code register (@var{CR}) to
12720indicate whether floating point values were passed in the floating point
12721registers in case the function takes a variable arguments. With
12722@option{-mprototype}, only calls to prototyped variable argument functions
12723will set or clear the bit.
83575957 12724
39bc1876
NS
12725@item -msim
12726@opindex msim
12727On embedded PowerPC systems, assume that the startup module is called
12728@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
12729@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
12730configurations.
df6194d4 12731
39bc1876
NS
12732@item -mmvme
12733@opindex mmvme
12734On embedded PowerPC systems, assume that the startup module is called
12735@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
12736@file{libc.a}.
df6194d4 12737
39bc1876
NS
12738@item -mads
12739@opindex mads
12740On embedded PowerPC systems, assume that the startup module is called
12741@file{crt0.o} and the standard C libraries are @file{libads.a} and
12742@file{libc.a}.
df6194d4 12743
39bc1876
NS
12744@item -myellowknife
12745@opindex myellowknife
12746On embedded PowerPC systems, assume that the startup module is called
12747@file{crt0.o} and the standard C libraries are @file{libyk.a} and
12748@file{libc.a}.
df6194d4 12749
39bc1876
NS
12750@item -mvxworks
12751@opindex mvxworks
12752On System V.4 and embedded PowerPC systems, specify that you are
12753compiling for a VxWorks system.
df6194d4 12754
39bc1876
NS
12755@item -mwindiss
12756@opindex mwindiss
12757Specify that you are compiling for the WindISS simulation environment.
df6194d4 12758
39bc1876
NS
12759@item -memb
12760@opindex memb
12761On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
12762header to indicate that @samp{eabi} extended relocations are used.
df6194d4 12763
39bc1876
NS
12764@item -meabi
12765@itemx -mno-eabi
12766@opindex meabi
12767@opindex mno-eabi
12768On System V.4 and embedded PowerPC systems do (do not) adhere to the
12769Embedded Applications Binary Interface (eabi) which is a set of
12770modifications to the System V.4 specifications. Selecting @option{-meabi}
12771means that the stack is aligned to an 8 byte boundary, a function
12772@code{__eabi} is called to from @code{main} to set up the eabi
12773environment, and the @option{-msdata} option can use both @code{r2} and
12774@code{r13} to point to two separate small data areas. Selecting
12775@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
12776do not call an initialization function from @code{main}, and the
12777@option{-msdata} option will only use @code{r13} to point to a single
12778small data area. The @option{-meabi} option is on by default if you
12779configured GCC using one of the @samp{powerpc*-*-eabi*} options.
df6194d4 12780
39bc1876
NS
12781@item -msdata=eabi
12782@opindex msdata=eabi
12783On System V.4 and embedded PowerPC systems, put small initialized
12784@code{const} global and static data in the @samp{.sdata2} section, which
12785is pointed to by register @code{r2}. Put small initialized
12786non-@code{const} global and static data in the @samp{.sdata} section,
12787which is pointed to by register @code{r13}. Put small uninitialized
12788global and static data in the @samp{.sbss} section, which is adjacent to
12789the @samp{.sdata} section. The @option{-msdata=eabi} option is
12790incompatible with the @option{-mrelocatable} option. The
12791@option{-msdata=eabi} option also sets the @option{-memb} option.
df6194d4 12792
39bc1876
NS
12793@item -msdata=sysv
12794@opindex msdata=sysv
12795On System V.4 and embedded PowerPC systems, put small global and static
12796data in the @samp{.sdata} section, which is pointed to by register
12797@code{r13}. Put small uninitialized global and static data in the
12798@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
12799The @option{-msdata=sysv} option is incompatible with the
12800@option{-mrelocatable} option.
df6194d4 12801
39bc1876 12802@item -msdata=default
df6194d4 12803@itemx -msdata
39bc1876 12804@opindex msdata=default
cd3bb277 12805@opindex msdata
39bc1876
NS
12806On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
12807compile code the same as @option{-msdata=eabi}, otherwise compile code the
12808same as @option{-msdata=sysv}.
df6194d4 12809
39bc1876
NS
12810@item -msdata-data
12811@opindex msdata-data
05f25017
AM
12812On System V.4 and embedded PowerPC systems, put small global
12813data in the @samp{.sdata} section. Put small uninitialized global
12814data in the @samp{.sbss} section. Do not use register @code{r13}
39bc1876
NS
12815to address small data however. This is the default behavior unless
12816other @option{-msdata} options are used.
df6194d4 12817
39bc1876
NS
12818@item -msdata=none
12819@itemx -mno-sdata
12820@opindex msdata=none
12821@opindex mno-sdata
12822On embedded PowerPC systems, put all initialized global and static data
12823in the @samp{.data} section, and all uninitialized data in the
12824@samp{.bss} section.
df6194d4 12825
39bc1876
NS
12826@item -G @var{num}
12827@opindex G
12828@cindex smaller data references (PowerPC)
12829@cindex .sdata/.sdata2 references (PowerPC)
12830On embedded PowerPC systems, put global and static items less than or
12831equal to @var{num} bytes into the small data or bss sections instead of
12832the normal data or bss section. By default, @var{num} is 8. The
12833@option{-G @var{num}} switch is also passed to the linker.
12834All modules should be compiled with the same @option{-G @var{num}} value.
dcffbade 12835
39bc1876
NS
12836@item -mregnames
12837@itemx -mno-regnames
12838@opindex mregnames
12839@opindex mno-regnames
12840On System V.4 and embedded PowerPC systems do (do not) emit register
12841names in the assembly language output using symbolic forms.
dcffbade 12842
39bc1876
NS
12843@item -mlongcall
12844@itemx -mno-longcall
12845@opindex mlongcall
12846@opindex mno-longcall
87c365a4
NS
12847By default assume that all calls are far away so that a longer more
12848expensive calling sequence is required. This is required for calls
12849further than 32 megabytes (33,554,432 bytes) from the current location.
12850A short call will be generated if the compiler knows
12851the call cannot be that far away. This setting can be overridden by
12852the @code{shortcall} function attribute, or by @code{#pragma
12853longcall(0)}.
dcffbade 12854
39bc1876
NS
12855Some linkers are capable of detecting out-of-range calls and generating
12856glue code on the fly. On these systems, long calls are unnecessary and
12857generate slower code. As of this writing, the AIX linker can do this,
12858as can the GNU linker for PowerPC/64. It is planned to add this feature
12859to the GNU linker for 32-bit PowerPC systems as well.
df6194d4 12860
39bc1876
NS
12861On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
12862callee, L42'', plus a ``branch island'' (glue code). The two target
d78aa55c 12863addresses represent the callee and the ``branch island''. The
39bc1876
NS
12864Darwin/PPC linker will prefer the first address and generate a ``bl
12865callee'' if the PPC ``bl'' instruction will reach the callee directly;
12866otherwise, the linker will generate ``bl L42'' to call the ``branch
d78aa55c 12867island''. The ``branch island'' is appended to the body of the
39bc1876
NS
12868calling function; it computes the full 32-bit address of the callee
12869and jumps to it.
df6194d4 12870
39bc1876
NS
12871On Mach-O (Darwin) systems, this option directs the compiler emit to
12872the glue for every direct call, and the Darwin linker decides whether
12873to use or discard it.
12874
12875In the future, we may cause GCC to ignore all longcall specifications
12876when the linker is known to generate glue.
12877
12878@item -pthread
12879@opindex pthread
12880Adds support for multithreading with the @dfn{pthreads} library.
12881This option sets flags for both the preprocessor and linker.
30028c85 12882
df6194d4
JW
12883@end table
12884
91abf72d
HP
12885@node S/390 and zSeries Options
12886@subsection S/390 and zSeries Options
12887@cindex S/390 and zSeries Options
12888
12889These are the @samp{-m} options defined for the S/390 and zSeries architecture.
12890
12891@table @gcctabopt
12892@item -mhard-float
12893@itemx -msoft-float
12894@opindex mhard-float
12895@opindex msoft-float
12896Use (do not use) the hardware floating-point instructions and registers
12897for floating-point operations. When @option{-msoft-float} is specified,
12898functions in @file{libgcc.a} will be used to perform floating-point
12899operations. When @option{-mhard-float} is specified, the compiler
12900generates IEEE floating-point instructions. This is the default.
12901
f61a2c7d
AK
12902@item -mlong-double-64
12903@itemx -mlong-double-128
12904@opindex mlong-double-64
12905@opindex mlong-double-128
12906These switches control the size of @code{long double} type. A size
12907of 64bit makes the @code{long double} type equivalent to the @code{double}
12908type. This is the default.
12909
91abf72d
HP
12910@item -mbackchain
12911@itemx -mno-backchain
12912@opindex mbackchain
12913@opindex mno-backchain
b3d31392
AK
12914Store (do not store) the address of the caller's frame as backchain pointer
12915into the callee's stack frame.
adf39f8f
AK
12916A backchain may be needed to allow debugging using tools that do not understand
12917DWARF-2 call frame information.
b3d31392
AK
12918When @option{-mno-packed-stack} is in effect, the backchain pointer is stored
12919at the bottom of the stack frame; when @option{-mpacked-stack} is in effect,
12920the backchain is placed into the topmost word of the 96/160 byte register
12921save area.
12922
12923In general, code compiled with @option{-mbackchain} is call-compatible with
12924code compiled with @option{-mmo-backchain}; however, use of the backchain
12925for debugging purposes usually requires that the whole binary is built with
6b78f6be
AK
12926@option{-mbackchain}. Note that the combination of @option{-mbackchain},
12927@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
12928to build a linux kernel use @option{-msoft-float}.
b3d31392
AK
12929
12930The default is to not maintain the backchain.
12931
12932@item -mpacked-stack
12933@item -mno-packed-stack
12934@opindex mpacked-stack
12935@opindex mno-packed-stack
12936Use (do not use) the packed stack layout. When @option{-mno-packed-stack} is
12937specified, the compiler uses the all fields of the 96/160 byte register save
12938area only for their default purpose; unused fields still take up stack space.
12939When @option{-mpacked-stack} is specified, register save slots are densely
12940packed at the top of the register save area; unused space is reused for other
12941purposes, allowing for more efficient use of the available stack space.
12942However, when @option{-mbackchain} is also in effect, the topmost word of
12943the save area is always used to store the backchain, and the return address
12944register is always saved two words below the backchain.
12945
f2fd3821 12946As long as the stack frame backchain is not used, code generated with
b3d31392
AK
12947@option{-mpacked-stack} is call-compatible with code generated with
12948@option{-mno-packed-stack}. Note that some non-FSF releases of GCC 2.95 for
12949S/390 or zSeries generated code that uses the stack frame backchain at run
12950time, not just for debugging purposes. Such code is not call-compatible
12951with code compiled with @option{-mpacked-stack}. Also, note that the
6b78f6be
AK
12952combination of @option{-mbackchain},
12953@option{-mpacked-stack} and @option{-mhard-float} is not supported. In order
12954to build a linux kernel use @option{-msoft-float}.
b3d31392
AK
12955
12956The default is to not use the packed stack layout.
91abf72d
HP
12957
12958@item -msmall-exec
12959@itemx -mno-small-exec
12960@opindex msmall-exec
12961@opindex mno-small-exec
f282ffb3
JM
12962Generate (or do not generate) code using the @code{bras} instruction
12963to do subroutine calls.
91abf72d
HP
12964This only works reliably if the total executable size does not
12965exceed 64k. The default is to use the @code{basr} instruction instead,
12966which does not have this limitation.
12967
12968@item -m64
12969@itemx -m31
12970@opindex m64
12971@opindex m31
12972When @option{-m31} is specified, generate code compliant to the
95fef11f
JM
12973GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
12974code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
91abf72d 12975particular to generate 64-bit instructions. For the @samp{s390}
f282ffb3 12976targets, the default is @option{-m31}, while the @samp{s390x}
91abf72d
HP
12977targets default to @option{-m64}.
12978
1fec52be
HP
12979@item -mzarch
12980@itemx -mesa
12981@opindex mzarch
12982@opindex mesa
daf2f129
JM
12983When @option{-mzarch} is specified, generate code using the
12984instructions available on z/Architecture.
12985When @option{-mesa} is specified, generate code using the
8a36672b 12986instructions available on ESA/390. Note that @option{-mesa} is
1fec52be 12987not possible with @option{-m64}.
95fef11f 12988When generating code compliant to the GNU/Linux for S/390 ABI,
f13e0d4e 12989the default is @option{-mesa}. When generating code compliant
95fef11f 12990to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
1fec52be 12991
91abf72d
HP
12992@item -mmvcle
12993@itemx -mno-mvcle
12994@opindex mmvcle
12995@opindex mno-mvcle
f282ffb3 12996Generate (or do not generate) code using the @code{mvcle} instruction
3364c33b 12997to perform block moves. When @option{-mno-mvcle} is specified,
8daf098e
AS
12998use a @code{mvc} loop instead. This is the default unless optimizing for
12999size.
91abf72d
HP
13000
13001@item -mdebug
13002@itemx -mno-debug
13003@opindex mdebug
13004@opindex mno-debug
13005Print (or do not print) additional debug information when compiling.
13006The default is to not print debug information.
13007
f13e0d4e 13008@item -march=@var{cpu-type}
1fec52be 13009@opindex march
f13e0d4e 13010Generate code that will run on @var{cpu-type}, which is the name of a system
8a36672b 13011representing a certain processor type. Possible values for
f13e0d4e
UW
13012@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
13013When generating code using the instructions available on z/Architecture,
13014the default is @option{-march=z900}. Otherwise, the default is
13015@option{-march=g5}.
1fec52be 13016
f13e0d4e 13017@item -mtune=@var{cpu-type}
35082351 13018@opindex mtune
1fec52be 13019Tune to @var{cpu-type} everything applicable about the generated code,
f13e0d4e
UW
13020except for the ABI and the set of available instructions.
13021The list of @var{cpu-type} values is the same as for @option{-march}.
13022The default is the value used for @option{-march}.
1fec52be 13023
f26c1794
EC
13024@item -mtpf-trace
13025@itemx -mno-tpf-trace
13026@opindex mtpf-trace
13027@opindex mno-tpf-trace
13028Generate code that adds (does not add) in TPF OS specific branches to trace
13029routines in the operating system. This option is off by default, even
8a36672b 13030when compiling for the TPF OS@.
f26c1794 13031
f2d226e1
AK
13032@item -mfused-madd
13033@itemx -mno-fused-madd
13034@opindex mfused-madd
13035@opindex mno-fused-madd
13036Generate code that uses (does not use) the floating point multiply and
13037accumulate instructions. These instructions are generated by default if
13038hardware floating point is used.
d75f90f1
AK
13039
13040@item -mwarn-framesize=@var{framesize}
13041@opindex mwarn-framesize
13042Emit a warning if the current function exceeds the given frame size. Because
13043this is a compile time check it doesn't need to be a real problem when the program
f0eb93a8
JM
13044runs. It is intended to identify functions which most probably cause
13045a stack overflow. It is useful to be used in an environment with limited stack
431ae0bf 13046size e.g.@: the linux kernel.
d75f90f1
AK
13047
13048@item -mwarn-dynamicstack
13049@opindex mwarn-dynamicstack
13050Emit a warning if the function calls alloca or uses dynamically
13051sized arrays. This is generally a bad idea with a limited stack size.
13052
13053@item -mstack-guard=@var{stack-guard}
13054@item -mstack-size=@var{stack-size}
13055@opindex mstack-guard
13056@opindex mstack-size
690e7b63
AK
13057If these options are provided the s390 back end emits additional instructions in
13058the function prologue which trigger a trap if the stack size is @var{stack-guard}
13059bytes above the @var{stack-size} (remember that the stack on s390 grows downward).
13060If the @var{stack-guard} option is omitted the smallest power of 2 larger than
13061the frame size of the compiled function is chosen.
13062These options are intended to be used to help debugging stack overflow problems.
13063The additionally emitted code causes only little overhead and hence can also be
13064used in production like systems without greater performance degradation. The given
13065values have to be exact powers of 2 and @var{stack-size} has to be greater than
13066@var{stack-guard} without exceeding 64k.
d75f90f1
AK
13067In order to be efficient the extra code makes the assumption that the stack starts
13068at an address aligned to the value given by @var{stack-size}.
690e7b63 13069The @var{stack-guard} option can only be used in conjunction with @var{stack-size}.
91abf72d
HP
13070@end table
13071
93ef7c1f
CL
13072@node Score Options
13073@subsection Score Options
13074@cindex Score Options
13075
13076These options are defined for Score implementations:
13077
13078@table @gcctabopt
93ef7c1f
CL
13079@item -meb
13080@opindex meb
13081Compile code for big endian mode. This is the default.
13082
c6681463 13083@item -mel
edc5f63b 13084@opindex mel
c6681463
CL
13085Compile code for little endian mode.
13086
13087@item -mnhwloop
edc5f63b 13088@opindex mnhwloop
c6681463
CL
13089Disable generate bcnz instruction.
13090
13091@item -muls
edc5f63b 13092@opindex muls
c6681463
CL
13093Enable generate unaligned load and store instruction.
13094
93ef7c1f
CL
13095@item -mmac
13096@opindex mmac
c6681463
CL
13097Enable the use of multiply-accumulate instructions. Disabled by default.
13098
13099@item -mscore5
13100@opindex mscore5
13101Specify the SCORE5 as the target architecture.
93ef7c1f
CL
13102
13103@item -mscore5u
13104@opindex mscore5u
13105Specify the SCORE5U of the target architecture.
13106
13107@item -mscore7
13108@opindex mscore7
c6681463
CL
13109Specify the SCORE7 as the target architecture. This is the default.
13110
13111@item -mscore7d
13112@opindex mscore7d
13113Specify the SCORE7D as the target architecture.
93ef7c1f
CL
13114@end table
13115
39bc1876
NS
13116@node SH Options
13117@subsection SH Options
bcf684c7 13118
39bc1876 13119These @samp{-m} options are defined for the SH implementations:
bcf684c7 13120
5d22c1a5 13121@table @gcctabopt
39bc1876
NS
13122@item -m1
13123@opindex m1
13124Generate code for the SH1.
9f85bca7 13125
39bc1876
NS
13126@item -m2
13127@opindex m2
13128Generate code for the SH2.
9f85bca7 13129
39bc1876
NS
13130@item -m2e
13131Generate code for the SH2e.
9f85bca7 13132
39bc1876
NS
13133@item -m3
13134@opindex m3
13135Generate code for the SH3.
9f85bca7 13136
39bc1876
NS
13137@item -m3e
13138@opindex m3e
13139Generate code for the SH3e.
9f85bca7 13140
39bc1876
NS
13141@item -m4-nofpu
13142@opindex m4-nofpu
13143Generate code for the SH4 without a floating-point unit.
9f85bca7 13144
39bc1876
NS
13145@item -m4-single-only
13146@opindex m4-single-only
13147Generate code for the SH4 with a floating-point unit that only
13148supports single-precision arithmetic.
9f85bca7 13149
39bc1876
NS
13150@item -m4-single
13151@opindex m4-single
13152Generate code for the SH4 assuming the floating-point unit is in
13153single-precision mode by default.
9f85bca7 13154
39bc1876
NS
13155@item -m4
13156@opindex m4
13157Generate code for the SH4.
9f85bca7 13158
312209c6
AO
13159@item -m4a-nofpu
13160@opindex m4a-nofpu
13161Generate code for the SH4al-dsp, or for a SH4a in such a way that the
13162floating-point unit is not used.
13163
13164@item -m4a-single-only
13165@opindex m4a-single-only
13166Generate code for the SH4a, in such a way that no double-precision
13167floating point operations are used.
13168
13169@item -m4a-single
13170@opindex m4a-single
13171Generate code for the SH4a assuming the floating-point unit is in
13172single-precision mode by default.
13173
13174@item -m4a
13175@opindex m4a
13176Generate code for the SH4a.
13177
13178@item -m4al
13179@opindex m4al
13180Same as @option{-m4a-nofpu}, except that it implicitly passes
13181@option{-dsp} to the assembler. GCC doesn't generate any DSP
13182instructions at the moment.
13183
39bc1876
NS
13184@item -mb
13185@opindex mb
13186Compile code for the processor in big endian mode.
9f85bca7 13187
39bc1876
NS
13188@item -ml
13189@opindex ml
13190Compile code for the processor in little endian mode.
9f85bca7 13191
39bc1876
NS
13192@item -mdalign
13193@opindex mdalign
13194Align doubles at 64-bit boundaries. Note that this changes the calling
13195conventions, and thus some functions from the standard C library will
13196not work unless you recompile it first with @option{-mdalign}.
9f85bca7 13197
39bc1876
NS
13198@item -mrelax
13199@opindex mrelax
13200Shorten some address references at link time, when possible; uses the
13201linker option @option{-relax}.
9f85bca7 13202
39bc1876
NS
13203@item -mbigtable
13204@opindex mbigtable
13205Use 32-bit offsets in @code{switch} tables. The default is to use
1320616-bit offsets.
9f85bca7 13207
39bc1876
NS
13208@item -mfmovd
13209@opindex mfmovd
13210Enable the use of the instruction @code{fmovd}.
9f85bca7 13211
39bc1876
NS
13212@item -mhitachi
13213@opindex mhitachi
13214Comply with the calling conventions defined by Renesas.
9f85bca7 13215
2acc29bd
NC
13216@item -mrenesas
13217@opindex mhitachi
13218Comply with the calling conventions defined by Renesas.
13219
13220@item -mno-renesas
13221@opindex mhitachi
13222Comply with the calling conventions defined for GCC before the Renesas
13223conventions were available. This option is the default for all
13224targets of the SH toolchain except for @samp{sh-symbianelf}.
13225
39bc1876
NS
13226@item -mnomacsave
13227@opindex mnomacsave
13228Mark the @code{MAC} register as call-clobbered, even if
13229@option{-mhitachi} is given.
9f85bca7 13230
39bc1876
NS
13231@item -mieee
13232@opindex mieee
13233Increase IEEE-compliance of floating-point code.
73a4d10b
R
13234At the moment, this is equivalent to @option{-fno-finite-math-only}.
13235When generating 16 bit SH opcodes, getting IEEE-conforming results for
13236comparisons of NANs / infinities incurs extra overhead in every
13237floating point comparison, therefore the default is set to
13238@option{-ffinite-math-only}.
9f85bca7 13239
dc557046
R
13240@item -minline-ic_invalidate
13241@opindex minline-ic_invalidate
13242Inline code to invalidate instruction cache entries after setting up
13243nested function trampolines.
13244This option has no effect if -musermode is in effect and the selected
13245code generation option (e.g. -m4) does not allow the use of the icbi
13246instruction.
13247If the selected code generation option does not allow the use of the icbi
13248instruction, and -musermode is not in effect, the inlined code will
13249manipulate the instruction cache address array directly with an associative
13250write. This not only requires privileged mode, but it will also
13251fail if the cache line had been mapped via the TLB and has become unmapped.
13252
39bc1876
NS
13253@item -misize
13254@opindex misize
13255Dump instruction size and location in the assembly code.
9f85bca7 13256
39bc1876
NS
13257@item -mpadstruct
13258@opindex mpadstruct
13259This option is deprecated. It pads structures to multiple of 4 bytes,
13260which is incompatible with the SH ABI@.
9f85bca7 13261
39bc1876
NS
13262@item -mspace
13263@opindex mspace
13264Optimize for space instead of speed. Implied by @option{-Os}.
9f85bca7 13265
39bc1876
NS
13266@item -mprefergot
13267@opindex mprefergot
13268When generating position-independent code, emit function calls using
13269the Global Offset Table instead of the Procedure Linkage Table.
9f85bca7 13270
39bc1876
NS
13271@item -musermode
13272@opindex musermode
dc557046
R
13273Don't generate privileged mode only code; implies -mno-inline-ic_invalidate
13274if the inlined code would not work in user mode.
13275This is the default when the target is @code{sh-*-linux*}.
73a4d10b
R
13276
13277@item -multcost=@var{number}
13278@opindex multcost=@var{number}
13279Set the cost to assume for a multiply insn.
13280
13281@item -mdiv=@var{strategy}
13282@opindex mdiv=@var{strategy}
13283Set the division strategy to use for SHmedia code. @var{strategy} must be
13284one of: call, call2, fp, inv, inv:minlat, inv20u, inv20l, inv:call,
13285inv:call2, inv:fp .
13286"fp" performs the operation in floating point. This has a very high latency,
13287but needs only a few instructions, so it might be a good choice if
30dc60c7 13288your code has enough easily exploitable ILP to allow the compiler to
73a4d10b
R
13289schedule the floating point instructions together with other instructions.
13290Division by zero causes a floating point exception.
13291"inv" uses integer operations to calculate the inverse of the divisor,
30dc60c7 13292and then multiplies the dividend with the inverse. This strategy allows
73a4d10b
R
13293cse and hoisting of the inverse calculation. Division by zero calculates
13294an unspecified result, but does not trap.
13295"inv:minlat" is a variant of "inv" where if no cse / hoisting opportunities
13296have been found, or if the entire operation has been hoisted to the same
13297place, the last stages of the inverse calculation are intertwined with the
13298final multiply to reduce the overall latency, at the expense of using a few
13299more instructions, and thus offering fewer scheduling opportunities with
13300other code.
13301"call" calls a library function that usually implements the inv:minlat
13302strategy.
13303This gives high code density for m5-*media-nofpu compilations.
13304"call2" uses a different entry point of the same library function, where it
13305assumes that a pointer to a lookup table has already been set up, which
13306exposes the pointer load to cse / code hoisting optimizations.
13307"inv:call", "inv:call2" and "inv:fp" all use the "inv" algorithm for initial
13308code generation, but if the code stays unoptimized, revert to the "call",
30dc60c7 13309"call2", or "fp" strategies, respectively. Note that the
73a4d10b
R
13310potentially-trapping side effect of division by zero is carried by a
13311separate instruction, so it is possible that all the integer instructions
13312are hoisted out, but the marker for the side effect stays where it is.
13313A recombination to fp operations or a call is not possible in that case.
13314"inv20u" and "inv20l" are variants of the "inv:minlat" strategy. In the case
13315that the inverse calculation was nor separated from the multiply, they speed
13316up division where the dividend fits into 20 bits (plus sign where applicable),
13317by inserting a test to skip a number of operations in this case; this test
30dc60c7 13318slows down the case of larger dividends. inv20u assumes the case of a such
73a4d10b
R
13319a small dividend to be unlikely, and inv20l assumes it to be likely.
13320
13321@item -mdivsi3_libfunc=@var{name}
13322@opindex mdivsi3_libfunc=@var{name}
13323Set the name of the library function used for 32 bit signed division to
13324@var{name}. This only affect the name used in the call and inv:call
13325division strategies, and the compiler will still expect the same
13326sets of input/output/clobbered registers as if this option was not present.
13327
13328@item -madjust-unroll
13329@opindex madjust-unroll
13330Throttle unrolling to avoid thrashing target registers.
13331This option only has an effect if the gcc code base supports the
13332TARGET_ADJUST_UNROLL_MAX target hook.
13333
13334@item -mindexed-addressing
13335@opindex mindexed-addressing
13336Enable the use of the indexed addressing mode for SHmedia32/SHcompact.
13337This is only safe if the hardware and/or OS implement 32 bit wrap-around
13338semantics for the indexed addressing mode. The architecture allows the
13339implementation of processors with 64 bit MMU, which the OS could use to
30dc60c7 13340get 32 bit addressing, but since no current hardware implementation supports
73a4d10b
R
13341this or any other way to make the indexed addressing mode safe to use in
13342the 32 bit ABI, the default is -mno-indexed-addressing.
13343
13344@item -mgettrcost=@var{number}
13345@opindex mgettrcost=@var{number}
13346Set the cost assumed for the gettr instruction to @var{number}.
13347The default is 2 if @option{-mpt-fixed} is in effect, 100 otherwise.
13348
13349@item -mpt-fixed
13350@opindex mpt-fixed
13351Assume pt* instructions won't trap. This will generally generate better
13352scheduled code, but is unsafe on current hardware. The current architecture
13353definition says that ptabs and ptrel trap when the target anded with 3 is 3.
13354This has the unintentional effect of making it unsafe to schedule ptabs /
13355ptrel before a branch, or hoist it out of a loop. For example,
13356__do_global_ctors, a part of libgcc that runs constructors at program
78681dbd
RS
13357startup, calls functions in a list which is delimited by @minus{}1. With the
13358-mpt-fixed option, the ptabs will be done before testing against @minus{}1.
73a4d10b 13359That means that all the constructors will be run a bit quicker, but when
30dc60c7 13360the loop comes to the end of the list, the program crashes because ptabs
78681dbd 13361loads @minus{}1 into a target register. Since this option is unsafe for any
73a4d10b
R
13362hardware implementing the current architecture specification, the default
13363is -mno-pt-fixed. Unless the user specifies a specific cost with
13364@option{-mgettrcost}, -mno-pt-fixed also implies @option{-mgettrcost=100};
13365this deters register allocation using target registers for storing
13366ordinary integers.
13367
13368@item -minvalid-symbols
13369@opindex minvalid-symbols
13370Assume symbols might be invalid. Ordinary function symbols generated by
13371the compiler will always be valid to load with movi/shori/ptabs or
13372movi/shori/ptrel, but with assembler and/or linker tricks it is possible
13373to generate symbols that will cause ptabs / ptrel to trap.
13374This option is only meaningful when @option{-mno-pt-fixed} is in effect.
13375It will then prevent cross-basic-block cse, hoisting and most scheduling
13376of symbol loads. The default is @option{-mno-invalid-symbols}.
9f85bca7
JM
13377@end table
13378
39bc1876
NS
13379@node SPARC Options
13380@subsection SPARC Options
13381@cindex SPARC options
69a0611f 13382
39bc1876 13383These @samp{-m} options are supported on the SPARC:
69a0611f
GK
13384
13385@table @gcctabopt
39bc1876
NS
13386@item -mno-app-regs
13387@itemx -mapp-regs
13388@opindex mno-app-regs
13389@opindex mapp-regs
13390Specify @option{-mapp-regs} to generate output using the global registers
133912 through 4, which the SPARC SVR4 ABI reserves for applications. This
d14f5ecb 13392is the default.
69a0611f 13393
39bc1876
NS
13394To be fully SVR4 ABI compliant at the cost of some performance loss,
13395specify @option{-mno-app-regs}. You should compile libraries and system
13396software with this option.
70899148 13397
39bc1876
NS
13398@item -mfpu
13399@itemx -mhard-float
13400@opindex mfpu
13401@opindex mhard-float
13402Generate output containing floating point instructions. This is the
13403default.
70899148 13404
39bc1876
NS
13405@item -mno-fpu
13406@itemx -msoft-float
13407@opindex mno-fpu
13408@opindex msoft-float
13409Generate output containing library calls for floating point.
13410@strong{Warning:} the requisite libraries are not available for all SPARC
13411targets. Normally the facilities of the machine's usual C compiler are
13412used, but this cannot be done directly in cross-compilation. You must make
13413your own arrangements to provide suitable library functions for
13414cross-compilation. The embedded targets @samp{sparc-*-aout} and
13415@samp{sparclite-*-*} do provide software floating point support.
70899148 13416
39bc1876
NS
13417@option{-msoft-float} changes the calling convention in the output file;
13418therefore, it is only useful if you compile @emph{all} of a program with
13419this option. In particular, you need to compile @file{libgcc.a}, the
13420library that comes with GCC, with @option{-msoft-float} in order for
13421this to work.
70899148 13422
39bc1876
NS
13423@item -mhard-quad-float
13424@opindex mhard-quad-float
13425Generate output containing quad-word (long double) floating point
13426instructions.
70899148 13427
39bc1876
NS
13428@item -msoft-quad-float
13429@opindex msoft-quad-float
13430Generate output containing library calls for quad-word (long double)
13431floating point instructions. The functions called are those specified
13432in the SPARC ABI@. This is the default.
70899148 13433
39bc1876
NS
13434As of this writing, there are no SPARC implementations that have hardware
13435support for the quad-word floating point instructions. They all invoke
13436a trap handler for one of these instructions, and then the trap handler
13437emulates the effect of the instruction. Because of the trap handler overhead,
13438this is much slower than calling the ABI library routines. Thus the
13439@option{-msoft-quad-float} option is the default.
70899148 13440
39bc1876
NS
13441@item -mno-unaligned-doubles
13442@itemx -munaligned-doubles
13443@opindex mno-unaligned-doubles
13444@opindex munaligned-doubles
13445Assume that doubles have 8 byte alignment. This is the default.
70899148 13446
39bc1876
NS
13447With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
13448alignment only if they are contained in another type, or if they have an
13449absolute address. Otherwise, it assumes they have 4 byte alignment.
13450Specifying this option avoids some rare compatibility problems with code
13451generated by other compilers. It is not the default because it results
13452in a performance loss, especially for floating point code.
70899148 13453
39bc1876
NS
13454@item -mno-faster-structs
13455@itemx -mfaster-structs
13456@opindex mno-faster-structs
13457@opindex mfaster-structs
13458With @option{-mfaster-structs}, the compiler assumes that structures
13459should have 8 byte alignment. This enables the use of pairs of
13460@code{ldd} and @code{std} instructions for copies in structure
13461assignment, in place of twice as many @code{ld} and @code{st} pairs.
13462However, the use of this changed alignment directly violates the SPARC
13463ABI@. Thus, it's intended only for use on targets where the developer
13464acknowledges that their resulting code will not be directly in line with
13465the rules of the ABI@.
70899148 13466
39bc1876
NS
13467@item -mimpure-text
13468@opindex mimpure-text
13469@option{-mimpure-text}, used in addition to @option{-shared}, tells
13470the compiler to not pass @option{-z text} to the linker when linking a
13471shared object. Using this option, you can link position-dependent
13472code into a shared object.
70899148 13473
39bc1876
NS
13474@option{-mimpure-text} suppresses the ``relocations remain against
13475allocatable but non-writable sections'' linker error message.
13476However, the necessary relocations will trigger copy-on-write, and the
13477shared object is not actually shared across processes. Instead of
13478using @option{-mimpure-text}, you should compile all source code with
13479@option{-fpic} or @option{-fPIC}.
13480
13481This option is only available on SunOS and Solaris.
13482
13483@item -mcpu=@var{cpu_type}
13484@opindex mcpu
13485Set the instruction set, register set, and instruction scheduling parameters
13486for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
13487@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
13488@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
4c837a1e
DM
13489@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
13490@samp{ultrasparc3}, and @samp{niagara}.
70899148 13491
39bc1876
NS
13492Default instruction scheduling parameters are used for values that select
13493an architecture and not an implementation. These are @samp{v7}, @samp{v8},
13494@samp{sparclite}, @samp{sparclet}, @samp{v9}.
70899148 13495
39bc1876
NS
13496Here is a list of each supported architecture and their supported
13497implementations.
70899148 13498
39bc1876
NS
13499@smallexample
13500 v7: cypress
13501 v8: supersparc, hypersparc
13502 sparclite: f930, f934, sparclite86x
13503 sparclet: tsc701
4c837a1e 13504 v9: ultrasparc, ultrasparc3, niagara
39bc1876 13505@end smallexample
70899148 13506
39bc1876
NS
13507By default (unless configured otherwise), GCC generates code for the V7
13508variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
13509additionally optimizes it for the Cypress CY7C602 chip, as used in the
13510SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
13511SPARCStation 1, 2, IPX etc.
70899148 13512
39bc1876
NS
13513With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
13514architecture. The only difference from V7 code is that the compiler emits
13515the integer multiply and integer divide instructions which exist in SPARC-V8
13516but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
13517optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
135182000 series.
70899148 13519
39bc1876
NS
13520With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
13521the SPARC architecture. This adds the integer multiply, integer divide step
13522and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
13523With @option{-mcpu=f930}, the compiler additionally optimizes it for the
8a36672b 13524Fujitsu MB86930 chip, which is the original SPARClite, with no FPU@. With
39bc1876 13525@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
8a36672b 13526MB86934 chip, which is the more recent SPARClite with FPU@.
70899148 13527
39bc1876
NS
13528With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
13529the SPARC architecture. This adds the integer multiply, multiply/accumulate,
13530integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
13531but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
13532optimizes it for the TEMIC SPARClet chip.
70899148 13533
39bc1876
NS
13534With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
13535architecture. This adds 64-bit integer and floating-point move instructions,
135363 additional floating-point condition code registers and conditional move
13537instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
4c837a1e 13538optimizes it for the Sun UltraSPARC I/II/IIi chips. With
39bc1876 13539@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
4c837a1e
DM
13540Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
13541@option{-mcpu=niagara}, the compiler additionally optimizes it for
13542Sun UltraSPARC T1 chips.
70899148 13543
39bc1876
NS
13544@item -mtune=@var{cpu_type}
13545@opindex mtune
13546Set the instruction scheduling parameters for machine type
13547@var{cpu_type}, but do not set the instruction set or register set that the
13548option @option{-mcpu=@var{cpu_type}} would.
70899148 13549
39bc1876
NS
13550The same values for @option{-mcpu=@var{cpu_type}} can be used for
13551@option{-mtune=@var{cpu_type}}, but the only useful values are those
13552that select a particular cpu implementation. Those are @samp{cypress},
13553@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
4c837a1e
DM
13554@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
13555@samp{ultrasparc3}, and @samp{niagara}.
70899148 13556
39bc1876
NS
13557@item -mv8plus
13558@itemx -mno-v8plus
13559@opindex mv8plus
13560@opindex mno-v8plus
8a36672b 13561With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI@. The
39bc1876
NS
13562difference from the V8 ABI is that the global and out registers are
13563considered 64-bit wide. This is enabled by default on Solaris in 32-bit
13564mode for all SPARC-V9 processors.
70899148 13565
39bc1876
NS
13566@item -mvis
13567@itemx -mno-vis
13568@opindex mvis
13569@opindex mno-vis
13570With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
13571Visual Instruction Set extensions. The default is @option{-mno-vis}.
13572@end table
70899148 13573
39bc1876
NS
13574These @samp{-m} options are supported in addition to the above
13575on SPARC-V9 processors in 64-bit environments:
70899148 13576
39bc1876
NS
13577@table @gcctabopt
13578@item -mlittle-endian
13579@opindex mlittle-endian
8a36672b 13580Generate code for a processor running in little-endian mode. It is only
d4e1591f 13581available for a few configurations and most notably not on Solaris and Linux.
70899148 13582
39bc1876
NS
13583@item -m32
13584@itemx -m64
13585@opindex m32
13586@opindex m64
13587Generate code for a 32-bit or 64-bit environment.
13588The 32-bit environment sets int, long and pointer to 32 bits.
13589The 64-bit environment sets int to 32 bits and long and pointer
13590to 64 bits.
70899148 13591
39bc1876
NS
13592@item -mcmodel=medlow
13593@opindex mcmodel=medlow
13594Generate code for the Medium/Low code model: 64-bit addresses, programs
13595must be linked in the low 32 bits of memory. Programs can be statically
13596or dynamically linked.
70899148 13597
39bc1876
NS
13598@item -mcmodel=medmid
13599@opindex mcmodel=medmid
13600Generate code for the Medium/Middle code model: 64-bit addresses, programs
13601must be linked in the low 44 bits of memory, the text and data segments must
13602be less than 2GB in size and the data segment must be located within 2GB of
13603the text segment.
70899148 13604
39bc1876
NS
13605@item -mcmodel=medany
13606@opindex mcmodel=medany
13607Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
13608may be linked anywhere in memory, the text and data segments must be less
13609than 2GB in size and the data segment must be located within 2GB of the
13610text segment.
70899148 13611
39bc1876
NS
13612@item -mcmodel=embmedany
13613@opindex mcmodel=embmedany
13614Generate code for the Medium/Anywhere code model for embedded systems:
1361564-bit addresses, the text and data segments must be less than 2GB in
13616size, both starting anywhere in memory (determined at link time). The
13617global register %g4 points to the base of the data segment. Programs
13618are statically linked and PIC is not supported.
70899148 13619
39bc1876
NS
13620@item -mstack-bias
13621@itemx -mno-stack-bias
13622@opindex mstack-bias
13623@opindex mno-stack-bias
13624With @option{-mstack-bias}, GCC assumes that the stack pointer, and
13625frame pointer if present, are offset by @minus{}2047 which must be added back
13626when making stack frame references. This is the default in 64-bit mode.
13627Otherwise, assume no such offset is present.
13628@end table
70899148 13629
6bfb2f93
EB
13630These switches are supported in addition to the above on Solaris:
13631
13632@table @gcctabopt
13633@item -threads
13634@opindex threads
13635Add support for multithreading using the Solaris threads library. This
13636option sets flags for both the preprocessor and linker. This option does
13637not affect the thread safety of object code produced by the compiler or
13638that of libraries supplied with it.
13639
13640@item -pthreads
13641@opindex pthreads
13642Add support for multithreading using the POSIX threads library. This
13643option sets flags for both the preprocessor and linker. This option does
13644not affect the thread safety of object code produced by the compiler or
13645that of libraries supplied with it.
f5e2061b
EB
13646
13647@item -pthread
13648@opindex pthread
13649This is a synonym for @option{-pthreads}.
6bfb2f93
EB
13650@end table
13651
85d9c13c
TS
13652@node SPU Options
13653@subsection SPU Options
13654@cindex SPU options
13655
13656These @samp{-m} options are supported on the SPU:
13657
13658@table @gcctabopt
13659@item -mwarn-reloc
13660@itemx -merror-reloc
13661@opindex mwarn-reloc
13662@opindex merror-reloc
13663
13664The loader for SPU does not handle dynamic relocations. By default, GCC
13665will give an error when it generates code that requires a dynamic
13666relocation. @option{-mno-error-reloc} disables the error,
13667@option{-mwarn-reloc} will generate a warning instead.
13668
13669@item -msafe-dma
13670@itemx -munsafe-dma
13671@opindex msafe-dma
13672@opindex munsafe-dma
13673
13674Instructions which initiate or test completion of DMA must not be
13675reordered with respect to loads and stores of the memory which is being
13676accessed. Users typically address this problem using the volatile
13677keyword, but that can lead to inefficient code in places where the
13678memory is known to not change. Rather than mark the memory as volatile
13679we treat the DMA instructions as potentially effecting all memory. With
13680@option{-munsafe-dma} users must use the volatile keyword to protect
13681memory accesses.
13682
13683@item -mbranch-hints
13684@opindex mbranch-hints
13685
13686By default, GCC will generate a branch hint instruction to avoid
13687pipeline stalls for always taken or probably taken branches. A hint
13688will not be generated closer than 8 instructions away from its branch.
13689There is little reason to disable them, except for debugging purposes,
13690or to make an object a little bit smaller.
13691
13692@item -msmall-mem
13693@itemx -mlarge-mem
13694@opindex msmall-mem
13695@opindex mlarge-mem
13696
13697By default, GCC generates code assuming that addresses are never larger
13698than 18 bits. With @option{-mlarge-mem} code is generated that assumes
13699a full 32 bit address.
13700
cc8d70cd
SL
13701@item -mstdmain
13702@opindex mstdmain
13703
13704By default, GCC links against startup code that assumes the SPU-style
13705main function interface (which has an unconventional parameter list).
13706With @option{-mstdmain}, GCC will link your program against startup
13707code that assumes a C99-style interface to @code{main}, including a
13708local copy of @code{argv} strings.
13709
32fb22af
SL
13710@item -mfixed-range=@var{register-range}
13711@opindex mfixed-range
13712Generate code treating the given register range as fixed registers.
13713A fixed register is one that the register allocator can not use. This is
13714useful when compiling kernel code. A register range is specified as
13715two registers separated by a dash. Multiple register ranges can be
13716specified separated by a comma.
13717
85d9c13c
TS
13718@end table
13719
39bc1876
NS
13720@node System V Options
13721@subsection Options for System V
70899148 13722
39bc1876
NS
13723These additional options are available on System V Release 4 for
13724compatibility with other compilers on those systems:
70899148 13725
39bc1876
NS
13726@table @gcctabopt
13727@item -G
13728@opindex G
13729Create a shared object.
13730It is recommended that @option{-symbolic} or @option{-shared} be used instead.
70899148 13731
39bc1876
NS
13732@item -Qy
13733@opindex Qy
13734Identify the versions of each tool used by the compiler, in a
13735@code{.ident} assembler directive in the output.
70899148 13736
39bc1876
NS
13737@item -Qn
13738@opindex Qn
13739Refrain from adding @code{.ident} directives to the output file (this is
13740the default).
70899148 13741
39bc1876
NS
13742@item -YP,@var{dirs}
13743@opindex YP
13744Search the directories @var{dirs}, and no others, for libraries
13745specified with @option{-l}.
70899148 13746
39bc1876
NS
13747@item -Ym,@var{dir}
13748@opindex Ym
13749Look in the directory @var{dir} to find the M4 preprocessor.
13750The assembler uses this option.
13751@c This is supposed to go with a -Yd for predefined M4 macro files, but
13752@c the generic assembler that comes with Solaris takes just -Ym.
13753@end table
70899148 13754
39bc1876
NS
13755@node TMS320C3x/C4x Options
13756@subsection TMS320C3x/C4x Options
13757@cindex TMS320C3x/C4x Options
70899148 13758
39bc1876 13759These @samp{-m} options are defined for TMS320C3x/C4x implementations:
70899148 13760
39bc1876 13761@table @gcctabopt
70899148 13762
39bc1876
NS
13763@item -mcpu=@var{cpu_type}
13764@opindex mcpu
13765Set the instruction set, register set, and instruction scheduling
13766parameters for machine type @var{cpu_type}. Supported values for
13767@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
13768@samp{c44}. The default is @samp{c40} to generate code for the
13769TMS320C40.
70899148 13770
39bc1876
NS
13771@item -mbig-memory
13772@itemx -mbig
13773@itemx -msmall-memory
13774@itemx -msmall
13775@opindex mbig-memory
13776@opindex mbig
13777@opindex msmall-memory
13778@opindex msmall
13779Generates code for the big or small memory model. The small memory
13780model assumed that all data fits into one 64K word page. At run-time
13781the data page (DP) register must be set to point to the 64K page
13782containing the .bss and .data program sections. The big memory model is
13783the default and requires reloading of the DP register for every direct
13784memory access.
70899148 13785
39bc1876
NS
13786@item -mbk
13787@itemx -mno-bk
13788@opindex mbk
13789@opindex mno-bk
13790Allow (disallow) allocation of general integer operands into the block
13791count register BK@.
70899148 13792
39bc1876
NS
13793@item -mdb
13794@itemx -mno-db
13795@opindex mdb
13796@opindex mno-db
13797Enable (disable) generation of code using decrement and branch,
13798DBcond(D), instructions. This is enabled by default for the C4x. To be
13799on the safe side, this is disabled for the C3x, since the maximum
13800iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
13801@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so
13802that it can utilize the decrement and branch instruction, but will give
13803up if there is more than one memory reference in the loop. Thus a loop
13804where the loop counter is decremented can generate slightly more
13805efficient code, in cases where the RPTB instruction cannot be utilized.
70899148 13806
39bc1876
NS
13807@item -mdp-isr-reload
13808@itemx -mparanoid
13809@opindex mdp-isr-reload
13810@opindex mparanoid
13811Force the DP register to be saved on entry to an interrupt service
13812routine (ISR), reloaded to point to the data section, and restored on
13813exit from the ISR@. This should not be required unless someone has
13814violated the small memory model by modifying the DP register, say within
13815an object library.
70899148 13816
39bc1876
NS
13817@item -mmpyi
13818@itemx -mno-mpyi
13819@opindex mmpyi
13820@opindex mno-mpyi
13821For the C3x use the 24-bit MPYI instruction for integer multiplies
13822instead of a library call to guarantee 32-bit results. Note that if one
13823of the operands is a constant, then the multiplication will be performed
13824using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x,
13825then squaring operations are performed inline instead of a library call.
70899148 13826
39bc1876
NS
13827@item -mfast-fix
13828@itemx -mno-fast-fix
13829@opindex mfast-fix
13830@opindex mno-fast-fix
13831The C3x/C4x FIX instruction to convert a floating point value to an
13832integer value chooses the nearest integer less than or equal to the
13833floating point value rather than to the nearest integer. Thus if the
13834floating point number is negative, the result will be incorrectly
13835truncated an additional code is necessary to detect and correct this
13836case. This option can be used to disable generation of the additional
13837code required to correct the result.
70899148 13838
39bc1876
NS
13839@item -mrptb
13840@itemx -mno-rptb
13841@opindex mrptb
13842@opindex mno-rptb
13843Enable (disable) generation of repeat block sequences using the RPTB
13844instruction for zero overhead looping. The RPTB construct is only used
13845for innermost loops that do not call functions or jump across the loop
13846boundaries. There is no advantage having nested RPTB loops due to the
13847overhead required to save and restore the RC, RS, and RE registers.
13848This is enabled by default with @option{-O2}.
70899148 13849
39bc1876
NS
13850@item -mrpts=@var{count}
13851@itemx -mno-rpts
13852@opindex mrpts
13853@opindex mno-rpts
13854Enable (disable) the use of the single instruction repeat instruction
13855RPTS@. If a repeat block contains a single instruction, and the loop
13856count can be guaranteed to be less than the value @var{count}, GCC will
13857emit a RPTS instruction instead of a RPTB@. If no value is specified,
13858then a RPTS will be emitted even if the loop count cannot be determined
13859at compile time. Note that the repeated instruction following RPTS does
13860not have to be reloaded from memory each iteration, thus freeing up the
13861CPU buses for operands. However, since interrupts are blocked by this
13862instruction, it is disabled by default.
70899148 13863
39bc1876
NS
13864@item -mloop-unsigned
13865@itemx -mno-loop-unsigned
13866@opindex mloop-unsigned
13867@opindex mno-loop-unsigned
13868The maximum iteration count when using RPTS and RPTB (and DB on the C40)
13869is @math{2^{31} + 1} since these instructions test if the iteration count is
13870negative to terminate the loop. If the iteration count is unsigned
13871there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
13872exceeded. This switch allows an unsigned iteration count.
70899148 13873
39bc1876
NS
13874@item -mti
13875@opindex mti
13876Try to emit an assembler syntax that the TI assembler (asm30) is happy
13877with. This also enforces compatibility with the API employed by the TI
13878C3x C compiler. For example, long doubles are passed as structures
13879rather than in floating point registers.
70899148 13880
39bc1876
NS
13881@item -mregparm
13882@itemx -mmemparm
13883@opindex mregparm
13884@opindex mmemparm
13885Generate code that uses registers (stack) for passing arguments to functions.
13886By default, arguments are passed in registers where possible rather
13887than by pushing arguments on to the stack.
70899148 13888
39bc1876
NS
13889@item -mparallel-insns
13890@itemx -mno-parallel-insns
13891@opindex mparallel-insns
13892@opindex mno-parallel-insns
13893Allow the generation of parallel instructions. This is enabled by
13894default with @option{-O2}.
70899148 13895
39bc1876
NS
13896@item -mparallel-mpy
13897@itemx -mno-parallel-mpy
13898@opindex mparallel-mpy
13899@opindex mno-parallel-mpy
13900Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
13901provided @option{-mparallel-insns} is also specified. These instructions have
13902tight register constraints which can pessimize the code generation
13903of large functions.
70899148 13904
39bc1876 13905@end table
70899148 13906
39bc1876
NS
13907@node V850 Options
13908@subsection V850 Options
13909@cindex V850 Options
70899148 13910
39bc1876 13911These @samp{-m} options are defined for V850 implementations:
70899148 13912
39bc1876
NS
13913@table @gcctabopt
13914@item -mlong-calls
13915@itemx -mno-long-calls
13916@opindex mlong-calls
13917@opindex mno-long-calls
13918Treat all calls as being far away (near). If calls are assumed to be
13919far away, the compiler will always load the functions address up into a
13920register, and call indirect through the pointer.
70899148 13921
39bc1876
NS
13922@item -mno-ep
13923@itemx -mep
13924@opindex mno-ep
13925@opindex mep
13926Do not optimize (do optimize) basic blocks that use the same index
13927pointer 4 or more times to copy pointer into the @code{ep} register, and
13928use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
13929option is on by default if you optimize.
70899148 13930
39bc1876
NS
13931@item -mno-prolog-function
13932@itemx -mprolog-function
13933@opindex mno-prolog-function
13934@opindex mprolog-function
13935Do not use (do use) external functions to save and restore registers
13936at the prologue and epilogue of a function. The external functions
13937are slower, but use less code space if more than one function saves
13938the same number of registers. The @option{-mprolog-function} option
13939is on by default if you optimize.
70899148 13940
39bc1876
NS
13941@item -mspace
13942@opindex mspace
13943Try to make the code as small as possible. At present, this just turns
13944on the @option{-mep} and @option{-mprolog-function} options.
70899148 13945
39bc1876
NS
13946@item -mtda=@var{n}
13947@opindex mtda
13948Put static or global variables whose size is @var{n} bytes or less into
13949the tiny data area that register @code{ep} points to. The tiny data
13950area can hold up to 256 bytes in total (128 bytes for byte references).
70899148 13951
39bc1876
NS
13952@item -msda=@var{n}
13953@opindex msda
13954Put static or global variables whose size is @var{n} bytes or less into
13955the small data area that register @code{gp} points to. The small data
13956area can hold up to 64 kilobytes.
70899148 13957
39bc1876
NS
13958@item -mzda=@var{n}
13959@opindex mzda
13960Put static or global variables whose size is @var{n} bytes or less into
13961the first 32 kilobytes of memory.
70899148 13962
39bc1876
NS
13963@item -mv850
13964@opindex mv850
13965Specify that the target processor is the V850.
70899148 13966
39bc1876
NS
13967@item -mbig-switch
13968@opindex mbig-switch
13969Generate code suitable for big switch tables. Use this option only if
13970the assembler/linker complain about out of range branches within a switch
13971table.
70899148 13972
39bc1876
NS
13973@item -mapp-regs
13974@opindex mapp-regs
13975This option will cause r2 and r5 to be used in the code generated by
13976the compiler. This setting is the default.
70899148 13977
39bc1876
NS
13978@item -mno-app-regs
13979@opindex mno-app-regs
13980This option will cause r2 and r5 to be treated as fixed registers.
70899148 13981
39bc1876
NS
13982@item -mv850e1
13983@opindex mv850e1
13984Specify that the target processor is the V850E1. The preprocessor
13985constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
13986this option is used.
70899148 13987
39bc1876
NS
13988@item -mv850e
13989@opindex mv850e
8a36672b 13990Specify that the target processor is the V850E@. The preprocessor
39bc1876 13991constant @samp{__v850e__} will be defined if this option is used.
70899148 13992
39bc1876
NS
13993If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
13994are defined then a default target processor will be chosen and the
13995relevant @samp{__v850*__} preprocessor constant will be defined.
70899148 13996
39bc1876
NS
13997The preprocessor constants @samp{__v850} and @samp{__v851__} are always
13998defined, regardless of which processor variant is the target.
70899148 13999
39bc1876
NS
14000@item -mdisable-callt
14001@opindex mdisable-callt
14002This option will suppress generation of the CALLT instruction for the
14003v850e and v850e1 flavors of the v850 architecture. The default is
14004@option{-mno-disable-callt} which allows the CALLT instruction to be used.
70899148 14005
39bc1876 14006@end table
70899148 14007
39bc1876
NS
14008@node VAX Options
14009@subsection VAX Options
14010@cindex VAX options
70899148 14011
39bc1876 14012These @samp{-m} options are defined for the VAX:
70899148 14013
39bc1876
NS
14014@table @gcctabopt
14015@item -munix
14016@opindex munix
14017Do not output certain jump instructions (@code{aobleq} and so on)
14018that the Unix assembler for the VAX cannot handle across long
14019ranges.
70899148 14020
39bc1876
NS
14021@item -mgnu
14022@opindex mgnu
14023Do output those jump instructions, on the assumption that you
14024will assemble with the GNU assembler.
70899148 14025
39bc1876
NS
14026@item -mg
14027@opindex mg
14028Output code for g-format floating point numbers instead of d-format.
14029@end table
70899148 14030
cd773ac4
RS
14031@node VxWorks Options
14032@subsection VxWorks Options
14033@cindex VxWorks Options
14034
14035The options in this section are defined for all VxWorks targets.
14036Options specific to the target hardware are listed with the other
14037options for that target.
14038
14039@table @gcctabopt
14040@item -mrtp
14041@opindex mrtp
14042GCC can generate code for both VxWorks kernels and real time processes
14043(RTPs). This option switches from the former to the latter. It also
14044defines the preprocessor macro @code{__RTP__}.
14045
14046@item -non-static
14047@opindex non-static
14048Link an RTP executable against shared libraries rather than static
14049libraries. The options @option{-static} and @option{-shared} can
14050also be used for RTPs (@pxref{Link Options}); @option{-static}
14051is the default.
14052
14053@item -Bstatic
14054@itemx -Bdynamic
14055@opindex Bstatic
14056@opindex Bdynamic
14057These options are passed down to the linker. They are defined for
14058compatibility with Diab.
14059
14060@item -Xbind-lazy
14061@opindex Xbind-lazy
14062Enable lazy binding of function calls. This option is equivalent to
14063@option{-Wl,-z,now} and is defined for compatibility with Diab.
14064
14065@item -Xbind-now
14066@opindex Xbind-now
14067Disable lazy binding of function calls. This option is the default and
14068is defined for compatibility with Diab.
14069@end table
14070
39bc1876
NS
14071@node x86-64 Options
14072@subsection x86-64 Options
14073@cindex x86-64 options
70899148 14074
39bc1876 14075These are listed under @xref{i386 and x86-64 Options}.
70899148 14076
39bc1876
NS
14077@node Xstormy16 Options
14078@subsection Xstormy16 Options
14079@cindex Xstormy16 Options
70899148 14080
39bc1876 14081These options are defined for Xstormy16:
70899148 14082
39bc1876
NS
14083@table @gcctabopt
14084@item -msim
14085@opindex msim
14086Choose startup files and linker script suitable for the simulator.
70899148
BS
14087@end table
14088
03984308
BW
14089@node Xtensa Options
14090@subsection Xtensa Options
14091@cindex Xtensa Options
14092
6cedbe44 14093These options are supported for Xtensa targets:
03984308
BW
14094
14095@table @gcctabopt
f42f5a1b
BW
14096@item -mconst16
14097@itemx -mno-const16
14098@opindex mconst16
14099@opindex mno-const16
6c2e8d1c
BW
14100Enable or disable use of @code{CONST16} instructions for loading
14101constant values. The @code{CONST16} instruction is currently not a
14102standard option from Tensilica. When enabled, @code{CONST16}
14103instructions are always used in place of the standard @code{L32R}
14104instructions. The use of @code{CONST16} is enabled by default only if
14105the @code{L32R} instruction is not available.
14106
03984308
BW
14107@item -mfused-madd
14108@itemx -mno-fused-madd
14109@opindex mfused-madd
14110@opindex mno-fused-madd
14111Enable or disable use of fused multiply/add and multiply/subtract
14112instructions in the floating-point option. This has no effect if the
14113floating-point option is not also enabled. Disabling fused multiply/add
14114and multiply/subtract instructions forces the compiler to use separate
14115instructions for the multiply and add/subtract operations. This may be
14116desirable in some cases where strict IEEE 754-compliant results are
14117required: the fused multiply add/subtract instructions do not round the
14118intermediate result, thereby producing results with @emph{more} bits of
14119precision than specified by the IEEE standard. Disabling fused multiply
14120add/subtract instructions also ensures that the program output is not
14121sensitive to the compiler's ability to combine multiply and add/subtract
14122operations.
14123
03984308
BW
14124@item -mtext-section-literals
14125@itemx -mno-text-section-literals
14126@opindex mtext-section-literals
14127@opindex mno-text-section-literals
14128Control the treatment of literal pools. The default is
14129@option{-mno-text-section-literals}, which places literals in a separate
14130section in the output file. This allows the literal pool to be placed
14131in a data RAM/ROM, and it also allows the linker to combine literal
14132pools from separate object files to remove redundant literals and
14133improve code size. With @option{-mtext-section-literals}, the literals
14134are interspersed in the text section in order to keep them as close as
14135possible to their references. This may be necessary for large assembly
14136files.
14137
14138@item -mtarget-align
14139@itemx -mno-target-align
14140@opindex mtarget-align
14141@opindex mno-target-align
14142When this option is enabled, GCC instructs the assembler to
14143automatically align instructions to reduce branch penalties at the
14144expense of some code density. The assembler attempts to widen density
14145instructions to align branch targets and the instructions following call
14146instructions. If there are not enough preceding safe density
14147instructions to align a target, no widening will be performed. The
14148default is @option{-mtarget-align}. These options do not affect the
14149treatment of auto-aligned instructions like @code{LOOP}, which the
14150assembler will always align, either by widening density instructions or
14151by inserting no-op instructions.
14152
14153@item -mlongcalls
14154@itemx -mno-longcalls
14155@opindex mlongcalls
14156@opindex mno-longcalls
14157When this option is enabled, GCC instructs the assembler to translate
14158direct calls to indirect calls unless it can determine that the target
14159of a direct call is in the range allowed by the call instruction. This
14160translation typically occurs for calls to functions in other source
14161files. Specifically, the assembler translates a direct @code{CALL}
14162instruction into an @code{L32R} followed by a @code{CALLX} instruction.
14163The default is @option{-mno-longcalls}. This option should be used in
14164programs where the call target can potentially be out of range. This
14165option is implemented in the assembler, not the compiler, so the
14166assembly code generated by GCC will still show direct call
14167instructions---look at the disassembled object code to see the actual
14168instructions. Note that the assembler will use an indirect call for
14169every cross-file call, not just those that really will be out of range.
14170@end table
14171
39bc1876
NS
14172@node zSeries Options
14173@subsection zSeries Options
14174@cindex zSeries options
14175
14176These are listed under @xref{S/390 and zSeries Options}.
14177
74291a4b
MM
14178@node Code Gen Options
14179@section Options for Code Generation Conventions
14180@cindex code generation conventions
14181@cindex options, code generation
14182@cindex run-time options
14183
14184These machine-independent options control the interface conventions
14185used in code generation.
14186
14187Most of them have both positive and negative forms; the negative form
630d3d5a 14188of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
74291a4b
MM
14189one of the forms is listed---the one which is not the default. You
14190can figure out the other form by either removing @samp{no-} or adding
14191it.
14192
2642624b 14193@table @gcctabopt
d4463dfc
JQ
14194@item -fbounds-check
14195@opindex fbounds-check
14196For front-ends that support it, generate additional code to check that
14197indices used to access arrays are within the declared range. This is
dc5abe77 14198currently only supported by the Java and Fortran front-ends, where
d4463dfc
JQ
14199this option defaults to true and false respectively.
14200
14201@item -ftrapv
14202@opindex ftrapv
14203This option generates traps for signed overflow on addition, subtraction,
14204multiplication operations.
14205
4fa26a60
RS
14206@item -fwrapv
14207@opindex fwrapv
14208This option instructs the compiler to assume that signed arithmetic
14209overflow of addition, subtraction and multiplication wraps around
c0cbdbd9 14210using twos-complement representation. This flag enables some optimizations
aa58883c 14211and disables others. This option is enabled by default for the Java
4fa26a60
RS
14212front-end, as required by the Java language specification.
14213
956d6950 14214@item -fexceptions
cd3bb277 14215@opindex fexceptions
767094dd 14216Enable exception handling. Generates extra code needed to propagate
f0523f02 14217exceptions. For some targets, this implies GCC will generate frame
c5c76735
JL
14218unwind information for all functions, which can produce significant data
14219size overhead, although it does not affect execution. If you do not
f0523f02 14220specify this option, GCC will enable it by default for languages like
90ecce3e 14221C++ which normally require exception handling, and disable it for
c5c76735
JL
14222languages like C that do not normally require it. However, you may need
14223to enable this option when compiling C code that needs to interoperate
14224properly with exception handlers written in C++. You may also wish to
14225disable this option if you are compiling older C++ programs that don't
14226use exception handling.
956d6950 14227
6cfc0341
RH
14228@item -fnon-call-exceptions
14229@opindex fnon-call-exceptions
14230Generate code that allows trapping instructions to throw exceptions.
14231Note that this requires platform-specific runtime support that does
14232not exist everywhere. Moreover, it only allows @emph{trapping}
e979f9e8 14233instructions to throw exceptions, i.e.@: memory references or floating
6cfc0341
RH
14234point instructions. It does not allow exceptions to be thrown from
14235arbitrary signal handlers such as @code{SIGALRM}.
14236
14a774a9 14237@item -funwind-tables
cd3bb277 14238@opindex funwind-tables
bedc7537 14239Similar to @option{-fexceptions}, except that it will just generate any needed
14a774a9
RK
14240static data, but will not affect the generated code in any other way.
14241You will normally not enable this option; instead, a language processor
14242that needs this handling would enable it on your behalf.
14243
b932f770 14244@item -fasynchronous-unwind-tables
2a9dc917 14245@opindex fasynchronous-unwind-tables
b932f770
JH
14246Generate unwind table in dwarf2 format, if supported by target machine. The
14247table is exact at each instruction boundary, so it can be used for stack
14248unwinding from asynchronous events (such as debugger or garbage collector).
14249
74291a4b 14250@item -fpcc-struct-return
cd3bb277 14251@opindex fpcc-struct-return
74291a4b
MM
14252Return ``short'' @code{struct} and @code{union} values in memory like
14253longer ones, rather than in registers. This convention is less
14254efficient, but it has the advantage of allowing intercallability between
a9c60612
JJ
14255GCC-compiled files and files compiled with other compilers, particularly
14256the Portable C Compiler (pcc).
74291a4b
MM
14257
14258The precise convention for returning structures in memory depends
14259on the target configuration macros.
14260
14261Short structures and unions are those whose size and alignment match
14262that of some integer type.
14263
a9c60612
JJ
14264@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
14265switch is not binary compatible with code compiled with the
14266@option{-freg-struct-return} switch.
14267Use it to conform to a non-default application binary interface.
14268
74291a4b 14269@item -freg-struct-return
cd3bb277 14270@opindex freg-struct-return
9c34dbbf
ZW
14271Return @code{struct} and @code{union} values in registers when possible.
14272This is more efficient for small structures than
14273@option{-fpcc-struct-return}.
74291a4b 14274
9c34dbbf 14275If you specify neither @option{-fpcc-struct-return} nor
630d3d5a 14276@option{-freg-struct-return}, GCC defaults to whichever convention is
0c2d1a2a 14277standard for the target. If there is no standard convention, GCC
9c34dbbf
ZW
14278defaults to @option{-fpcc-struct-return}, except on targets where GCC is
14279the principal compiler. In those cases, we can choose the standard, and
14280we chose the more efficient register return alternative.
74291a4b 14281
a9c60612
JJ
14282@strong{Warning:} code compiled with the @option{-freg-struct-return}
14283switch is not binary compatible with code compiled with the
14284@option{-fpcc-struct-return} switch.
14285Use it to conform to a non-default application binary interface.
14286
74291a4b 14287@item -fshort-enums
cd3bb277 14288@opindex fshort-enums
74291a4b
MM
14289Allocate to an @code{enum} type only as many bytes as it needs for the
14290declared range of possible values. Specifically, the @code{enum} type
14291will be equivalent to the smallest integer type which has enough room.
14292
a9c60612
JJ
14293@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
14294code that is not binary compatible with code generated without that switch.
14295Use it to conform to a non-default application binary interface.
14296
74291a4b 14297@item -fshort-double
cd3bb277 14298@opindex fshort-double
74291a4b
MM
14299Use the same size for @code{double} as for @code{float}.
14300
a9c60612
JJ
14301@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
14302code that is not binary compatible with code generated without that switch.
14303Use it to conform to a non-default application binary interface.
14304
14305@item -fshort-wchar
14306@opindex fshort-wchar
14307Override the underlying type for @samp{wchar_t} to be @samp{short
14308unsigned int} instead of the default for the target. This option is
14309useful for building programs to run under WINE@.
14310
14311@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
14312code that is not binary compatible with code generated without that switch.
14313Use it to conform to a non-default application binary interface.
14314
74291a4b 14315@item -fno-common
cd3bb277 14316@opindex fno-common
90ecce3e 14317In C, allocate even uninitialized global variables in the data section of the
74291a4b
MM
14318object file, rather than generating them as common blocks. This has the
14319effect that if the same variable is declared (without @code{extern}) in
14320two different compilations, you will get an error when you link them.
14321The only reason this might be useful is if you wish to verify that the
14322program will work on other systems which always work this way.
14323
14324@item -fno-ident
cd3bb277 14325@opindex fno-ident
74291a4b
MM
14326Ignore the @samp{#ident} directive.
14327
74291a4b 14328@item -finhibit-size-directive
cd3bb277 14329@opindex finhibit-size-directive
74291a4b
MM
14330Don't output a @code{.size} assembler directive, or anything else that
14331would cause trouble if the function is split in the middle, and the
14332two halves are placed at locations far apart in memory. This option is
14333used when compiling @file{crtstuff.c}; you should not need to use it
14334for anything else.
14335
14336@item -fverbose-asm
cd3bb277 14337@opindex fverbose-asm
74291a4b
MM
14338Put extra commentary information in the generated assembly code to
14339make it more readable. This option is generally only of use to those
14340who actually need to read the generated assembly code (perhaps while
14341debugging the compiler itself).
14342
630d3d5a 14343@option{-fno-verbose-asm}, the default, causes the
74291a4b
MM
14344extra information to be omitted and is useful when comparing two assembler
14345files.
14346
e0d9d0dd
NC
14347@item -frecord-gcc-switches
14348@opindex frecord-gcc-switches
14349This switch causes the command line that was used to invoke the
14350compiler to be recorded into the object file that is being created.
14351This switch is only implemented on some targets and the exact format
14352of the recording is target and binary file format dependent, but it
14353usually takes the form of a section containing ASCII text. This
14354switch is related to the @option{-fverbose-asm} switch, but that
14355switch only records information in the assembler output file as
14356comments, so it never reaches the object file.
14357
74291a4b 14358@item -fpic
cd3bb277 14359@opindex fpic
74291a4b
MM
14360@cindex global offset table
14361@cindex PIC
14362Generate position-independent code (PIC) suitable for use in a shared
14363library, if supported for the target machine. Such code accesses all
161d7b59 14364constant addresses through a global offset table (GOT)@. The dynamic
861bb6c1 14365loader resolves the GOT entries when the program starts (the dynamic
0c2d1a2a 14366loader is not part of GCC; it is part of the operating system). If
861bb6c1
JL
14367the GOT size for the linked executable exceeds a machine-specific
14368maximum size, you get an error message from the linker indicating that
630d3d5a 14369@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
b6e69d94 14370instead. (These maximums are 8k on the SPARC and 32k
861bb6c1 14371on the m68k and RS/6000. The 386 has no such limit.)
74291a4b
MM
14372
14373Position-independent code requires special support, and therefore works
0c2d1a2a 14374only on certain machines. For the 386, GCC supports PIC for System V
74291a4b
MM
14375but not for the Sun 386i. Code generated for the IBM RS/6000 is always
14376position-independent.
14377
3d119f8f
KG
14378When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14379are defined to 1.
14380
74291a4b 14381@item -fPIC
cd3bb277 14382@opindex fPIC
74291a4b
MM
14383If supported for the target machine, emit position-independent code,
14384suitable for dynamic linking and avoiding any limit on the size of the
068d4f38
BE
14385global offset table. This option makes a difference on the m68k,
14386PowerPC and SPARC@.
74291a4b
MM
14387
14388Position-independent code requires special support, and therefore works
14389only on certain machines.
14390
3d119f8f
KG
14391When this flag is set, the macros @code{__pic__} and @code{__PIC__}
14392are defined to 2.
14393
24a4dd31
JJ
14394@item -fpie
14395@itemx -fPIE
14396@opindex fpie
14397@opindex fPIE
14398These options are similar to @option{-fpic} and @option{-fPIC}, but
14399generated position independent code can be only linked into executables.
14400Usually these options are used when @option{-pie} GCC option will be
14401used during linking.
14402
7c0ffd09
RS
14403@option{-fpie} and @option{-fPIE} both define the macros
14404@code{__pie__} and @code{__PIE__}. The macros have the value 1
14405for @option{-fpie} and 2 for @option{-fPIE}.
14406
82c0180d
JM
14407@item -fno-jump-tables
14408@opindex fno-jump-tables
14409Do not use jump tables for switch statements even where it would be
14410more efficient than other code generation strategies. This option is
14411of use in conjunction with @option{-fpic} or @option{-fPIC} for
14412building code which forms part of a dynamic linker and cannot
14413reference the address of a jump table. On some targets, jump tables
14414do not require a GOT and this option is not needed.
14415
74291a4b 14416@item -ffixed-@var{reg}
cd3bb277 14417@opindex ffixed
74291a4b
MM
14418Treat the register named @var{reg} as a fixed register; generated code
14419should never refer to it (except perhaps as a stack pointer, frame
14420pointer or in some other fixed role).
14421
14422@var{reg} must be the name of a register. The register names accepted
14423are machine-specific and are defined in the @code{REGISTER_NAMES}
14424macro in the machine description macro file.
14425
14426This flag does not have a negative form, because it specifies a
14427three-way choice.
14428
14429@item -fcall-used-@var{reg}
cd3bb277 14430@opindex fcall-used
956d6950 14431Treat the register named @var{reg} as an allocable register that is
74291a4b
MM
14432clobbered by function calls. It may be allocated for temporaries or
14433variables that do not live across a call. Functions compiled this way
14434will not save and restore the register @var{reg}.
14435
cb2fdc84
GRK
14436It is an error to used this flag with the frame pointer or stack pointer.
14437Use of this flag for other registers that have fixed pervasive roles in
14438the machine's execution model will produce disastrous results.
74291a4b
MM
14439
14440This flag does not have a negative form, because it specifies a
14441three-way choice.
14442
14443@item -fcall-saved-@var{reg}
cd3bb277 14444@opindex fcall-saved
956d6950 14445Treat the register named @var{reg} as an allocable register saved by
74291a4b
MM
14446functions. It may be allocated even for temporaries or variables that
14447live across a call. Functions compiled this way will save and restore
14448the register @var{reg} if they use it.
14449
cb2fdc84
GRK
14450It is an error to used this flag with the frame pointer or stack pointer.
14451Use of this flag for other registers that have fixed pervasive roles in
14452the machine's execution model will produce disastrous results.
74291a4b
MM
14453
14454A different sort of disaster will result from the use of this flag for
14455a register in which function values may be returned.
14456
14457This flag does not have a negative form, because it specifies a
14458three-way choice.
14459
467cecf3 14460@item -fpack-struct[=@var{n}]
cd3bb277 14461@opindex fpack-struct
467cecf3 14462Without a value specified, pack all structure members together without
8a36672b 14463holes. When a value is specified (which must be a small power of two), pack
467cecf3
JB
14464structure members according to this value, representing the maximum
14465alignment (that is, objects with default alignment requirements larger than
14466this will be output potentially unaligned at the next fitting location.
a9c60612
JJ
14467
14468@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
14469code that is not binary compatible with code generated without that switch.
3364c33b 14470Additionally, it makes the code suboptimal.
a9c60612 14471Use it to conform to a non-default application binary interface.
74291a4b 14472
07417085 14473@item -finstrument-functions
cd3bb277 14474@opindex finstrument-functions
07417085
KR
14475Generate instrumentation calls for entry and exit to functions. Just
14476after function entry and just before function exit, the following
14477profiling functions will be called with the address of the current
14478function and its call site. (On some platforms,
14479@code{__builtin_return_address} does not work beyond the current
14480function, so the call site information may not be available to the
14481profiling functions otherwise.)
14482
3ab51846 14483@smallexample
310668e8
JM
14484void __cyg_profile_func_enter (void *this_fn,
14485 void *call_site);
14486void __cyg_profile_func_exit (void *this_fn,
14487 void *call_site);
3ab51846 14488@end smallexample
07417085
KR
14489
14490The first argument is the address of the start of the current function,
14491which may be looked up exactly in the symbol table.
14492
14493This instrumentation is also done for functions expanded inline in other
14494functions. The profiling calls will indicate where, conceptually, the
14495inline function is entered and exited. This means that addressable
14496versions of such functions must be available. If all your uses of a
14497function are expanded inline, this may mean an additional expansion of
14498code size. If you use @samp{extern inline} in your C code, an
14499addressable version of such functions must be provided. (This is
14500normally the case anyways, but if you get lucky and the optimizer always
14501expands the functions inline, you might have gotten away without
14502providing static copies.)
14503
14504A function may be given the attribute @code{no_instrument_function}, in
14505which case this instrumentation will not be done. This can be used, for
14506example, for the profiling functions listed above, high-priority
14507interrupt routines, and any functions from which the profiling functions
14508cannot safely be called (perhaps signal handlers, if the profiling
14509routines generate output or allocate memory).
14510
861bb6c1 14511@item -fstack-check
cd3bb277 14512@opindex fstack-check
861bb6c1
JL
14513Generate code to verify that you do not go beyond the boundary of the
14514stack. You should specify this flag if you are running in an
14515environment with multiple threads, but only rarely need to specify it in
14516a single-threaded environment since stack overflow is automatically
14517detected on nearly all systems if there is only one stack.
14518
a157febd
GK
14519Note that this switch does not actually cause checking to be done; the
14520operating system must do that. The switch causes generation of code
14521to ensure that the operating system sees the stack being extended.
14522
14523@item -fstack-limit-register=@var{reg}
14524@itemx -fstack-limit-symbol=@var{sym}
14525@itemx -fno-stack-limit
cd3bb277
JM
14526@opindex fstack-limit-register
14527@opindex fstack-limit-symbol
14528@opindex fno-stack-limit
a157febd
GK
14529Generate code to ensure that the stack does not grow beyond a certain value,
14530either the value of a register or the address of a symbol. If the stack
14531would grow beyond the value, a signal is raised. For most targets,
14532the signal is raised before the stack overruns the boundary, so
14533it is possible to catch the signal without taking special precautions.
14534
9c34dbbf
ZW
14535For instance, if the stack starts at absolute address @samp{0x80000000}
14536and grows downwards, you can use the flags
14537@option{-fstack-limit-symbol=__stack_limit} and
14538@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
14539of 128KB@. Note that this may only work with the GNU linker.
a157febd 14540
e5eb27e5
JL
14541@cindex aliasing of parameters
14542@cindex parameters, aliased
14543@item -fargument-alias
04afd9d6
JL
14544@itemx -fargument-noalias
14545@itemx -fargument-noalias-global
0698a1d2 14546@itemx -fargument-noalias-anything
cd3bb277
JM
14547@opindex fargument-alias
14548@opindex fargument-noalias
14549@opindex fargument-noalias-global
0698a1d2 14550@opindex fargument-noalias-anything
e5eb27e5
JL
14551Specify the possible relationships among parameters and between
14552parameters and global data.
14553
630d3d5a 14554@option{-fargument-alias} specifies that arguments (parameters) may
9c34dbbf 14555alias each other and may alias global storage.@*
630d3d5a 14556@option{-fargument-noalias} specifies that arguments do not alias
9c34dbbf 14557each other, but may alias global storage.@*
630d3d5a 14558@option{-fargument-noalias-global} specifies that arguments do not
e5eb27e5 14559alias each other and do not alias global storage.
0698a1d2
TM
14560@option{-fargument-noalias-anything} specifies that arguments do not
14561alias any other storage.
e5eb27e5
JL
14562
14563Each language will automatically use whatever option is required by
14564the language standard. You should not need to use these options yourself.
19283265
RH
14565
14566@item -fleading-underscore
cd3bb277 14567@opindex fleading-underscore
695ac33f 14568This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19283265
RH
14569change the way C symbols are represented in the object file. One use
14570is to help link with legacy assembly code.
14571
a9c60612
JJ
14572@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
14573generate code that is not binary compatible with code generated without that
14574switch. Use it to conform to a non-default application binary interface.
14575Not all targets provide complete support for this switch.
3d78f2e9
RH
14576
14577@item -ftls-model=@var{model}
14578Alter the thread-local storage model to be used (@pxref{Thread-Local}).
14579The @var{model} argument should be one of @code{global-dynamic},
14580@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
14581
14582The default without @option{-fpic} is @code{initial-exec}; with
14583@option{-fpic} the default is @code{global-dynamic}.
d7afec4b
ND
14584
14585@item -fvisibility=@var{default|internal|hidden|protected}
14586@opindex fvisibility
78466c0e 14587Set the default ELF image symbol visibility to the specified option---all
27ef2cdd 14588symbols will be marked with this unless overridden within the code.
d7afec4b 14589Using this feature can very substantially improve linking and
27ef2cdd 14590load times of shared object libraries, produce more optimized
d7afec4b
ND
14591code, provide near-perfect API export and prevent symbol clashes.
14592It is @strong{strongly} recommended that you use this in any shared objects
14593you distribute.
f0eb93a8 14594
d7afec4b
ND
14595Despite the nomenclature, @code{default} always means public ie;
14596available to be linked against from outside the shared object.
14597@code{protected} and @code{internal} are pretty useless in real-world
14598usage so the only other commonly used option will be @code{hidden}.
78466c0e
JM
14599The default if @option{-fvisibility} isn't specified is
14600@code{default}, i.e., make every
14601symbol public---this causes the same behavior as previous versions of
8a36672b 14602GCC@.
f0eb93a8 14603
d7afec4b
ND
14604A good explanation of the benefits offered by ensuring ELF
14605symbols have the correct visibility is given by ``How To Write
14606Shared Libraries'' by Ulrich Drepper (which can be found at
78466c0e 14607@w{@uref{http://people.redhat.com/~drepper/}})---however a superior
d7afec4b
ND
14608solution made possible by this option to marking things hidden when
14609the default is public is to make the default hidden and mark things
8a36672b 14610public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
d7afec4b
ND
14611and @code{__attribute__ ((visibility("default")))} instead of
14612@code{__declspec(dllexport)} you get almost identical semantics with
8a36672b 14613identical syntax. This is a great boon to those working with
d7afec4b
ND
14614cross-platform projects.
14615
14616For those adding visibility support to existing code, you may find
8a36672b 14617@samp{#pragma GCC visibility} of use. This works by you enclosing
d7afec4b
ND
14618the declarations you wish to set visibility for with (for example)
14619@samp{#pragma GCC visibility push(hidden)} and
be1b1c9b
L
14620@samp{#pragma GCC visibility pop}.
14621Bear in mind that symbol visibility should be viewed @strong{as
d7afec4b
ND
14622part of the API interface contract} and thus all new code should
14623always specify visibility when it is not the default ie; declarations
14624only for use within the local DSO should @strong{always} be marked explicitly
78466c0e 14625as hidden as so to avoid PLT indirection overheads---making this
d7afec4b
ND
14626abundantly clear also aids readability and self-documentation of the code.
14627Note that due to ISO C++ specification requirements, operator new and
14628operator delete must always be of default visibility.
14629
46bdbc00
GK
14630Be aware that headers from outside your project, in particular system
14631headers and headers from any other library you use, may not be
14632expecting to be compiled with visibility other than the default. You
14633may need to explicitly say @samp{#pragma GCC visibility push(default)}
14634before including any such headers.
14635
b9e75696
JM
14636@samp{extern} declarations are not affected by @samp{-fvisibility}, so
14637a lot of code can be recompiled with @samp{-fvisibility=hidden} with
14638no modifications. However, this means that calls to @samp{extern}
14639functions with no explicit visibility will use the PLT, so it is more
14640effective to use @samp{__attribute ((visibility))} and/or
14641@samp{#pragma GCC visibility} to tell the compiler which @samp{extern}
14642declarations should be treated as hidden.
14643
14644Note that @samp{-fvisibility} does affect C++ vague linkage
14645entities. This means that, for instance, an exception class that will
14646be thrown between DSOs must be explicitly marked with default
14647visibility so that the @samp{type_info} nodes will be unified between
14648the DSOs.
14649
ce84fa41
DP
14650An overview of these techniques, their benefits and how to use them
14651is at @w{@uref{http://gcc.gnu.org/wiki/Visibility}}.
14652
74291a4b
MM
14653@end table
14654
ee457005
JM
14655@c man end
14656
74291a4b 14657@node Environment Variables
0c2d1a2a 14658@section Environment Variables Affecting GCC
74291a4b
MM
14659@cindex environment variables
14660
ee457005 14661@c man begin ENVIRONMENT
0c2d1a2a
JB
14662This section describes several environment variables that affect how GCC
14663operates. Some of them work by specifying directories or prefixes to use
767094dd 14664when searching for various kinds of files. Some are used to specify other
46103ab4 14665aspects of the compilation environment.
74291a4b 14666
74291a4b 14667Note that you can also specify places to search using options such as
630d3d5a 14668@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
74291a4b 14669take precedence over places specified using environment variables, which
161d7b59 14670in turn take precedence over those specified by the configuration of GCC@.
b11cc610
JM
14671@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
14672GNU Compiler Collection (GCC) Internals}.
74291a4b 14673
bedc7537 14674@table @env
ab87f8c8
JL
14675@item LANG
14676@itemx LC_CTYPE
14677@c @itemx LC_COLLATE
14678@itemx LC_MESSAGES
14679@c @itemx LC_MONETARY
14680@c @itemx LC_NUMERIC
14681@c @itemx LC_TIME
14682@itemx LC_ALL
14683@findex LANG
14684@findex LC_CTYPE
14685@c @findex LC_COLLATE
14686@findex LC_MESSAGES
14687@c @findex LC_MONETARY
14688@c @findex LC_NUMERIC
14689@c @findex LC_TIME
14690@findex LC_ALL
14691@cindex locale
0c2d1a2a
JB
14692These environment variables control the way that GCC uses
14693localization information that allow GCC to work with different
14694national conventions. GCC inspects the locale categories
bedc7537 14695@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
ab87f8c8 14696so. These locale categories can be set to any value supported by your
0e6d31fb
JM
14697installation. A typical value is @samp{en_GB.UTF-8} for English in the United
14698Kingdom encoded in UTF-8.
ab87f8c8 14699
bedc7537 14700The @env{LC_CTYPE} environment variable specifies character
0c2d1a2a 14701classification. GCC uses it to determine the character boundaries in
ab87f8c8
JL
14702a string; this is needed for some multibyte encodings that contain quote
14703and escape characters that would otherwise be interpreted as a string
14704end or escape.
14705
bedc7537 14706The @env{LC_MESSAGES} environment variable specifies the language to
ab87f8c8
JL
14707use in diagnostic messages.
14708
bedc7537
NC
14709If the @env{LC_ALL} environment variable is set, it overrides the value
14710of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
14711and @env{LC_MESSAGES} default to the value of the @env{LANG}
0c2d1a2a 14712environment variable. If none of these variables are set, GCC
ab87f8c8
JL
14713defaults to traditional C English behavior.
14714
74291a4b
MM
14715@item TMPDIR
14716@findex TMPDIR
bedc7537 14717If @env{TMPDIR} is set, it specifies the directory to use for temporary
0c2d1a2a 14718files. GCC uses temporary files to hold the output of one stage of
74291a4b
MM
14719compilation which is to be used as input to the next stage: for example,
14720the output of the preprocessor, which is the input to the compiler
14721proper.
14722
14723@item GCC_EXEC_PREFIX
14724@findex GCC_EXEC_PREFIX
bedc7537 14725If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
74291a4b
MM
14726names of the subprograms executed by the compiler. No slash is added
14727when this prefix is combined with the name of a subprogram, but you can
14728specify a prefix that ends with a slash if you wish.
14729
f0523f02 14730If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
0deb20df
TT
14731an appropriate prefix to use based on the pathname it was invoked with.
14732
0c2d1a2a 14733If GCC cannot find the subprogram using the specified prefix, it
74291a4b
MM
14734tries looking in the usual places for the subprogram.
14735
bedc7537 14736The default value of @env{GCC_EXEC_PREFIX} is
fe037b8a
CD
14737@file{@var{prefix}/lib/gcc/} where @var{prefix} is the prefix to
14738the installed compiler. In many cases @var{prefix} is the value
74291a4b
MM
14739of @code{prefix} when you ran the @file{configure} script.
14740
630d3d5a 14741Other prefixes specified with @option{-B} take precedence over this prefix.
74291a4b
MM
14742
14743This prefix is also used for finding files such as @file{crt0.o} that are
14744used for linking.
14745
14746In addition, the prefix is used in an unusual way in finding the
14747directories to search for header files. For each of the standard
8e5f33ff 14748directories whose name normally begins with @samp{/usr/local/lib/gcc}
bedc7537 14749(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
74291a4b 14750replacing that beginning with the specified prefix to produce an
630d3d5a 14751alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
74291a4b
MM
14752@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
14753These alternate directories are searched first; the standard directories
cb7ad97b
EC
14754come next. If a standard directory begins with the configured
14755@var{prefix} then the value of @var{prefix} is replaced by
fe037b8a 14756@env{GCC_EXEC_PREFIX} when looking for header files.
74291a4b
MM
14757
14758@item COMPILER_PATH
14759@findex COMPILER_PATH
bedc7537
NC
14760The value of @env{COMPILER_PATH} is a colon-separated list of
14761directories, much like @env{PATH}. GCC tries the directories thus
74291a4b 14762specified when searching for subprograms, if it can't find the
bedc7537 14763subprograms using @env{GCC_EXEC_PREFIX}.
74291a4b
MM
14764
14765@item LIBRARY_PATH
14766@findex LIBRARY_PATH
bedc7537
NC
14767The value of @env{LIBRARY_PATH} is a colon-separated list of
14768directories, much like @env{PATH}. When configured as a native compiler,
0c2d1a2a 14769GCC tries the directories thus specified when searching for special
bedc7537 14770linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
0c2d1a2a 14771using GCC also uses these directories when searching for ordinary
630d3d5a
JM
14772libraries for the @option{-l} option (but directories specified with
14773@option{-L} come first).
74291a4b 14774
56f48ce9
DB
14775@item LANG
14776@findex LANG
14777@cindex locale definition
767094dd 14778This variable is used to pass locale information to the compiler. One way in
56f48ce9
DB
14779which this information is used is to determine the character set to be used
14780when character literals, string literals and comments are parsed in C and C++.
14781When the compiler is configured to allow multibyte characters,
bedc7537 14782the following values for @env{LANG} are recognized:
56f48ce9 14783
2642624b 14784@table @samp
56f48ce9
DB
14785@item C-JIS
14786Recognize JIS characters.
14787@item C-SJIS
14788Recognize SJIS characters.
14789@item C-EUCJP
14790Recognize EUCJP characters.
14791@end table
14792
bedc7537 14793If @env{LANG} is not defined, or if it has some other value, then the
56f48ce9
DB
14794compiler will use mblen and mbtowc as defined by the default locale to
14795recognize and translate multibyte characters.
74291a4b
MM
14796@end table
14797
40adaa27
NB
14798@noindent
14799Some additional environments variables affect the behavior of the
14800preprocessor.
14801
14802@include cppenv.texi
14803
9d86bffc
JM
14804@c man end
14805
17211ab5
GK
14806@node Precompiled Headers
14807@section Using Precompiled Headers
14808@cindex precompiled headers
14809@cindex speed of compilation
14810
14811Often large projects have many header files that are included in every
14812source file. The time the compiler takes to process these header files
14813over and over again can account for nearly all of the time required to
14814build the project. To make builds faster, GCC allows users to
14815`precompile' a header file; then, if builds can use the precompiled
14816header file they will be much faster.
14817
14818To create a precompiled header file, simply compile it as you would any
14819other file, if necessary using the @option{-x} option to make the driver
14820treat it as a C or C++ header file. You will probably want to use a
14821tool like @command{make} to keep the precompiled header up-to-date when
14822the headers it contains change.
14823
14824A precompiled header file will be searched for when @code{#include} is
14825seen in the compilation. As it searches for the included file
24726b96 14826(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
17211ab5
GK
14827compiler looks for a precompiled header in each directory just before it
14828looks for the include file in that directory. The name searched for is
d8fad4ea 14829the name specified in the @code{#include} with @samp{.gch} appended. If
17211ab5
GK
14830the precompiled header file can't be used, it is ignored.
14831
14832For instance, if you have @code{#include "all.h"}, and you have
d8fad4ea 14833@file{all.h.gch} in the same directory as @file{all.h}, then the
17211ab5
GK
14834precompiled header file will be used if possible, and the original
14835header will be used otherwise.
14836
14837Alternatively, you might decide to put the precompiled header file in a
14838directory and use @option{-I} to ensure that directory is searched
14839before (or instead of) the directory containing the original header.
14840Then, if you want to check that the precompiled header file is always
14841used, you can put a file of the same name as the original header in this
14842directory containing an @code{#error} command.
14843
14844This also works with @option{-include}. So yet another way to use
14845precompiled headers, good for projects not designed with precompiled
14846header files in mind, is to simply take most of the header files used by
14847a project, include them from another header file, precompile that header
14848file, and @option{-include} the precompiled header. If the header files
14849have guards against multiple inclusion, they will be skipped because
14850they've already been included (in the precompiled header).
14851
14852If you need to precompile the same header file for different
14853languages, targets, or compiler options, you can instead make a
d8fad4ea 14854@emph{directory} named like @file{all.h.gch}, and put each precompiled
54e109ed
GK
14855header in the directory, perhaps using @option{-o}. It doesn't matter
14856what you call the files in the directory, every precompiled header in
14857the directory will be considered. The first precompiled header
14858encountered in the directory that is valid for this compilation will
14859be used; they're searched in no particular order.
17211ab5
GK
14860
14861There are many other possibilities, limited only by your imagination,
14862good sense, and the constraints of your build system.
14863
14864A precompiled header file can be used only when these conditions apply:
14865
14866@itemize
14867@item
14868Only one precompiled header can be used in a particular compilation.
54e109ed 14869
17211ab5
GK
14870@item
14871A precompiled header can't be used once the first C token is seen. You
14872can have preprocessor directives before a precompiled header; you can
14873even include a precompiled header from inside another header, so long as
14874there are no C tokens before the @code{#include}.
54e109ed 14875
17211ab5
GK
14876@item
14877The precompiled header file must be produced for the same language as
14878the current compilation. You can't use a C precompiled header for a C++
14879compilation.
54e109ed 14880
17211ab5 14881@item
3fd30b88
GK
14882The precompiled header file must have been produced by the same compiler
14883binary as the current compilation is using.
54e109ed 14884
17211ab5 14885@item
54e109ed
GK
14886Any macros defined before the precompiled header is included must
14887either be defined in the same way as when the precompiled header was
14888generated, or must not affect the precompiled header, which usually
0bdcd332 14889means that they don't appear in the precompiled header at all.
54e109ed
GK
14890
14891The @option{-D} option is one way to define a macro before a
14892precompiled header is included; using a @code{#define} can also do it.
14893There are also some options that define macros implicitly, like
14894@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
14895defined this way.
14896
14897@item If debugging information is output when using the precompiled
14898header, using @option{-g} or similar, the same kind of debugging information
14899must have been output when building the precompiled header. However,
14900a precompiled header built using @option{-g} can be used in a compilation
14901when no debugging information is being output.
14902
14903@item The same @option{-m} options must generally be used when building
14904and using the precompiled header. @xref{Submodel Options},
14905for any cases where this rule is relaxed.
14906
14907@item Each of the following options must be the same when building and using
14908the precompiled header:
14909
14910@gccoptlist{-fexceptions -funit-at-a-time}
14911
17211ab5 14912@item
54e109ed
GK
14913Some other command-line options starting with @option{-f},
14914@option{-p}, or @option{-O} must be defined in the same way as when
14915the precompiled header was generated. At present, it's not clear
14916which options are safe to change and which are not; the safest choice
14917is to use exactly the same options when generating and using the
14918precompiled header. The following are known to be safe:
14919
78681dbd
RS
14920@gccoptlist{-fmessage-length= -fpreprocessed -fsched-interblock @gol
14921-fsched-spec -fsched-spec-load -fsched-spec-load-dangerous @gol
14922-fsched-verbose=<number> -fschedule-insns -fvisibility= @gol
3fd30b88 14923-pedantic-errors}
54e109ed 14924
17211ab5
GK
14925@end itemize
14926
54e109ed
GK
14927For all of these except the last, the compiler will automatically
14928ignore the precompiled header if the conditions aren't met. If you
14929find an option combination that doesn't work and doesn't cause the
14930precompiled header to be ignored, please consider filing a bug report,
14931see @ref{Bugs}.
17211ab5 14932
c0d578e6 14933If you do use differing options when generating and using the
83c99486
KH
14934precompiled header, the actual behavior will be a mixture of the
14935behavior for the options. For instance, if you use @option{-g} to
c0d578e6
GK
14936generate the precompiled header but not when using it, you may or may
14937not get debugging information for routines in the precompiled header.
14938
74291a4b
MM
14939@node Running Protoize
14940@section Running Protoize
14941
161d7b59 14942The program @code{protoize} is an optional part of GCC@. You can use
c1030c7c 14943it to add prototypes to a program, thus converting the program to ISO
74291a4b
MM
14944C in one respect. The companion program @code{unprotoize} does the
14945reverse: it removes argument types from any prototypes that are found.
14946
14947When you run these programs, you must specify a set of source files as
14948command line arguments. The conversion programs start out by compiling
14949these files to see what functions they define. The information gathered
14950about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
14951
14952After scanning comes actual conversion. The specified files are all
14953eligible to be converted; any files they include (whether sources or
14954just headers) are eligible as well.
14955
14956But not all the eligible files are converted. By default,
14957@code{protoize} and @code{unprotoize} convert only source and header
14958files in the current directory. You can specify additional directories
630d3d5a 14959whose files should be converted with the @option{-d @var{directory}}
74291a4b 14960option. You can also specify particular files to exclude with the
630d3d5a 14961@option{-x @var{file}} option. A file is converted if it is eligible, its
74291a4b
MM
14962directory name matches one of the specified directory names, and its
14963name within the directory has not been excluded.
14964
14965Basic conversion with @code{protoize} consists of rewriting most
14966function definitions and function declarations to specify the types of
14967the arguments. The only ones not rewritten are those for varargs
14968functions.
14969
14970@code{protoize} optionally inserts prototype declarations at the
14971beginning of the source file, to make them available for any calls that
14972precede the function's definition. Or it can insert prototype
14973declarations with block scope in the blocks where undeclared functions
14974are called.
14975
14976Basic conversion with @code{unprotoize} consists of rewriting most
14977function declarations to remove any argument types, and rewriting
c1030c7c 14978function definitions to the old-style pre-ISO form.
74291a4b
MM
14979
14980Both conversion programs print a warning for any function declaration or
14981definition that they can't convert. You can suppress these warnings
630d3d5a 14982with @option{-q}.
74291a4b
MM
14983
14984The output from @code{protoize} or @code{unprotoize} replaces the
14985original source file. The original file is renamed to a name ending
02f52e19 14986with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
a7db8bbb
MK
14987without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav}
14988for DOS) file already exists, then the source file is simply discarded.
74291a4b 14989
0c2d1a2a 14990@code{protoize} and @code{unprotoize} both depend on GCC itself to
74291a4b 14991scan the program and collect information about the functions it uses.
0c2d1a2a 14992So neither of these programs will work until GCC is installed.
74291a4b
MM
14993
14994Here is a table of the options you can use with @code{protoize} and
14995@code{unprotoize}. Each option works with both programs unless
14996otherwise stated.
14997
14998@table @code
14999@item -B @var{directory}
15000Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
15001usual directory (normally @file{/usr/local/lib}). This file contains
15002prototype information about standard system functions. This option
15003applies only to @code{protoize}.
15004
15005@item -c @var{compilation-options}
05739753 15006Use @var{compilation-options} as the options when running @command{gcc} to
630d3d5a 15007produce the @samp{.X} files. The special option @option{-aux-info} is
05739753 15008always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
74291a4b
MM
15009
15010Note that the compilation options must be given as a single argument to
15011@code{protoize} or @code{unprotoize}. If you want to specify several
05739753 15012@command{gcc} options, you must quote the entire set of compilation options
74291a4b
MM
15013to make them a single word in the shell.
15014
05739753 15015There are certain @command{gcc} arguments that you cannot use, because they
630d3d5a
JM
15016would produce the wrong kind of output. These include @option{-g},
15017@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
74291a4b
MM
15018the @var{compilation-options}, they are ignored.
15019
15020@item -C
a7db8bbb 15021Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
02f52e19 15022systems) instead of @samp{.c}. This is convenient if you are converting
ee77eda5 15023a C program to C++. This option applies only to @code{protoize}.
74291a4b
MM
15024
15025@item -g
15026Add explicit global declarations. This means inserting explicit
15027declarations at the beginning of each source file for each function
15028that is called in the file and was not declared. These declarations
15029precede the first function definition that contains a call to an
15030undeclared function. This option applies only to @code{protoize}.
15031
15032@item -i @var{string}
15033Indent old-style parameter declarations with the string @var{string}.
15034This option applies only to @code{protoize}.
15035
15036@code{unprotoize} converts prototyped function definitions to old-style
15037function definitions, where the arguments are declared between the
15038argument list and the initial @samp{@{}. By default, @code{unprotoize}
15039uses five spaces as the indentation. If you want to indent with just
630d3d5a 15040one space instead, use @option{-i " "}.
74291a4b
MM
15041
15042@item -k
15043Keep the @samp{.X} files. Normally, they are deleted after conversion
15044is finished.
15045
15046@item -l
630d3d5a 15047Add explicit local declarations. @code{protoize} with @option{-l} inserts
74291a4b
MM
15048a prototype declaration for each function in each block which calls the
15049function without any declaration. This option applies only to
15050@code{protoize}.
15051
15052@item -n
15053Make no real changes. This mode just prints information about the conversions
630d3d5a 15054that would have been done without @option{-n}.
74291a4b
MM
15055
15056@item -N
15057Make no @samp{.save} files. The original files are simply deleted.
15058Use this option with caution.
15059
15060@item -p @var{program}
15061Use the program @var{program} as the compiler. Normally, the name
15062@file{gcc} is used.
15063
15064@item -q
15065Work quietly. Most warnings are suppressed.
15066
15067@item -v
05739753 15068Print the version number, just like @option{-v} for @command{gcc}.
74291a4b
MM
15069@end table
15070
15071If you need special compiler options to compile one of your program's
15072source files, then you should generate that file's @samp{.X} file
05739753 15073specially, by running @command{gcc} on that source file with the
630d3d5a 15074appropriate options and the option @option{-aux-info}. Then run
74291a4b
MM
15075@code{protoize} on the entire set of files. @code{protoize} will use
15076the existing @samp{.X} file because it is newer than the source file.
15077For example:
15078
3ab51846 15079@smallexample
b1018de6 15080gcc -Dfoo=bar file1.c -aux-info file1.X
74291a4b 15081protoize *.c
3ab51846 15082@end smallexample
74291a4b
MM
15083
15084@noindent
15085You need to include the special files along with the rest in the
15086@code{protoize} command, even though their @samp{.X} files already
15087exist, because otherwise they won't get converted.
15088
15089@xref{Protoize Caveats}, for more information on how to use
15090@code{protoize} successfully.