]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/invoke.texi
re PR c++/13684 (local static object variable constructed once but ctors and dtors...
[thirdparty/gcc.git] / gcc / doc / invoke.texi
CommitLineData
d0a5eb32 1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
b684a3df 2@c 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
74291a4b
MM
3@c This is part of the GCC manual.
4@c For copying conditions, see the file gcc.texi.
5
9d86bffc
JM
6@ignore
7@c man begin COPYRIGHT
8Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
daef8bbd 91998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
9d86bffc 10
77bd67cb 11Permission is granted to copy, distribute and/or modify this document
b3a8389d 12under the terms of the GNU Free Documentation License, Version 1.2 or
77bd67cb
JM
13any later version published by the Free Software Foundation; with the
14Invariant Sections being ``GNU General Public License'' and ``Funding
15Free Software'', the Front-Cover texts being (a) (see below), and with
16the Back-Cover Texts being (b) (see below). A copy of the license is
17included in the gfdl(7) man page.
9d86bffc 18
77bd67cb 19(a) The FSF's Front-Cover Text is:
9d86bffc 20
77bd67cb
JM
21 A GNU Manual
22
23(b) The FSF's Back-Cover Text is:
24
25 You have freedom to copy and modify this GNU Manual, like GNU
26 software. Copies published by the Free Software Foundation raise
27 funds for GNU development.
9d86bffc
JM
28@c man end
29@c Set file name and title for the man page.
30@setfilename gcc
31@settitle GNU project C and C++ compiler
32@c man begin SYNOPSIS
630d3d5a
JM
33gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
34 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
35 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
36 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
37 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
38 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
39 [@option{-o} @var{outfile}] @var{infile}@dots{}
9d86bffc
JM
40
41Only the most useful options are listed here; see below for the
42remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
43@c man end
44@c man begin SEEALSO
77bd67cb 45gpl(7), gfdl(7), fsf-funding(7),
b4117c30
ZW
46cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47and the Info entries for @file{gcc}, @file{cpp}, @file{as},
9d86bffc
JM
48@file{ld}, @file{binutils} and @file{gdb}.
49@c man end
2642624b
JM
50@c man begin BUGS
51For instructions on reporting bugs, see
bedc7537 52@w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug}
2642624b
JM
53script to report bugs is recommended.
54@c man end
55@c man begin AUTHOR
24dbb440
GP
56See the Info entry for @command{gcc}, or
57@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58for contributors to GCC@.
2642624b 59@c man end
9d86bffc
JM
60@end ignore
61
74291a4b 62@node Invoking GCC
0c2d1a2a
JB
63@chapter GCC Command Options
64@cindex GCC command options
74291a4b 65@cindex command options
0c2d1a2a 66@cindex options, GCC command
74291a4b 67
9d86bffc 68@c man begin DESCRIPTION
0c2d1a2a 69When you invoke GCC, it normally does preprocessing, compilation,
74291a4b 70assembly and linking. The ``overall options'' allow you to stop this
630d3d5a 71process at an intermediate stage. For example, the @option{-c} option
74291a4b
MM
72says not to run the linker. Then the output consists of object files
73output by the assembler.
74
75Other options are passed on to one stage of processing. Some options
76control the preprocessor and others the compiler itself. Yet other
77options control the assembler and linker; most of these are not
78documented here, since you rarely need to use any of them.
79
80@cindex C compilation options
0c2d1a2a 81Most of the command line options that you can use with GCC are useful
74291a4b
MM
82for C programs; when an option is only useful with another language
83(usually C++), the explanation says so explicitly. If the description
84for a particular option does not mention a source language, you can use
85that option with all supported languages.
86
87@cindex C++ compilation options
88@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
89options for compiling C++ programs.
90
91@cindex grouping options
92@cindex options, grouping
bedc7537 93The @command{gcc} program accepts options and file names as operands. Many
b192711e 94options have multi-letter names; therefore multiple single-letter options
630d3d5a 95may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
74291a4b
MM
96-r}}.
97
98@cindex order of options
99@cindex options, order
100You can mix options and other arguments. For the most part, the order
101you use doesn't matter. Order does matter when you use several options
630d3d5a 102of the same kind; for example, if you specify @option{-L} more than once,
74291a4b
MM
103the directories are searched in the order specified.
104
105Many options have long names starting with @samp{-f} or with
630d3d5a
JM
106@samp{-W}---for example, @option{-fforce-mem},
107@option{-fstrength-reduce}, @option{-Wformat} and so on. Most of
74291a4b 108these have both positive and negative forms; the negative form of
630d3d5a 109@option{-ffoo} would be @option{-fno-foo}. This manual documents
74291a4b
MM
110only one of these two forms, whichever one is not the default.
111
9d86bffc
JM
112@c man end
113
cd3bb277
JM
114@xref{Option Index}, for an index to GCC's options.
115
74291a4b
MM
116@menu
117* Option Summary:: Brief list of all options, without explanations.
118* Overall Options:: Controlling the kind of output:
119 an executable, object files, assembler files,
120 or preprocessed source.
121* Invoking G++:: Compiling C++ programs.
122* C Dialect Options:: Controlling the variant of C language compiled.
123* C++ Dialect Options:: Variations on C++.
46e34f96
ZL
124* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
125 and Objective-C++.
764dbbf2 126* Language Independent Options:: Controlling how diagnostics should be
02f52e19 127 formatted.
74291a4b
MM
128* Warning Options:: How picky should the compiler be?
129* Debugging Options:: Symbol tables, measurements, and debugging dumps.
130* Optimize Options:: How much optimization?
131* Preprocessor Options:: Controlling header files and macro definitions.
132 Also, getting dependency information for Make.
133* Assembler Options:: Passing options to the assembler.
134* Link Options:: Specifying libraries and so on.
135* Directory Options:: Where to find header files and libraries.
136 Where to find the compiler executable files.
a743d340 137* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 138* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
139* Submodel Options:: Specifying minor hardware or convention variations,
140 such as 68010 vs 68020.
141* Code Gen Options:: Specifying conventions for function calls, data layout
142 and register usage.
0c2d1a2a 143* Environment Variables:: Env vars that affect GCC.
17211ab5 144* Precompiled Headers:: Compiling a header once, and using it many times.
74291a4b
MM
145* Running Protoize:: Automatically adding or removing function prototypes.
146@end menu
147
4bc1997b
JM
148@c man begin OPTIONS
149
74291a4b
MM
150@node Option Summary
151@section Option Summary
152
153Here is a summary of all the options, grouped by type. Explanations are
154in the following sections.
155
156@table @emph
157@item Overall Options
158@xref{Overall Options,,Options Controlling the Kind of Output}.
0855eab7 159@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
9a94f7f3 160-x @var{language} -v -### --help --target-help --version}
74291a4b
MM
161
162@item C Language Options
163@xref{C Dialect Options,,Options Controlling C Dialect}.
9a94f7f3
JM
164@gccoptlist{-ansi -std=@var{standard} -aux-info @var{filename} @gol
165-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
750491fc 166-fhosted -ffreestanding -fms-extensions @gol
8a035a6b 167-trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
4bc1997b
JM
168-fallow-single-precision -fcond-mismatch @gol
169-fsigned-bitfields -fsigned-char @gol
3521b33c 170-funsigned-bitfields -funsigned-char}
74291a4b
MM
171
172@item C++ Language Options
173@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
9a94f7f3 174@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
b1822ccc 175-fconserve-space -fno-const-strings @gol
aa0cc562 176-fno-elide-constructors @gol
7813d14c 177-fno-enforce-eh-specs @gol
1dbb6023 178-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
90ecce3e 179-fno-implicit-templates @gol
4bc1997b
JM
180-fno-implicit-inline-templates @gol
181-fno-implement-inlines -fms-extensions @gol
aa0cc562 182-fno-nonansi-builtins -fno-operator-names @gol
4bc1997b 183-fno-optional-diags -fpermissive @gol
aa0cc562 184-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
40aac948 185-fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
d7afec4b
ND
186-fno-default-inline -fvisibility-inlines-hidden @gol
187-Wabi -Wctor-dtor-privacy @gol
4bc1997b
JM
188-Wnon-virtual-dtor -Wreorder @gol
189-Weffc++ -Wno-deprecated @gol
190-Wno-non-template-friend -Wold-style-cast @gol
191-Woverloaded-virtual -Wno-pmf-conversions @gol
192-Wsign-promo -Wsynth}
74291a4b 193
46e34f96
ZL
194@item Objective-C and Objective-C++ Language Options
195@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
196Objective-C and Objective-C++ Dialects}.
264fa2db
ZL
197@gccoptlist{
198-fconstant-string-class=@var{class-name} @gol
199-fgnu-runtime -fnext-runtime @gol
200-fno-nil-receivers @gol
201-fobjc-exceptions @gol
202-freplace-objc-classes @gol
203-fzero-link @gol
204-gen-decls @gol
1f676100 205-Wno-protocol -Wselector -Wundeclared-selector}
60de6385 206
764dbbf2
GDR
207@item Language Independent Options
208@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
9a94f7f3 209@gccoptlist{-fmessage-length=@var{n} @gol
4bc1997b 210-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
764dbbf2 211
74291a4b
MM
212@item Warning Options
213@xref{Warning Options,,Options to Request or Suppress Warnings}.
9a94f7f3 214@gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
65ca2d60 215-w -Wextra -Wall -Waggregate-return @gol
4bc1997b 216-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol
e23bd218 217-Wconversion -Wno-deprecated-declarations @gol
fb0317c6
VR
218-Wdisabled-optimization -Wno-div-by-zero -Wendif-labels @gol
219-Werror -Werror-implicit-function-declaration @gol
c65a01af 220-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
fb0317c6 221-Wno-format-extra-args -Wformat-nonliteral @gol
c76f4e8e 222-Wformat-security -Wformat-y2k @gol
fb0317c6
VR
223-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
224-Wimport -Wno-import -Winit-self -Winline @gol
225-Wno-invalid-offsetof -Winvalid-pch @gol
4bc1997b 226-Wlarger-than-@var{len} -Wlong-long @gol
eaac4679 227-Wmain -Wmissing-braces -Wmissing-field-initializers @gol
b02398bd
BE
228-Wmissing-format-attribute -Wmissing-include-dirs @gol
229-Wmissing-noreturn @gol
fb0317c6 230-Wno-multichar -Wnonnull -Wpacked -Wpadded @gol
310668e8 231-Wparentheses -Wpointer-arith -Wredundant-decls @gol
4bc1997b 232-Wreturn-type -Wsequence-point -Wshadow @gol
5399d643 233-Wsign-compare -Wstrict-aliasing -Wstrict-aliasing=2 @gol
9a94f7f3
JM
234-Wswitch -Wswitch-default -Wswitch-enum @gol
235-Wsystem-headers -Wtrigraphs -Wundef -Wuninitialized @gol
4bc1997b
JM
236-Wunknown-pragmas -Wunreachable-code @gol
237-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
7c4d376d
RH
238-Wunused-value -Wunused-variable -Wwrite-strings @gol
239-Wvariadic-macros}
74291a4b 240
fe50c0eb 241@item C-only Warning Options
9a94f7f3 242@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
fb0317c6 243-Wmissing-prototypes -Wnested-externs -Wold-style-definition @gol
85617eba
HPN
244-Wstrict-prototypes -Wtraditional @gol
245-Wdeclaration-after-statement}
fe50c0eb 246
74291a4b
MM
247@item Debugging Options
248@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
9a94f7f3
JM
249@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
250-fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
aee96fe9 251-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
6de9cd9a 252-fdump-tree-all @gol
9a94f7f3
JM
253-fdump-tree-original@r{[}-@var{n}@r{]} @gol
254-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
22367161 255-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
6de9cd9a
DN
256-fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
257-fdump-tree-ch @gol
258-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
259-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
260-fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
261-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
262-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
263-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
264-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
265-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
79fe1b3b 266-fdump-tree-nrv -fdump-tree-vect @gol
6de9cd9a 267-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
ff2ad0f7 268-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
a37db56b 269-feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
6de9cd9a 270-feliminate-unused-debug-symbols -fmem-report -fprofile-arcs -ftree-based-profiling @gol
a37db56b 271-frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
014a1138 272-ftest-coverage -ftime-report -fvar-tracking @gol
def66b10 273-g -g@var{level} -gcoff -gdwarf-2 @gol
5f98259a 274-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
4bc1997b 275-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
b1018de6 276-print-multi-directory -print-multi-lib @gol
4bc1997b
JM
277-print-prog-name=@var{program} -print-search-dirs -Q @gol
278-save-temps -time}
74291a4b
MM
279
280@item Optimization Options
281@xref{Optimize Options,,Options that Control Optimization}.
9a94f7f3 282@gccoptlist{-falign-functions=@var{n} -falign-jumps=@var{n} @gol
4bc1997b 283-falign-labels=@var{n} -falign-loops=@var{n} @gol
6de9cd9a 284-fbounds-check -fmudflap -fmudflapth -fmudflapir @gol
fca9dc00 285-fbranch-probabilities -fprofile-values -fvpt -fbranch-target-load-optimize @gol
1194fc79
R
286-fbranch-target-load-optimize2 -fbtr-bb-exclusive @gol
287-fcaller-saves -fcprop-registers @gol
62d285ff 288-fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol
4bc1997b
JM
289-fdelayed-branch -fdelete-null-pointer-checks @gol
290-fexpensive-optimizations -ffast-math -ffloat-store @gol
feb48bde 291-fforce-addr -fforce-mem -ffunction-sections @gol
db643b91
SH
292-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol
293-floop-optimize -fcrossjumping -fif-conversion -fif-conversion2 @gol
4bc1997b 294-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol
201556f0 295-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
e5626198 296-fmodulo-sched -fmove-all-movables -fnew-ra -fno-branch-count-reg @gol
5e962776 297-fno-default-inline -fno-defer-pop -floop-optimize2 -fmove-loop-invariants @gol
feb48bde 298-fno-function-cse -fno-guess-branch-probability @gol
6cfc0341 299-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
9a94f7f3
JM
300-funsafe-math-optimizations -ffinite-math-only @gol
301-fno-trapping-math -fno-zero-initialized-in-bss @gol
4bc1997b 302-fomit-frame-pointer -foptimize-register-move @gol
5d22c1a5 303-foptimize-sibling-calls -fprefetch-loop-arrays @gol
a8a5f53a 304-fprofile-generate -fprofile-use @gol
9a94f7f3 305-freduce-all-givs -fregmove -frename-registers @gol
750054a2 306-freorder-blocks -freorder-blocks-and-partition -freorder-functions @gol
4bc1997b 307-frerun-cse-after-loop -frerun-loop-opt @gol
039c3d42 308-frounding-math -fschedule-insns -fschedule-insns2 @gol
e03b7153 309-fno-sched-interblock -fno-sched-spec -fsched-spec-load @gol
569fa502
DN
310-fsched-spec-load-dangerous @gol
311-fsched-stalled-insns=@var{n} -sched-stalled-insns-dep=@var{n} @gol
312-fsched2-use-superblocks @gol
d72372e4
MH
313-fsched2-use-traces -freschedule-modulo-scheduled-loops @gol
314-fsignaling-nans -fsingle-precision-constant @gol
9a94f7f3
JM
315-fstrength-reduce -fstrict-aliasing -ftracer -fthread-jumps @gol
316-funroll-all-loops -funroll-loops -fpeel-loops @gol
317-funswitch-loops -fold-unroll-loops -fold-unroll-all-loops @gol
c66b6c66 318-ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol
82b85a85 319-ftree-lim -fivcanon @gol
6de9cd9a 320-ftree-dominator-opts -ftree-dse -ftree-copyrename @gol
79fe1b3b 321-ftree-ch -ftree-sra -ftree-ter -ftree-lrs -ftree-fre -ftree-vectorize @gol
3af64fd6 322--param @var{name}=@var{value}
4bc1997b 323-O -O0 -O1 -O2 -O3 -Os}
74291a4b
MM
324
325@item Preprocessor Options
326@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
c2d635bc 327@gccoptlist{-A@var{question}=@var{answer} @gol
9a94f7f3 328-A-@var{question}@r{[}=@var{answer}@r{]} @gol
4bc1997b
JM
329-C -dD -dI -dM -dN @gol
330-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
331-idirafter @var{dir} @gol
332-include @var{file} -imacros @var{file} @gol
333-iprefix @var{file} -iwithprefix @var{dir} @gol
bdd42dd9 334-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
b20d9f0c
AO
335-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
336-P -fworking-directory -remap @gol
9a94f7f3
JM
337-trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
338-Xpreprocessor @var{option}}
74291a4b
MM
339
340@item Assembler Option
341@xref{Assembler Options,,Passing Options to the Assembler}.
9a94f7f3 342@gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
74291a4b
MM
343
344@item Linker Options
345@xref{Link Options,,Options for Linking}.
9a94f7f3 346@gccoptlist{@var{object-file-name} -l@var{library} @gol
24a4dd31 347-nostartfiles -nodefaultlibs -nostdlib -pie @gol
4bc1997b 348-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
aee96fe9 349-Wl,@var{option} -Xlinker @var{option} @gol
4bc1997b 350-u @var{symbol}}
74291a4b
MM
351
352@item Directory Options
353@xref{Directory Options,,Options for Directory Search}.
4bed3787 354@gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir} -specs=@var{file} -I-}
74291a4b
MM
355
356@item Target Options
357@c I wrote this xref this way to avoid overfull hbox. -- rms
358@xref{Target Options}.
9a94f7f3 359@gccoptlist{-V @var{version} -b @var{machine}}
74291a4b
MM
360
361@item Machine Dependent Options
362@xref{Submodel Options,,Hardware Models and Configurations}.
39bc1876
NS
363@c This list is ordered alphanumerically by subsection name.
364@c Try and put the significant identifier (CPU or system) first,
365@c so users have a clue at guessing where the ones they want will be.
5d22c1a5 366
39bc1876
NS
367@emph{ARC Options}
368@gccoptlist{-EB -EL @gol
369-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
370-mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
74291a4b 371
74291a4b 372@emph{ARM Options}
9a94f7f3 373@gccoptlist{-mapcs-frame -mno-apcs-frame @gol
5848830f 374-mabi=@var{name} @gol
310668e8
JM
375-mapcs-stack-check -mno-apcs-stack-check @gol
376-mapcs-float -mno-apcs-float @gol
377-mapcs-reentrant -mno-apcs-reentrant @gol
378-msched-prolog -mno-sched-prolog @gol
379-mlittle-endian -mbig-endian -mwords-little-endian @gol
34a86306 380-mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
310668e8 381-mthumb-interwork -mno-thumb-interwork @gol
9b66ebb1 382-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
247f8561 383-mstructure-size-boundary=@var{n} @gol
4bc1997b 384-mabort-on-noreturn @gol
310668e8
JM
385-mlong-calls -mno-long-calls @gol
386-msingle-pic-base -mno-single-pic-base @gol
247f8561
PB
387-mpic-register=@var{reg} @gol
388-mnop-fun-dllimport @gol
9b6b54e2 389-mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
247f8561 390-mpoke-function-name @gol
310668e8
JM
391-mthumb -marm @gol
392-mtpcs-frame -mtpcs-leaf-frame @gol
9a94f7f3 393-mcaller-super-interworking -mcallee-super-interworking}
74291a4b 394
39bc1876
NS
395@emph{AVR Options}
396@gccoptlist{-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
397-mcall-prologues -mno-tablejump -mtiny-stack -mint8}
861bb6c1 398
39bc1876
NS
399@emph{CRIS Options}
400@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
401-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
402-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
403-mstack-align -mdata-align -mconst-align @gol
404-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
405-melf -maout -melinux -mlinux -sim -sim2 @gol
406-mmul-bug-workaround -mno-mul-bug-workaround}
74291a4b 407
48aec0bc 408@emph{Darwin Options}
6d2f9dd3
JM
409@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
410-arch_only -bind_at_load -bundle -bundle_loader @gol
411-client_name -compatibility_version -current_version @gol
5079843a 412-dead_strip @gol
6d2f9dd3
JM
413-dependency-file -dylib_file -dylinker_install_name @gol
414-dynamic -dynamiclib -exported_symbols_list @gol
415-filelist -flat_namespace -force_cpusubtype_ALL @gol
416-force_flat_namespace -headerpad_max_install_names @gol
417-image_base -init -install_name -keep_private_externs @gol
418-multi_module -multiply_defined -multiply_defined_unused @gol
5079843a
DP
419-noall_load -no_dead_strip_inits_and_terms @gol
420-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
6d2f9dd3
JM
421-pagezero_size -prebind -prebind_all_twolevel_modules @gol
422-private_bundle -read_only_relocs -sectalign @gol
423-sectobjectsymbols -whyload -seg1addr @gol
424-sectcreate -sectobjectsymbols -sectorder @gol
425-seg_addr_table -seg_addr_table_filename -seglinkedit @gol
426-segprot -segs_read_only_addr -segs_read_write_addr @gol
427-single_module -static -sub_library -sub_umbrella @gol
428-twolevel_namespace -umbrella -undefined @gol
429-unexported_symbols_list -weak_reference_mismatches @gol
8f4220dc 430-whatsloaded -F -gused -gfull -mone-byte-bool}
48aec0bc 431
74291a4b 432@emph{DEC Alpha Options}
9a94f7f3 433@gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
4bc1997b
JM
434-mieee -mieee-with-inexact -mieee-conformant @gol
435-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
436-mtrap-precision=@var{mode} -mbuild-constants @gol
58605ba0
RH
437-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
438-mbwx -mmax -mfix -mcix @gol
439-mfloat-vax -mfloat-ieee @gol
9a94f7f3
JM
440-mexplicit-relocs -msmall-data -mlarge-data @gol
441-msmall-text -mlarge-text @gol
4bc1997b 442-mmemory-latency=@var{time}}
74291a4b 443
d7c23cdc 444@emph{DEC Alpha/VMS Options}
9a94f7f3 445@gccoptlist{-mvms-return-codes}
d7c23cdc 446
39bc1876
NS
447@emph{FRV Options}
448@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
449-mhard-float -msoft-float @gol
450-malloc-cc -mfixed-cc -mdword -mno-dword @gol
451-mdouble -mno-double @gol
452-mmedia -mno-media -mmuladd -mno-muladd @gol
453-mfdpic -minline-plt -mgprel-ro -multilib-library-pic -mlinked-fp @gol
454-mlibrary-pic -macc-4 -macc-8 @gol
455-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
456-mscc -mno-scc -mcond-exec -mno-cond-exec @gol
457-mvliw-branch -mno-vliw-branch @gol
458-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
459-mno-nested-cond-exec -mtomcat-stats @gol
460-mcpu=@var{cpu}}
461
74291a4b 462@emph{H8/300 Options}
9a94f7f3 463@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
74291a4b 464
39bc1876
NS
465@emph{HPPA Options}
466@gccoptlist{-march=@var{architecture-type} @gol
467-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
468-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
a2017852 469-mfixed-range=@var{register-range} @gol
39bc1876
NS
470-mjump-in-delay -mlinker-opt -mlong-calls @gol
471-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
472-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
473-mno-jump-in-delay -mno-long-load-store @gol
474-mno-portable-runtime -mno-soft-float @gol
475-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
476-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
477-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
d711cf67 478-munix=@var{unix-std} -nolibdld -static -threads}
74291a4b 479
39bc1876
NS
480@emph{i386 and x86-64 Options}
481@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
482-mfpmath=@var{unit} @gol
483-masm=@var{dialect} -mno-fancy-math-387 @gol
484-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol
485-mno-wide-multiply -mrtd -malign-double @gol
486-mpreferred-stack-boundary=@var{num} @gol
487-mmmx -msse -msse2 -msse3 -m3dnow @gol
488-mthreads -mno-align-stringops -minline-all-stringops @gol
489-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
490-m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol
491-mno-red-zone -mno-tls-direct-seg-refs @gol
492-mcmodel=@var{code-model} @gol
493-m32 -m64}
56b2d7a7 494
39bc1876
NS
495@emph{IA-64 Options}
496@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
497-mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol
498-mconstant-gp -mauto-pic -minline-float-divide-min-latency @gol
499-minline-float-divide-max-throughput @gol
500-minline-int-divide-min-latency @gol
501-minline-int-divide-max-throughput -mno-dwarf2-asm @gol
502-mfixed-range=@var{register-range}}
282a61e6 503
39bc1876
NS
504@emph{M32R/D Options}
505@gccoptlist{-m32r2 -m32rx -m32r @gol
506-mdebug @gol
507-malign-loops -mno-align-loops @gol
508-missue-rate=@var{number} @gol
509-mbranch-cost=@var{number} @gol
510-mmodel=@var{code-size-model-type} @gol
511-msdata=@var{sdata-type} @gol
512-mno-flush-func -mflush-func=@var{name} @gol
513-mno-flush-trap -mflush-trap=@var{number} @gol
514-G @var{num}}
83575957 515
39bc1876
NS
516@emph{M680x0 Options}
517@gccoptlist{-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
518-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol
519-mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol
520-malign-int -mstrict-align -msep-data -mno-sep-data @gol
521-mshared-library-id=n -mid-shared-library -mno-id-shared-library}
789a3090 522
39bc1876
NS
523@emph{M68hc1x Options}
524@gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
525-mauto-incdec -minmax -mlong-calls -mshort @gol
526-msoft-reg-count=@var{count}}
052a4b28 527
789a3090 528@emph{MCore Options}
9a94f7f3 529@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
310668e8
JM
530-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
531-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
532-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
533-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
f84271d9 534
39bc1876
NS
535@emph{MIPS Options}
536@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
537-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips64 @gol
538-mips16 -mno-mips16 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
539-mxgot -mno-xgot -mgp32 -mgp64 -mfp32 -mfp64 @gol
540-mhard-float -msoft-float -msingle-float -mdouble-float @gol
541-mint64 -mlong64 -mlong32 @gol
542-G@var{num} -membedded-data -mno-embedded-data @gol
543-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
544-msplit-addresses -mno-split-addresses @gol
545-mexplicit-relocs -mno-explicit-relocs @gol
39bc1876
NS
546-mcheck-zero-division -mno-check-zero-division @gol
547-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
548-mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
549-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
550-mfix-vr4120 -mno-fix-vr4120 -mfix-sb1 -mno-fix-sb1 @gol
551-mflush-func=@var{func} -mno-flush-func @gol
552-mbranch-likely -mno-branch-likely @gol
553-mfp-exceptions -mno-fp-exceptions @gol
554-mvr4130-align -mno-vr4130-align}
bcf684c7 555
39bc1876
NS
556@emph{MMIX Options}
557@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
558-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
559-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
560-mno-base-addresses -msingle-exit -mno-single-exit}
df6194d4 561
39bc1876
NS
562@emph{MN10300 Options}
563@gccoptlist{-mmult-bug -mno-mult-bug @gol
564-mam33 -mno-am33 @gol
565-mam33-2 -mno-am33-2 @gol
566-mno-crt0 -mrelax}
91abf72d 567
39bc1876
NS
568@emph{NS32K Options}
569@gccoptlist{-m32032 -m32332 -m32532 -m32081 -m32381 @gol
570-mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol
571-mregparam -mnoregparam -msb -mnosb @gol
572-mbitfield -mnobitfield -mhimem -mnohimem}
0b85d816 573
9f85bca7 574@emph{PDP-11 Options}
9a94f7f3 575@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
9f85bca7
JM
576-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
577-mint16 -mno-int32 -mfloat32 -mno-float64 @gol
578-mfloat64 -mno-float32 -mabshi -mno-abshi @gol
579-mbranch-expensive -mbranch-cheap @gol
580-msplit -mno-split -munix-asm -mdec-asm}
581
39bc1876
NS
582@emph{PowerPC Options}
583See RS/6000 and PowerPC Options.
584
585@emph{RS/6000 and PowerPC Options}
586@gccoptlist{-mcpu=@var{cpu-type} @gol
587-mtune=@var{cpu-type} @gol
588-mpower -mno-power -mpower2 -mno-power2 @gol
589-mpowerpc -mpowerpc64 -mno-powerpc @gol
590-maltivec -mno-altivec @gol
591-mpowerpc-gpopt -mno-powerpc-gpopt @gol
592-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
593-mnew-mnemonics -mold-mnemonics @gol
594-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
595-m64 -m32 -mxl-call -mno-xl-call -mpe @gol
596-malign-power -malign-natural @gol
597-msoft-float -mhard-float -mmultiple -mno-multiple @gol
598-mstring -mno-string -mupdate -mno-update @gol
599-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
600-mstrict-align -mno-strict-align -mrelocatable @gol
601-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
602-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
603-mdynamic-no-pic @gol
604-mprioritize-restricted-insns=@var{priority} @gol
605-msched-costly-dep=@var{dependence_type} @gol
606-minsert-sched-nops=@var{scheme} @gol
607-mcall-sysv -mcall-netbsd @gol
608-maix-struct-return -msvr4-struct-return @gol
609-mabi=altivec -mabi=no-altivec @gol
610-mabi=spe -mabi=no-spe @gol
611-misel=yes -misel=no @gol
612-mspe=yes -mspe=no @gol
613-mfloat-gprs=yes -mfloat-gprs=no @gol
614-mprototype -mno-prototype @gol
615-msim -mmvme -mads -myellowknife -memb -msdata @gol
616-msdata=@var{opt} -mvxworks -mwindiss -G @var{num} -pthread}
617
618@emph{S/390 and zSeries Options}
619@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
adf39f8f 620-mhard-float -msoft-float -mbackchain -mno-backchain -mkernel-backchain @gol
39bc1876
NS
621-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
622-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
d75f90f1
AK
623-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
624-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
39bc1876
NS
625
626@emph{SH Options}
627@gccoptlist{-m1 -m2 -m2e -m3 -m3e @gol
628-m4-nofpu -m4-single-only -m4-single -m4 @gol
312209c6 629-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
39bc1876
NS
630-m5-64media -m5-64media-nofpu @gol
631-m5-32media -m5-32media-nofpu @gol
632-m5-compact -m5-compact-nofpu @gol
633-mb -ml -mdalign -mrelax @gol
2acc29bd 634-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
39bc1876
NS
635-mieee -misize -mpadstruct -mspace @gol
636-mprefergot -musermode}
637
638@emph{SPARC Options}
639@gccoptlist{-mcpu=@var{cpu-type} @gol
640-mtune=@var{cpu-type} @gol
641-mcmodel=@var{code-model} @gol
642-m32 -m64 -mapp-regs -mno-app-regs @gol
643-mfaster-structs -mno-faster-structs @gol
644-mfpu -mno-fpu -mhard-float -msoft-float @gol
645-mhard-quad-float -msoft-quad-float @gol
646-mimpure-text -mno-impure-text -mlittle-endian @gol
647-mstack-bias -mno-stack-bias @gol
648-munaligned-doubles -mno-unaligned-doubles @gol
6bfb2f93
EB
649-mv8plus -mno-v8plus -mvis -mno-vis
650-threads -pthreads}
39bc1876
NS
651
652@emph{System V Options}
653@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
654
655@emph{TMS320C3x/C4x Options}
656@gccoptlist{-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol
657-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol
658-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol
659-mparallel-insns -mparallel-mpy -mpreserve-float}
660
661@emph{V850 Options}
662@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
663-mprolog-function -mno-prolog-function -mspace @gol
664-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
665-mapp-regs -mno-app-regs @gol
666-mdisable-callt -mno-disable-callt @gol
667-mv850e1 @gol
668-mv850e @gol
669-mv850 -mbig-switch}
670
671@emph{VAX Options}
672@gccoptlist{-mg -mgnu -munix}
673
674@emph{x86-64 Options}
675See i386 and x86-64 Options.
676
69a0611f 677@emph{Xstormy16 Options}
9a94f7f3 678@gccoptlist{-msim}
69a0611f 679
03984308 680@emph{Xtensa Options}
6cedbe44 681@gccoptlist{-mconst16 -mno-const16 @gol
9a94f7f3 682-mfused-madd -mno-fused-madd @gol
9a94f7f3
JM
683-mtext-section-literals -mno-text-section-literals @gol
684-mtarget-align -mno-target-align @gol
685-mlongcalls -mno-longcalls}
03984308 686
39bc1876
NS
687@emph{zSeries Options}
688See S/390 and zSeries Options.
70899148 689
74291a4b
MM
690@item Code Generation Options
691@xref{Code Gen Options,,Options for Code Generation Conventions}.
9a94f7f3
JM
692@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
693-ffixed-@var{reg} -fexceptions @gol
5d22c1a5 694-fnon-call-exceptions -funwind-tables @gol
a944ceb9 695-fasynchronous-unwind-tables @gol
4bc1997b 696-finhibit-size-directive -finstrument-functions @gol
dc170a87 697-fno-common -fno-ident @gol
24a4dd31 698-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
4bc1997b 699-freg-struct-return -fshared-data -fshort-enums @gol
271bd540 700-fshort-double -fshort-wchar @gol
4bc1997b
JM
701-fverbose-asm -fpack-struct -fstack-check @gol
702-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
703-fargument-alias -fargument-noalias @gol
478c9e72 704-fargument-noalias-global -fleading-underscore @gol
d4463dfc 705-ftls-model=@var{model} @gol
d7afec4b
ND
706-ftrapv -fwrapv -fbounds-check @gol
707-fvisibility}
74291a4b
MM
708@end table
709
710@menu
711* Overall Options:: Controlling the kind of output:
712 an executable, object files, assembler files,
713 or preprocessed source.
714* C Dialect Options:: Controlling the variant of C language compiled.
715* C++ Dialect Options:: Variations on C++.
46e34f96
ZL
716* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
717 and Objective-C++.
764dbbf2 718* Language Independent Options:: Controlling how diagnostics should be
02f52e19 719 formatted.
74291a4b
MM
720* Warning Options:: How picky should the compiler be?
721* Debugging Options:: Symbol tables, measurements, and debugging dumps.
722* Optimize Options:: How much optimization?
723* Preprocessor Options:: Controlling header files and macro definitions.
724 Also, getting dependency information for Make.
725* Assembler Options:: Passing options to the assembler.
726* Link Options:: Specifying libraries and so on.
727* Directory Options:: Where to find header files and libraries.
728 Where to find the compiler executable files.
a743d340 729* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 730* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
731@end menu
732
733@node Overall Options
734@section Options Controlling the Kind of Output
735
736Compilation can involve up to four stages: preprocessing, compilation
d1bd0ded
GK
737proper, assembly and linking, always in that order. GCC is capable of
738preprocessing and compiling several files either into several
739assembler input files, or into one assembler input file; then each
740assembler input file produces an object file, and linking combines all
741the object files (those newly compiled, and those specified as input)
742into an executable file.
74291a4b
MM
743
744@cindex file name suffix
745For any given input file, the file name suffix determines what kind of
746compilation is done:
747
2642624b 748@table @gcctabopt
74291a4b
MM
749@item @var{file}.c
750C source code which must be preprocessed.
751
752@item @var{file}.i
753C source code which should not be preprocessed.
754
755@item @var{file}.ii
756C++ source code which should not be preprocessed.
757
758@item @var{file}.m
46e34f96
ZL
759Objective-C source code. Note that you must link with the @file{libobjc}
760library to make an Objective-C program work.
74291a4b 761
b9265ec1
JM
762@item @var{file}.mi
763Objective-C source code which should not be preprocessed.
764
46e34f96
ZL
765@item @var{file}.mm
766@itemx @var{file}.M
767Objective-C++ source code. Note that you must link with the @file{libobjc}
768library to make an Objective-C++ program work. Note that @samp{.M} refers
769to a literal capital M@.
770
771@item @var{file}.mii
772Objective-C++ source code which should not be preprocessed.
773
74291a4b 774@item @var{file}.h
46e34f96
ZL
775C, C++, Objective-C or Objective-C++ header file to be turned into a
776precompiled header.
74291a4b
MM
777
778@item @var{file}.cc
b9265ec1 779@itemx @var{file}.cp
74291a4b
MM
780@itemx @var{file}.cxx
781@itemx @var{file}.cpp
ee8acf89 782@itemx @var{file}.CPP
b9265ec1 783@itemx @var{file}.c++
74291a4b
MM
784@itemx @var{file}.C
785C++ source code which must be preprocessed. Note that in @samp{.cxx},
786the last two letters must both be literally @samp{x}. Likewise,
161d7b59 787@samp{.C} refers to a literal capital C@.
74291a4b 788
17211ab5
GK
789@item @var{file}.hh
790@itemx @var{file}.H
791C++ header file to be turned into a precompiled header.
792
b9265ec1
JM
793@item @var{file}.f
794@itemx @var{file}.for
795@itemx @var{file}.FOR
796Fortran source code which should not be preprocessed.
797
798@item @var{file}.F
799@itemx @var{file}.fpp
800@itemx @var{file}.FPP
801Fortran source code which must be preprocessed (with the traditional
802preprocessor).
803
804@item @var{file}.r
805Fortran source code which must be preprocessed with a RATFOR
161d7b59 806preprocessor (not included with GCC)@.
b9265ec1 807
6de9cd9a
DN
808@item @var{file}.f90
809@itemx @var{file}.f95
810Fortran 90/95 source code which should not be preprocessed.
811
b9265ec1
JM
812@c FIXME: Descriptions of Java file types.
813@c @var{file}.java
814@c @var{file}.class
815@c @var{file}.zip
816@c @var{file}.jar
817
e23381df
GB
818@item @var{file}.ads
819Ada source code file which contains a library unit declaration (a
820declaration of a package, subprogram, or generic, or a generic
821instantiation), or a library unit renaming declaration (a package,
822generic, or subprogram renaming declaration). Such files are also
823called @dfn{specs}.
824
825@itemx @var{file}.adb
826Ada source code file containing a library unit body (a subprogram or
827package body). Such files are also called @dfn{bodies}.
828
b9265ec1 829@c GCC also knows about some suffixes for languages not yet included:
b9265ec1
JM
830@c Pascal:
831@c @var{file}.p
832@c @var{file}.pas
833
74291a4b
MM
834@item @var{file}.s
835Assembler code.
836
837@item @var{file}.S
838Assembler code which must be preprocessed.
839
840@item @var{other}
841An object file to be fed straight into linking.
842Any file name with no recognized suffix is treated this way.
843@end table
844
cd3bb277 845@opindex x
630d3d5a 846You can specify the input language explicitly with the @option{-x} option:
74291a4b 847
2642624b 848@table @gcctabopt
74291a4b
MM
849@item -x @var{language}
850Specify explicitly the @var{language} for the following input files
851(rather than letting the compiler choose a default based on the file
852name suffix). This option applies to all following input files until
630d3d5a 853the next @option{-x} option. Possible values for @var{language} are:
3ab51846 854@smallexample
46e34f96 855c c-header c-cpp-output
17211ab5 856c++ c++-header c++-cpp-output
46e34f96
ZL
857objective-c objective-c-header objective-c-cpp-output
858objective-c++ objective-c++-header objective-c++-cpp-output
74291a4b 859assembler assembler-with-cpp
e23381df 860ada
b9265ec1 861f77 f77-cpp-input ratfor
6de9cd9a 862f95
e23381df 863java
b38b97c4 864treelang
3ab51846 865@end smallexample
74291a4b
MM
866
867@item -x none
868Turn off any specification of a language, so that subsequent files are
630d3d5a 869handled according to their file name suffixes (as they are if @option{-x}
74291a4b 870has not been used at all).
14a774a9
RK
871
872@item -pass-exit-codes
cd3bb277 873@opindex pass-exit-codes
bedc7537 874Normally the @command{gcc} program will exit with the code of 1 if any
14a774a9 875phase of the compiler returns a non-success return code. If you specify
630d3d5a 876@option{-pass-exit-codes}, the @command{gcc} program will instead return with
14a774a9
RK
877numerically highest error produced by any phase that returned an error
878indication.
74291a4b
MM
879@end table
880
881If you only want some of the stages of compilation, you can use
630d3d5a
JM
882@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
883one of the options @option{-c}, @option{-S}, or @option{-E} to say where
bedc7537
NC
884@command{gcc} is to stop. Note that some combinations (for example,
885@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
74291a4b 886
2642624b 887@table @gcctabopt
74291a4b 888@item -c
cd3bb277 889@opindex c
74291a4b
MM
890Compile or assemble the source files, but do not link. The linking
891stage simply is not done. The ultimate output is in the form of an
892object file for each source file.
893
894By default, the object file name for a source file is made by replacing
895the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
896
897Unrecognized input files, not requiring compilation or assembly, are
898ignored.
899
900@item -S
cd3bb277 901@opindex S
74291a4b
MM
902Stop after the stage of compilation proper; do not assemble. The output
903is in the form of an assembler code file for each non-assembler input
904file specified.
905
906By default, the assembler file name for a source file is made by
907replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
908
909Input files that don't require compilation are ignored.
910
911@item -E
cd3bb277 912@opindex E
74291a4b
MM
913Stop after the preprocessing stage; do not run the compiler proper. The
914output is in the form of preprocessed source code, which is sent to the
915standard output.
916
917Input files which don't require preprocessing are ignored.
918
919@cindex output file option
920@item -o @var{file}
cd3bb277 921@opindex o
74291a4b
MM
922Place output in file @var{file}. This applies regardless to whatever
923sort of output is being produced, whether it be an executable file,
924an object file, an assembler file or preprocessed C code.
925
488061c8
GK
926If @option{-o} is not specified, the default is to put an executable
927file in @file{a.out}, the object file for
928@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
929assembler file in @file{@var{source}.s}, a precompiled header file in
930@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
931standard output.
74291a4b
MM
932
933@item -v
cd3bb277 934@opindex v
74291a4b
MM
935Print (on standard error output) the commands executed to run the stages
936of compilation. Also print the version number of the compiler driver
937program and of the preprocessor and the compiler proper.
938
e8b3c8ac
IR
939@item -###
940@opindex ###
941Like @option{-v} except the commands are not executed and all command
942arguments are quoted. This is useful for shell scripts to capture the
943driver-generated command lines.
944
74291a4b 945@item -pipe
cd3bb277 946@opindex pipe
74291a4b
MM
947Use pipes rather than temporary files for communication between the
948various stages of compilation. This fails to work on some systems where
949the assembler is unable to read from a pipe; but the GNU assembler has
950no trouble.
844642e6 951
0855eab7
CT
952@item -combine
953@opindex combine
954If you are compiling multiple source files, this option tells the driver
f26c1794 955to pass all the source files to the compiler at once (for those
0855eab7
CT
956languages for which the compiler can handle this). This will allow
957intermodule analysis (IMA) to be performed by the compiler. Currently the only
958language for which this is supported is C. If you pass source files for
959multiple languages to the driver, using this option, the driver will invoke
960the compiler(s) that support IMA once each, passing each compiler all the
961source files appropriate for it. For those languages that do not support
962IMA this option will be ignored, and the compiler will be invoked once for
963each source file in that language. If you use this option in conjunction
964with -save-temps, the compiler will generate multiple pre-processed files
f26c1794 965(one for each source file), but only one (combined) .o or .s file.
0855eab7 966
844642e6 967@item --help
cd3bb277 968@opindex help
844642e6 969Print (on the standard output) a description of the command line options
bedc7537
NC
970understood by @command{gcc}. If the @option{-v} option is also specified
971then @option{--help} will also be passed on to the various processes
972invoked by @command{gcc}, so that they can display the command line options
65ca2d60 973they accept. If the @option{-Wextra} option is also specified then command
844642e6
NC
974line options which have no documentation associated with them will also
975be displayed.
10501d8f
CC
976
977@item --target-help
cd3bb277 978@opindex target-help
10501d8f
CC
979Print (on the standard output) a description of target specific command
980line options for each tool.
e03b7153
RS
981
982@item --version
983@opindex version
984Display the version number and copyrights of the invoked GCC.
74291a4b
MM
985@end table
986
987@node Invoking G++
988@section Compiling C++ Programs
989
990@cindex suffixes for C++ source
991@cindex C++ source file suffixes
992C++ source files conventionally use one of the suffixes @samp{.C},
17211ab5
GK
993@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
994@samp{.cxx}; C++ header files often use @samp{.hh} or @samp{.H}; and
0c2d1a2a 995preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
bba975d4 996files with these names and compiles them as C++ programs even if you
17211ab5
GK
997call the compiler the same way as for compiling C programs (usually
998with the name @command{gcc}).
74291a4b
MM
999
1000@findex g++
1001@findex c++
1002However, C++ programs often require class libraries as well as a
1003compiler that understands the C++ language---and under some
17211ab5
GK
1004circumstances, you might want to compile programs or header files from
1005standard input, or otherwise without a suffix that flags them as C++
1006programs. You might also like to precompile a C header file with a
1007@samp{.h} extension to be used in C++ compilations. @command{g++} is a
1008program that calls GCC with the default language set to C++, and
1009automatically specifies linking against the C++ library. On many
1010systems, @command{g++} is also installed with the name @command{c++}.
74291a4b 1011
bedc7537 1012@cindex invoking @command{g++}
74291a4b
MM
1013When you compile C++ programs, you may specify many of the same
1014command-line options that you use for compiling programs in any
1015language; or command-line options meaningful for C and related
1016languages; or options that are meaningful only for C++ programs.
1017@xref{C Dialect Options,,Options Controlling C Dialect}, for
161d7b59 1018explanations of options for languages related to C@.
74291a4b
MM
1019@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1020explanations of options that are meaningful only for C++ programs.
1021
1022@node C Dialect Options
1023@section Options Controlling C Dialect
1024@cindex dialect options
1025@cindex language dialect options
1026@cindex options, dialect
1027
1028The following options control the dialect of C (or languages derived
46e34f96
ZL
1029from C, such as C++, Objective-C and Objective-C++) that the compiler
1030accepts:
74291a4b 1031
2642624b 1032@table @gcctabopt
74291a4b 1033@cindex ANSI support
c1030c7c 1034@cindex ISO support
74291a4b 1035@item -ansi
cd3bb277 1036@opindex ansi
3764f879 1037In C mode, support all ISO C90 programs. In C++ mode,
775afb25 1038remove GNU extensions that conflict with ISO C++.
74291a4b 1039
c1030c7c 1040This turns off certain features of GCC that are incompatible with ISO
3764f879 1041C90 (when compiling C code), or of standard C++ (when compiling C++ code),
0c2d1a2a 1042such as the @code{asm} and @code{typeof} keywords, and
74291a4b
MM
1043predefined macros such as @code{unix} and @code{vax} that identify the
1044type of system you are using. It also enables the undesirable and
02f52e19 1045rarely used ISO trigraph feature. For the C compiler,
0c2d1a2a 1046it disables recognition of C++ style @samp{//} comments as well as
775afb25 1047the @code{inline} keyword.
74291a4b
MM
1048
1049The alternate keywords @code{__asm__}, @code{__extension__},
1050@code{__inline__} and @code{__typeof__} continue to work despite
630d3d5a 1051@option{-ansi}. You would not want to use them in an ISO C program, of
74291a4b 1052course, but it is useful to put them in header files that might be included
630d3d5a 1053in compilations done with @option{-ansi}. Alternate predefined macros
74291a4b 1054such as @code{__unix__} and @code{__vax__} are also available, with or
630d3d5a 1055without @option{-ansi}.
74291a4b 1056
630d3d5a
JM
1057The @option{-ansi} option does not cause non-ISO programs to be
1058rejected gratuitously. For that, @option{-pedantic} is required in
1059addition to @option{-ansi}. @xref{Warning Options}.
74291a4b 1060
630d3d5a 1061The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
74291a4b
MM
1062option is used. Some header files may notice this macro and refrain
1063from declaring certain functions or defining certain macros that the
c1030c7c 1064ISO standard doesn't call for; this is to avoid interfering with any
74291a4b
MM
1065programs that might use these names for other things.
1066
c771326b
JM
1067Functions which would normally be built in but do not have semantics
1068defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
630d3d5a 1069functions with @option{-ansi} is used. @xref{Other Builtins,,Other
f0523f02 1070built-in functions provided by GCC}, for details of the functions
01702459 1071affected.
74291a4b 1072
49419c8f 1073@item -std=
cd3bb277 1074@opindex std
aee96fe9 1075Determine the language standard. This option is currently only
f749a36b
NB
1076supported when compiling C or C++. A value for this option must be
1077provided; possible values are
3932261a 1078
ee457005 1079@table @samp
aee96fe9
JM
1080@item c89
1081@itemx iso9899:1990
3764f879 1082ISO C90 (same as @option{-ansi}).
3043b30e
ML
1083
1084@item iso9899:199409
3764f879 1085ISO C90 as modified in amendment 1.
3043b30e 1086
49419c8f 1087@item c99
aee96fe9
JM
1088@itemx c9x
1089@itemx iso9899:1999
1090@itemx iso9899:199x
1091ISO C99. Note that this standard is not yet fully supported; see
1092@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1093names @samp{c9x} and @samp{iso9899:199x} are deprecated.
3043b30e
ML
1094
1095@item gnu89
3764f879 1096Default, ISO C90 plus GNU extensions (including some C99 features).
3043b30e 1097
49419c8f 1098@item gnu99
31775d31 1099@itemx gnu9x
d15a05b3
EC
1100ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
1101this will become the default. The name @samp{gnu9x} is deprecated.
49419c8f 1102
f749a36b
NB
1103@item c++98
1104The 1998 ISO C++ standard plus amendments.
1105
1106@item gnu++98
1107The same as @option{-std=c++98} plus GNU extensions. This is the
1108default for C++ code.
ee457005 1109@end table
3043b30e
ML
1110
1111Even when this option is not specified, you can still use some of the
1112features of newer standards in so far as they do not conflict with
1113previous C standards. For example, you may use @code{__restrict__} even
bedc7537 1114when @option{-std=c99} is not specified.
3932261a 1115
5490d604 1116The @option{-std} options specifying some version of ISO C have the same
3764f879 1117effects as @option{-ansi}, except that features that were not in ISO C90
5490d604
JM
1118but are in the specified version (for example, @samp{//} comments and
1119the @code{inline} keyword in ISO C99) are not disabled.
1120
c1030c7c
JM
1121@xref{Standards,,Language Standards Supported by GCC}, for details of
1122these standard versions.
1123
b1018de6
AO
1124@item -aux-info @var{filename}
1125@opindex aux-info
1126Output to the given filename prototyped declarations for all functions
1127declared and/or defined in a translation unit, including those in header
161d7b59 1128files. This option is silently ignored in any language other than C@.
b1018de6
AO
1129
1130Besides declarations, the file indicates, in comments, the origin of
1131each declaration (source file and line), whether the declaration was
1132implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1133@samp{O} for old, respectively, in the first character after the line
1134number and the colon), and whether it came from a declaration or a
1135definition (@samp{C} or @samp{F}, respectively, in the following
1136character). In the case of function definitions, a K&R-style list of
1137arguments followed by their declarations is also provided, inside
1138comments, after the declaration.
1139
74291a4b 1140@item -fno-asm
cd3bb277 1141@opindex fno-asm
74291a4b
MM
1142Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1143keyword, so that code can use these words as identifiers. You can use
1144the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
630d3d5a 1145instead. @option{-ansi} implies @option{-fno-asm}.
74291a4b
MM
1146
1147In C++, this switch only affects the @code{typeof} keyword, since
1148@code{asm} and @code{inline} are standard keywords. You may want to
630d3d5a 1149use the @option{-fno-gnu-keywords} flag instead, which has the same
5490d604
JM
1150effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1151switch only affects the @code{asm} and @code{typeof} keywords, since
1152@code{inline} is a standard keyword in ISO C99.
74291a4b
MM
1153
1154@item -fno-builtin
a3926fe1 1155@itemx -fno-builtin-@var{function}
cd3bb277 1156@opindex fno-builtin
c771326b
JM
1157@cindex built-in functions
1158Don't recognize built-in functions that do not begin with
01702459 1159@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
f0523f02 1160functions provided by GCC}, for details of the functions affected,
c771326b 1161including those which are not built-in functions when @option{-ansi} or
5490d604
JM
1162@option{-std} options for strict ISO C conformance are used because they
1163do not have an ISO standard meaning.
74291a4b 1164
c771326b 1165GCC normally generates special code to handle certain built-in functions
74291a4b
MM
1166more efficiently; for instance, calls to @code{alloca} may become single
1167instructions that adjust the stack directly, and calls to @code{memcpy}
1168may become inline copy loops. The resulting code is often both smaller
1169and faster, but since the function calls no longer appear as such, you
1170cannot set a breakpoint on those calls, nor can you change the behavior
1171of the functions by linking with a different library.
1172
a3926fe1
RS
1173With the @option{-fno-builtin-@var{function}} option
1174only the built-in function @var{function} is
7d14c755
JM
1175disabled. @var{function} must not begin with @samp{__builtin_}. If a
1176function is named this is not built-in in this version of GCC, this
1177option is ignored. There is no corresponding
1178@option{-fbuiltin-@var{function}} option; if you wish to enable
1179built-in functions selectively when using @option{-fno-builtin} or
1180@option{-ffreestanding}, you may define macros such as:
1181
1182@smallexample
1183#define abs(n) __builtin_abs ((n))
1184#define strcpy(d, s) __builtin_strcpy ((d), (s))
1185@end smallexample
1186
861bb6c1 1187@item -fhosted
cd3bb277 1188@opindex fhosted
861bb6c1
JL
1189@cindex hosted environment
1190
1191Assert that compilation takes place in a hosted environment. This implies
630d3d5a 1192@option{-fbuiltin}. A hosted environment is one in which the
861bb6c1
JL
1193entire standard library is available, and in which @code{main} has a return
1194type of @code{int}. Examples are nearly everything except a kernel.
630d3d5a 1195This is equivalent to @option{-fno-freestanding}.
861bb6c1
JL
1196
1197@item -ffreestanding
cd3bb277 1198@opindex ffreestanding
861bb6c1
JL
1199@cindex hosted environment
1200
1201Assert that compilation takes place in a freestanding environment. This
630d3d5a 1202implies @option{-fno-builtin}. A freestanding environment
861bb6c1
JL
1203is one in which the standard library may not exist, and program startup may
1204not necessarily be at @code{main}. The most obvious example is an OS kernel.
630d3d5a 1205This is equivalent to @option{-fno-hosted}.
861bb6c1 1206
c1030c7c
JM
1207@xref{Standards,,Language Standards Supported by GCC}, for details of
1208freestanding and hosted environments.
1209
750491fc
RH
1210@item -fms-extensions
1211@opindex fms-extensions
1212Accept some non-standard constructs used in Microsoft header files.
1213
74291a4b 1214@item -trigraphs
cd3bb277 1215@opindex trigraphs
3bce8a01
NB
1216Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1217options for strict ISO C conformance) implies @option{-trigraphs}.
74291a4b 1218
8a035a6b
AH
1219@item -no-integrated-cpp
1220@opindex no-integrated-cpp
1221Performs a compilation in two passes: preprocessing and compiling. This
1222option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1223@option{-B} option. The user supplied compilation step can then add in
1224an additional preprocessing step after normal preprocessing but before
1225compiling. The default is to use the integrated cpp (internal cpp)
1226
1227The semantics of this option will change if "cc1", "cc1plus", and
1228"cc1obj" are merged.
1229
74291a4b
MM
1230@cindex traditional C language
1231@cindex C language, traditional
1232@item -traditional
f458d1d5 1233@itemx -traditional-cpp
cd3bb277 1234@opindex traditional-cpp
f458d1d5
ZW
1235@opindex traditional
1236Formerly, these options caused GCC to attempt to emulate a pre-standard
1237C compiler. They are now only supported with the @option{-E} switch.
1238The preprocessor continues to support a pre-standard mode. See the GNU
1239CPP manual for details.
74291a4b
MM
1240
1241@item -fcond-mismatch
cd3bb277 1242@opindex fcond-mismatch
74291a4b 1243Allow conditional expressions with mismatched types in the second and
a7537031
JM
1244third arguments. The value of such an expression is void. This option
1245is not supported for C++.
74291a4b
MM
1246
1247@item -funsigned-char
cd3bb277 1248@opindex funsigned-char
74291a4b
MM
1249Let the type @code{char} be unsigned, like @code{unsigned char}.
1250
1251Each kind of machine has a default for what @code{char} should
1252be. It is either like @code{unsigned char} by default or like
1253@code{signed char} by default.
1254
1255Ideally, a portable program should always use @code{signed char} or
1256@code{unsigned char} when it depends on the signedness of an object.
1257But many programs have been written to use plain @code{char} and
1258expect it to be signed, or expect it to be unsigned, depending on the
1259machines they were written for. This option, and its inverse, let you
1260make such a program work with the opposite default.
1261
1262The type @code{char} is always a distinct type from each of
1263@code{signed char} or @code{unsigned char}, even though its behavior
1264is always just like one of those two.
1265
1266@item -fsigned-char
cd3bb277 1267@opindex fsigned-char
74291a4b
MM
1268Let the type @code{char} be signed, like @code{signed char}.
1269
630d3d5a
JM
1270Note that this is equivalent to @option{-fno-unsigned-char}, which is
1271the negative form of @option{-funsigned-char}. Likewise, the option
1272@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
74291a4b 1273
74291a4b
MM
1274@item -fsigned-bitfields
1275@itemx -funsigned-bitfields
1276@itemx -fno-signed-bitfields
1277@itemx -fno-unsigned-bitfields
cd3bb277
JM
1278@opindex fsigned-bitfields
1279@opindex funsigned-bitfields
1280@opindex fno-signed-bitfields
1281@opindex fno-unsigned-bitfields
c771326b 1282These options control whether a bit-field is signed or unsigned, when the
74291a4b 1283declaration does not use either @code{signed} or @code{unsigned}. By
c771326b 1284default, such a bit-field is signed, because this is consistent: the
74291a4b 1285basic integer types such as @code{int} are signed types.
74291a4b
MM
1286@end table
1287
1288@node C++ Dialect Options
1289@section Options Controlling C++ Dialect
1290
1291@cindex compiler options, C++
1292@cindex C++ options, command line
1293@cindex options, C++
1294This section describes the command-line options that are only meaningful
1295for C++ programs; but you can also use most of the GNU compiler options
1296regardless of what language your program is in. For example, you
1297might compile a file @code{firstClass.C} like this:
1298
3ab51846 1299@smallexample
1dc5fc4b 1300g++ -g -frepo -O -c firstClass.C
3ab51846 1301@end smallexample
74291a4b
MM
1302
1303@noindent
630d3d5a 1304In this example, only @option{-frepo} is an option meant
74291a4b 1305only for C++ programs; you can use the other options with any
161d7b59 1306language supported by GCC@.
74291a4b
MM
1307
1308Here is a list of options that are @emph{only} for compiling C++ programs:
1309
2642624b 1310@table @gcctabopt
2d3e278d
MM
1311
1312@item -fabi-version=@var{n}
1313@opindex fabi-version
57702a80
MM
1314Use version @var{n} of the C++ ABI. Version 2 is the version of the
1315C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1316the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1317the version that conforms most closely to the C++ ABI specification.
1318Therefore, the ABI obtained using version 0 will change as ABI bugs
1319are fixed.
2d3e278d 1320
d150ccef 1321The default is version 2.
46c83bce 1322
74291a4b 1323@item -fno-access-control
cd3bb277 1324@opindex fno-access-control
74291a4b
MM
1325Turn off all access checking. This switch is mainly useful for working
1326around bugs in the access control code.
1327
74291a4b 1328@item -fcheck-new
cd3bb277 1329@opindex fcheck-new
74291a4b 1330Check that the pointer returned by @code{operator new} is non-null
6d9c4c83
JW
1331before attempting to modify the storage allocated. This check is
1332normally unnecessary because the C++ standard specifies that
1333@code{operator new} will only return @code{0} if it is declared
1334@samp{throw()}, in which case the compiler will always check the
1335return value even without this option. In all other cases, when
1336@code{operator new} has a non-empty exception specification, memory
1337exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1338@samp{new (nothrow)}.
1dc5fc4b 1339
74291a4b 1340@item -fconserve-space
cd3bb277 1341@opindex fconserve-space
74291a4b
MM
1342Put uninitialized or runtime-initialized global variables into the
1343common segment, as C does. This saves space in the executable at the
1344cost of not diagnosing duplicate definitions. If you compile with this
1345flag and your program mysteriously crashes after @code{main()} has
1346completed, you may have an object that is being destroyed twice because
1347two definitions were merged.
1348
1dc5fc4b
JM
1349This option is no longer useful on most targets, now that support has
1350been added for putting variables into BSS without making them common.
1351
02f52e19 1352@item -fno-const-strings
cd3bb277 1353@opindex fno-const-strings
fcca588c
MM
1354Give string constants type @code{char *} instead of type @code{const
1355char *}. By default, G++ uses type @code{const char *} as required by
630d3d5a 1356the standard. Even if you use @option{-fno-const-strings}, you cannot
3521b33c 1357actually modify the value of a string constant.
fcca588c
MM
1358
1359This option might be removed in a future release of G++. For maximum
1360portability, you should structure your code so that it works with
1361string constants that have type @code{const char *}.
1362
1dc5fc4b 1363@item -fno-elide-constructors
cd3bb277 1364@opindex fno-elide-constructors
1dc5fc4b
JM
1365The C++ standard allows an implementation to omit creating a temporary
1366which is only used to initialize another object of the same type.
aee96fe9 1367Specifying this option disables that optimization, and forces G++ to
1dc5fc4b 1368call the copy constructor in all cases.
74291a4b 1369
dd1ba632 1370@item -fno-enforce-eh-specs
cd3bb277 1371@opindex fno-enforce-eh-specs
dd1ba632
JM
1372Don't check for violation of exception specifications at runtime. This
1373option violates the C++ standard, but may be useful for reducing code
1374size in production builds, much like defining @samp{NDEBUG}. The compiler
1375will still optimize based on the exception specifications.
1376
74291a4b 1377@item -ffor-scope
8c81598d 1378@itemx -fno-for-scope
cd3bb277
JM
1379@opindex ffor-scope
1380@opindex fno-for-scope
695ac33f 1381If @option{-ffor-scope} is specified, the scope of variables declared in
74291a4b 1382a @i{for-init-statement} is limited to the @samp{for} loop itself,
34527c47 1383as specified by the C++ standard.
695ac33f 1384If @option{-fno-for-scope} is specified, the scope of variables declared in
74291a4b 1385a @i{for-init-statement} extends to the end of the enclosing scope,
aee96fe9 1386as was the case in old versions of G++, and other (traditional)
74291a4b
MM
1387implementations of C++.
1388
1389The default if neither flag is given to follow the standard,
1390but to allow and give a warning for old-style code that would
1391otherwise be invalid, or have different behavior.
1392
1393@item -fno-gnu-keywords
cd3bb277 1394@opindex fno-gnu-keywords
9762e8a4 1395Do not recognize @code{typeof} as a keyword, so that code can use this
767094dd 1396word as an identifier. You can use the keyword @code{__typeof__} instead.
630d3d5a 1397@option{-ansi} implies @option{-fno-gnu-keywords}.
74291a4b 1398
1dc5fc4b 1399@item -fno-implicit-templates
cd3bb277 1400@opindex fno-implicit-templates
bba975d4 1401Never emit code for non-inline templates which are instantiated
e979f9e8 1402implicitly (i.e.@: by use); only emit code for explicit instantiations.
bba975d4
JM
1403@xref{Template Instantiation}, for more information.
1404
1405@item -fno-implicit-inline-templates
cd3bb277 1406@opindex fno-implicit-inline-templates
bba975d4
JM
1407Don't emit code for implicit instantiations of inline templates, either.
1408The default is to handle inlines differently so that compiles with and
1409without optimization will need the same set of explicit instantiations.
1dc5fc4b 1410
74291a4b 1411@item -fno-implement-inlines
cd3bb277 1412@opindex fno-implement-inlines
74291a4b
MM
1413To save space, do not emit out-of-line copies of inline functions
1414controlled by @samp{#pragma implementation}. This will cause linker
1415errors if these functions are not inlined everywhere they are called.
1416
631cf95d 1417@item -fms-extensions
cd3bb277 1418@opindex fms-extensions
32fb1fb2
PE
1419Disable pedantic warnings about constructs used in MFC, such as implicit
1420int and getting a pointer to member function via non-standard syntax.
631cf95d 1421
fcca588c 1422@item -fno-nonansi-builtins
cd3bb277 1423@opindex fno-nonansi-builtins
c771326b 1424Disable built-in declarations of functions that are not mandated by
161d7b59 1425ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
fcca588c
MM
1426@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1427
775afb25 1428@item -fno-operator-names
cd3bb277 1429@opindex fno-operator-names
775afb25 1430Do not treat the operator name keywords @code{and}, @code{bitand},
74291a4b 1431@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
775afb25 1432synonyms as keywords.
74291a4b 1433
4f8b4fd9 1434@item -fno-optional-diags
cd3bb277 1435@opindex fno-optional-diags
4f8b4fd9 1436Disable diagnostics that the standard says a compiler does not need to
aee96fe9 1437issue. Currently, the only such diagnostic issued by G++ is the one for
bba975d4 1438a name having multiple meanings within a class.
4f8b4fd9 1439
8c7707b0 1440@item -fpermissive
cd3bb277 1441@opindex fpermissive
4a386498
MM
1442Downgrade some diagnostics about nonconformant code from errors to
1443warnings. Thus, using @option{-fpermissive} will allow some
1444nonconforming code to compile.
8c7707b0 1445
8c81598d 1446@item -frepo
cd3bb277 1447@opindex frepo
9c34dbbf
ZW
1448Enable automatic template instantiation at link time. This option also
1449implies @option{-fno-implicit-templates}. @xref{Template
1450Instantiation}, for more information.
8c81598d 1451
8c7707b0 1452@item -fno-rtti
cd3bb277 1453@opindex fno-rtti
a7fbfcf9
JM
1454Disable generation of information about every class with virtual
1455functions for use by the C++ runtime type identification features
1456(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1457of the language, you can save some space by using this flag. Note that
1458exception handling uses the same information, but it will generate it as
1459needed.
8c7707b0 1460
fcca588c 1461@item -fstats
cd3bb277 1462@opindex fstats
fcca588c
MM
1463Emit statistics about front-end processing at the end of the compilation.
1464This information is generally only useful to the G++ development team.
1465
1dc5fc4b 1466@item -ftemplate-depth-@var{n}
cd3bb277 1467@opindex ftemplate-depth
1dc5fc4b
JM
1468Set the maximum instantiation depth for template classes to @var{n}.
1469A limit on the template instantiation depth is needed to detect
767094dd 1470endless recursions during template class instantiation. ANSI/ISO C++
1dc5fc4b
JM
1471conforming programs must not rely on a maximum depth greater than 17.
1472
40aac948
JM
1473@item -fno-threadsafe-statics
1474@opindex fno-threadsafe-statics
1475Do not emit the extra code to use the routines specified in the C++
1476ABI for thread-safe initialization of local statics. You can use this
1477option to reduce code size slightly in code that doesn't need to be
1478thread-safe.
1479
fc693822 1480@item -fuse-cxa-atexit
cd3bb277 1481@opindex fuse-cxa-atexit
fc693822
MM
1482Register destructors for objects with static storage duration with the
1483@code{__cxa_atexit} function rather than the @code{atexit} function.
1484This option is required for fully standards-compliant handling of static
1485destructors, but will only work if your C library supports
1486@code{__cxa_atexit}.
1487
d7afec4b
ND
1488@item -fvisibility-inlines-hidden
1489@opindex fvisibility-inlines-hidden
1490Causes all inlined methods to be marked with
1491@code{__attribute__ ((visibility ("hidden")))} so that they do not
1492appear in the export table of a DSO and do not require a PLT indirection
1493when used within the DSO. Enabling this option can have a dramatic effect
1494on load and link times of a DSO as it massively reduces the size of the
1495dynamic export table when the library makes heavy use of templates. While
1496it can cause bloating through duplication of code within each DSO where
1497it is used, often the wastage is less than the considerable space occupied
1498by a long symbol name in the export table which is typical when using
1499templates and namespaces. For even more savings, combine with the
1500@code{-fvisibility=hidden} switch.
1501
02f52e19 1502@item -fno-weak
cd3bb277 1503@opindex fno-weak
90ecce3e 1504Do not use weak symbol support, even if it is provided by the linker.
fcca588c
MM
1505By default, G++ will use weak symbols if they are available. This
1506option exists only for testing, and should not be used by end-users;
1507it will result in inferior code and has no benefits. This option may
1508be removed in a future release of G++.
1509
74291a4b 1510@item -nostdinc++
cd3bb277 1511@opindex nostdinc++
74291a4b
MM
1512Do not search for header files in the standard directories specific to
1513C++, but do still search the other standard directories. (This option
e5e809f4 1514is used when building the C++ library.)
74291a4b
MM
1515@end table
1516
1517In addition, these optimization, warning, and code generation options
1518have meanings only for C++ programs:
1519
2642624b 1520@table @gcctabopt
74291a4b 1521@item -fno-default-inline
cd3bb277 1522@opindex fno-default-inline
74291a4b 1523Do not assume @samp{inline} for functions defined inside a class scope.
1dc5fc4b
JM
1524@xref{Optimize Options,,Options That Control Optimization}. Note that these
1525functions will have linkage like inline functions; they just won't be
1526inlined by default.
74291a4b 1527
eca7f13c
MM
1528@item -Wabi @r{(C++ only)}
1529@opindex Wabi
1530Warn when G++ generates code that is probably not compatible with the
1531vendor-neutral C++ ABI. Although an effort has been made to warn about
daf2f129 1532all such cases, there are probably some cases that are not warned about,
eca7f13c
MM
1533even though G++ is generating incompatible code. There may also be
1534cases where warnings are emitted even though the code that is generated
1535will be compatible.
1536
1537You should rewrite your code to avoid these warnings if you are
1538concerned about the fact that code generated by G++ may not be binary
1539compatible with code generated by other compilers.
1540
3364c33b 1541The known incompatibilities at this point include:
eca7f13c
MM
1542
1543@itemize @bullet
1544
1545@item
1546Incorrect handling of tail-padding for bit-fields. G++ may attempt to
1547pack data into the same byte as a base class. For example:
1548
1549@smallexample
1550struct A @{ virtual void f(); int f1 : 1; @};
1551struct B : public A @{ int f2 : 1; @};
1552@end smallexample
1553
1554@noindent
1555In this case, G++ will place @code{B::f2} into the same byte
daf2f129 1556as@code{A::f1}; other compilers will not. You can avoid this problem
eca7f13c
MM
1557by explicitly padding @code{A} so that its size is a multiple of the
1558byte size on your platform; that will cause G++ and other compilers to
1559layout @code{B} identically.
1560
1561@item
1562Incorrect handling of tail-padding for virtual bases. G++ does not use
1563tail padding when laying out virtual bases. For example:
1564
1565@smallexample
1566struct A @{ virtual void f(); char c1; @};
1567struct B @{ B(); char c2; @};
1568struct C : public A, public virtual B @{@};
1569@end smallexample
1570
1571@noindent
1572In this case, G++ will not place @code{B} into the tail-padding for
1573@code{A}; other compilers will. You can avoid this problem by
1574explicitly padding @code{A} so that its size is a multiple of its
1575alignment (ignoring virtual base classes); that will cause G++ and other
1576compilers to layout @code{C} identically.
1577
2d3e278d
MM
1578@item
1579Incorrect handling of bit-fields with declared widths greater than that
1580of their underlying types, when the bit-fields appear in a union. For
1581example:
1582
1583@smallexample
1584union U @{ int i : 4096; @};
1585@end smallexample
1586
1587@noindent
1588Assuming that an @code{int} does not have 4096 bits, G++ will make the
1589union too small by the number of bits in an @code{int}.
1590
956d9305
MM
1591@item
1592Empty classes can be placed at incorrect offsets. For example:
daf2f129 1593
956d9305
MM
1594@smallexample
1595struct A @{@};
1596
1597struct B @{
1598 A a;
1599 virtual void f ();
1600@};
1601
1602struct C : public B, public A @{@};
1603@end smallexample
1604
1605@noindent
c0478a66 1606G++ will place the @code{A} base class of @code{C} at a nonzero offset;
956d9305
MM
1607it should be placed at offset zero. G++ mistakenly believes that the
1608@code{A} data member of @code{B} is already at offset zero.
1609
6397d80b
MM
1610@item
1611Names of template functions whose types involve @code{typename} or
1612template template parameters can be mangled incorrectly.
1613
1614@smallexample
1615template <typename Q>
1616void f(typename Q::X) @{@}
1617
1618template <template <typename> class Q>
1619void f(typename Q<int>::X) @{@}
1620@end smallexample
1621
1622@noindent
3364c33b 1623Instantiations of these templates may be mangled incorrectly.
6397d80b 1624
eca7f13c
MM
1625@end itemize
1626
aee96fe9 1627@item -Wctor-dtor-privacy @r{(C++ only)}
cd3bb277 1628@opindex Wctor-dtor-privacy
9eff22bc
LG
1629Warn when a class seems unusable because all the constructors or
1630destructors in that class are private, and it has neither friends nor
78d0a54d 1631public static member functions.
bba975d4 1632
aee96fe9 1633@item -Wnon-virtual-dtor @r{(C++ only)}
cd3bb277 1634@opindex Wnon-virtual-dtor
9eff22bc
LG
1635Warn when a class appears to be polymorphic, thereby requiring a virtual
1636destructor, yet it declares a non-virtual one.
bd8f9aec 1637This warning is enabled by @option{-Wall}.
bba975d4 1638
aee96fe9 1639@item -Wreorder @r{(C++ only)}
cd3bb277 1640@opindex Wreorder
bba975d4
JM
1641@cindex reordering, warning
1642@cindex warning for reordering of member initializers
1643Warn when the order of member initializers given in the code does not
1644match the order in which they must be executed. For instance:
1645
1646@smallexample
1647struct A @{
1648 int i;
1649 int j;
1650 A(): j (0), i (1) @{ @}
1651@};
1652@end smallexample
1653
9eff22bc
LG
1654The compiler will rearrange the member initializers for @samp{i}
1655and @samp{j} to match the declaration order of the members, emitting
1656a warning to that effect. This warning is enabled by @option{-Wall}.
bba975d4
JM
1657@end table
1658
630d3d5a 1659The following @option{-W@dots{}} options are not affected by @option{-Wall}.
bba975d4 1660
2642624b 1661@table @gcctabopt
aee96fe9 1662@item -Weffc++ @r{(C++ only)}
cd3bb277 1663@opindex Weffc++
77f6c1eb
RS
1664Warn about violations of the following style guidelines from Scott Meyers'
1665@cite{Effective C++} book:
1666
1667@itemize @bullet
1668@item
1669Item 11: Define a copy constructor and an assignment operator for classes
1670with dynamically allocated memory.
1671
1672@item
1673Item 12: Prefer initialization to assignment in constructors.
1674
1675@item
1676Item 14: Make destructors virtual in base classes.
1677
1678@item
1679Item 15: Have @code{operator=} return a reference to @code{*this}.
1680
1681@item
1682Item 23: Don't try to return a reference when you must return an object.
1683
1684@end itemize
1685
daf2f129 1686Also warn about violations of the following style guidelines from
9eff22bc 1687Scott Meyers' @cite{More Effective C++} book:
77f6c1eb
RS
1688
1689@itemize @bullet
1690@item
1691Item 6: Distinguish between prefix and postfix forms of increment and
1692decrement operators.
1693
1694@item
1695Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
1696
1697@end itemize
1698
9eff22bc
LG
1699When selecting this option, be aware that the standard library
1700headers do not obey all of these guidelines; use @samp{grep -v}
77f6c1eb 1701to filter out those warnings.
bba975d4 1702
aee96fe9 1703@item -Wno-deprecated @r{(C++ only)}
cd3bb277 1704@opindex Wno-deprecated
767094dd 1705Do not warn about usage of deprecated features. @xref{Deprecated Features}.
2de45c06 1706
aee96fe9 1707@item -Wno-non-template-friend @r{(C++ only)}
cd3bb277 1708@opindex Wno-non-template-friend
bba975d4 1709Disable warnings when non-templatized friend functions are declared
9eff22bc 1710within a template. Since the advent of explicit template specification
aee96fe9 1711support in G++, if the name of the friend is an unqualified-id (i.e.,
bba975d4 1712@samp{friend foo(int)}), the C++ language specification demands that the
767094dd 1713friend declare or define an ordinary, nontemplate function. (Section
aee96fe9 171414.5.3). Before G++ implemented explicit specification, unqualified-ids
bba975d4 1715could be interpreted as a particular specialization of a templatized
767094dd 1716function. Because this non-conforming behavior is no longer the default
aee96fe9 1717behavior for G++, @option{-Wnon-template-friend} allows the compiler to
9eff22bc 1718check existing code for potential trouble spots and is on by default.
2228d450 1719This new compiler behavior can be turned off with
630d3d5a 1720@option{-Wno-non-template-friend} which keeps the conformant compiler code
2228d450 1721but disables the helpful warning.
bba975d4 1722
aee96fe9 1723@item -Wold-style-cast @r{(C++ only)}
cd3bb277 1724@opindex Wold-style-cast
323728aa
NS
1725Warn if an old-style (C-style) cast to a non-void type is used within
1726a C++ program. The new-style casts (@samp{static_cast},
1727@samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
9eff22bc 1728unintended effects and much easier to search for.
bba975d4 1729
aee96fe9 1730@item -Woverloaded-virtual @r{(C++ only)}
cd3bb277 1731@opindex Woverloaded-virtual
bba975d4
JM
1732@cindex overloaded virtual fn, warning
1733@cindex warning for overloaded virtual fn
3747f3dc
MM
1734Warn when a function declaration hides virtual functions from a
1735base class. For example, in:
1736
1737@smallexample
1738struct A @{
1739 virtual void f();
1740@};
1741
1742struct B: public A @{
1743 void f(int);
1744@};
1745@end smallexample
1746
1747the @code{A} class version of @code{f} is hidden in @code{B}, and code
9eff22bc 1748like:
3747f3dc
MM
1749
1750@smallexample
1751B* b;
1752b->f();
1753@end smallexample
1754
1755will fail to compile.
bba975d4 1756
aee96fe9 1757@item -Wno-pmf-conversions @r{(C++ only)}
cd3bb277 1758@opindex Wno-pmf-conversions
bba975d4
JM
1759Disable the diagnostic for converting a bound pointer to member function
1760to a plain pointer.
1761
aee96fe9 1762@item -Wsign-promo @r{(C++ only)}
cd3bb277 1763@opindex Wsign-promo
bba975d4 1764Warn when overload resolution chooses a promotion from unsigned or
2eac577f 1765enumerated type to a signed type, over a conversion to an unsigned type of
aee96fe9 1766the same size. Previous versions of G++ would try to preserve
bba975d4
JM
1767unsignedness, but the standard mandates the current behavior.
1768
aee96fe9 1769@item -Wsynth @r{(C++ only)}
cd3bb277 1770@opindex Wsynth
bba975d4
JM
1771@cindex warning for synthesized methods
1772@cindex synthesized methods, warning
aee96fe9 1773Warn when G++'s synthesis behavior does not match that of cfront. For
bba975d4
JM
1774instance:
1775
1776@smallexample
1777struct A @{
1778 operator int ();
1779 A& operator = (int);
1780@};
1781
1782main ()
1783@{
1784 A a,b;
1785 a = b;
1786@}
1787@end smallexample
74291a4b 1788
aee96fe9 1789In this example, G++ will synthesize a default @samp{A& operator =
bba975d4 1790(const A&);}, while cfront will use the user-defined @samp{operator =}.
74291a4b
MM
1791@end table
1792
46e34f96
ZL
1793@node Objective-C and Objective-C++ Dialect Options
1794@section Options Controlling Objective-C and Objective-C++ Dialects
60de6385 1795
46e34f96
ZL
1796@cindex compiler options, Objective-C and Objective-C++
1797@cindex Objective-C and Objective-C++ options, command line
1798@cindex options, Objective-C and Objective-C++
1799(NOTE: This manual does not describe the Objective-C and Objective-C++
1800languages themselves. See @xref{Standards,,Language Standards
1801Supported by GCC}, for references.)
264fa2db 1802
60de6385 1803This section describes the command-line options that are only meaningful
46e34f96
ZL
1804for Objective-C and Objective-C++ programs, but you can also use most of
1805the language-independent GNU compiler options.
1806For example, you might compile a file @code{some_class.m} like this:
60de6385 1807
3ab51846 1808@smallexample
60de6385 1809gcc -g -fgnu-runtime -O -c some_class.m
3ab51846 1810@end smallexample
60de6385
SS
1811
1812@noindent
9eff22bc 1813In this example, @option{-fgnu-runtime} is an option meant only for
46e34f96
ZL
1814Objective-C and Objective-C++ programs; you can use the other options with
1815any language supported by GCC@.
1816
1817Note that since Objective-C is an extension of the C language, Objective-C
1818compilations may also use options specific to the C front-end (e.g.,
1819@option{-Wtraditional}). Similarly, Objective-C++ compilations may use
1820C++-specific options (e.g., @option{-Wabi}).
60de6385
SS
1821
1822Here is a list of options that are @emph{only} for compiling Objective-C
46e34f96 1823and Objective-C++ programs:
60de6385
SS
1824
1825@table @gcctabopt
630d3d5a 1826@item -fconstant-string-class=@var{class-name}
cd3bb277 1827@opindex fconstant-string-class
630d3d5a 1828Use @var{class-name} as the name of the class to instantiate for each
695ac33f 1829literal string specified with the syntax @code{@@"@dots{}"}. The default
264fa2db
ZL
1830class name is @code{NXConstantString} if the GNU runtime is being used, and
1831@code{NSConstantString} if the NeXT runtime is being used (see below). The
1832@option{-fconstant-cfstrings} option, if also present, will override the
1833@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
1834to be laid out as constant CoreFoundation strings.
60de6385
SS
1835
1836@item -fgnu-runtime
cd3bb277 1837@opindex fgnu-runtime
60de6385
SS
1838Generate object code compatible with the standard GNU Objective-C
1839runtime. This is the default for most types of systems.
1840
1841@item -fnext-runtime
cd3bb277 1842@opindex fnext-runtime
60de6385 1843Generate output compatible with the NeXT runtime. This is the default
1f676100
NP
1844for NeXT-based systems, including Darwin and Mac OS X@. The macro
1845@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1846used.
60de6385 1847
264fa2db 1848@item -fno-nil-receivers
5ad7ae7f 1849@opindex fno-nil-receivers
daf2f129
JM
1850Assume that all Objective-C message dispatches (e.g.,
1851@code{[receiver message:arg]}) in this translation unit ensure that the receiver
46e34f96
ZL
1852is not @code{nil}. This allows for more efficient entry points in the runtime
1853to be used. Currently, this option is only available in conjunction with
264fa2db
ZL
1854the NeXT runtime on Mac OS X 10.3 and later.
1855
1856@item -fobjc-exceptions
5ad7ae7f 1857@opindex fobjc-exceptions
daf2f129
JM
1858Enable syntactic support for structured exception handling in Objective-C,
1859similar to what is offered by C++ and Java. Currently, this option is only
1860available in conjunction with the NeXT runtime on Mac OS X 10.3 and later.
264fa2db
ZL
1861
1862@smallexample
1863 @@try @{
1864 @dots{}
1865 @@throw expr;
1866 @dots{}
1867 @}
1868 @@catch (AnObjCClass *exc) @{
1869 @dots{}
1870 @@throw expr;
1871 @dots{}
1872 @@throw;
1873 @dots{}
1874 @}
1875 @@catch (AnotherClass *exc) @{
1876 @dots{}
1877 @}
1878 @@catch (id allOthers) @{
1879 @dots{}
1880 @}
1881 @@finally @{
1882 @dots{}
1883 @@throw expr;
1884 @dots{}
1885 @}
1886@end smallexample
1887
1888The @code{@@throw} statement may appear anywhere in an Objective-C or
daf2f129
JM
1889Objective-C++ program; when used inside of a @code{@@catch} block, the
1890@code{@@throw} may appear without an argument (as shown above), in which case
264fa2db
ZL
1891the object caught by the @code{@@catch} will be rethrown.
1892
1893Note that only (pointers to) Objective-C objects may be thrown and
1894caught using this scheme. When an object is thrown, it will be caught
1895by the nearest @code{@@catch} clause capable of handling objects of that type,
daf2f129
JM
1896analogously to how @code{catch} blocks work in C++ and Java. A
1897@code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
264fa2db
ZL
1898any and all Objective-C exceptions not caught by previous @code{@@catch}
1899clauses (if any).
1900
1901The @code{@@finally} clause, if present, will be executed upon exit from the
1902immediately preceding @code{@@try @dots{} @@catch} section. This will happen
1903regardless of whether any exceptions are thrown, caught or rethrown
1904inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
1905of the @code{finally} clause in Java.
1906
1907There are several caveats to using the new exception mechanism:
1908
1909@itemize @bullet
1910@item
daf2f129 1911Although currently designed to be binary compatible with @code{NS_HANDLER}-style
264fa2db
ZL
1912idioms provided by the @code{NSException} class, the new
1913exceptions can only be used on Mac OS X 10.3 (Panther) and later
1914systems, due to additional functionality needed in the (NeXT) Objective-C
1915runtime.
1916
1917@item
1918As mentioned above, the new exceptions do not support handling
daf2f129 1919types other than Objective-C objects. Furthermore, when used from
264fa2db
ZL
1920Objective-C++, the Objective-C exception model does not interoperate with C++
1921exceptions at this time. This means you cannot @code{@@throw} an exception
daf2f129 1922from Objective-C and @code{catch} it in C++, or vice versa
264fa2db
ZL
1923(i.e., @code{throw @dots{} @@catch}).
1924@end itemize
daf2f129 1925
264fa2db
ZL
1926The @option{-fobjc-exceptions} switch also enables the use of synchronization
1927blocks for thread-safe execution:
1928
1929@smallexample
1930 @@synchronized (ObjCClass *guard) @{
1931 @dots{}
1932 @}
1933@end smallexample
1934
1935Upon entering the @code{@@synchronized} block, a thread of execution shall
1936first check whether a lock has been placed on the corresponding @code{guard}
1937object by another thread. If it has, the current thread shall wait until
daf2f129 1938the other thread relinquishes its lock. Once @code{guard} becomes available,
264fa2db
ZL
1939the current thread will place its own lock on it, execute the code contained in
1940the @code{@@synchronized} block, and finally relinquish the lock (thereby
1941making @code{guard} available to other threads).
1942
1943Unlike Java, Objective-C does not allow for entire methods to be marked
1944@code{@@synchronized}. Note that throwing exceptions out of
1945@code{@@synchronized} blocks is allowed, and will cause the guarding object
1946to be unlocked properly.
1947
1948@item -freplace-objc-classes
5ad7ae7f 1949@opindex freplace-objc-classes
264fa2db
ZL
1950Emit a special marker instructing @command{ld(1)} not to statically link in
1951the resulting object file, and allow @command{dyld(1)} to load it in at
1952run time instead. This is used in conjunction with the Fix-and-Continue
daf2f129 1953debugging mode, where the object file in question may be recompiled and
264fa2db
ZL
1954dynamically reloaded in the course of program execution, without the need
1955to restart the program itself. Currently, Fix-and-Continue functionality
daf2f129 1956is only available in conjunction with the NeXT runtime on Mac OS X 10.3
264fa2db
ZL
1957and later.
1958
1959@item -fzero-link
5ad7ae7f 1960@opindex fzero-link
264fa2db
ZL
1961When compiling for the NeXT runtime, the compiler ordinarily replaces calls
1962to @code{objc_getClass("@dots{}")} (when the name of the class is known at
1963compile time) with static class references that get initialized at load time,
1964which improves run-time performance. Specifying the @option{-fzero-link} flag
1965suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
daf2f129 1966to be retained. This is useful in Zero-Link debugging mode, since it allows
264fa2db
ZL
1967for individual class implementations to be modified during program execution.
1968
60de6385 1969@item -gen-decls
cd3bb277 1970@opindex gen-decls
60de6385
SS
1971Dump interface declarations for all classes seen in the source file to a
1972file named @file{@var{sourcename}.decl}.
1973
1974@item -Wno-protocol
cd3bb277 1975@opindex Wno-protocol
1f676100
NP
1976If a class is declared to implement a protocol, a warning is issued for
1977every method in the protocol that is not implemented by the class. The
6335b0aa 1978default behavior is to issue a warning for every method not explicitly
1f676100
NP
1979implemented in the class, even if a method implementation is inherited
1980from the superclass. If you use the @code{-Wno-protocol} option, then
1981methods inherited from the superclass are considered to be implemented,
1982and no warning is issued for them.
60de6385
SS
1983
1984@item -Wselector
cd3bb277 1985@opindex Wselector
1f676100
NP
1986Warn if multiple methods of different types for the same selector are
1987found during compilation. The check is performed on the list of methods
1988in the final stage of compilation. Additionally, a check is performed
9eff22bc
LG
1989for each selector appearing in a @code{@@selector(@dots{})}
1990expression, and a corresponding method for that selector has been found
1f676100
NP
1991during compilation. Because these checks scan the method table only at
1992the end of compilation, these warnings are not produced if the final
1993stage of compilation is not reached, for example because an error is
1994found during compilation, or because the @code{-fsyntax-only} option is
1995being used.
1996
1997@item -Wundeclared-selector
1998@opindex Wundeclared-selector
1999Warn if a @code{@@selector(@dots{})} expression referring to an
2000undeclared selector is found. A selector is considered undeclared if no
daf2f129 2001method with that name has been declared before the
9eff22bc
LG
2002@code{@@selector(@dots{})} expression, either explicitly in an
2003@code{@@interface} or @code{@@protocol} declaration, or implicitly in
2004an @code{@@implementation} section. This option always performs its
2005checks as soon as a @code{@@selector(@dots{})} expression is found,
2006while @code{-Wselector} only performs its checks in the final stage of
2007compilation. This also enforces the coding style convention
1f676100 2008that methods and selectors must be declared before being used.
60de6385 2009
7989e4dc 2010@item -print-objc-runtime-info
5ad7ae7f 2011@opindex print-objc-runtime-info
7989e4dc
RO
2012Generate C header describing the largest structure that is passed by
2013value, if any.
60de6385
SS
2014
2015@end table
2016
764dbbf2
GDR
2017@node Language Independent Options
2018@section Options to Control Diagnostic Messages Formatting
2019@cindex options to control diagnostics formatting
2020@cindex diagnostic messages
2021@cindex message formatting
2022
b192711e 2023Traditionally, diagnostic messages have been formatted irrespective of
e979f9e8 2024the output device's aspect (e.g.@: its width, @dots{}). The options described
764dbbf2 2025below can be used to control the diagnostic messages formatting
e979f9e8 2026algorithm, e.g.@: how many characters per line, how often source location
6c0a4eab 2027information should be reported. Right now, only the C++ front end can
764dbbf2 2028honor these options. However it is expected, in the near future, that
6c0a4eab 2029the remaining front ends would be able to digest them correctly.
764dbbf2 2030
2642624b 2031@table @gcctabopt
764dbbf2 2032@item -fmessage-length=@var{n}
cd3bb277 2033@opindex fmessage-length
764dbbf2 2034Try to format error messages so that they fit on lines of about @var{n}
aee96fe9 2035characters. The default is 72 characters for @command{g++} and 0 for the rest of
161d7b59 2036the front ends supported by GCC@. If @var{n} is zero, then no
02f52e19 2037line-wrapping will be done; each error message will appear on a single
764dbbf2
GDR
2038line.
2039
cd3bb277 2040@opindex fdiagnostics-show-location
764dbbf2 2041@item -fdiagnostics-show-location=once
b192711e 2042Only meaningful in line-wrapping mode. Instructs the diagnostic messages
764dbbf2
GDR
2043reporter to emit @emph{once} source location information; that is, in
2044case the message is too long to fit on a single physical line and has to
2045be wrapped, the source location won't be emitted (as prefix) again,
2046over and over, in subsequent continuation lines. This is the default
c21cd8b1 2047behavior.
764dbbf2
GDR
2048
2049@item -fdiagnostics-show-location=every-line
2050Only meaningful in line-wrapping mode. Instructs the diagnostic
2051messages reporter to emit the same source location information (as
4fe9b91c 2052prefix) for physical lines that result from the process of breaking
b192711e 2053a message which is too long to fit on a single line.
764dbbf2
GDR
2054
2055@end table
2056
74291a4b
MM
2057@node Warning Options
2058@section Options to Request or Suppress Warnings
2059@cindex options to control warnings
2060@cindex warning messages
2061@cindex messages, warning
2062@cindex suppressing warnings
2063
2064Warnings are diagnostic messages that report constructions which
2065are not inherently erroneous but which are risky or suggest there
2066may have been an error.
2067
2068You can request many specific warnings with options beginning @samp{-W},
630d3d5a 2069for example @option{-Wimplicit} to request warnings on implicit
74291a4b
MM
2070declarations. Each of these specific warning options also has a
2071negative form beginning @samp{-Wno-} to turn off warnings;
630d3d5a 2072for example, @option{-Wno-implicit}. This manual lists only one of the
74291a4b
MM
2073two forms, whichever is not the default.
2074
62aaa62c
GP
2075The following options control the amount and kinds of warnings produced
2076by GCC; for further, language-specific options also refer to
46e34f96
ZL
2077@ref{C++ Dialect Options} and @ref{Objective-C and Objective-C++ Dialect
2078Options}.
74291a4b 2079
2642624b 2080@table @gcctabopt
74291a4b
MM
2081@cindex syntax checking
2082@item -fsyntax-only
cd3bb277 2083@opindex fsyntax-only
74291a4b
MM
2084Check the code for syntax errors, but don't do anything beyond that.
2085
2086@item -pedantic
cd3bb277 2087@opindex pedantic
074e95e3
JM
2088Issue all the warnings demanded by strict ISO C and ISO C++;
2089reject all programs that use forbidden extensions, and some other
2090programs that do not follow ISO C and ISO C++. For ISO C, follows the
630d3d5a 2091version of the ISO C standard specified by any @option{-std} option used.
74291a4b 2092
074e95e3 2093Valid ISO C and ISO C++ programs should compile properly with or without
5490d604 2094this option (though a rare few will require @option{-ansi} or a
161d7b59 2095@option{-std} option specifying the required version of ISO C)@. However,
b1d16193
JL
2096without this option, certain GNU extensions and traditional C and C++
2097features are supported as well. With this option, they are rejected.
74291a4b 2098
630d3d5a 2099@option{-pedantic} does not cause warning messages for use of the
74291a4b
MM
2100alternate keywords whose names begin and end with @samp{__}. Pedantic
2101warnings are also disabled in the expression that follows
2102@code{__extension__}. However, only system header files should use
2103these escape routes; application programs should avoid them.
2104@xref{Alternate Keywords}.
2105
630d3d5a 2106Some users try to use @option{-pedantic} to check programs for strict ISO
74291a4b 2107C conformance. They soon find that it does not do quite what they want:
c1030c7c 2108it finds some non-ISO practices, but not all---only those for which
074e95e3
JM
2109ISO C @emph{requires} a diagnostic, and some others for which
2110diagnostics have been added.
74291a4b 2111
074e95e3 2112A feature to report any failure to conform to ISO C might be useful in
74291a4b 2113some instances, but would require considerable additional work and would
630d3d5a 2114be quite different from @option{-pedantic}. We don't have plans to
892d0a6d 2115support such a feature in the near future.
74291a4b 2116
91ea548a
JM
2117Where the standard specified with @option{-std} represents a GNU
2118extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2119corresponding @dfn{base standard}, the version of ISO C on which the GNU
2120extended dialect is based. Warnings from @option{-pedantic} are given
2121where they are required by the base standard. (It would not make sense
2122for such warnings to be given only for features not in the specified GNU
2123C dialect, since by definition the GNU dialects of C include all
2124features the compiler supports with the given option, and there would be
2125nothing to warn about.)
2126
74291a4b 2127@item -pedantic-errors
cd3bb277 2128@opindex pedantic-errors
630d3d5a 2129Like @option{-pedantic}, except that errors are produced rather than
74291a4b
MM
2130warnings.
2131
2132@item -w
cd3bb277 2133@opindex w
74291a4b
MM
2134Inhibit all warning messages.
2135
2136@item -Wno-import
cd3bb277 2137@opindex Wno-import
74291a4b
MM
2138Inhibit warning messages about the use of @samp{#import}.
2139
2140@item -Wchar-subscripts
cd3bb277 2141@opindex Wchar-subscripts
74291a4b
MM
2142Warn if an array subscript has type @code{char}. This is a common cause
2143of error, as programmers often forget that this type is signed on some
2144machines.
2145
2146@item -Wcomment
cd3bb277 2147@opindex Wcomment
74291a4b
MM
2148Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2149comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2150
c65a01af
RG
2151@item -Wfatal-errors
2152@opindex Wfatal-errors
2153This option causes the compiler to abort compilation on the first error
2154occurred rather than trying to keep going and printing further error
2155messages.
2156
74291a4b 2157@item -Wformat
cd3bb277 2158@opindex Wformat
74291a4b
MM
2159Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2160the arguments supplied have types appropriate to the format string
26f6672d
JM
2161specified, and that the conversions specified in the format string make
2162sense. This includes standard functions, and others specified by format
2163attributes (@pxref{Function Attributes}), in the @code{printf},
2164@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
a2bec818 2165not in the C standard) families (or other target-specific families).
74291a4b 2166
8308e0b7 2167The formats are checked against the format features supported by GNU
3764f879 2168libc version 2.2. These include all ISO C90 and C99 features, as well
8308e0b7
JM
2169as features from the Single Unix Specification and some BSD and GNU
2170extensions. Other library implementations may not support all these
2171features; GCC does not support warning about features that go beyond a
630d3d5a
JM
2172particular library's limitations. However, if @option{-pedantic} is used
2173with @option{-Wformat}, warnings will be given about format features not
26f6672d
JM
2174in the selected standard version (but not for @code{strfmon} formats,
2175since those are not in any version of the C standard). @xref{C Dialect
2176Options,,Options Controlling C Dialect}.
8308e0b7 2177
b34c7881
JT
2178Since @option{-Wformat} also checks for null format arguments for
2179several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2180
630d3d5a 2181@option{-Wformat} is included in @option{-Wall}. For more control over some
c76f4e8e 2182aspects of format checking, the options @option{-Wformat-y2k},
e964a556
JT
2183@option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2184@option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2185@option{-Wformat=2} are available, but are not included in @option{-Wall}.
4d808927 2186
c76f4e8e
JM
2187@item -Wformat-y2k
2188@opindex Wformat-y2k
2189If @option{-Wformat} is specified, also warn about @code{strftime}
4d808927
JM
2190formats which may yield only a two-digit year.
2191
2192@item -Wno-format-extra-args
cd3bb277 2193@opindex Wno-format-extra-args
630d3d5a 2194If @option{-Wformat} is specified, do not warn about excess arguments to a
4d808927
JM
2195@code{printf} or @code{scanf} format function. The C standard specifies
2196that such arguments are ignored.
2197
7e5fb12f
JM
2198Where the unused arguments lie between used arguments that are
2199specified with @samp{$} operand number specifications, normally
2200warnings are still given, since the implementation could not know what
2201type to pass to @code{va_arg} to skip the unused arguments. However,
2202in the case of @code{scanf} formats, this option will suppress the
2203warning if the unused arguments are all pointers, since the Single
2204Unix Specification says that such unused arguments are allowed.
2205
e964a556
JT
2206@item -Wno-format-zero-length
2207@opindex Wno-format-zero-length
2208If @option{-Wformat} is specified, do not warn about zero-length formats.
2209The C standard specifies that zero-length formats are allowed.
2210
4d808927 2211@item -Wformat-nonliteral
cd3bb277 2212@opindex Wformat-nonliteral
630d3d5a 2213If @option{-Wformat} is specified, also warn if the format string is not a
4d808927
JM
2214string literal and so cannot be checked, unless the format function
2215takes its format arguments as a @code{va_list}.
2216
c907e684 2217@item -Wformat-security
cd3bb277 2218@opindex Wformat-security
630d3d5a 2219If @option{-Wformat} is specified, also warn about uses of format
c907e684
JM
2220functions that represent possible security problems. At present, this
2221warns about calls to @code{printf} and @code{scanf} functions where the
2222format string is not a string literal and there are no format arguments,
2223as in @code{printf (foo);}. This may be a security hole if the format
2224string came from untrusted input and contains @samp{%n}. (This is
630d3d5a
JM
2225currently a subset of what @option{-Wformat-nonliteral} warns about, but
2226in future warnings may be added to @option{-Wformat-security} that are not
2227included in @option{-Wformat-nonliteral}.)
c907e684 2228
4d808927 2229@item -Wformat=2
cd3bb277 2230@opindex Wformat=2
630d3d5a
JM
2231Enable @option{-Wformat} plus format checks not included in
2232@option{-Wformat}. Currently equivalent to @samp{-Wformat
c76f4e8e 2233-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
4d808927 2234
b34c7881
JT
2235@item -Wnonnull
2236@opindex Wnonnull
f6d9224f 2237Warn about passing a null pointer for arguments marked as
b34c7881
JT
2238requiring a non-null value by the @code{nonnull} function attribute.
2239
2240@option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
2241can be disabled with the @option{-Wno-nonnull} option.
2242
46e34f96 2243@item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3390f9c9 2244@opindex Winit-self
f6d9224f
GP
2245Warn about uninitialized variables which are initialized with themselves.
2246Note this option can only be used with the @option{-Wuninitialized} option,
2247which in turn only works with @option{-O1} and above.
3390f9c9 2248
f6d9224f
GP
2249For example, GCC will warn about @code{i} being uninitialized in the
2250following snippet only when @option{-Winit-self} has been specified:
3390f9c9
AP
2251@smallexample
2252@group
2253int f()
2254@{
2255 int i = i;
2256 return i;
2257@}
2258@end group
2259@end smallexample
2260
e9a25f70 2261@item -Wimplicit-int
cd3bb277 2262@opindex Wimplicit-int
e9a25f70
JL
2263Warn when a declaration does not specify a type.
2264
f5963e61
JL
2265@item -Wimplicit-function-declaration
2266@itemx -Werror-implicit-function-declaration
cd3bb277
JM
2267@opindex Wimplicit-function-declaration
2268@opindex Werror-implicit-function-declaration
f5963e61
JL
2269Give a warning (or error) whenever a function is used before being
2270declared.
e9a25f70 2271
74291a4b 2272@item -Wimplicit
cd3bb277 2273@opindex Wimplicit
630d3d5a 2274Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
861bb6c1
JL
2275
2276@item -Wmain
cd3bb277 2277@opindex Wmain
861bb6c1
JL
2278Warn if the type of @samp{main} is suspicious. @samp{main} should be a
2279function with external linkage, returning int, taking either zero
2280arguments, two, or three arguments of appropriate types.
4a870dba 2281
1f0c3120 2282@item -Wmissing-braces
cd3bb277 2283@opindex Wmissing-braces
1f0c3120
JM
2284Warn if an aggregate or union initializer is not fully bracketed. In
2285the following example, the initializer for @samp{a} is not fully
2286bracketed, but that for @samp{b} is fully bracketed.
2287
2288@smallexample
2289int a[2][2] = @{ 0, 1, 2, 3 @};
2290int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2291@end smallexample
2292
46e34f96 2293@item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
b02398bd
BE
2294@opindex Wmissing-include-dirs
2295Warn if a user-supplied include directory does not exist.
2296
74291a4b 2297@item -Wparentheses
cd3bb277 2298@opindex Wparentheses
74291a4b
MM
2299Warn if parentheses are omitted in certain contexts, such
2300as when there is an assignment in a context where a truth value
2301is expected, or when operators are nested whose precedence people
3e3970a2
JM
2302often get confused about. Only the warning for an assignment used as
2303a truth value is supported when compiling C++; the other warnings are
2304only supported when compiling C@.
2305
2306Also warn if a comparison like @samp{x<=y<=z} appears; this is
2307equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
2308interpretation from that of ordinary mathematical notation.
74291a4b 2309
e9a25f70
JL
2310Also warn about constructions where there may be confusion to which
2311@code{if} statement an @code{else} branch belongs. Here is an example of
2312such a case:
2313
2314@smallexample
aee96fe9 2315@group
e9a25f70
JL
2316@{
2317 if (a)
2318 if (b)
2319 foo ();
2320 else
2321 bar ();
2322@}
aee96fe9 2323@end group
e9a25f70
JL
2324@end smallexample
2325
2326In C, every @code{else} branch belongs to the innermost possible @code{if}
2327statement, which in this example is @code{if (b)}. This is often not
2328what the programmer expected, as illustrated in the above example by
2329indentation the programmer chose. When there is the potential for this
f0523f02 2330confusion, GCC will issue a warning when this flag is specified.
e9a25f70
JL
2331To eliminate the warning, add explicit braces around the innermost
2332@code{if} statement so there is no way the @code{else} could belong to
2333the enclosing @code{if}. The resulting code would look like this:
2334
2335@smallexample
aee96fe9 2336@group
e9a25f70
JL
2337@{
2338 if (a)
2339 @{
2340 if (b)
2341 foo ();
2342 else
2343 bar ();
2344 @}
2345@}
aee96fe9 2346@end group
e9a25f70
JL
2347@end smallexample
2348
bb58bec5 2349@item -Wsequence-point
cd3bb277 2350@opindex Wsequence-point
bb58bec5
JM
2351Warn about code that may have undefined semantics because of violations
2352of sequence point rules in the C standard.
2353
2354The C standard defines the order in which expressions in a C program are
2355evaluated in terms of @dfn{sequence points}, which represent a partial
2356ordering between the execution of parts of the program: those executed
2357before the sequence point, and those executed after it. These occur
2358after the evaluation of a full expression (one which is not part of a
2359larger expression), after the evaluation of the first operand of a
2360@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2361function is called (but after the evaluation of its arguments and the
2362expression denoting the called function), and in certain other places.
2363Other than as expressed by the sequence point rules, the order of
2364evaluation of subexpressions of an expression is not specified. All
2365these rules describe only a partial order rather than a total order,
2366since, for example, if two functions are called within one expression
2367with no sequence point between them, the order in which the functions
2368are called is not specified. However, the standards committee have
2369ruled that function calls do not overlap.
2370
2371It is not specified when between sequence points modifications to the
2372values of objects take effect. Programs whose behavior depends on this
2373have undefined behavior; the C standard specifies that ``Between the
2374previous and next sequence point an object shall have its stored value
2375modified at most once by the evaluation of an expression. Furthermore,
2376the prior value shall be read only to determine the value to be
2377stored.''. If a program breaks these rules, the results on any
2378particular implementation are entirely unpredictable.
2379
2380Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2381= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
2382diagnosed by this option, and it may give an occasional false positive
2383result, but in general it has been found fairly effective at detecting
2384this sort of problem in programs.
2385
2386The present implementation of this option only works for C programs. A
2387future implementation may also work for C++ programs.
2388
9c34dbbf
ZW
2389The C standard is worded confusingly, therefore there is some debate
2390over the precise meaning of the sequence point rules in subtle cases.
2391Links to discussions of the problem, including proposed formal
962e6e00 2392definitions, may be found on the GCC readings page, at
c5122d75 2393@w{@uref{http://gcc.gnu.org/readings.html}}.
bb58bec5 2394
74291a4b 2395@item -Wreturn-type
cd3bb277 2396@opindex Wreturn-type
32c4c36c
ML
2397Warn whenever a function is defined with a return-type that defaults to
2398@code{int}. Also warn about any @code{return} statement with no
02f52e19 2399return-value in a function whose return-type is not @code{void}.
32c4c36c 2400
e508a019
JM
2401For C, also warn if the return type of a function has a type qualifier
2402such as @code{const}. Such a type qualifier has no effect, since the
2403value returned by a function is not an lvalue. ISO C prohibits
2404qualified @code{void} return types on function definitions, so such
2405return types always receive a warning even without this option.
2406
32c4c36c 2407For C++, a function without return type always produces a diagnostic
767094dd 2408message, even when @option{-Wno-return-type} is specified. The only
32c4c36c 2409exceptions are @samp{main} and functions defined in system headers.
74291a4b
MM
2410
2411@item -Wswitch
cd3bb277 2412@opindex Wswitch
2eac577f 2413Warn whenever a @code{switch} statement has an index of enumerated type
74291a4b
MM
2414and lacks a @code{case} for one or more of the named codes of that
2415enumeration. (The presence of a @code{default} label prevents this
2416warning.) @code{case} labels outside the enumeration range also
2417provoke warnings when this option is used.
2418
d6961341
AC
2419@item -Wswitch-default
2420@opindex Wswitch-switch
2421Warn whenever a @code{switch} statement does not have a @code{default}
2422case.
2423
173028e5
AC
2424@item -Wswitch-enum
2425@opindex Wswitch-enum
2eac577f 2426Warn whenever a @code{switch} statement has an index of enumerated type
173028e5
AC
2427and lacks a @code{case} for one or more of the named codes of that
2428enumeration. @code{case} labels outside the enumeration range also
2429provoke warnings when this option is used.
2430
74291a4b 2431@item -Wtrigraphs
cd3bb277 2432@opindex Wtrigraphs
f2ecb02d
JM
2433Warn if any trigraphs are encountered that might change the meaning of
2434the program (trigraphs within comments are not warned about).
74291a4b 2435
078721e1 2436@item -Wunused-function
cd3bb277 2437@opindex Wunused-function
078721e1
AC
2438Warn whenever a static function is declared but not defined or a
2439non\-inline static function is unused.
74291a4b 2440
078721e1 2441@item -Wunused-label
cd3bb277 2442@opindex Wunused-label
078721e1
AC
2443Warn whenever a label is declared but not used.
2444
2445To suppress this warning use the @samp{unused} attribute
2446(@pxref{Variable Attributes}).
2447
2448@item -Wunused-parameter
cd3bb277 2449@opindex Wunused-parameter
078721e1
AC
2450Warn whenever a function parameter is unused aside from its declaration.
2451
2452To suppress this warning use the @samp{unused} attribute
2453(@pxref{Variable Attributes}).
956d6950 2454
078721e1 2455@item -Wunused-variable
cd3bb277 2456@opindex Wunused-variable
078721e1
AC
2457Warn whenever a local variable or non-constant static variable is unused
2458aside from its declaration
2459
2460To suppress this warning use the @samp{unused} attribute
74291a4b
MM
2461(@pxref{Variable Attributes}).
2462
078721e1 2463@item -Wunused-value
cd3bb277 2464@opindex Wunused-value
078721e1
AC
2465Warn whenever a statement computes a result that is explicitly not used.
2466
2467To suppress this warning cast the expression to @samp{void}.
2468
2469@item -Wunused
cd3bb277 2470@opindex Wunused
d3075b6c 2471All the above @option{-Wunused} options combined.
078721e1
AC
2472
2473In order to get a warning about an unused function parameter, you must
65ca2d60
PE
2474either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
2475@samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
078721e1 2476
74291a4b 2477@item -Wuninitialized
cd3bb277 2478@opindex Wuninitialized
c5c76735
JL
2479Warn if an automatic variable is used without first being initialized or
2480if a variable may be clobbered by a @code{setjmp} call.
74291a4b
MM
2481
2482These warnings are possible only in optimizing compilation,
2483because they require data flow information that is computed only
630d3d5a 2484when optimizing. If you don't specify @option{-O}, you simply won't
74291a4b
MM
2485get these warnings.
2486
3390f9c9
AP
2487If you want to warn about code which uses the uninitialized value of the
2488variable in its own initializer, use the @option{-Winit-self} option.
2489
74291a4b
MM
2490These warnings occur only for variables that are candidates for
2491register allocation. Therefore, they do not occur for a variable that
2492is declared @code{volatile}, or whose address is taken, or whose size
2493is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
2494structures, unions or arrays, even when they are in registers.
2495
2496Note that there may be no warning about a variable that is used only
2497to compute a value that itself is never used, because such
2498computations may be deleted by data flow analysis before the warnings
2499are printed.
2500
0c2d1a2a 2501These warnings are made optional because GCC is not smart
74291a4b
MM
2502enough to see all the reasons why the code might be correct
2503despite appearing to have an error. Here is one example of how
2504this can happen:
2505
2506@smallexample
aee96fe9 2507@group
74291a4b
MM
2508@{
2509 int x;
2510 switch (y)
2511 @{
2512 case 1: x = 1;
2513 break;
2514 case 2: x = 4;
2515 break;
2516 case 3: x = 5;
2517 @}
2518 foo (x);
2519@}
aee96fe9 2520@end group
74291a4b
MM
2521@end smallexample
2522
2523@noindent
2524If the value of @code{y} is always 1, 2 or 3, then @code{x} is
0c2d1a2a 2525always initialized, but GCC doesn't know this. Here is
74291a4b
MM
2526another common case:
2527
2528@smallexample
2529@{
2530 int save_y;
2531 if (change_y) save_y = y, y = new_y;
2532 @dots{}
2533 if (change_y) y = save_y;
2534@}
2535@end smallexample
2536
2537@noindent
2538This has no bug because @code{save_y} is used only if it is set.
2539
20300b05 2540@cindex @code{longjmp} warnings
b192711e 2541This option also warns when a non-volatile automatic variable might be
c5c76735
JL
2542changed by a call to @code{longjmp}. These warnings as well are possible
2543only in optimizing compilation.
20300b05
GK
2544
2545The compiler sees only the calls to @code{setjmp}. It cannot know
2546where @code{longjmp} will be called; in fact, a signal handler could
2547call it at any point in the code. As a result, you may get a warning
2548even when there is in fact no problem because @code{longjmp} cannot
2549in fact be called at the place which would cause a problem.
2550
74291a4b
MM
2551Some spurious warnings can be avoided if you declare all the functions
2552you use that never return as @code{noreturn}. @xref{Function
2553Attributes}.
2554
d300e551 2555@item -Wunknown-pragmas
cd3bb277 2556@opindex Wunknown-pragmas
d300e551
NC
2557@cindex warning for unknown pragmas
2558@cindex unknown pragmas, warning
2559@cindex pragmas, warning of unknown
2560Warn when a #pragma directive is encountered which is not understood by
161d7b59 2561GCC@. If this command line option is used, warnings will even be issued
d300e551 2562for unknown pragmas in system header files. This is not the case if
630d3d5a 2563the warnings were only enabled by the @option{-Wall} command line option.
d300e551 2564
bf52f899
NS
2565@item -Wstrict-aliasing
2566@opindex Wstrict-aliasing
2567This option is only active when @option{-fstrict-aliasing} is active.
2568It warns about code which might break the strict aliasing rules that the
2569compiler is using for optimization. The warning does not catch all
2570cases, but does attempt to catch the more common pitfalls. It is
2571included in @option{-Wall}.
2572
5399d643
JW
2573@item -Wstrict-aliasing=2
2574@opindex Wstrict-aliasing=2
2575This option is only active when @option{-fstrict-aliasing} is active.
2576It warns about all code which might break the strict aliasing rules that the
2577compiler is using for optimization. This warning catches all cases, but
2578it will also give a warning for some ambiguous cases that are safe.
2579
74291a4b 2580@item -Wall
cd3bb277 2581@opindex Wall
74291a4b
MM
2582All of the above @samp{-W} options combined. This enables all the
2583warnings about constructions that some users consider questionable, and
2584that are easy to avoid (or modify to prevent the warning), even in
bd8f9aec
SP
2585conjunction with macros. This also enables some language-specific
2586warnings described in @ref{C++ Dialect Options} and
46e34f96 2587@ref{Objective-C and Objective-C++ Dialect Options}.
74291a4b
MM
2588@end table
2589
630d3d5a 2590The following @option{-W@dots{}} options are not implied by @option{-Wall}.
74291a4b
MM
2591Some of them warn about constructions that users generally do not
2592consider questionable, but which occasionally you might wish to check
2593for; others warn about constructions that are necessary or hard to avoid
2594in some cases, and there is no simple way to modify the code to suppress
2595the warning.
2596
2642624b 2597@table @gcctabopt
65ca2d60 2598@item -Wextra
cd3bb277 2599@opindex W
65ca2d60
PE
2600@opindex Wextra
2601(This option used to be called @option{-W}. The older name is still
2602supported, but the newer name is more descriptive.) Print extra warning
2603messages for these events:
74291a4b
MM
2604
2605@itemize @bullet
74291a4b
MM
2606@item
2607A function can return either with or without a value. (Falling
2608off the end of the function body is considered returning without
2609a value.) For example, this function would evoke such a
2610warning:
2611
2612@smallexample
2613@group
2614foo (a)
2615@{
2616 if (a > 0)
2617 return a;
2618@}
2619@end group
2620@end smallexample
2621
2622@item
2623An expression-statement or the left-hand side of a comma expression
2624contains no side effects.
2625To suppress the warning, cast the unused expression to void.
2626For example, an expression such as @samp{x[i,j]} will cause a warning,
2627but @samp{x[(void)i,j]} will not.
2628
2629@item
65ca2d60 2630An unsigned value is compared against zero with @samp{<} or @samp{>=}.
74291a4b 2631
74291a4b
MM
2632@item
2633Storage-class specifiers like @code{static} are not the first things in
2634a declaration. According to the C Standard, this usage is obsolescent.
2635
2636@item
630d3d5a 2637If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
74291a4b
MM
2638arguments.
2639
e9a25f70
JL
2640@item
2641A comparison between signed and unsigned values could produce an
2642incorrect result when the signed value is converted to unsigned.
630d3d5a 2643(But don't warn if @option{-Wno-sign-compare} is also specified.)
e9a25f70 2644
dbde0d5d
BH
2645@item
2646An aggregate has an initializer which does not initialize all members.
eaac4679
RS
2647This warning can be independently controlled by
2648@option{-Wmissing-field-initializers}.
65ca2d60
PE
2649
2650@item
2651A function parameter is declared without a type specifier in K&R-style
2652functions:
2653
2654@smallexample
2655void foo(bar) @{ @}
2656@end smallexample
2657
2658@item
2659An empty body occurs in an @samp{if} or @samp{else} statement.
2660
2661@item
2662A pointer is compared against integer zero with @samp{<}, @samp{<=},
2663@samp{>}, or @samp{>=}.
2664
2665@item
2666A variable might be changed by @samp{longjmp} or @samp{vfork}.
2667
2668@item
2669Any of several floating-point events that often indicate errors, such as
2670overflow, underflow, loss of precision, etc.
2671
2672@item @r{(C++ only)}
2673An enumerator and a non-enumerator both appear in a conditional expression.
2674
2675@item @r{(C++ only)}
2676A non-static reference or non-static @samp{const} member appears in a
2677class without constructors.
2678
2679@item @r{(C++ only)}
2680Ambiguous virtual bases.
2681
2682@item @r{(C++ only)}
2683Subscripting an array which has been declared @samp{register}.
2684
2685@item @r{(C++ only)}
2686Taking the address of a variable which has been declared @samp{register}.
2687
2688@item @r{(C++ only)}
62b9c42c 2689A base class is not initialized in a derived class' copy constructor.
74291a4b
MM
2690@end itemize
2691
75227a33
GK
2692@item -Wno-div-by-zero
2693@opindex Wno-div-by-zero
2694@opindex Wdiv-by-zero
2695Do not warn about compile-time integer division by zero. Floating point
2696division by zero is not warned about, as it can be a legitimate way of
2697obtaining infinities and NaNs.
2698
2699@item -Wsystem-headers
2700@opindex Wsystem-headers
2701@cindex warnings from system headers
2702@cindex system headers, warnings from
2703Print warning messages for constructs found in system header files.
2704Warnings from system headers are normally suppressed, on the assumption
2705that they usually do not indicate real problems and would only make the
2706compiler output harder to read. Using this command line option tells
2707GCC to emit warnings from system headers as if they occurred in user
2708code. However, note that using @option{-Wall} in conjunction with this
2709option will @emph{not} warn about unknown pragmas in system
2710headers---for that, @option{-Wunknown-pragmas} must also be used.
2711
f793a95e 2712@item -Wfloat-equal
cd3bb277 2713@opindex Wfloat-equal
f793a95e
JL
2714Warn if floating point values are used in equality comparisons.
2715
488d3985
GK
2716The idea behind this is that sometimes it is convenient (for the
2717programmer) to consider floating-point values as approximations to
2718infinitely precise real numbers. If you are doing this, then you need
c0478a66 2719to compute (by analyzing the code, or in some other way) the maximum or
488d3985
GK
2720likely maximum error that the computation introduces, and allow for it
2721when performing comparisons (and when producing output, but that's a
2722different problem). In particular, instead of testing for equality, you
2723would check to see whether the two values have ranges that overlap; and
2724this is done with the relational operators, so equality comparisons are
2725probably mistaken.
2726
aee96fe9 2727@item -Wtraditional @r{(C only)}
cd3bb277 2728@opindex Wtraditional
74291a4b 2729Warn about certain constructs that behave differently in traditional and
161d7b59 2730ISO C@. Also warn about ISO C constructs that have no traditional C
c8abc684 2731equivalent, and/or problematic constructs which should be avoided.
74291a4b
MM
2732
2733@itemize @bullet
2734@item
da312b55
NB
2735Macro parameters that appear within string literals in the macro body.
2736In traditional C macro replacement takes place within string literals,
161d7b59 2737but does not in ISO C@.
da312b55
NB
2738
2739@item
2740In traditional C, some preprocessor directives did not exist.
2741Traditional preprocessors would only consider a line to be a directive
2742if the @samp{#} appeared in column 1 on the line. Therefore
630d3d5a 2743@option{-Wtraditional} warns about directives that traditional C
da312b55
NB
2744understands but would ignore because the @samp{#} does not appear as the
2745first character on the line. It also suggests you hide directives like
2746@samp{#pragma} not understood by traditional C by indenting them. Some
c21cd8b1 2747traditional implementations would not recognize @samp{#elif}, so it
da312b55
NB
2748suggests avoiding it altogether.
2749
2750@item
2751A function-like macro that appears without arguments.
2752
2753@item
2754The unary plus operator.
2755
2756@item
c771326b
JM
2757The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2758constant suffixes. (Traditional C does support the @samp{L} suffix on integer
da312b55 2759constants.) Note, these suffixes appear in macros defined in the system
e979f9e8 2760headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
c8abc684 2761Use of these macros in user code might normally lead to spurious
2dd76960 2762warnings, however GCC's integrated preprocessor has enough context to
c8abc684 2763avoid warning in these cases.
74291a4b
MM
2764
2765@item
2766A function declared external in one block and then used after the end of
2767the block.
2768
2769@item
2770A @code{switch} statement has an operand of type @code{long}.
db838bb8
KG
2771
2772@item
2773A non-@code{static} function declaration follows a @code{static} one.
2774This construct is not accepted by some traditional C compilers.
48776cde
KG
2775
2776@item
c1030c7c 2777The ISO type of an integer constant has a different width or
48776cde 2778signedness from its traditional type. This warning is only issued if
e979f9e8 2779the base of the constant is ten. I.e.@: hexadecimal or octal values, which
48776cde 2780typically represent bit patterns, are not warned about.
bb66adca
KG
2781
2782@item
c1030c7c 2783Usage of ISO string concatenation is detected.
7f094a94 2784
895ea614
KG
2785@item
2786Initialization of automatic aggregates.
2787
2788@item
2789Identifier conflicts with labels. Traditional C lacks a separate
2790namespace for labels.
253b6b82
KG
2791
2792@item
2793Initialization of unions. If the initializer is zero, the warning is
2794omitted. This is done under the assumption that the zero initializer in
e979f9e8 2795user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
253b6b82
KG
2796initializer warnings and relies on default initialization to zero in the
2797traditional C case.
03829ad2
KG
2798
2799@item
3ed56f8a
KG
2800Conversions by prototypes between fixed/floating point values and vice
2801versa. The absence of these prototypes when compiling with traditional
2802C would cause serious problems. This is a subset of the possible
630d3d5a 2803conversion warnings, for the full set use @option{-Wconversion}.
622d3731
KG
2804
2805@item
2806Use of ISO C style function definitions. This warning intentionally is
2807@emph{not} issued for prototype declarations or variadic functions
2808because these ISO C features will appear in your code when using
2809libiberty's traditional C compatibility macros, @code{PARAMS} and
2810@code{VPARAMS}. This warning is also bypassed for nested functions
2dd76960 2811because that feature is already a GCC extension and thus not relevant to
622d3731 2812traditional C compatibility.
74291a4b
MM
2813@end itemize
2814
85617eba
HPN
2815@item -Wdeclaration-after-statement @r{(C only)}
2816@opindex Wdeclaration-after-statement
2817Warn when a declaration is found after a statement in a block. This
2818construct, known from C++, was introduced with ISO C99 and is by default
2819allowed in GCC@. It is not supported by ISO C90 and was not supported by
2820GCC versions before GCC 3.0. @xref{Mixed Declarations}.
2821
861bb6c1 2822@item -Wundef
cd3bb277 2823@opindex Wundef
861bb6c1
JL
2824Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2825
909de5da
PE
2826@item -Wendif-labels
2827@opindex Wendif-labels
2828Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2829
74291a4b 2830@item -Wshadow
cd3bb277 2831@opindex Wshadow
d773df5a
DB
2832Warn whenever a local variable shadows another local variable, parameter or
2833global variable or whenever a built-in function is shadowed.
74291a4b 2834
74291a4b 2835@item -Wlarger-than-@var{len}
cd3bb277 2836@opindex Wlarger-than
74291a4b
MM
2837Warn whenever an object of larger than @var{len} bytes is defined.
2838
2839@item -Wpointer-arith
cd3bb277 2840@opindex Wpointer-arith
74291a4b
MM
2841Warn about anything that depends on the ``size of'' a function type or
2842of @code{void}. GNU C assigns these types a size of 1, for
2843convenience in calculations with @code{void *} pointers and pointers
2844to functions.
2845
aee96fe9 2846@item -Wbad-function-cast @r{(C only)}
cd3bb277 2847@opindex Wbad-function-cast
74291a4b
MM
2848Warn whenever a function call is cast to a non-matching type.
2849For example, warn if @code{int malloc()} is cast to @code{anything *}.
2850
2851@item -Wcast-qual
cd3bb277 2852@opindex Wcast-qual
74291a4b
MM
2853Warn whenever a pointer is cast so as to remove a type qualifier from
2854the target type. For example, warn if a @code{const char *} is cast
2855to an ordinary @code{char *}.
2856
2857@item -Wcast-align
cd3bb277 2858@opindex Wcast-align
74291a4b
MM
2859Warn whenever a pointer is cast such that the required alignment of the
2860target is increased. For example, warn if a @code{char *} is cast to
2861an @code{int *} on machines where integers can only be accessed at
2862two- or four-byte boundaries.
2863
2864@item -Wwrite-strings
cd3bb277 2865@opindex Wwrite-strings
aee96fe9
JM
2866When compiling C, give string constants the type @code{const
2867char[@var{length}]} so that
74291a4b 2868copying the address of one into a non-@code{const} @code{char *}
aee96fe9
JM
2869pointer will get a warning; when compiling C++, warn about the
2870deprecated conversion from string constants to @code{char *}.
2871These warnings will help you find at
74291a4b
MM
2872compile time code that can try to write into a string constant, but
2873only if you have been very careful about using @code{const} in
2874declarations and prototypes. Otherwise, it will just be a nuisance;
630d3d5a 2875this is why we did not make @option{-Wall} request these warnings.
74291a4b
MM
2876
2877@item -Wconversion
cd3bb277 2878@opindex Wconversion
74291a4b
MM
2879Warn if a prototype causes a type conversion that is different from what
2880would happen to the same argument in the absence of a prototype. This
2881includes conversions of fixed point to floating and vice versa, and
2882conversions changing the width or signedness of a fixed point argument
2883except when the same as the default promotion.
2884
2885Also, warn if a negative integer constant expression is implicitly
2886converted to an unsigned type. For example, warn about the assignment
2887@code{x = -1} if @code{x} is unsigned. But do not warn about explicit
2888casts like @code{(unsigned) -1}.
2889
e9a25f70 2890@item -Wsign-compare
cd3bb277 2891@opindex Wsign-compare
e9a25f70
JL
2892@cindex warning for comparison of signed and unsigned values
2893@cindex comparison of signed and unsigned values, warning
2894@cindex signed and unsigned values, comparison warning
2895Warn when a comparison between signed and unsigned values could produce
2896an incorrect result when the signed value is converted to unsigned.
65ca2d60
PE
2897This warning is also enabled by @option{-Wextra}; to get the other warnings
2898of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
e9a25f70 2899
74291a4b 2900@item -Waggregate-return
cd3bb277 2901@opindex Waggregate-return
74291a4b
MM
2902Warn if any functions that return structures or unions are defined or
2903called. (In languages where you can return an array, this also elicits
2904a warning.)
2905
aee96fe9 2906@item -Wstrict-prototypes @r{(C only)}
cd3bb277 2907@opindex Wstrict-prototypes
74291a4b
MM
2908Warn if a function is declared or defined without specifying the
2909argument types. (An old-style function definition is permitted without
2910a warning if preceded by a declaration which specifies the argument
2911types.)
2912
c034f121
AJ
2913@item -Wold-style-definition @r{(C only)}
2914@opindex Wold-style-definition
2915Warn if an old-style function definition is used. A warning is given
2916even if there is a previous prototype.
2917
aee96fe9 2918@item -Wmissing-prototypes @r{(C only)}
cd3bb277 2919@opindex Wmissing-prototypes
74291a4b
MM
2920Warn if a global function is defined without a previous prototype
2921declaration. This warning is issued even if the definition itself
2922provides a prototype. The aim is to detect global functions that fail
2923to be declared in header files.
2924
da635858 2925@item -Wmissing-declarations @r{(C only)}
cd3bb277 2926@opindex Wmissing-declarations
74291a4b
MM
2927Warn if a global function is defined without a previous declaration.
2928Do so even if the definition itself provides a prototype.
2929Use this option to detect global functions that are not declared in
2930header files.
2931
eaac4679
RS
2932@item -Wmissing-field-initializers
2933@opindex Wmissing-field-initializers
2934@opindex W
2935@opindex Wextra
2936Warn if a structure's initializer has some fields missing. For
2937example, the following code would cause such a warning, because
2938@code{x.h} is implicitly zero:
2939
2940@smallexample
2941struct s @{ int f, g, h; @};
2942struct s x = @{ 3, 4 @};
2943@end smallexample
2944
2945This option does not warn about designated initializers, so the following
2946modification would not trigger a warning:
2947
2948@smallexample
2949struct s @{ int f, g, h; @};
2950struct s x = @{ .f = 3, .g = 4 @};
2951@end smallexample
2952
2953This warning is included in @option{-Wextra}. To get other @option{-Wextra}
2954warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
2955
0ca3fb0a 2956@item -Wmissing-noreturn
cd3bb277 2957@opindex Wmissing-noreturn
0ca3fb0a
KG
2958Warn about functions which might be candidates for attribute @code{noreturn}.
2959Note these are only possible candidates, not absolute ones. Care should
2960be taken to manually verify functions actually do not ever return before
2961adding the @code{noreturn} attribute, otherwise subtle code generation
21c7361e
AJ
2962bugs could be introduced. You will not get a warning for @code{main} in
2963hosted C environments.
0ca3fb0a 2964
74ff4629 2965@item -Wmissing-format-attribute
cd3bb277
JM
2966@opindex Wmissing-format-attribute
2967@opindex Wformat
630d3d5a 2968If @option{-Wformat} is enabled, also warn about functions which might be
74ff4629
JM
2969candidates for @code{format} attributes. Note these are only possible
2970candidates, not absolute ones. GCC will guess that @code{format}
2971attributes might be appropriate for any function that calls a function
2972like @code{vprintf} or @code{vscanf}, but this might not always be the
2973case, and some functions for which @code{format} attributes are
2974appropriate may not be detected. This option has no effect unless
630d3d5a 2975@option{-Wformat} is enabled (possibly by @option{-Wall}).
74ff4629 2976
75227a33
GK
2977@item -Wno-multichar
2978@opindex Wno-multichar
2979@opindex Wmultichar
2980Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2981Usually they indicate a typo in the user's code, as they have
2982implementation-defined values, and should not be used in portable code.
2983
e23bd218
IR
2984@item -Wno-deprecated-declarations
2985@opindex Wno-deprecated-declarations
2986Do not warn about uses of functions, variables, and types marked as
f282ffb3 2987deprecated by using the @code{deprecated} attribute.
e23bd218
IR
2988(@pxref{Function Attributes}, @pxref{Variable Attributes},
2989@pxref{Type Attributes}.)
2990
3c12fcc2 2991@item -Wpacked
cd3bb277 2992@opindex Wpacked
3c12fcc2 2993Warn if a structure is given the packed attribute, but the packed
02f52e19 2994attribute has no effect on the layout or size of the structure.
3c12fcc2
GM
2995Such structures may be mis-aligned for little benefit. For
2996instance, in this code, the variable @code{f.x} in @code{struct bar}
2997will be misaligned even though @code{struct bar} does not itself
2998have the packed attribute:
2999
3000@smallexample
3001@group
3002struct foo @{
3003 int x;
3004 char a, b, c, d;
3005@} __attribute__((packed));
3006struct bar @{
3007 char z;
3008 struct foo f;
3009@};
3010@end group
3011@end smallexample
3012
3013@item -Wpadded
cd3bb277 3014@opindex Wpadded
3c12fcc2
GM
3015Warn if padding is included in a structure, either to align an element
3016of the structure or to align the whole structure. Sometimes when this
3017happens it is possible to rearrange the fields of the structure to
3018reduce the padding and so make the structure smaller.
3019
74291a4b 3020@item -Wredundant-decls
cd3bb277 3021@opindex Wredundant-decls
74291a4b
MM
3022Warn if anything is declared more than once in the same scope, even in
3023cases where multiple declaration is valid and changes nothing.
3024
aee96fe9 3025@item -Wnested-externs @r{(C only)}
cd3bb277 3026@opindex Wnested-externs
252215a7 3027Warn if an @code{extern} declaration is encountered within a function.
74291a4b 3028
312f6255 3029@item -Wunreachable-code
cd3bb277 3030@opindex Wunreachable-code
312f6255
GK
3031Warn if the compiler detects that code will never be executed.
3032
3033This option is intended to warn when the compiler detects that at
3034least a whole line of source code will never be executed, because
3035some condition is never satisfied or because it is after a
3036procedure that never returns.
3037
3038It is possible for this option to produce a warning even though there
3039are circumstances under which part of the affected line can be executed,
3040so care should be taken when removing apparently-unreachable code.
3041
3042For instance, when a function is inlined, a warning may mean that the
02f52e19 3043line is unreachable in only one inlined copy of the function.
312f6255 3044
630d3d5a 3045This option is not made part of @option{-Wall} because in a debugging
312f6255
GK
3046version of a program there is often substantial code which checks
3047correct functioning of the program and is, hopefully, unreachable
3048because the program does work. Another common use of unreachable
c21cd8b1 3049code is to provide behavior which is selectable at compile-time.
312f6255 3050
74291a4b 3051@item -Winline
cd3bb277 3052@opindex Winline
c5c76735 3053Warn if a function can not be inlined and it was declared as inline.
ae4a7155 3054Even with this option, the compiler will not warn about failures to
daf2f129 3055inline functions declared in system headers.
ae4a7155
MM
3056
3057The compiler uses a variety of heuristics to determine whether or not
3058to inline a function. For example, the compiler takes into account
3059the size of the function being inlined and the the amount of inlining
3060that has already been done in the current function. Therefore,
3061seemingly insignificant changes in the source program can cause the
3062warnings produced by @option{-Winline} to appear or disappear.
74291a4b 3063
a01fff59
MA
3064@item -Wno-invalid-offsetof @r{(C++ only)}
3065@opindex Wno-invalid-offsetof
3066Suppress warnings from applying the @samp{offsetof} macro to a non-POD
3067type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
3068to a non-POD type is undefined. In existing C++ implementations,
3069however, @samp{offsetof} typically gives meaningful results even when
3070applied to certain kinds of non-POD types. (Such as a simple
3071@samp{struct} that fails to be a POD type only by virtue of having a
3072constructor.) This flag is for users who are aware that they are
3073writing nonportable code and who have deliberately chosen to ignore the
3074warning about it.
3075
3076The restrictions on @samp{offsetof} may be relaxed in a future version
3077of the C++ standard.
3078
17211ab5
GK
3079@item -Winvalid-pch
3080@opindex Winvalid-pch
3081Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
3082the search path but can't be used.
3083
795add94 3084@item -Wlong-long
cd3bb277
JM
3085@opindex Wlong-long
3086@opindex Wno-long-long
795add94 3087Warn if @samp{long long} type is used. This is default. To inhibit
630d3d5a
JM
3088the warning messages, use @option{-Wno-long-long}. Flags
3089@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
3090only when @option{-pedantic} flag is used.
795add94 3091
7c4d376d
RH
3092@item -Wvariadic-macros
3093@opindex Wvariadic-macros
3094@opindex Wno-variadic-macros
3095Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
3096alternate syntax when in pedantic ISO C99 mode. This is default.
3097To inhibit the warning messages, use @option{-Wno-variadic-macros}.
3098
18424ae1 3099@item -Wdisabled-optimization
cd3bb277 3100@opindex Wdisabled-optimization
18424ae1
BL
3101Warn if a requested optimization pass is disabled. This warning does
3102not generally indicate that there is anything wrong with your code; it
3103merely indicates that GCC's optimizers were unable to handle the code
3104effectively. Often, the problem is that your code is too big or too
3105complex; GCC will refuse to optimize programs when the optimization
3106itself is likely to take inordinate amounts of time.
3107
74291a4b 3108@item -Werror
cd3bb277 3109@opindex Werror
74291a4b
MM
3110Make all warnings into errors.
3111@end table
3112
3113@node Debugging Options
0c2d1a2a 3114@section Options for Debugging Your Program or GCC
74291a4b
MM
3115@cindex options, debugging
3116@cindex debugging information options
3117
0c2d1a2a 3118GCC has various special options that are used for debugging
74291a4b
MM
3119either your program or GCC:
3120
2642624b 3121@table @gcctabopt
74291a4b 3122@item -g
cd3bb277 3123@opindex g
74291a4b 3124Produce debugging information in the operating system's native format
f8ca7e49 3125(stabs, COFF, XCOFF, or DWARF 2)@. GDB can work with this debugging
74291a4b
MM
3126information.
3127
630d3d5a 3128On most systems that use stabs format, @option{-g} enables use of extra
74291a4b
MM
3129debugging information that only GDB can use; this extra information
3130makes debugging work better in GDB but will probably make other debuggers
3131crash or
3132refuse to read the program. If you want to control for certain whether
630d3d5a 3133to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
def66b10 3134@option{-gxcoff+}, @option{-gxcoff}, or @option{-gvms} (see below).
74291a4b 3135
f8ca7e49 3136GCC allows you to use @option{-g} with
630d3d5a 3137@option{-O}. The shortcuts taken by optimized code may occasionally
74291a4b
MM
3138produce surprising results: some variables you declared may not exist
3139at all; flow of control may briefly move where you did not expect it;
3140some statements may not be executed because they compute constant
3141results or their values were already at hand; some statements may
3142execute in different places because they were moved out of loops.
3143
3144Nevertheless it proves possible to debug optimized output. This makes
3145it reasonable to use the optimizer for programs that might have bugs.
3146
0c2d1a2a 3147The following options are useful when GCC is generated with the
74291a4b
MM
3148capability for more than one debugging format.
3149
3150@item -ggdb
cd3bb277 3151@opindex ggdb
161d7b59 3152Produce debugging information for use by GDB@. This means to use the
861bb6c1
JL
3153most expressive format available (DWARF 2, stabs, or the native format
3154if neither of those are supported), including GDB extensions if at all
3155possible.
74291a4b
MM
3156
3157@item -gstabs
cd3bb277 3158@opindex gstabs
74291a4b
MM
3159Produce debugging information in stabs format (if that is supported),
3160without GDB extensions. This is the format used by DBX on most BSD
3161systems. On MIPS, Alpha and System V Release 4 systems this option
161d7b59 3162produces stabs debugging output which is not understood by DBX or SDB@.
74291a4b
MM
3163On System V Release 4 systems this option requires the GNU assembler.
3164
6a08f7b3
DP
3165@item -feliminate-unused-debug-symbols
3166@opindex feliminate-unused-debug-symbols
3167Produce debugging information in stabs format (if that is supported),
c0cbdbd9 3168for only symbols that are actually used.
6a08f7b3 3169
74291a4b 3170@item -gstabs+
cd3bb277 3171@opindex gstabs+
74291a4b 3172Produce debugging information in stabs format (if that is supported),
161d7b59 3173using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
3174use of these extensions is likely to make other debuggers crash or
3175refuse to read the program.
3176
3177@item -gcoff
cd3bb277 3178@opindex gcoff
74291a4b
MM
3179Produce debugging information in COFF format (if that is supported).
3180This is the format used by SDB on most System V systems prior to
3181System V Release 4.
3182
3183@item -gxcoff
cd3bb277 3184@opindex gxcoff
74291a4b
MM
3185Produce debugging information in XCOFF format (if that is supported).
3186This is the format used by the DBX debugger on IBM RS/6000 systems.
3187
3188@item -gxcoff+
cd3bb277 3189@opindex gxcoff+
74291a4b 3190Produce debugging information in XCOFF format (if that is supported),
161d7b59 3191using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
3192use of these extensions is likely to make other debuggers crash or
3193refuse to read the program, and may cause assemblers other than the GNU
3194assembler (GAS) to fail with an error.
3195
861bb6c1 3196@item -gdwarf-2
cd3bb277 3197@opindex gdwarf-2
861bb6c1 3198Produce debugging information in DWARF version 2 format (if that is
f8ca7e49
ZW
3199supported). This is the format used by DBX on IRIX 6. With this
3200option, GCC uses features of DWARF version 3 when they are useful;
3201version 3 is upward compatible with version 2, but may still cause
3202problems for older debuggers.
74291a4b 3203
5f98259a
RK
3204@item -gvms
3205@opindex gvms
3206Produce debugging information in VMS debug format (if that is
3207supported). This is the format used by DEBUG on VMS systems.
3208
74291a4b
MM
3209@item -g@var{level}
3210@itemx -ggdb@var{level}
3211@itemx -gstabs@var{level}
3212@itemx -gcoff@var{level}
3213@itemx -gxcoff@var{level}
5f98259a 3214@itemx -gvms@var{level}
74291a4b
MM
3215Request debugging information and also use @var{level} to specify how
3216much information. The default level is 2.
3217
3218Level 1 produces minimal information, enough for making backtraces in
3219parts of the program that you don't plan to debug. This includes
3220descriptions of functions and external variables, but no information
3221about local variables and no line numbers.
3222
3223Level 3 includes extra information, such as all the macro definitions
3224present in the program. Some debuggers support macro expansion when
630d3d5a 3225you use @option{-g3}.
74291a4b 3226
f8ca7e49
ZW
3227@option{-gdwarf-2} does not accept a concatenated debug level, because
3228GCC used to support an option @option{-gdwarf} that meant to generate
3229debug information in version 1 of the DWARF format (which is very
3230different from version 2), and it would have been too confusing. That
3231debug format is long obsolete, but the option cannot be changed now.
3232Instead use an additional @option{-g@var{level}} option to change the
3233debug level for DWARF2.
eb7715a4 3234
e03b7153
RS
3235@item -feliminate-dwarf2-dups
3236@opindex feliminate-dwarf2-dups
3237Compress DWARF2 debugging information by eliminating duplicated
3238information about each symbol. This option only makes sense when
3239generating DWARF2 debugging information with @option{-gdwarf-2}.
3240
05739753 3241@cindex @command{prof}
74291a4b 3242@item -p
cd3bb277 3243@opindex p
74291a4b 3244Generate extra code to write profile information suitable for the
05739753 3245analysis program @command{prof}. You must use this option when compiling
74291a4b
MM
3246the source files you want data about, and you must also use it when
3247linking.
3248
05739753 3249@cindex @command{gprof}
74291a4b 3250@item -pg
cd3bb277 3251@opindex pg
74291a4b 3252Generate extra code to write profile information suitable for the
05739753 3253analysis program @command{gprof}. You must use this option when compiling
74291a4b
MM
3254the source files you want data about, and you must also use it when
3255linking.
3256
898f531b 3257@item -Q
cd3bb277 3258@opindex Q
898f531b
JL
3259Makes the compiler print out each function name as it is compiled, and
3260print some statistics about each pass when it finishes.
3261
1f0c3120 3262@item -ftime-report
cd3bb277 3263@opindex ftime-report
1f0c3120
JM
3264Makes the compiler print some statistics about the time consumed by each
3265pass when it finishes.
3266
3267@item -fmem-report
cd3bb277 3268@opindex fmem-report
1f0c3120
JM
3269Makes the compiler print some statistics about permanent memory
3270allocation when it finishes.
3271
861bb6c1 3272@item -fprofile-arcs
cd3bb277 3273@opindex fprofile-arcs
23af32e6
NS
3274Add code so that program flow @dfn{arcs} are instrumented. During
3275execution the program records how many times each branch and call is
3276executed and how many times it is taken or returns. When the compiled
3277program exits it saves this data to a file called
a4878735 3278@file{@var{auxname}.gcda} for each source file. The data may be used for
23af32e6
NS
3279profile-directed optimizations (@option{-fbranch-probabilities}), or for
3280test coverage analysis (@option{-ftest-coverage}). Each object file's
3281@var{auxname} is generated from the name of the output file, if
3282explicitly specified and it is not the final executable, otherwise it is
3283the basename of the source file. In both cases any suffix is removed
a4878735
NS
3284(e.g. @file{foo.gcda} for input file @file{dir/foo.c}, or
3285@file{dir/foo.gcda} for output file specified as @option{-o dir/foo.o}).
23af32e6
NS
3286
3287@itemize
3288
3289@item
3290Compile the source files with @option{-fprofile-arcs} plus optimization
3291and code generation options. For test coverage analysis, use the
3292additional @option{-ftest-coverage} option. You do not need to profile
3293every source file in a program.
3294
3295@item
8555daff
NS
3296Link your object files with @option{-lgcov} or @option{-fprofile-arcs}
3297(the latter implies the former).
23af32e6
NS
3298
3299@item
3300Run the program on a representative workload to generate the arc profile
8555daff
NS
3301information. This may be repeated any number of times. You can run
3302concurrent instances of your program, and provided that the file system
3303supports locking, the data files will be correctly updated. Also
3304@code{fork} calls are detected and correctly handled (double counting
3305will not happen).
23af32e6
NS
3306
3307@item
3308For profile-directed optimizations, compile the source files again with
3309the same optimization and code generation options plus
630d3d5a 3310@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3de87bf2
JJ
3311Control Optimization}).
3312
23af32e6
NS
3313@item
3314For test coverage analysis, use @command{gcov} to produce human readable
a4878735 3315information from the @file{.gcno} and @file{.gcda} files. Refer to the
23af32e6
NS
3316@command{gcov} documentation for further information.
3317
3318@end itemize
3de87bf2
JJ
3319
3320With @option{-fprofile-arcs}, for each function of your program GCC
3321creates a program flow graph, then finds a spanning tree for the graph.
3322Only arcs that are not on the spanning tree have to be instrumented: the
3323compiler adds code to count the number of times that these arcs are
3324executed. When an arc is the only exit or only entrance to a block, the
3325instrumentation code can be added to the block; otherwise, a new basic
3326block must be created to hold the instrumentation code.
3327
6de9cd9a
DN
3328@item -ftree-based-profiling
3329@opindex ftree-based-profiling
3330This option is used in addition to @option{-fprofile-arcs} or
3331@option{-fbranch-probabilities} to control whether those optimizations
3332are performed on a tree-based or rtl-based internal representation.
3333If you use this option when compiling with @option{-fprofile-arcs},
3334you must also use it when compiling later with @option{-fbranch-probabilities}.
3335Currently the tree-based optimization is in an early stage of
3336development, and this option is recommended only for those people
3337working on improving it.
3338
861bb6c1
JL
3339@need 2000
3340@item -ftest-coverage
cd3bb277 3341@opindex ftest-coverage
a4878735 3342Produce a notes file that the @command{gcov} code-coverage utility
23af32e6 3343(@pxref{Gcov,, @command{gcov}---a Test Coverage Program}) can use to
a4878735
NS
3344show program coverage. Each source file's note file is called
3345@file{@var{auxname}.gcno}. Refer to the @option{-fprofile-arcs} option
23af32e6
NS
3346above for a description of @var{auxname} and instructions on how to
3347generate test coverage data. Coverage data will match the source files
3348more closely, if you do not optimize.
3de87bf2 3349
74291a4b 3350@item -d@var{letters}
cd3bb277 3351@opindex d
74291a4b
MM
3352Says to make debugging dumps during compilation at times specified by
3353@var{letters}. This is used for debugging the compiler. The file names
375e2d5c 3354for most of the dumps are made by appending a pass number and a word to
ea67fe71
NS
3355the @var{dumpname}. @var{dumpname} is generated from the name of the
3356output file, if explicitly specified and it is not an executable,
3357otherwise it is the basename of the source file. In both cases any
98edbb7a 3358suffix is removed (e.g. @file{foo.01.rtl} or @file{foo.02.sibling}).
ea67fe71
NS
3359Here are the possible letters for use in @var{letters}, and their
3360meanings:
74291a4b
MM
3361
3362@table @samp
375e2d5c 3363@item A
cd3bb277 3364@opindex dA
375e2d5c 3365Annotate the assembler output with miscellaneous debugging information.
956d6950 3366@item b
cd3bb277 3367@opindex db
98edbb7a 3368Dump after computing branch probabilities, to @file{@var{file}.12.bp}.
48d9ade5 3369@item B
cd3bb277 3370@opindex dB
e5626198 3371Dump after block reordering, to @file{@var{file}.32.bbro}.
032713aa 3372@item c
cd3bb277 3373@opindex dc
98edbb7a 3374Dump after instruction combination, to the file @file{@var{file}.20.combine}.
470fc13d 3375@item C
cd3bb277 3376@opindex dC
98edbb7a
KH
3377Dump after the first if conversion, to the file @file{@var{file}.14.ce1}.
3378Also dump after the second if conversion, to the file @file{@var{file}.21.ce2}.
032713aa 3379@item d
cd3bb277 3380@opindex dd
e5626198
AZ
3381Dump after branch target load optimization, to to @file{@var{file}.33.btl}.
3382Also dump after delayed branch scheduling, to @file{@var{file}.37.dbr}.
032713aa 3383@item D
cd3bb277 3384@opindex dD
f5963e61
JL
3385Dump all macro definitions, at the end of preprocessing, in addition to
3386normal output.
470fc13d 3387@item E
cd3bb277 3388@opindex dE
e5626198 3389Dump after the third if conversion, to @file{@var{file}.31.ce3}.
74291a4b 3390@item f
cd3bb277 3391@opindex df
98edbb7a
KH
3392Dump after control and data flow analysis, to @file{@var{file}.11.cfg}.
3393Also dump after life analysis, to @file{@var{file}.19.life}.
74291a4b 3394@item g
cd3bb277 3395@opindex dg
e5626198 3396Dump after global register allocation, to @file{@var{file}.26.greg}.
02f52e19 3397@item G
cd3bb277 3398@opindex dG
98edbb7a 3399Dump after GCSE, to @file{@var{file}.08.gcse}.
34695841 3400Also dump after jump bypassing and control flow optimizations, to
98edbb7a 3401@file{@var{file}.10.bypass}.
7fedea11
KH
3402@item h
3403@opindex dh
a194aa56 3404Dump after finalization of EH handling code, to @file{@var{file}.03.eh}.
48d9ade5 3405@item i
cd3bb277 3406@opindex di
a194aa56 3407Dump after sibling call optimizations, to @file{@var{file}.02.sibling}.
032713aa 3408@item j
cd3bb277 3409@opindex dj
a194aa56 3410Dump after the first jump optimization, to @file{@var{file}.04.jump}.
74291a4b 3411@item k
cd3bb277 3412@opindex dk
e5626198 3413Dump after conversion from registers to stack, to @file{@var{file}.35.stack}.
032713aa 3414@item l
cd3bb277 3415@opindex dl
e5626198 3416Dump after local register allocation, to @file{@var{file}.25.lreg}.
032713aa 3417@item L
cd3bb277 3418@opindex dL
98edbb7a
KH
3419Dump after loop optimization passes, to @file{@var{file}.09.loop} and
3420@file{@var{file}.16.loop2}.
e5626198
AZ
3421@item m
3422@opindex dm
f26c1794 3423Dump after modulo scheduling, to @file{@var{file}.23.sms}.
032713aa 3424@item M
cd3bb277 3425@opindex dM
c0478a66 3426Dump after performing the machine dependent reorganization pass, to
e5626198 3427@file{@var{file}.36.mach}.
48d9ade5 3428@item n
cd3bb277 3429@opindex dn
e5626198 3430Dump after register renumbering, to @file{@var{file}.30.rnreg}.
032713aa 3431@item N
cd3bb277 3432@opindex dN
98edbb7a 3433Dump after the register move pass, to @file{@var{file}.22.regmove}.
7fedea11
KH
3434@item o
3435@opindex do
e5626198 3436Dump after post-reload optimizations, to @file{@var{file}.27.postreload}.
032713aa 3437@item r
cd3bb277 3438@opindex dr
a194aa56 3439Dump after RTL generation, to @file{@var{file}.01.rtl}.
032713aa 3440@item R
cd3bb277 3441@opindex dR
e5626198 3442Dump after the second scheduling pass, to @file{@var{file}.34.sched2}.
032713aa 3443@item s
cd3bb277 3444@opindex ds
032713aa 3445Dump after CSE (including the jump optimization that sometimes follows
98edbb7a 3446CSE), to @file{@var{file}.06.cse}.
032713aa 3447@item S
cd3bb277 3448@opindex dS
e5626198 3449Dump after the first scheduling pass, to @file{@var{file}.24.sched}.
032713aa 3450@item t
cd3bb277 3451@opindex dt
032713aa 3452Dump after the second CSE pass (including the jump optimization that
98edbb7a 3453sometimes follows CSE), to @file{@var{file}.18.cse2}.
4319ef2a
KH
3454@item T
3455@opindex dT
98edbb7a 3456Dump after running tracer, to @file{@var{file}.15.tracer}.
38c1593d
JH
3457@item u
3458@opindex du
98edbb7a 3459Dump after null pointer elimination pass to @file{@var{file}.05.null}.
a194aa56
JH
3460@item U
3461@opindex dU
3462Dump callgraph and unit-at-a-time optimization @file{@var{file}.00.unit}.
9313cfdd
KH
3463@item V
3464@opindex dV
3465Dump after the value profile transformations, to @file{@var{file}.13.vpt}.
014a1138 3466Also dump after variable tracking, to @file{@var{file}.35.vartrack}.
c80e4c17 3467@item w
cd3bb277 3468@opindex dw
e5626198 3469Dump after the second flow pass, to @file{@var{file}.28.flow2}.
48d9ade5 3470@item z
cd3bb277 3471@opindex dz
e5626198 3472Dump after the peephole pass, to @file{@var{file}.29.peephole2}.
9313cfdd
KH
3473@item Z
3474@opindex dZ
3475Dump after constructing the web, to @file{@var{file}.17.web}.
74291a4b 3476@item a
cd3bb277 3477@opindex da
74291a4b 3478Produce all the dumps listed above.
886e0865
GK
3479@item H
3480@opindex dH
3481Produce a core dump whenever an error occurs.
74291a4b 3482@item m
cd3bb277 3483@opindex dm
74291a4b
MM
3484Print statistics on memory usage, at the end of the run, to
3485standard error.
3486@item p
cd3bb277 3487@opindex dp
74291a4b 3488Annotate the assembler output with a comment indicating which
f20b5577
MM
3489pattern and alternative was used. The length of each instruction is
3490also printed.
2856c3e3 3491@item P
cd3bb277 3492@opindex dP
2856c3e3 3493Dump the RTL in the assembler output as a comment before each instruction.
630d3d5a 3494Also turns on @option{-dp} annotation.
375e2d5c 3495@item v
cd3bb277 3496@opindex dv
375e2d5c 3497For each of the other indicated dump files (except for
a194aa56 3498@file{@var{file}.01.rtl}), dump a representation of the control flow graph
b192711e 3499suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
62a1403d 3500@item x
cd3bb277 3501@opindex dx
62a1403d
AS
3502Just generate RTL for a function instead of compiling it. Usually used
3503with @samp{r}.
032713aa 3504@item y
cd3bb277 3505@opindex dy
032713aa 3506Dump debugging information during parsing, to standard error.
74291a4b
MM
3507@end table
3508
b707b450 3509@item -fdump-unnumbered
cd3bb277 3510@opindex fdump-unnumbered
695ac33f 3511When doing debugging dumps (see @option{-d} option above), suppress instruction
b707b450 3512numbers and line number note output. This makes it more feasible to
b192711e 3513use diff on debugging dumps for compiler invocations with different
695ac33f 3514options, in particular with and without @option{-g}.
b707b450 3515
f70a54cb
CR
3516@item -fdump-translation-unit @r{(C and C++ only)}
3517@itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3518@opindex fdump-translation-unit
3519Dump a representation of the tree structure for the entire translation
3520unit to a file. The file name is made by appending @file{.tu} to the
3521source file name. If the @samp{-@var{options}} form is used, @var{options}
3522controls the details of the dump as described for the
3523@option{-fdump-tree} options.
3524
aee96fe9 3525@item -fdump-class-hierarchy @r{(C++ only)}
22367161 3526@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
cd3bb277 3527@opindex fdump-class-hierarchy
e76b4820 3528Dump a representation of each class's hierarchy and virtual function
767094dd 3529table layout to a file. The file name is made by appending @file{.class}
22367161
NS
3530to the source file name. If the @samp{-@var{options}} form is used,
3531@var{options} controls the details of the dump as described for the
3532@option{-fdump-tree} options.
3533
6de9cd9a
DN
3534@item -fdump-tree-@var{switch} @r{(C and C++ only)}
3535@itemx -fdump-tree-@var{switch}-@var{options} @r{(C and C++ only)}
22367161
NS
3536@opindex fdump-tree
3537Control the dumping at various stages of processing the intermediate
3538language tree to a file. The file name is generated by appending a switch
3539specific suffix to the source file name. If the @samp{-@var{options}}
3540form is used, @var{options} is a list of @samp{-} separated options that
3541control the details of the dump. Not all options are applicable to all
3542dumps, those which are not meaningful will be ignored. The following
3543options are available
f71f87f9 3544
e76b4820 3545@table @samp
22367161 3546@item address
767094dd 3547Print the address of each node. Usually this is not meaningful as it
22367161
NS
3548changes according to the environment and source file. Its primary use
3549is for tying up a dump file with a debug environment.
3550@item slim
3551Inhibit dumping of members of a scope or body of a function merely
6de9cd9a
DN
3552because that scope has been reached. Only dump such items when they
3553are directly reachable by some other path. When dumping pretty-printed
3554trees, this option inhibits dumping the bodies of control structures.
3555@item raw
3556Print a raw representation of the tree. By default, trees are
3557pretty-printed into a C-like representation.
3558@item details
3559Enable more detailed dumps (not honored by every dump option).
3560@item stats
3561Enable dumping various statistics about the pass (not honored by every dump
3562option).
3563@item blocks
3564Enable showing basic block boundaries (disabled in raw dumps).
3565@item vops
3566Enable showing virtual operands for every statement.
3567@item lineno
3568Enable showing line numbers for statements.
3569@item uid
3570Enable showing the unique ID (@code{DECL_UID}) for each variable.
22367161 3571@item all
6de9cd9a 3572Turn on all options, except @option{raw}, @option{slim} and @option{lineno}.
e76b4820
NS
3573@end table
3574
3575The following tree dumps are possible:
3576@table @samp
6de9cd9a 3577
e76b4820
NS
3578@item original
3579Dump before any tree based optimization, to @file{@var{file}.original}.
6de9cd9a 3580
e76b4820
NS
3581@item optimized
3582Dump after all tree based optimization, to @file{@var{file}.optimized}.
6de9cd9a 3583
6be77748 3584@item inlined
9c34dbbf 3585Dump after function inlining, to @file{@var{file}.inlined}.
6de9cd9a
DN
3586
3587@item gimple
3588@opindex fdump-tree-gimple
3589Dump each function before and after the gimplification pass to a file. The
3590file name is made by appending @file{.gimple} to the source file name.
3591
3592@item cfg
3593@opindex fdump-tree-cfg
3594Dump the control flow graph of each function to a file. The file name is
3595made by appending @file{.cfg} to the source file name.
3596
3597@item vcg
3598@opindex fdump-tree-vcg
3599Dump the control flow graph of each function to a file in VCG format. The
3600file name is made by appending @file{.vcg} to the source file name. Note
3601that if the file contains more than one function, the generated file cannot
3602be used directly by VCG. You will need to cut and paste each function's
3603graph into its own separate file first.
3604
3605@item ch
3606@opindex fdump-tree-ch
3607Dump each function after copying loop headers. The file name is made by
3608appending @file{.ch} to the source file name.
3609
3610@item ssa
3611@opindex fdump-tree-ssa
3612Dump SSA related information to a file. The file name is made by appending
3613@file{.ssa} to the source file name.
3614
3615@item alias
3616@opindex fdump-tree-alias
3617Dump aliasing information for each function. The file name is made by
3618appending @file{.alias} to the source file name.
3619
3620@item ccp
3621@opindex fdump-tree-ccp
3622Dump each function after CCP. The file name is made by appending
3623@file{.ccp} to the source file name.
3624
3625@item pre
3626@opindex fdump-tree-pre
3627Dump trees after partial redundancy elimination. The file name is made
3628by appending @file{.pre} to the source file name.
3629
ff2ad0f7
DN
3630@item fre
3631@opindex fdump-tree-fre
3632Dump trees after full redundancy elimination. The file name is made
3633by appending @file{.fre} to the source file name.
3634
6de9cd9a
DN
3635@item dce
3636@opindex fdump-tree-dce
3637Dump each function after dead code elimination. The file name is made by
3638appending @file{.dce} to the source file name.
3639
3640@item mudflap
3641@opindex fdump-tree-mudflap
3642Dump each function after adding mudflap instrumentation. The file name is
3643made by appending @file{.mudflap} to the source file name.
3644
3645@item sra
3646@opindex fdump-tree-sra
3647Dump each function after performing scalar replacement of aggregates. The
3648file name is made by appending @file{.sra} to the source file name.
3649
3650@item dom
3651@opindex fdump-tree-dom
3652Dump each function after applying dominator tree optimizations. The file
3653name is made by appending @file{.dom} to the source file name.
3654
3655@item dse
3656@opindex fdump-tree-dse
3657Dump each function after applying dead store elimination. The file
3658name is made by appending @file{.dse} to the source file name.
3659
3660@item phiopt
3661@opindex fdump-tree-phiopt
3662Dump each function after optimizing PHI nodes into straightline code. The file
3663name is made by appending @file{.phiopt} to the source file name.
3664
3665@item forwprop
3666@opindex fdump-tree-forwprop
3667Dump each function after forward propagating single use variables. The file
3668name is made by appending @file{.forwprop} to the source file name.
3669
3670@item copyrename
3671@opindex fdump-tree-copyrename
3672Dump each function after applying the copy rename optimization. The file
3673name is made by appending @file{.copyrename} to the source file name.
3674
3675@item nrv
3676@opindex fdump-tree-nrv
3677Dump each function after applying the named return value optimization on
3678generic trees. The file name is made by appending @file{.nrv} to the source
3679file name.
3680
79fe1b3b
DN
3681@item vect
3682@opindex fdump-tree-vect
3683Dump each function after applying vectorization of loops. The file name is
3684made by appending @file{.vect} to the source file name.
3685
6de9cd9a
DN
3686@item all
3687@opindex fdump-tree-all
3688Enable all the available tree dumps with the flags provided in this option.
e76b4820 3689@end table
9965d119 3690
a37db56b
GK
3691@item -frandom-seed=@var{string}
3692@opindex frandom-string
3693This option provides a seed that GCC uses when it would otherwise use
e61a2eb7
NS
3694random numbers. It is used to generate certain symbol names
3695that have to be different in every compiled file. It is also used to
3696place unique stamps in coverage data files and the object files that
3697produce them. You can use the @option{-frandom-seed} option to produce
3698reproducibly identical object files.
a37db56b
GK
3699
3700The @var{string} should be different for every file you compile.
3701
e03b7153
RS
3702@item -fsched-verbose=@var{n}
3703@opindex fsched-verbose
3704On targets that use instruction scheduling, this option controls the
3705amount of debugging output the scheduler prints. This information is
3706written to standard error, unless @option{-dS} or @option{-dR} is
3707specified, in which case it is output to the usual dump
3708listing file, @file{.sched} or @file{.sched2} respectively. However
3709for @var{n} greater than nine, the output is always printed to standard
3710error.
3711
3712For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3713same information as @option{-dRS}. For @var{n} greater than one, it
3714also output basic block probabilities, detailed ready list information
3715and unit/insn info. For @var{n} greater than two, it includes RTL
3716at abort point, control-flow and regions info. And for @var{n} over
3717four, @option{-fsched-verbose} also includes dependence info.
3718
74291a4b 3719@item -save-temps
cd3bb277 3720@opindex save-temps
74291a4b
MM
3721Store the usual ``temporary'' intermediate files permanently; place them
3722in the current directory and name them based on the source file. Thus,
3723compiling @file{foo.c} with @samp{-c -save-temps} would produce files
f2ecb02d
JM
3724@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
3725preprocessed @file{foo.i} output file even though the compiler now
3726normally uses an integrated preprocessor.
74291a4b 3727
03c41c05 3728@item -time
cd3bb277 3729@opindex time
03c41c05 3730Report the CPU time taken by each subprocess in the compilation
f2ecb02d
JM
3731sequence. For C source files, this is the compiler proper and assembler
3732(plus the linker if linking is done). The output looks like this:
03c41c05
ZW
3733
3734@smallexample
03c41c05
ZW
3735# cc1 0.12 0.01
3736# as 0.00 0.01
3737@end smallexample
3738
3739The first number on each line is the ``user time,'' that is time spent
3740executing the program itself. The second number is ``system time,''
3741time spent executing operating system routines on behalf of the program.
3742Both numbers are in seconds.
3743
014a1138
JZ
3744@item -fvar-tracking
3745@opindex fvar-tracking
3746Run variable tracking pass. It computes where variables are stored at each
3747position in code. Better debugging information is then generated
3748(if the debugging information format supports this information).
3749
3750It is enabled by default when compiling with optimization (@option{-Os},
3751@option{-O}, @option{-O2}, ...), debugging information (@option{-g}) and
3752the debug info format supports it.
3753
74291a4b 3754@item -print-file-name=@var{library}
cd3bb277 3755@opindex print-file-name
74291a4b
MM
3756Print the full absolute name of the library file @var{library} that
3757would be used when linking---and don't do anything else. With this
0c2d1a2a 3758option, GCC does not compile or link anything; it just prints the
74291a4b
MM
3759file name.
3760
b1018de6
AO
3761@item -print-multi-directory
3762@opindex print-multi-directory
3763Print the directory name corresponding to the multilib selected by any
3764other switches present in the command line. This directory is supposed
3765to exist in @env{GCC_EXEC_PREFIX}.
3766
3767@item -print-multi-lib
3768@opindex print-multi-lib
3769Print the mapping from multilib directory names to compiler switches
3770that enable them. The directory name is separated from the switches by
3771@samp{;}, and each switch starts with an @samp{@@} instead of the
3772@samp{-}, without spaces between multiple switches. This is supposed to
3773ease shell-processing.
3774
74291a4b 3775@item -print-prog-name=@var{program}
cd3bb277 3776@opindex print-prog-name
630d3d5a 3777Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
74291a4b
MM
3778
3779@item -print-libgcc-file-name
cd3bb277 3780@opindex print-libgcc-file-name
630d3d5a 3781Same as @option{-print-file-name=libgcc.a}.
74291a4b 3782
630d3d5a 3783This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
74291a4b
MM
3784but you do want to link with @file{libgcc.a}. You can do
3785
3ab51846 3786@smallexample
74291a4b 3787gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3ab51846 3788@end smallexample
74291a4b
MM
3789
3790@item -print-search-dirs
cd3bb277 3791@opindex print-search-dirs
74291a4b 3792Print the name of the configured installation directory and a list of
2dd76960 3793program and library directories @command{gcc} will search---and don't do anything else.
74291a4b 3794
2dd76960 3795This is useful when @command{gcc} prints the error message
3c0b7970
JM
3796@samp{installation problem, cannot exec cpp0: No such file or directory}.
3797To resolve this you either need to put @file{cpp0} and the other compiler
2dd76960 3798components where @command{gcc} expects to find them, or you can set the environment
bedc7537 3799variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
74291a4b
MM
3800Don't forget the trailing '/'.
3801@xref{Environment Variables}.
1f0c3120
JM
3802
3803@item -dumpmachine
cd3bb277 3804@opindex dumpmachine
1f0c3120
JM
3805Print the compiler's target machine (for example,
3806@samp{i686-pc-linux-gnu})---and don't do anything else.
3807
3808@item -dumpversion
cd3bb277 3809@opindex dumpversion
1f0c3120
JM
3810Print the compiler version (for example, @samp{3.0})---and don't do
3811anything else.
3812
3813@item -dumpspecs
cd3bb277 3814@opindex dumpspecs
1f0c3120
JM
3815Print the compiler's built-in specs---and don't do anything else. (This
3816is used when GCC itself is being built.) @xref{Spec Files}.
73c68f61
SS
3817
3818@item -feliminate-unused-debug-types
3819@opindex feliminate-unused-debug-types
3820Normally, when producing DWARF2 output, GCC will emit debugging
3821information for all types declared in a compilation
3822unit, regardless of whether or not they are actually used
3823in that compilation unit. Sometimes this is useful, such as
3824if, in the debugger, you want to cast a value to a type that is
3825not actually used in your program (but is declared). More often,
3826however, this results in a significant amount of wasted space.
3827With this option, GCC will avoid producing debug symbol output
3828for types that are nowhere used in the source file being compiled.
74291a4b
MM
3829@end table
3830
3831@node Optimize Options
3832@section Options That Control Optimization
3833@cindex optimize options
3834@cindex options, optimization
3835
147d1cd3
JQ
3836These options control various sorts of optimizations.
3837
3838Without any optimization option, the compiler's goal is to reduce the
3839cost of compilation and to make debugging produce the expected
3840results. Statements are independent: if you stop the program with a
3841breakpoint between statements, you can then assign a new value to any
3842variable or change the program counter to any other statement in the
3843function and get exactly the results you would expect from the source
3844code.
3845
3846Turning on optimization flags makes the compiler attempt to improve
3847the performance and/or code size at the expense of compilation time
3848and possibly the ability to debug the program.
3849
a451b0bd 3850The compiler performs optimization based on the knowledge it has of
7797ff53
PB
3851the program. Optimization levels @option{-O2} and above, in
3852particular, enable @emph{unit-at-a-time} mode, which allows the
3853compiler to consider information gained from later functions in
3854the file when compiling a function. Compiling multiple files at
3855once to a single output file in @emph{unit-at-a-time} mode allows
d1bd0ded
GK
3856the compiler to use information gained from all of the files when
3857compiling each of them.
3858
147d1cd3
JQ
3859Not all optimizations are controlled directly by a flag. Only
3860optimizations that have a flag are listed.
74291a4b 3861
2642624b 3862@table @gcctabopt
74291a4b
MM
3863@item -O
3864@itemx -O1
cd3bb277
JM
3865@opindex O
3866@opindex O1
74291a4b
MM
3867Optimize. Optimizing compilation takes somewhat more time, and a lot
3868more memory for a large function.
3869
630d3d5a 3870With @option{-O}, the compiler tries to reduce code size and execution
9c34dbbf
ZW
3871time, without performing any optimizations that take a great deal of
3872compilation time.
74291a4b 3873
daf2f129 3874@option{-O} turns on the following optimization flags:
9a94f7f3
JM
3875@gccoptlist{-fdefer-pop @gol
3876-fmerge-constants @gol
3877-fthread-jumps @gol
3878-floop-optimize @gol
9a94f7f3
JM
3879-fif-conversion @gol
3880-fif-conversion2 @gol
3881-fdelayed-branch @gol
3882-fguess-branch-probability @gol
fad893da
JQ
3883-fcprop-registers}
3884
3885@option{-O} also turns on @option{-fomit-frame-pointer} on machines
3886where doing so does not interfere with debugging.
3887
74291a4b 3888@item -O2
cd3bb277 3889@opindex O2
0c2d1a2a 3890Optimize even more. GCC performs nearly all supported optimizations
74291a4b 3891that do not involve a space-speed tradeoff. The compiler does not
630d3d5a
JM
3892perform loop unrolling or function inlining when you specify @option{-O2}.
3893As compared to @option{-O}, this option increases both compilation time
74291a4b
MM
3894and the performance of the generated code.
3895
fad893da
JQ
3896@option{-O2} turns on all optimization flags specified by @option{-O}. It
3897also turns on the following optimization flags:
9a94f7f3
JM
3898@gccoptlist{-fforce-mem @gol
3899-foptimize-sibling-calls @gol
3900-fstrength-reduce @gol
3901-fcse-follow-jumps -fcse-skip-blocks @gol
3902-frerun-cse-after-loop -frerun-loop-opt @gol
f5f2e3cd 3903-fgcse -fgcse-lm -fgcse-sm -fgcse-las @gol
9a94f7f3
JM
3904-fdelete-null-pointer-checks @gol
3905-fexpensive-optimizations @gol
f5f2e3cd 3906-fregmove @gol
9a94f7f3
JM
3907-fschedule-insns -fschedule-insns2 @gol
3908-fsched-interblock -fsched-spec @gol
3909-fcaller-saves @gol
3910-fpeephole2 @gol
3911-freorder-blocks -freorder-functions @gol
3912-fstrict-aliasing @gol
23a44080 3913-funit-at-a-time @gol
9a94f7f3 3914-falign-functions -falign-jumps @gol
b684a3df
JH
3915-falign-loops -falign-labels @gol
3916-fcrossjumping}
74291a4b 3917
081ca317
BL
3918Please note the warning under @option{-fgcse} about
3919invoking @option{-O2} on programs that use computed gotos.
3920
74291a4b 3921@item -O3
cd3bb277 3922@opindex O3
630d3d5a 3923Optimize yet more. @option{-O3} turns on all optimizations specified by
dafc5b82 3924@option{-O2} and also turns on the @option{-finline-functions},
4c59781d 3925@option{-fweb} and @option{-fgcse-after-reload} options.
74291a4b
MM
3926
3927@item -O0
cd3bb277 3928@opindex O0
fad893da 3929Do not optimize. This is the default.
74291a4b 3930
c6aded7c 3931@item -Os
cd3bb277 3932@opindex Os
630d3d5a 3933Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
c6aded7c
AG
3934do not typically increase code size. It also performs further
3935optimizations designed to reduce code size.
3936
fad893da 3937@option{-Os} disables the following optimization flags:
9a94f7f3 3938@gccoptlist{-falign-functions -falign-jumps -falign-loops @gol
750054a2 3939-falign-labels -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays}
fad893da 3940
630d3d5a 3941If you use multiple @option{-O} options, with or without level numbers,
74291a4b
MM
3942the last such option is the one that is effective.
3943@end table
3944
630d3d5a 3945Options of the form @option{-f@var{flag}} specify machine-independent
74291a4b 3946flags. Most flags have both positive and negative forms; the negative
147d1cd3
JQ
3947form of @option{-ffoo} would be @option{-fno-foo}. In the table
3948below, only one of the forms is listed---the one you typically will
3949use. You can figure out the other form by either removing @samp{no-}
3950or adding it.
3951
3952The following options control specific optimizations. They are either
3953activated by @option{-O} options or are related to ones that are. You
3954can use the following flags in the rare cases when ``fine-tuning'' of
3955optimizations to be performed is desired.
74291a4b 3956
2642624b 3957@table @gcctabopt
74291a4b 3958@item -fno-default-inline
cd3bb277 3959@opindex fno-default-inline
74291a4b
MM
3960Do not make member functions inline by default merely because they are
3961defined inside the class scope (C++ only). Otherwise, when you specify
630d3d5a 3962@w{@option{-O}}, member functions defined inside class scope are compiled
74291a4b
MM
3963inline by default; i.e., you don't need to add @samp{inline} in front of
3964the member function name.
3965
3966@item -fno-defer-pop
cd3bb277 3967@opindex fno-defer-pop
74291a4b
MM
3968Always pop the arguments to each function call as soon as that function
3969returns. For machines which must pop arguments after a function call,
3970the compiler normally lets arguments accumulate on the stack for several
3971function calls and pops them all at once.
3972
38df970e
JQ
3973Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
3974
74291a4b 3975@item -fforce-mem
cd3bb277 3976@opindex fforce-mem
74291a4b
MM
3977Force memory operands to be copied into registers before doing
3978arithmetic on them. This produces better code by making all memory
3979references potential common subexpressions. When they are not common
3980subexpressions, instruction combination should eliminate the separate
38df970e
JQ
3981register-load.
3982
3983Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
74291a4b
MM
3984
3985@item -fforce-addr
cd3bb277 3986@opindex fforce-addr
74291a4b
MM
3987Force memory address constants to be copied into registers before
3988doing arithmetic on them. This may produce better code just as
630d3d5a 3989@option{-fforce-mem} may.
74291a4b
MM
3990
3991@item -fomit-frame-pointer
cd3bb277 3992@opindex fomit-frame-pointer
74291a4b
MM
3993Don't keep the frame pointer in a register for functions that
3994don't need one. This avoids the instructions to save, set up and
3995restore frame pointers; it also makes an extra register available
3996in many functions. @strong{It also makes debugging impossible on
3997some machines.}
3998
8aeea6e6 3999On some machines, such as the VAX, this flag has no effect, because
74291a4b
MM
4000the standard calling sequence automatically handles the frame pointer
4001and nothing is saved by pretending it doesn't exist. The
4002machine-description macro @code{FRAME_POINTER_REQUIRED} controls
4003whether a target machine supports this flag. @xref{Registers,,Register
b11cc610 4004Usage, gccint, GNU Compiler Collection (GCC) Internals}.
74291a4b 4005
38df970e
JQ
4006Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4007
1aaef9c1 4008@item -foptimize-sibling-calls
cd3bb277 4009@opindex foptimize-sibling-calls
1aaef9c1
JH
4010Optimize sibling and tail recursive calls.
4011
38df970e
JQ
4012Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4013
74291a4b 4014@item -fno-inline
cd3bb277 4015@opindex fno-inline
74291a4b
MM
4016Don't pay attention to the @code{inline} keyword. Normally this option
4017is used to keep the compiler from expanding any functions inline.
4018Note that if you are not optimizing, no functions can be expanded inline.
4019
4020@item -finline-functions
cd3bb277 4021@opindex finline-functions
74291a4b
MM
4022Integrate all simple functions into their callers. The compiler
4023heuristically decides which functions are simple enough to be worth
4024integrating in this way.
4025
4026If all calls to a given function are integrated, and the function is
4027declared @code{static}, then the function is normally not output as
4028assembler code in its own right.
4029
38df970e
JQ
4030Enabled at level @option{-O3}.
4031
efa3896a 4032@item -finline-limit=@var{n}
cd3bb277 4033@opindex finline-limit
2dd76960 4034By default, GCC limits the size of functions that can be inlined. This flag
f9e814f1 4035allows the control of this limit for functions that are explicitly marked as
3364c33b 4036inline (i.e., marked with the inline keyword or defined within the class
02f52e19 4037definition in c++). @var{n} is the size of functions that can be inlined in
f9e814f1 4038number of pseudo instructions (not counting parameter handling). The default
93ee12c4
GP
4039value of @var{n} is 600.
4040Increasing this value can result in more inlined code at
f9e814f1 4041the cost of compilation time and memory consumption. Decreasing usually makes
02f52e19
AJ
4042the compilation faster and less code will be inlined (which presumably
4043means slower programs). This option is particularly useful for programs that
aee96fe9 4044use inlining heavily such as those based on recursive templates with C++.
f9e814f1 4045
bc522472
KG
4046Inlining is actually controlled by a number of parameters, which may be
4047specified individually by using @option{--param @var{name}=@var{value}}.
daf2f129 4048The @option{-finline-limit=@var{n}} option sets some of these parameters
bc522472
KG
4049as follows:
4050
4051@table @gcctabopt
bc522472
KG
4052 @item max-inline-insns-single
4053 is set to @var{n}/2.
6d7fe8b3 4054 @item max-inline-insns-auto
bc522472
KG
4055 is set to @var{n}/2.
4056 @item min-inline-insns
4057 is set to 130 or @var{n}/4, whichever is smaller.
4058 @item max-inline-insns-rtl
4059 is set to @var{n}.
4060@end table
4061
f7a01847 4062See below for a documentation of the individual
bc522472
KG
4063parameters controlling inlining.
4064
f9e814f1
TP
4065@emph{Note:} pseudo instruction represents, in this particular context, an
4066abstract measurement of function's size. In no way, it represents a count
4067of assembly instructions and as such its exact meaning might change from one
4068release to an another.
4069
74291a4b 4070@item -fkeep-inline-functions
cd3bb277 4071@opindex fkeep-inline-functions
1a10290c
MM
4072In C, emit @code{static} functions that are declared @code{inline}
4073into the object file, even if the function has been inlined into all
4074of its callers. This switch does not affect functions using the
4075@code{extern inline} extension in GNU C. In C++, emit any and all
4076inline functions into the object file.
74291a4b
MM
4077
4078@item -fkeep-static-consts
cd3bb277 4079@opindex fkeep-static-consts
74291a4b
MM
4080Emit variables declared @code{static const} when optimization isn't turned
4081on, even if the variables aren't referenced.
4082
0c2d1a2a 4083GCC enables this option by default. If you want to force the compiler to
74291a4b 4084check if the variable was referenced, regardless of whether or not
630d3d5a 4085optimization is turned on, use the @option{-fno-keep-static-consts} option.
74291a4b 4086
201556f0
JJ
4087@item -fmerge-constants
4088Attempt to merge identical constants (string constants and floating point
3364c33b 4089constants) across compilation units.
201556f0 4090
3364c33b
JQ
4091This option is the default for optimized compilation if the assembler and
4092linker support it. Use @option{-fno-merge-constants} to inhibit this
4093behavior.
201556f0 4094
38df970e
JQ
4095Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4096
201556f0
JJ
4097@item -fmerge-all-constants
4098Attempt to merge identical constants and identical variables.
4099
4100This option implies @option{-fmerge-constants}. In addition to
4101@option{-fmerge-constants} this considers e.g. even constant initialized
4102arrays or initialized constant variables with integral or floating point
4103types. Languages like C or C++ require each non-automatic variable to
4104have distinct location, so using this option will result in non-conforming
c21cd8b1 4105behavior.
201556f0 4106
e5626198
AZ
4107@item -fmodulo-sched
4108@opindex fmodulo-sched
4109Perform swing modulo scheduling immediately before the first scheduling
4110pass. This pass looks at innermost loops and reorders their
4111instructions by overlapping different iterations.
4112
ed8d2920
MM
4113@item -fnew-ra
4114@opindex fnew-ra
4115Use a graph coloring register allocator. Currently this option is meant
7db956db
DH
4116only for testing. Users should not specify this option, since it is not
4117yet ready for production use.
ed8d2920 4118
e03b7153
RS
4119@item -fno-branch-count-reg
4120@opindex fno-branch-count-reg
4121Do not use ``decrement and branch'' instructions on a count register,
4122but instead generate a sequence of instructions that decrement a
4123register, compare it against zero, then branch based upon the result.
4124This option is only meaningful on architectures that support such
4125instructions, which include x86, PowerPC, IA-64 and S/390.
4126
38df970e
JQ
4127The default is @option{-fbranch-count-reg}, enabled when
4128@option{-fstrength-reduce} is enabled.
4129
74291a4b 4130@item -fno-function-cse
cd3bb277 4131@opindex fno-function-cse
74291a4b
MM
4132Do not put function addresses in registers; make each instruction that
4133calls a constant function contain the function's address explicitly.
4134
4135This option results in less efficient code, but some strange hacks
4136that alter the assembler output may be confused by the optimizations
4137performed when this option is not used.
4138
38df970e
JQ
4139The default is @option{-ffunction-cse}
4140
27b41650
KG
4141@item -fno-zero-initialized-in-bss
4142@opindex fno-zero-initialized-in-bss
4143If the target supports a BSS section, GCC by default puts variables that
4144are initialized to zero into BSS@. This can save space in the resulting
4145code.
4146
4147This option turns off this behavior because some programs explicitly
4148rely on variables going to the data section. E.g., so that the
4149resulting executable can find the beginning of that section and/or make
4150assumptions based on that.
4151
4152The default is @option{-fzero-initialized-in-bss}.
e03b7153 4153
6de9cd9a
DN
4154@item -fbounds-check
4155@opindex fbounds-check
4156For front-ends that support it, generate additional code to check that
4157indices used to access arrays are within the declared range. This is
4158currently only supported by the Java and Fortran front-ends, where
4159this option defaults to true and false respectively.
4160
4161@item -fmudflap -fmudflapth -fmudflapir
4162@opindex fmudflap
4163@opindex fmudflapth
4164@opindex fmudflapir
4165@cindex bounds checking
4166@cindex mudflap
4167For front-ends that support it (C and C++), instrument all risky
4168pointer/array dereferencing operations, some standard library
4169string/heap functions, and some other associated constructs with
4170range/validity tests. Modules so instrumented should be immune to
4171buffer overflows, invalid heap use, and some other classes of C/C++
4172programming errors. The instrumentation relies on a separate runtime
4173library (@file{libmudflap}), which will be linked into a program if
4174@option{-fmudflap} is given at link time. Run-time behavior of the
4175instrumented program is controlled by the @env{MUDFLAP_OPTIONS}
4176environment variable. See @code{env MUDFLAP_OPTIONS=-help a.out}
4177for its options.
4178
4179Use @option{-fmudflapth} instead of @option{-fmudflap} to compile and to
4180link if your program is multi-threaded. Use @option{-fmudflapir}, in
4181addition to @option{-fmudflap} or @option{-fmudflapth}, if
4182instrumentation should ignore pointer reads. This produces less
4183instrumentation (and therefore faster execution) and still provides
4184some protection against outright memory corrupting writes, but allows
4185erroneously read data to propagate within a program.
4186
74291a4b 4187@item -fstrength-reduce
cd3bb277 4188@opindex fstrength-reduce
74291a4b
MM
4189Perform the optimizations of loop strength reduction and
4190elimination of iteration variables.
4191
38df970e
JQ
4192Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4193
74291a4b 4194@item -fthread-jumps
cd3bb277 4195@opindex fthread-jumps
74291a4b
MM
4196Perform optimizations where we check to see if a jump branches to a
4197location where another comparison subsumed by the first is found. If
4198so, the first branch is redirected to either the destination of the
4199second branch or a point immediately following it, depending on whether
4200the condition is known to be true or false.
4201
38df970e
JQ
4202Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4203
74291a4b 4204@item -fcse-follow-jumps
cd3bb277 4205@opindex fcse-follow-jumps
74291a4b
MM
4206In common subexpression elimination, scan through jump instructions
4207when the target of the jump is not reached by any other path. For
4208example, when CSE encounters an @code{if} statement with an
4209@code{else} clause, CSE will follow the jump when the condition
4210tested is false.
4211
38df970e
JQ
4212Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4213
74291a4b 4214@item -fcse-skip-blocks
cd3bb277 4215@opindex fcse-skip-blocks
630d3d5a 4216This is similar to @option{-fcse-follow-jumps}, but causes CSE to
74291a4b
MM
4217follow jumps which conditionally skip over blocks. When CSE
4218encounters a simple @code{if} statement with no else clause,
630d3d5a 4219@option{-fcse-skip-blocks} causes CSE to follow the jump around the
74291a4b
MM
4220body of the @code{if}.
4221
38df970e
JQ
4222Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4223
74291a4b 4224@item -frerun-cse-after-loop
cd3bb277 4225@opindex frerun-cse-after-loop
74291a4b
MM
4226Re-run common subexpression elimination after loop optimizations has been
4227performed.
4228
38df970e
JQ
4229Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4230
6d6d0fa0 4231@item -frerun-loop-opt
cd3bb277 4232@opindex frerun-loop-opt
6d6d0fa0
JL
4233Run the loop optimizer twice.
4234
38df970e
JQ
4235Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4236
7506f491 4237@item -fgcse
cd3bb277 4238@opindex fgcse
7506f491
DE
4239Perform a global common subexpression elimination pass.
4240This pass also performs global constant and copy propagation.
4241
081ca317
BL
4242@emph{Note:} When compiling a program using computed gotos, a GCC
4243extension, you may get better runtime performance if you disable
3364c33b 4244the global common subexpression elimination pass by adding
081ca317
BL
4245@option{-fno-gcse} to the command line.
4246
38df970e
JQ
4247Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4248
a13d4ebf 4249@item -fgcse-lm
cd3bb277 4250@opindex fgcse-lm
695ac33f 4251When @option{-fgcse-lm} is enabled, global common subexpression elimination will
767094dd 4252attempt to move loads which are only killed by stores into themselves. This
a13d4ebf 4253allows a loop containing a load/store sequence to be changed to a load outside
02f52e19 4254the loop, and a copy/store within the loop.
a13d4ebf 4255
38df970e
JQ
4256Enabled by default when gcse is enabled.
4257
a13d4ebf 4258@item -fgcse-sm
cd3bb277 4259@opindex fgcse-sm
f5f2e3cd
MH
4260When @option{-fgcse-sm} is enabled, a store motion pass is run after
4261global common subexpression elimination. This pass will attempt to move
4262stores out of loops. When used in conjunction with @option{-fgcse-lm},
4263loops containing a load/store sequence can be changed to a load before
4264the loop and a store after the loop.
4265
4266Enabled by default when gcse is enabled.
4267
4268@item -fgcse-las
4269@opindex fgcse-las
4270When @option{-fgcse-las} is enabled, the global common subexpression
4271elimination pass eliminates redundant loads that come after stores to the
2206e783 4272same memory location (both partial and full redundancies).
a13d4ebf 4273
38df970e
JQ
4274Enabled by default when gcse is enabled.
4275
db643b91
SH
4276@item -fgcse-after-reload
4277@opindex fgcse-after-reload
4278When @option{-fgcse-after-reload} is enabled, a redundant load elimination
4279pass is performed after reload. The purpose of this pass is to cleanup
4280redundant spilling.
4281
96327cdc
JH
4282@item -floop-optimize
4283@opindex floop-optimize
4284Perform loop optimizations: move constant expressions out of loops, simplify
4285exit test conditions and optionally do strength-reduction and loop unrolling as
4286well.
4287
38df970e
JQ
4288Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4289
5e962776
ZD
4290@item -floop-optimize2
4291@opindex floop-optimize2
4292Perform loop optimizations using the new loop optimizer. The optimizations
4293(loop unrolling, peeling and unswitching, loop invariant motion) are enabled
4294by separate flags.
4295
96327cdc
JH
4296@item -fcrossjumping
4297@opindex crossjumping
4298Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
4299resulting code may or may not perform better than without cross-jumping.
4300
38df970e
JQ
4301Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4302
2c4b77f3
JH
4303@item -fif-conversion
4304@opindex if-conversion
4305Attempt to transform conditional jumps into branch-less equivalents. This
4306include use of conditional moves, min, max, set flags and abs instructions, and
4307some tricks doable by standard arithmetics. The use of conditional execution
4308on chips where it is available is controlled by @code{if-conversion2}.
4309
38df970e
JQ
4310Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4311
2c4b77f3
JH
4312@item -fif-conversion2
4313@opindex if-conversion2
4314Use conditional execution (where available) to transform conditional jumps into
4315branch-less equivalents.
4316
38df970e
JQ
4317Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4318
b6d24183 4319@item -fdelete-null-pointer-checks
cd3bb277 4320@opindex fdelete-null-pointer-checks
9c34dbbf
ZW
4321Use global dataflow analysis to identify and eliminate useless checks
4322for null pointers. The compiler assumes that dereferencing a null
4323pointer would have halted the program. If a pointer is checked after
4324it has already been dereferenced, it cannot be null.
4325
4326In some environments, this assumption is not true, and programs can
4327safely dereference null pointers. Use
4328@option{-fno-delete-null-pointer-checks} to disable this optimization
4329for programs which depend on that behavior.
b6d24183 4330
38df970e
JQ
4331Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4332
74291a4b 4333@item -fexpensive-optimizations
cd3bb277 4334@opindex fexpensive-optimizations
74291a4b
MM
4335Perform a number of minor optimizations that are relatively expensive.
4336
38df970e
JQ
4337Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4338
639726ba 4339@item -foptimize-register-move
59d40964 4340@itemx -fregmove
cd3bb277
JM
4341@opindex foptimize-register-move
4342@opindex fregmove
9ec36da5
JL
4343Attempt to reassign register numbers in move instructions and as
4344operands of other simple instructions in order to maximize the amount of
56159047 4345register tying. This is especially helpful on machines with two-operand
38df970e 4346instructions.
9ec36da5 4347
bedc7537 4348Note @option{-fregmove} and @option{-foptimize-register-move} are the same
9ec36da5
JL
4349optimization.
4350
38df970e
JQ
4351Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4352
74291a4b 4353@item -fdelayed-branch
cd3bb277 4354@opindex fdelayed-branch
74291a4b
MM
4355If supported for the target machine, attempt to reorder instructions
4356to exploit instruction slots available after delayed branch
4357instructions.
4358
38df970e
JQ
4359Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4360
74291a4b 4361@item -fschedule-insns
cd3bb277 4362@opindex fschedule-insns
74291a4b
MM
4363If supported for the target machine, attempt to reorder instructions to
4364eliminate execution stalls due to required data being unavailable. This
4365helps machines that have slow floating point or memory load instructions
4366by allowing other instructions to be issued until the result of the load
4367or floating point instruction is required.
4368
38df970e
JQ
4369Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4370
74291a4b 4371@item -fschedule-insns2
cd3bb277 4372@opindex fschedule-insns2
630d3d5a 4373Similar to @option{-fschedule-insns}, but requests an additional pass of
74291a4b
MM
4374instruction scheduling after register allocation has been done. This is
4375especially useful on machines with a relatively small number of
4376registers and where memory load instructions take more than one cycle.
4377
38df970e
JQ
4378Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4379
e03b7153
RS
4380@item -fno-sched-interblock
4381@opindex fno-sched-interblock
4382Don't schedule instructions across basic blocks. This is normally
4383enabled by default when scheduling before register allocation, i.e.@:
4384with @option{-fschedule-insns} or at @option{-O2} or higher.
4385
4386@item -fno-sched-spec
4387@opindex fno-sched-spec
4388Don't allow speculative motion of non-load instructions. This is normally
4389enabled by default when scheduling before register allocation, i.e.@:
4390with @option{-fschedule-insns} or at @option{-O2} or higher.
4391
4392@item -fsched-spec-load
4393@opindex fsched-spec-load
4394Allow speculative motion of some load instructions. This only makes
4395sense when scheduling before register allocation, i.e.@: with
4396@option{-fschedule-insns} or at @option{-O2} or higher.
4397
4398@item -fsched-spec-load-dangerous
4399@opindex fsched-spec-load-dangerous
4400Allow speculative motion of more load instructions. This only makes
4401sense when scheduling before register allocation, i.e.@: with
4402@option{-fschedule-insns} or at @option{-O2} or higher.
4403
569fa502
DN
4404@item -fsched-stalled-insns=@var{n}
4405@opindex fsched-stalled-insns
4406Define how many insns (if any) can be moved prematurely from the queue
4407of stalled insns into the ready list, during the second scheduling pass.
4408
4409@item -fsched-stalled-insns-dep=@var{n}
4410@opindex fsched-stalled-insns-dep
daf2f129
JM
4411Define how many insn groups (cycles) will be examined for a dependency
4412on a stalled insn that is candidate for premature removal from the queue
4413of stalled insns. Has an effect only during the second scheduling pass,
569fa502
DN
4414and only if @option{-fsched-stalled-insns} is used and its value is not zero.
4415
b9422b69
JH
4416@item -fsched2-use-superblocks
4417@opindex fsched2-use-superblocks
61aeb06f 4418When scheduling after register allocation, do use superblock scheduling
62b9c42c 4419algorithm. Superblock scheduling allows motion across basic block boundaries
b9422b69 4420resulting on faster schedules. This option is experimental, as not all machine
62b9c42c 4421descriptions used by GCC model the CPU closely enough to avoid unreliable
daf2f129 4422results from the algorithm.
b9422b69
JH
4423
4424This only makes sense when scheduling after register allocation, i.e.@: with
4425@option{-fschedule-insns2} or at @option{-O2} or higher.
4426
4427@item -fsched2-use-traces
4428@opindex fsched2-use-traces
4429Use @option{-fsched2-use-superblocks} algorithm when scheduling after register
4430allocation and additionally perform code duplication in order to increase the
4431size of superblocks using tracer pass. See @option{-ftracer} for details on
4432trace formation.
4433
62b9c42c 4434This mode should produce faster but significantly longer programs. Also
b9422b69
JH
4435without @code{-fbranch-probabilities} the traces constructed may not match the
4436reality and hurt the performance. This only makes
4437sense when scheduling after register allocation, i.e.@: with
4438@option{-fschedule-insns2} or at @option{-O2} or higher.
4439
d72372e4
MH
4440@item -freschedule-modulo-scheduled-loops
4441@opindex fscheduling-in-modulo-scheduled-loops
4442The modulo scheduling comes before the traditional scheduling, if a loop was modulo scheduled
4443we may want to prevent the later scheduling passes from changing its schedule, we use this
4444option to control that.
4445
74291a4b 4446@item -fcaller-saves
cd3bb277 4447@opindex fcaller-saves
74291a4b
MM
4448Enable values to be allocated in registers that will be clobbered by
4449function calls, by emitting extra instructions to save and restore the
4450registers around such calls. Such allocation is done only when it
4451seems to result in better code than would otherwise be produced.
4452
81610a0d
HPN
4453This option is always enabled by default on certain machines, usually
4454those which have no call-preserved registers to use instead.
4455
38df970e 4456Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
74291a4b 4457
6de9cd9a
DN
4458@item -ftree-pre
4459Perform Partial Redundancy Elimination (PRE) on trees. This flag is
4460enabled by default at -O and higher.
ff2ad0f7
DN
4461
4462@item -ftree-fre
4463Perform Full Redundancy Elimination (FRE) on trees. The difference
4464between FRE and PRE is that FRE only considers expressions
4465that are computed on all paths leading to the redundant computation.
4466This analysis faster than PRE, though it exposes fewer redundancies.
4467This flag is enabled by default at -O and higher.
6de9cd9a
DN
4468
4469@item -ftree-ccp
4470Perform sparse conditional constant propagation (CCP) on trees. This flag
4471is enabled by default at -O and higher.
4472
4473@item -ftree-dce
4474Perform dead code elimination (DCE) on trees. This flag is enabled by
4475default at -O and higher.
4476
4477@item -ftree-dominator-opts
4478Perform dead code elimination (DCE) on trees. This flag is enabled by
4479default at -O and higher.
4480
4481@item -ftree-ch
4482Perform loop header copying on trees. This is beneficial since it increases
4483effectivity of code motion optimizations. It also saves one jump. This flag
4484is enabled by default at -O and higher. It is not enabled for -Os, since it
4485usually increases code size.
4486
c66b6c66
ZD
4487@item -ftree-loop-optimize
4488Perform loop optimizations on trees. This flag is enabled by default at -O
4489and higher.
4490
a7e5372d
ZD
4491@item -ftree-lim
4492Perform loop invariant motion on trees. This pass moves only invartiants that
4493would be hard to handle on rtl level (function calls, operations that expand to
4494nontrivial sequences of insns). With @option{-funswitch-loops} it also moves
4495operands of conditions that are invariant out of the loop, so that we can use
4496just trivial invariantness analysis in loop unswitching. The pass also includes
4497store motion.
4498
82b85a85
ZD
4499@item -fivcanon
4500Create a canonical counter for number of iterations in the loop for that
4501determining number of iterations requires complicated analysis. Later
4502optimizations then may determine the number easily. Useful especially
4503in connection with unrolling.
4504
6de9cd9a
DN
4505@item -ftree-sra
4506Perform scalar replacement of aggregates. This pass replaces structure
4507references with scalars to prevent committing structures to memory too
4508early. This flag is enabled by default at -O and higher.
4509
4510@item -ftree-copyrename
f26c1794
EC
4511Perform copy renaming on trees. This pass attempts to rename compiler
4512temporaries to other variables at copy locations, usually resulting in
4513variable names which more closely resemble the original variables. This flag
6de9cd9a
DN
4514is enabled by default at -O and higher.
4515
4516@item -ftree-ter
4517Perform temporary expression replacement during the SSA->normal phase. Single
f26c1794
EC
4518use/single def temporaries are replaced at their use location with their
4519defining expression. This results in non-GIMPLE code, but gives the expanders
6de9cd9a
DN
4520much more complex trees to work on resulting in better RTL generation. This is
4521enabled by default at -O and higher.
4522
4523@item -ftree-lrs
f26c1794
EC
4524Perform live range splitting during the SSA->normal phase. Distinct live
4525ranges of a variable are split into unique variables, allowing for better
6de9cd9a
DN
4526optimization later. This is enabled by default at -O and higher.
4527
79fe1b3b
DN
4528@item -ftree-vectorize
4529Perform loop vectorization on trees.
4530
6de9cd9a
DN
4531@item -ftracer
4532@opindex ftracer
4533Perform tail duplication to enlarge superblock size. This transformation
4534simplifies the control flow of the function allowing other optimizations to do
4535better job.
4536
4537@item -funroll-loops
4538@opindex funroll-loops
4539Unroll loops whose number of iterations can be determined at compile
4540time or upon entry to the loop. @option{-funroll-loops} implies both
4541@option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This
4542option makes code larger, and may or may not make it run faster.
4543
4544@item -funroll-all-loops
4545@opindex funroll-all-loops
4546Unroll all loops, even if their number of iterations is uncertain when
4547the loop is entered. This usually makes programs run more slowly.
4548@option{-funroll-all-loops} implies the same options as
4549@option{-funroll-loops},
4550
4551@item -fprefetch-loop-arrays
4552@opindex fprefetch-loop-arrays
4553If supported by the target machine, generate instructions to prefetch
4554memory to improve the performance of loops that access large arrays.
4555
e5eb27e5 4556@item -fmove-all-movables
cd3bb277 4557@opindex fmove-all-movables
e5eb27e5
JL
4558Forces all invariant computations in loops to be moved
4559outside the loop.
4560
4561@item -freduce-all-givs
cd3bb277 4562@opindex freduce-all-givs
e5eb27e5
JL
4563Forces all general-induction variables in loops to be
4564strength-reduced.
4565
4566@emph{Note:} When compiling programs written in Fortran,
630d3d5a 4567@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
e5eb27e5
JL
4568by default when you use the optimizer.
4569
4570These options may generate better or worse code; results are highly
4571dependent on the structure of loops within the source code.
4572
4573These two options are intended to be removed someday, once
4574they have helped determine the efficacy of various
4575approaches to improving loop optimizations.
4576
962e6e00
JM
4577Please contact @w{@email{gcc@@gcc.gnu.org}}, and describe how use of
4578these options affects the performance of your production code.
4579Examples of code that runs @emph{slower} when these options are
4580@emph{enabled} are very valuable.
e5eb27e5 4581
74291a4b 4582@item -fno-peephole
6cfc0341 4583@itemx -fno-peephole2
cd3bb277 4584@opindex fno-peephole
6cfc0341
RH
4585@opindex fno-peephole2
4586Disable any machine-specific peephole optimizations. The difference
630d3d5a 4587between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6cfc0341
RH
4588are implemented in the compiler; some targets use one, some use the
4589other, a few use both.
861bb6c1 4590
38df970e
JQ
4591@option{-fpeephole} is enabled by default.
4592@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4593
454d0cc7 4594@item -fno-guess-branch-probability
cd3bb277 4595@opindex fno-guess-branch-probability
9c34dbbf
ZW
4596Do not guess branch probabilities using a randomized model.
4597
2dd76960 4598Sometimes GCC will opt to use a randomized model to guess branch
9c34dbbf
ZW
4599probabilities, when none are available from either profiling feedback
4600(@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that
4601different runs of the compiler on the same program may produce different
4602object code.
4603
4604In a hard real-time system, people don't want different runs of the
4605compiler to produce code that has different behavior; minimizing
4606non-determinism is of paramount import. This switch allows users to
4607reduce non-determinism, possibly at the expense of inferior
4608optimization.
454d0cc7 4609
38df970e
JQ
4610The default is @option{-fguess-branch-probability} at levels
4611@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4612
194734e9
JH
4613@item -freorder-blocks
4614@opindex freorder-blocks
4615Reorder basic blocks in the compiled function in order to reduce number of
4616taken branches and improve code locality.
4617
3f8b659d 4618Enabled at levels @option{-O2}, @option{-O3}.
38df970e 4619
750054a2
CT
4620@item -freorder-blocks-and-partition
4621@opindex freorder-blocks-and-partition
4622In addition to reordering basic blocks in the compiled function, in order
4623to reduce number of taken branches, partitions hot and cold basic blocks
4624into separate sections of the assembly and .o files, to improve
4625paging and cache locality performance.
4626
8e8d5162
CT
4627This optimization is automatically turned off in the presence of
4628exception handling, for linkonce sections, for functions with a user-defined
4629section attribute and on any architecture that does not support named
4630sections.
4631
194734e9
JH
4632@item -freorder-functions
4633@opindex freorder-functions
4634Reorder basic blocks in the compiled function in order to reduce number of
4635taken branches and improve code locality. This is implemented by using special
3a4bdd05
RH
4636subsections @code{.text.hot} for most frequently executed functions and
4637@code{.text.unlikely} for unlikely executed functions. Reordering is done by
194734e9 4638the linker so object file format must support named sections and linker must
3364c33b 4639place them in a reasonable way.
194734e9
JH
4640
4641Also profile feedback must be available in to make this option effective. See
4642@option{-fprofile-arcs} for details.
4643
38df970e
JQ
4644Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
4645
41472af8 4646@item -fstrict-aliasing
cd3bb277 4647@opindex fstrict-aliasing
41472af8
MM
4648Allows the compiler to assume the strictest aliasing rules applicable to
4649the language being compiled. For C (and C++), this activates
4650optimizations based on the type of expressions. In particular, an
4651object of one type is assumed never to reside at the same address as an
4652object of a different type, unless the types are almost the same. For
4653example, an @code{unsigned int} can alias an @code{int}, but not a
4654@code{void*} or a @code{double}. A character type may alias any other
02f52e19 4655type.
41472af8
MM
4656
4657Pay special attention to code like this:
3ab51846 4658@smallexample
02f52e19 4659union a_union @{
41472af8
MM
4660 int i;
4661 double d;
4662@};
4663
4664int f() @{
4665 a_union t;
4666 t.d = 3.0;
4667 return t.i;
4668@}
3ab51846 4669@end smallexample
41472af8
MM
4670The practice of reading from a different union member than the one most
4671recently written to (called ``type-punning'') is common. Even with
630d3d5a 4672@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
41472af8
MM
4673is accessed through the union type. So, the code above will work as
4674expected. However, this code might not:
3ab51846 4675@smallexample
02f52e19 4676int f() @{
41472af8
MM
4677 a_union t;
4678 int* ip;
4679 t.d = 3.0;
4680 ip = &t.i;
4681 return *ip;
4682@}
3ab51846 4683@end smallexample
41472af8 4684
41472af8
MM
4685Every language that wishes to perform language-specific alias analysis
4686should define a function that computes, given an @code{tree}
4687node, an alias set for the node. Nodes in different alias sets are not
4688allowed to alias. For an example, see the C front-end function
4689@code{c_get_alias_set}.
41472af8 4690
38df970e 4691Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
852b81bb 4692
efa3896a
GK
4693@item -falign-functions
4694@itemx -falign-functions=@var{n}
cd3bb277 4695@opindex falign-functions
efa3896a
GK
4696Align the start of functions to the next power-of-two greater than
4697@var{n}, skipping up to @var{n} bytes. For instance,
630d3d5a
JM
4698@option{-falign-functions=32} aligns functions to the next 32-byte
4699boundary, but @option{-falign-functions=24} would align to the next
efa3896a
GK
470032-byte boundary only if this can be done by skipping 23 bytes or less.
4701
630d3d5a 4702@option{-fno-align-functions} and @option{-falign-functions=1} are
efa3896a
GK
4703equivalent and mean that functions will not be aligned.
4704
4705Some assemblers only support this flag when @var{n} is a power of two;
4706in that case, it is rounded up.
4707
561913cb 4708If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 4709
38df970e
JQ
4710Enabled at levels @option{-O2}, @option{-O3}.
4711
efa3896a
GK
4712@item -falign-labels
4713@itemx -falign-labels=@var{n}
cd3bb277 4714@opindex falign-labels
efa3896a 4715Align all branch targets to a power-of-two boundary, skipping up to
630d3d5a 4716@var{n} bytes like @option{-falign-functions}. This option can easily
efa3896a
GK
4717make code slower, because it must insert dummy operations for when the
4718branch target is reached in the usual flow of the code.
4719
561913cb
AP
4720@option{-fno-align-labels} and @option{-falign-labels=1} are
4721equivalent and mean that labels will not be aligned.
4722
630d3d5a 4723If @option{-falign-loops} or @option{-falign-jumps} are applicable and
efa3896a
GK
4724are greater than this value, then their values are used instead.
4725
561913cb
AP
4726If @var{n} is not specified or is zero, use a machine-dependent default
4727which is very likely to be @samp{1}, meaning no alignment.
efa3896a 4728
38df970e
JQ
4729Enabled at levels @option{-O2}, @option{-O3}.
4730
efa3896a
GK
4731@item -falign-loops
4732@itemx -falign-loops=@var{n}
cd3bb277 4733@opindex falign-loops
efa3896a 4734Align loops to a power-of-two boundary, skipping up to @var{n} bytes
630d3d5a 4735like @option{-falign-functions}. The hope is that the loop will be
efa3896a
GK
4736executed many times, which will make up for any execution of the dummy
4737operations.
4738
561913cb
AP
4739@option{-fno-align-loops} and @option{-falign-loops=1} are
4740equivalent and mean that loops will not be aligned.
4741
4742If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 4743
38df970e
JQ
4744Enabled at levels @option{-O2}, @option{-O3}.
4745
efa3896a
GK
4746@item -falign-jumps
4747@itemx -falign-jumps=@var{n}
cd3bb277 4748@opindex falign-jumps
efa3896a
GK
4749Align branch targets to a power-of-two boundary, for branch targets
4750where the targets can only be reached by jumping, skipping up to @var{n}
630d3d5a 4751bytes like @option{-falign-functions}. In this case, no dummy operations
efa3896a
GK
4752need be executed.
4753
561913cb
AP
4754@option{-fno-align-jumps} and @option{-falign-jumps=1} are
4755equivalent and mean that loops will not be aligned.
4756
4757If @var{n} is not specified or is zero, use a machine-dependent default.
efa3896a 4758
38df970e
JQ
4759Enabled at levels @option{-O2}, @option{-O3}.
4760
7797ff53
PB
4761@item -funit-at-a-time
4762@opindex funit-at-a-time
4763Parse the whole compilation unit before starting to produce code.
4764This allows some extra optimizations to take place but consumes
4765more memory (in general). There are some compatibility issues
4766with @emph{unit-at-at-time} mode:
4767@itemize @bullet
4768@item
4769enabling @emph{unit-at-a-time} mode may change the order
4770in which functions, variables, and top-level @code{asm} statements
4771are emitted, and will likely break code relying on some particular
4772ordering. The majority of such top-level @code{asm} statements,
4773though, can be replaced by @code{section} attributes.
4774
4775@item
4776@emph{unit-at-a-time} mode removes unreferenced static variables
4777and functions are removed. This may result in undefined references
4778when an @code{asm} statement refers directly to variables or functions
4779that are otherwise unused. In that case either the variable/function
4780shall be listed as an operand of the @code{asm} statement operand or,
4781in the case of top-level @code{asm} statements the attribute @code{used}
4782shall be used on the declaration.
4783
4784@item
4785Static functions now can use non-standard passing conventions that
4786may break @code{asm} statements calling functions directly. Again,
4787attribute @code{used} will prevent this behavior.
4788@end itemize
4789
4790As a temporary workaround, @option{-fno-unit-at-a-time} can be used,
f26c1794 4791but this scheme may not be supported by future releases of GCC.
7797ff53
PB
4792
4793Enabled at levels @option{-O2}, @option{-O3}.
4794
7260e9a0
JH
4795@item -fweb
4796@opindex fweb
4797Constructs webs as commonly used for register allocation purposes and assign
962e6e00 4798each web individual pseudo register. This allows the register allocation pass
7260e9a0
JH
4799to operate on pseudos directly, but also strengthens several other optimization
4800passes, such as CSE, loop optimizer and trivial dead code remover. It can,
4801however, make debugging impossible, since variables will no longer stay in a
4802``home register''.
4803
38d396e5
PB
4804Enabled at levels @option{-O2}, @option{-O3}, @option{-Os},
4805on targets where the default format for debugging information supports
4806variable tracking.
d4463dfc
JQ
4807
4808@item -fno-cprop-registers
4809@opindex fno-cprop-registers
4810After register allocation and post-register allocation instruction splitting,
4811we perform a copy-propagation pass to try to reduce scheduling dependencies
4812and occasionally eliminate the copy.
4813
4814Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
4815
a8a5f53a
JH
4816@item -fprofile-generate
4817@opindex fprofile-generate
a8a5f53a 4818
33adcb6c
MM
4819Enable options usually used for instrumenting application to produce
4820profile useful for later recompilation with profile feedback based
4821optimization. You must use @code{-fprofile-generate} both when
4822compiling and when linking your program.
4823
4824The following options are enabled: @code{-fprofile-arcs}, @code{-fprofile-values}, @code{-fvpt}.
a8a5f53a
JH
4825
4826@item -fprofile-use
4827@opindex fprofile-use
4828Enable profile feedback directed optimizations, and optimizations
4829generally profitable only with profile feedback available.
4830
4831The following options are enabled: @code{-fbranch-probabilities},
4832@code{-fvpt}, @code{-funroll-loops}, @code{-fpeel-loops}, @code{-ftracer}.
4833
d4463dfc
JQ
4834@end table
4835
4836The following options control compiler behavior regarding floating
4837point arithmetic. These options trade off between speed and
4838correctness. All must be specifically enabled.
4839
4840@table @gcctabopt
4841@item -ffloat-store
4842@opindex ffloat-store
4843Do not store floating point variables in registers, and inhibit other
4844options that might change whether a floating point value is taken from a
4845register or memory.
4846
4847@cindex floating point precision
4848This option prevents undesirable excess precision on machines such as
4849the 68000 where the floating registers (of the 68881) keep more
4850precision than a @code{double} is supposed to have. Similarly for the
4851x86 architecture. For most programs, the excess precision does only
4852good, but a few programs rely on the precise definition of IEEE floating
4853point. Use @option{-ffloat-store} for such programs, after modifying
4854them to store all pertinent intermediate computations into variables.
4855
4856@item -ffast-math
4857@opindex ffast-math
4858Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
039c3d42
RS
4859@option{-fno-trapping-math}, @option{-ffinite-math-only},
4860@option{-fno-rounding-math} and @option{-fno-signaling-nans}.
d4463dfc
JQ
4861
4862This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
4863
4864This option should never be turned on by any @option{-O} option since
4865it can result in incorrect output for programs which depend on
4866an exact implementation of IEEE or ISO rules/specifications for
4867math functions.
4868
4869@item -fno-math-errno
4870@opindex fno-math-errno
4871Do not set ERRNO after calling math functions that are executed
4872with a single instruction, e.g., sqrt. A program that relies on
4873IEEE exceptions for math error handling may want to use this flag
4874for speed while maintaining IEEE arithmetic compatibility.
4875
4876This option should never be turned on by any @option{-O} option since
4877it can result in incorrect output for programs which depend on
4878an exact implementation of IEEE or ISO rules/specifications for
4879math functions.
4880
4881The default is @option{-fmath-errno}.
4882
4883@item -funsafe-math-optimizations
4884@opindex funsafe-math-optimizations
4885Allow optimizations for floating-point arithmetic that (a) assume
4886that arguments and results are valid and (b) may violate IEEE or
4887ANSI standards. When used at link-time, it may include libraries
4888or startup files that change the default FPU control word or other
4889similar optimizations.
4890
4891This option should never be turned on by any @option{-O} option since
4892it can result in incorrect output for programs which depend on
4893an exact implementation of IEEE or ISO rules/specifications for
4894math functions.
4895
4896The default is @option{-fno-unsafe-math-optimizations}.
4897
4898@item -ffinite-math-only
4899@opindex ffinite-math-only
4900Allow optimizations for floating-point arithmetic that assume
4901that arguments and results are not NaNs or +-Infs.
4902
4903This option should never be turned on by any @option{-O} option since
4904it can result in incorrect output for programs which depend on
4905an exact implementation of IEEE or ISO rules/specifications.
4906
4907The default is @option{-fno-finite-math-only}.
4908
4909@item -fno-trapping-math
4910@opindex fno-trapping-math
4911Compile code assuming that floating-point operations cannot generate
4912user-visible traps. These traps include division by zero, overflow,
4913underflow, inexact result and invalid operation. This option implies
4914@option{-fno-signaling-nans}. Setting this option may allow faster
4915code if one relies on ``non-stop'' IEEE arithmetic, for example.
4916
4917This option should never be turned on by any @option{-O} option since
4918it can result in incorrect output for programs which depend on
4919an exact implementation of IEEE or ISO rules/specifications for
4920math functions.
4921
4922The default is @option{-ftrapping-math}.
4923
039c3d42
RS
4924@item -frounding-math
4925@opindex frounding-math
4926Disable transformations and optimizations that assume default floating
4927point rounding behavior. This is round-to-zero for all floating point
4928to integer conversions, and round-to-nearest for all other arithmetic
4929truncations. This option should be specified for programs that change
4930the FP rounding mode dynamically, or that may be executed with a
4931non-default rounding mode. This option disables constant folding of
4932floating point expressions at compile-time (which may be affected by
4933rounding mode) and arithmetic transformations that are unsafe in the
4934presence of sign-dependent rounding modes.
4935
4936The default is @option{-fno-rounding-math}.
4937
4938This option is experimental and does not currently guarantee to
4939disable all GCC optimizations that are affected by rounding mode.
2dd76960 4940Future versions of GCC may provide finer control of this setting
039c3d42
RS
4941using C99's @code{FENV_ACCESS} pragma. This command line option
4942will be used to specify the default state for @code{FENV_ACCESS}.
4943
d4463dfc
JQ
4944@item -fsignaling-nans
4945@opindex fsignaling-nans
4946Compile code assuming that IEEE signaling NaNs may generate user-visible
4947traps during floating-point operations. Setting this option disables
4948optimizations that may change the number of exceptions visible with
4949signaling NaNs. This option implies @option{-ftrapping-math}.
4950
4951This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
4952be defined.
4953
4954The default is @option{-fno-signaling-nans}.
4955
4956This option is experimental and does not currently guarantee to
4957disable all GCC optimizations that affect signaling NaN behavior.
4958
4959@item -fsingle-precision-constant
4960@opindex fsingle-precision-constant
4961Treat floating point constant as single precision constant instead of
4962implicitly converting it to double precision constant.
4963
4964
4965@end table
4966
4967The following options control optimizations that may improve
4968performance, but are not enabled by any @option{-O} options. This
4969section includes experimental options that may produce broken code.
4970
4971@table @gcctabopt
4972@item -fbranch-probabilities
4973@opindex fbranch-probabilities
4974After running a program compiled with @option{-fprofile-arcs}
4975(@pxref{Debugging Options,, Options for Debugging Your Program or
4976@command{gcc}}), you can compile it a second time using
4977@option{-fbranch-probabilities}, to improve optimizations based on
4978the number of times each branch was taken. When the program
4979compiled with @option{-fprofile-arcs} exits it saves arc execution
a4878735 4980counts to a file called @file{@var{sourcename}.gcda} for each source
d4463dfc
JQ
4981file The information in this data file is very dependent on the
4982structure of the generated code, so you must use the same source code
4983and the same optimization options for both compilations.
4984
daf2f129 4985With @option{-fbranch-probabilities}, GCC puts a
d4463dfc
JQ
4986@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
4987These can be used to improve optimization. Currently, they are only
4988used in one place: in @file{reorg.c}, instead of guessing which path a
4989branch is mostly to take, the @samp{REG_BR_PROB} values are used to
4990exactly determine which path is taken more often.
4991
fc5eb4a1
ZD
4992@item -fprofile-values
4993@opindex fprofile-values
4994If combined with @option{-fprofile-arcs}, it adds code so that some
4995data about values of expressions in the program is gathered.
4996
6e885ee3
ZD
4997With @option{-fbranch-probabilities}, it reads back the data gathered
4998from profiling values of expressions and adds @samp{REG_VALUE_PROFILE}
4999notes to instructions for their later usage in optimizations.
5000
7797ff53 5001Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8d3b3fb7 5002
fca9dc00
ZD
5003@item -fvpt
5004@opindex fvpt
5005If combined with @option{-fprofile-arcs}, it instructs the compiler to add
5006a code to gather information about values of expressions.
5007
5008With @option{-fbranch-probabilities}, it reads back the data gathered
5009and actually performs the optimizations based on them.
5010Currently the optimizations include specialization of division operation
5011using the knowledge about the value of the denominator.
5012
7797ff53 5013Enabled with @option{-fprofile-generate} and @option{-fprofile-use}.
8d3b3fb7 5014
a7b1dc36
PB
5015@item -frename-registers
5016@opindex frename-registers
5017Attempt to avoid false dependencies in scheduled code by making use
5018of registers left over after register allocation. This optimization
5019will most benefit processors with lots of registers. Depending on the
5020debug information format adopted by the target, however, it can
5021make debugging impossible, since variables will no longer stay in
5022a ``home register''.
5023
5024Not enabled by default at any level because it has known bugs.
5025
d4463dfc
JQ
5026@item -fnew-ra
5027@opindex fnew-ra
5028Use a graph coloring register allocator. Currently this option is meant
5029for testing, so we are interested to hear about miscompilations with
5030@option{-fnew-ra}.
5031
5032@item -ftracer
5033@opindex ftracer
5034Perform tail duplication to enlarge superblock size. This transformation
5035simplifies the control flow of the function allowing other optimizations to do
5036better job.
5037
7797ff53 5038Enabled with @option{-fprofile-use}.
8d3b3fb7 5039
d4463dfc
JQ
5040@item -funroll-loops
5041@opindex funroll-loops
b17d5d7c
ZD
5042Unroll loops whose number of iterations can be determined at compile time or
5043upon entry to the loop. @option{-funroll-loops} implies
5044@option{-frerun-cse-after-loop}. It also turns on complete loop peeling
5045(i.e. complete removal of loops with small constant number of iterations).
5046This option makes code larger, and may or may not make it run faster.
d4463dfc 5047
7797ff53 5048Enabled with @option{-fprofile-use}.
8d3b3fb7 5049
d4463dfc
JQ
5050@item -funroll-all-loops
5051@opindex funroll-all-loops
5052Unroll all loops, even if their number of iterations is uncertain when
5053the loop is entered. This usually makes programs run more slowly.
5054@option{-funroll-all-loops} implies the same options as
b17d5d7c
ZD
5055@option{-funroll-loops}.
5056
5057@item -fpeel-loops
5058@opindex fpeel-loops
5059Peels the loops for that there is enough information that they do not
5060roll much (from profile feedback). It also turns on complete loop peeling
5061(i.e. complete removal of loops with small constant number of iterations).
5062
7797ff53 5063Enabled with @option{-fprofile-use}.
8d3b3fb7 5064
5e962776
ZD
5065@item -fmove-loop-invariants
5066@opindex fmove-loop-invariants
5067Enables the loop invariant motion pass in the new loop optimizer. Enabled
5068at level @option{-O1}
5069
b17d5d7c
ZD
5070@item -funswitch-loops
5071@opindex funswitch-loops
5072Move branches with loop invariant conditions out of the loop, with duplicates
5073of the loop on both branches (modified according to result of the condition).
5074
5075@item -fold-unroll-loops
5076@opindex fold-unroll-loops
5077Unroll loops whose number of iterations can be determined at compile
5078time or upon entry to the loop, using the old loop unroller whose loop
5079recognition is based on notes from frontend. @option{-fold-unroll-loops} implies
5080both @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This
5081option makes code larger, and may or may not make it run faster.
5082
5083@item -fold-unroll-all-loops
5084@opindex fold-unroll-all-loops
5085Unroll all loops, even if their number of iterations is uncertain when
5086the loop is entered. This is done using the old loop unroller whose loop
5087recognition is based on notes from frontend. This usually makes programs run more slowly.
5088@option{-fold-unroll-all-loops} implies the same options as
5089@option{-fold-unroll-loops}.
daf2f129 5090
d4463dfc
JQ
5091@item -fprefetch-loop-arrays
5092@opindex fprefetch-loop-arrays
5093If supported by the target machine, generate instructions to prefetch
5094memory to improve the performance of loops that access large arrays.
5095
5096Disabled at level @option{-Os}.
5097
5098@item -ffunction-sections
5099@itemx -fdata-sections
5100@opindex ffunction-sections
5101@opindex fdata-sections
5102Place each function or data item into its own section in the output
5103file if the target supports arbitrary sections. The name of the
5104function or the name of the data item determines the section's name
5105in the output file.
5106
5107Use these options on systems where the linker can perform optimizations
f401d0f5
JDA
5108to improve locality of reference in the instruction space. Most systems
5109using the ELF object format and SPARC processors running Solaris 2 have
5110linkers with such optimizations. AIX may have these optimizations in
5111the future.
d4463dfc
JQ
5112
5113Only use these options when there are significant benefits from doing
5114so. When you specify these options, the assembler and linker will
5115create larger object and executable files and will also be slower.
5116You will not be able to use @code{gprof} on all systems if you
5117specify this option and you may have problems with debugging if
5118you specify both this option and @option{-g}.
5119
fe3ad572
SC
5120@item -fbranch-target-load-optimize
5121@opindex fbranch-target-load-optimize
5122Perform branch target register load optimization before prologue / epilogue
5123threading.
5124The use of target registers can typically be exposed only during reload,
5125thus hoisting loads out of loops and doing inter-block scheduling needs
5126a separate optimization pass.
5127
5128@item -fbranch-target-load-optimize2
5129@opindex fbranch-target-load-optimize2
5130Perform branch target register load optimization after prologue / epilogue
5131threading.
5132
1194fc79
R
5133@item -fbtr-bb-exclusive
5134@opindex fbtr-bb-exclusive
8d3b3fb7 5135When performing branch target register load optimization, don't reuse
1194fc79
R
5136branch target registers in within any basic block.
5137
3af64fd6 5138@item --param @var{name}=@var{value}
cd3bb277 5139@opindex param
3af64fd6
MM
5140In some places, GCC uses various constants to control the amount of
5141optimization that is done. For example, GCC will not inline functions
5142that contain more that a certain number of instructions. You can
5143control some of these constants on the command-line using the
630d3d5a 5144@option{--param} option.
3af64fd6 5145
b00567b0
ILT
5146The names of specific parameters, and the meaning of the values, are
5147tied to the internals of the compiler, and are subject to change
5148without notice in future releases.
5149
4fe9b91c 5150In each case, the @var{value} is an integer. The allowable choices for
3af64fd6
MM
5151@var{name} are given in the following table:
5152
5153@table @gcctabopt
5f24e0dc
RH
5154@item max-crossjump-edges
5155The maximum number of incoming edges to consider for crossjumping.
d203738b 5156The algorithm used by @option{-fcrossjumping} is @math{O(N^2)} in
5f24e0dc
RH
5157the number of edges incoming to each block. Increasing values mean
5158more aggressive optimization, making the compile time increase with
5159probably small improvement in executable size.
5160
12183e0f
PH
5161@item min-crossjump-insns
5162The minimum number of instructions which must be matched at the end
5163of two blocks before crossjumping will be performed on them. This
5164value is ignored in the case where all instructions in the block being
5165crossjumped from are matched. The default value is 5.
5166
1c4c47db
JO
5167@item max-delay-slot-insn-search
5168The maximum number of instructions to consider when looking for an
5169instruction to fill a delay slot. If more than this arbitrary number of
5170instructions is searched, the time savings from filling the delay slot
5171will be minimal so stop searching. Increasing values mean more
5172aggressive optimization, making the compile time increase with probably
5173small improvement in executable run time.
5174
5175@item max-delay-slot-live-search
5176When trying to fill delay slots, the maximum number of instructions to
5177consider when searching for a block with valid live register
5178information. Increasing this arbitrarily chosen value means more
5179aggressive optimization, increasing the compile time. This parameter
5180should be removed when the delay slot code is rewritten to maintain the
5181control-flow graph.
33d3b05b
MM
5182
5183@item max-gcse-memory
5184The approximate maximum amount of memory that will be allocated in
5185order to perform the global common subexpression elimination
5186optimization. If more memory than specified is required, the
5187optimization will not be done.
3af64fd6 5188
740f35a0 5189@item max-gcse-passes
8d3b3fb7 5190The maximum number of passes of GCSE to run. The default is 1.
740f35a0 5191
4a121cc3 5192@item max-pending-list-length
0c688a7d 5193The maximum number of pending dependencies scheduling will allow
4a121cc3
AM
5194before flushing the current state and starting over. Large functions
5195with few branches or calls can create excessively large lists which
5196needlessly consume memory and resources.
5197
bc522472
KG
5198@item max-inline-insns-single
5199Several parameters control the tree inliner used in gcc.
2dd76960 5200This number sets the maximum number of instructions (counted in GCC's
daf2f129 5201internal representation) in a single function that the tree inliner
bc522472
KG
5202will consider for inlining. This only affects functions declared
5203inline and methods implemented in a class declaration (C++).
1f95c733 5204The default value is 500.
bc522472
KG
5205
5206@item max-inline-insns-auto
5207When you use @option{-finline-functions} (included in @option{-O3}),
5208a lot of functions that would otherwise not be considered for inlining
5209by the compiler will be investigated. To those functions, a different
5210(more restrictive) limit compared to functions declared inline can
5211be applied.
3b75d796 5212The default value is 120.
bc522472 5213
b58b1157
JH
5214@item large-function-insns
5215The limit specifying really large functions. For functions greater than this
5216limit inlining is constrained by @option{--param large-function-growth}.
a2b172fb 5217This parameter is useful primarily to avoid extreme compilation time caused by non-linear
b58b1157
JH
5218algorithms used by the backend.
5219This parameter is ignored when @option{-funit-at-a-time} is not used.
3b75d796 5220The default value is 3000.
b58b1157
JH
5221
5222@item large-function-growth
e53e0c56 5223Specifies maximal growth of large function caused by inlining in percents.
b58b1157
JH
5224This parameter is ignored when @option{-funit-at-a-time} is not used.
5225The default value is 200.
5226
5227@item inline-unit-growth
5228Specifies maximal overall growth of the compilation unit caused by inlining.
5229This parameter is ignored when @option{-funit-at-a-time} is not used.
5230The default value is 150.
5231
6de9cd9a
DN
5232@item max-inline-insns-recursive
5233@itemx max-inline-insns-recursive-auto
5234Specifies maximum number of instructions out-of-line copy of self recursive inline
5235function can grow into by performing recursive inlining.
5236
5237For functions declared inline @option{--param max-inline-insns-recursive} is
5238taken into acount. For function not declared inline, recursive inlining
5239happens only when @option{-finline-functions} (included in @option{-O3}) is
5240enabled and @option{--param max-inline-insns-recursive-auto} is used. The
5241default value is 500.
5242
5243@item max-inline-recursive-depth
5244@itemx max-inline-recursive-depth-auto
5245Specifies maximum recursion depth used by the recursive inlining.
5246
5247For functions declared inline @option{--param max-inline-recursive-depth} is
5248taken into acount. For function not declared inline, recursive inlining
5249happens only when @option{-finline-functions} (included in @option{-O3}) is
5250enabled and @option{--param max-inline-recursive-depth-auto} is used. The
5251default value is 500.
5252
bc522472
KG
5253@item max-inline-insns-rtl
5254For languages that use the RTL inliner (this happens at a later stage
daf2f129 5255than tree inlining), you can set the maximum allowable size (counted
bc522472
KG
5256in RTL instructions) for the RTL inliner with this parameter.
5257The default value is 600.
5258
03e9dbc9
MM
5259@item max-unrolled-insns
5260The maximum number of instructions that a loop should have if that loop
5261is unrolled, and if the loop is unrolled, it determines how many times
5262the loop code is unrolled.
5263
b17d5d7c
ZD
5264@item max-average-unrolled-insns
5265The maximum number of instructions biased by probabilities of their execution
5266that a loop should have if that loop is unrolled, and if the loop is unrolled,
5267it determines how many times the loop code is unrolled.
5268
5269@item max-unroll-times
5270The maximum number of unrollings of a single loop.
5271
5272@item max-peeled-insns
5273The maximum number of instructions that a loop should have if that loop
5274is peeled, and if the loop is peeled, it determines how many times
5275the loop code is peeled.
5276
5277@item max-peel-times
5278The maximum number of peelings of a single loop.
5279
5280@item max-completely-peeled-insns
5281The maximum number of insns of a completely peeled loop.
5282
5283@item max-completely-peel-times
5284The maximum number of iterations of a loop to be suitable for complete peeling.
5285
01a132bb
ZD
5286@item max-unswitch-insns
5287The maximum number of insns of an unswitched loop.
5288
5289@item max-unswitch-level
5290The maximum number of branches unswitched in a single loop.
5291
a7e5372d
ZD
5292@item lim-expensive
5293The minimum cost of an expensive expression in the loop invariant motion.
5294
e9eb809d
ZD
5295@item max-iterations-to-track
5296
5297The maximum number of iterations of a loop the brute force algorithm
5298for analysis of # of iterations of the loop tries to evaluate.
5299
194734e9
JH
5300@item hot-bb-count-fraction
5301Select fraction of the maximal count of repetitions of basic block in program
5302given basic block needs to have to be considered hot.
5303
5304@item hot-bb-frequency-fraction
5305Select fraction of the maximal frequency of executions of basic block in
5306function given basic block needs to have to be considered hot
5c856b23
JH
5307
5308@item tracer-dynamic-coverage
5309@itemx tracer-dynamic-coverage-feedback
5310
3364c33b
JQ
5311This value is used to limit superblock formation once the given percentage of
5312executed instructions is covered. This limits unnecessary code size
5313expansion.
5c856b23
JH
5314
5315The @option{tracer-dynamic-coverage-feedback} is used only when profile
5316feedback is available. The real profiles (as opposed to statically estimated
5317ones) are much less balanced allowing the threshold to be larger value.
5318
5319@item tracer-max-code-growth
5320Stop tail duplication once code growth has reached given percentage. This is
3364c33b 5321rather hokey argument, as most of the duplicates will be eliminated later in
5c856b23
JH
5322cross jumping, so it may be set to much higher values than is the desired code
5323growth.
5324
5325@item tracer-min-branch-ratio
5326
5327Stop reverse growth when the reverse probability of best edge is less than this
5328threshold (in percent).
5329
5330@item tracer-min-branch-ratio
5331@itemx tracer-min-branch-ratio-feedback
5332
5333Stop forward growth if the best edge do have probability lower than this
5334threshold.
5335
3364c33b 5336Similarly to @option{tracer-dynamic-coverage} two values are present, one for
5c856b23
JH
5337compilation for profile feedback and one for compilation without. The value
5338for compilation with profile feedback needs to be more conservative (higher) in
5339order to make tracer effective.
5340
c48ec590
ZD
5341@item max-cse-path-length
5342
8d3b3fb7 5343Maximum number of basic blocks on path that cse considers. The default is 10.
c48ec590 5344
6de9cd9a
DN
5345@item global-var-threshold
5346
5347Counts the number of function calls (N) and the number of
5348call-clobbered variables (V). If NxV is larger than this limit, a
5349single artificial variable will be created to represent all the
5350call-clobbered variables at function call sites. This artificial
5351variable will then be made to alias every call-clobbered variable.
5352(done as int * size_t on the host machine; beware overflow).
5353
5354@item max-aliased-vops
5355
5356Maxiumum number of virtual operands allowed to represent aliases
5357before triggering the alias grouping heuristic. Alias grouping
5358reduces compile times and memory consumption needed for aliasing at
5359the expense of precision loss in alias information.
5360
3788cc17
ZW
5361@item ggc-min-expand
5362
5363GCC uses a garbage collector to manage its own memory allocation. This
5364parameter specifies the minimum percentage by which the garbage
5365collector's heap should be allowed to expand between collections.
5366Tuning this may improve compilation speed; it has no effect on code
5367generation.
5368
9ac121af 5369The default is 30% + 70% * (RAM/1GB) with an upper bound of 100% when
16226f1e 5370RAM >= 1GB. If @code{getrlimit} is available, the notion of "RAM" is
d37e6b50 5371the smallest of actual RAM and RLIMIT_DATA or RLIMIT_AS. If
16226f1e
KG
5372GCC is not able to calculate RAM on a particular platform, the lower
5373bound of 30% is used. Setting this parameter and
737c38d1
GK
5374@option{ggc-min-heapsize} to zero causes a full collection to occur at
5375every opportunity. This is extremely slow, but can be useful for
5376debugging.
3788cc17
ZW
5377
5378@item ggc-min-heapsize
5379
5380Minimum size of the garbage collector's heap before it begins bothering
5381to collect garbage. The first collection occurs after the heap expands
5382by @option{ggc-min-expand}% beyond @option{ggc-min-heapsize}. Again,
5383tuning this may improve compilation speed, and has no effect on code
5384generation.
5385
d37e6b50
GK
5386The default is the smaller of RAM/8, RLIMIT_RSS, or a limit which
5387tries to ensure that RLIMIT_DATA or RLIMIT_AS are not exceeded, but
5388with a lower bound of 4096 (four megabytes) and an upper bound of
5389131072 (128 megabytes). If GCC is not able to calculate RAM on a
5390particular platform, the lower bound is used. Setting this parameter
5391very large effectively disables garbage collection. Setting this
5392parameter and @option{ggc-min-expand} to zero causes a full collection
5393to occur at every opportunity.
3788cc17 5394
0bcf8261
JH
5395@item max-reload-search-insns
5396The maximum number of instruction reload should look backward for equivalent
5397register. Increasing values mean more aggressive optimization, making the
5398compile time increase with probably slightly better performance. The default
5399value is 100.
5400
c65ecebc
JH
5401@item max-cselib-memory-location
5402The maximum number of memory locations cselib should take into acount.
5403Increasing values mean more aggressive optimization, making the compile time
5404increase with probably slightly better performance. The default value is 500.
5405
26f74aa3
JH
5406@item reorder-blocks-duplicate
5407@itemx reorder-blocks-duplicate-feedback
5408
65d2d764 5409Used by basic block reordering pass to decide whether to use unconditional
b222f49a 5410branch or duplicate the code on its destination. Code is duplicated when its
26f74aa3 5411estimated size is smaller than this value multiplied by the estimated size of
65d2d764 5412unconditional jump in the hot spots of the program.
26f74aa3
JH
5413
5414The @option{reorder-block-duplicate-feedback} is used only when profile
5415feedback is available and may be set to higher values than
5416@option{reorder-block-duplicate} since information about the hot spots is more
5417accurate.
f72c6b56
DE
5418
5419@item max-sched-region-blocks
5420The maximum number of blocks in a region to be considered for
5421interblock scheduling. The default value is 10.
5422
fbce7685 5423@item max-sched-region-insns
f72c6b56
DE
5424The maximum number of insns in a region to be considered for
5425interblock scheduling. The default value is 100.
31ebd7c8
NS
5426
5427@item integer-share-limit
5428Small integer constants can use a shared data structure, reducing the
5429compiler's memory usage and increasing its speed. This sets the maximum
5430value of a shared integer constant's. The default value is 256.
5431
1c4c47db 5432@end table
74291a4b
MM
5433@end table
5434
5435@node Preprocessor Options
5436@section Options Controlling the Preprocessor
5437@cindex preprocessor options
5438@cindex options, preprocessor
5439
5440These options control the C preprocessor, which is run on each C source
5441file before actual compilation.
5442
630d3d5a
JM
5443If you use the @option{-E} option, nothing is done except preprocessing.
5444Some of these options make sense only together with @option{-E} because
74291a4b
MM
5445they cause the preprocessor output to be unsuitable for actual
5446compilation.
5447
4977bab6 5448@table @gcctabopt
cd3bb277 5449@opindex Wp
40adaa27
NB
5450You can use @option{-Wp,@var{option}} to bypass the compiler driver
5451and pass @var{option} directly through to the preprocessor. If
5452@var{option} contains commas, it is split into multiple options at the
5453commas. However, many options are modified, translated or interpreted
5454by the compiler driver before being passed to the preprocessor, and
5455@option{-Wp} forcibly bypasses this phase. The preprocessor's direct
5456interface is undocumented and subject to change, so whenever possible
5457you should avoid using @option{-Wp} and let the driver handle the
5458options instead.
5459
4977bab6
ZW
5460@item -Xpreprocessor @var{option}
5461@opindex preprocessor
5462Pass @var{option} as an option to the preprocessor. You can use this to
5463supply system-specific preprocessor options which GCC does not know how to
5464recognize.
5465
5466If you want to pass an option that takes an argument, you must use
5467@option{-Xpreprocessor} twice, once for the option and once for the argument.
5468@end table
5469
40adaa27 5470@include cppopts.texi
74291a4b
MM
5471
5472@node Assembler Options
5473@section Passing Options to the Assembler
5474
5475@c prevent bad page break with this line
5476You can pass options to the assembler.
5477
2642624b 5478@table @gcctabopt
aee96fe9 5479@item -Wa,@var{option}
cd3bb277 5480@opindex Wa
74291a4b
MM
5481Pass @var{option} as an option to the assembler. If @var{option}
5482contains commas, it is split into multiple options at the commas.
4977bab6
ZW
5483
5484@item -Xassembler @var{option}
5485@opindex Xassembler
5486Pass @var{option} as an option to the assembler. You can use this to
5487supply system-specific assembler options which GCC does not know how to
5488recognize.
5489
5490If you want to pass an option that takes an argument, you must use
5491@option{-Xassembler} twice, once for the option and once for the argument.
5492
74291a4b
MM
5493@end table
5494
5495@node Link Options
5496@section Options for Linking
5497@cindex link options
5498@cindex options, linking
5499
5500These options come into play when the compiler links object files into
5501an executable output file. They are meaningless if the compiler is
5502not doing a link step.
5503
2642624b 5504@table @gcctabopt
74291a4b
MM
5505@cindex file names
5506@item @var{object-file-name}
5507A file name that does not end in a special recognized suffix is
5508considered to name an object file or library. (Object files are
5509distinguished from libraries by the linker according to the file
5510contents.) If linking is done, these object files are used as input
5511to the linker.
5512
5513@item -c
5514@itemx -S
5515@itemx -E
cd3bb277
JM
5516@opindex c
5517@opindex S
5518@opindex E
74291a4b
MM
5519If any of these options is used, then the linker is not run, and
5520object file names should not be used as arguments. @xref{Overall
5521Options}.
5522
5523@cindex Libraries
5524@item -l@var{library}
4275c4c4 5525@itemx -l @var{library}
cd3bb277 5526@opindex l
4275c4c4
JS
5527Search the library named @var{library} when linking. (The second
5528alternative with the library as a separate argument is only for
5529POSIX compliance and is not recommended.)
74291a4b
MM
5530
5531It makes a difference where in the command you write this option; the
4275c4c4 5532linker searches and processes libraries and object files in the order they
74291a4b
MM
5533are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
5534after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
5535to functions in @samp{z}, those functions may not be loaded.
5536
5537The linker searches a standard list of directories for the library,
5538which is actually a file named @file{lib@var{library}.a}. The linker
5539then uses this file as if it had been specified precisely by name.
5540
5541The directories searched include several standard system directories
630d3d5a 5542plus any that you specify with @option{-L}.
74291a4b
MM
5543
5544Normally the files found this way are library files---archive files
5545whose members are object files. The linker handles an archive file by
5546scanning through it for members which define symbols that have so far
5547been referenced but not defined. But if the file that is found is an
5548ordinary object file, it is linked in the usual fashion. The only
630d3d5a
JM
5549difference between using an @option{-l} option and specifying a file name
5550is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
74291a4b
MM
5551and searches several directories.
5552
5553@item -lobjc
cd3bb277 5554@opindex lobjc
630d3d5a 5555You need this special case of the @option{-l} option in order to
46e34f96 5556link an Objective-C or Objective-C++ program.
74291a4b
MM
5557
5558@item -nostartfiles
cd3bb277 5559@opindex nostartfiles
74291a4b 5560Do not use the standard system startup files when linking.
bedc7537
NC
5561The standard system libraries are used normally, unless @option{-nostdlib}
5562or @option{-nodefaultlibs} is used.
74291a4b
MM
5563
5564@item -nodefaultlibs
cd3bb277 5565@opindex nodefaultlibs
74291a4b
MM
5566Do not use the standard system libraries when linking.
5567Only the libraries you specify will be passed to the linker.
bedc7537 5568The standard startup files are used normally, unless @option{-nostartfiles}
8f99553f
JM
5569is used. The compiler may generate calls to @code{memcmp},
5570@code{memset}, @code{memcpy} and @code{memmove}.
5571These entries are usually resolved by entries in
4754172c
CM
5572libc. These entry points should be supplied through some other
5573mechanism when this option is specified.
74291a4b
MM
5574
5575@item -nostdlib
cd3bb277 5576@opindex nostdlib
74291a4b
MM
5577Do not use the standard system startup files or libraries when linking.
5578No startup files and only the libraries you specify will be passed to
8f99553f
JM
5579the linker. The compiler may generate calls to @code{memcmp}, @code{memset},
5580@code{memcpy} and @code{memmove}.
5581These entries are usually resolved by entries in
4754172c
CM
5582libc. These entry points should be supplied through some other
5583mechanism when this option is specified.
74291a4b 5584
630d3d5a
JM
5585@cindex @option{-lgcc}, use with @option{-nostdlib}
5586@cindex @option{-nostdlib} and unresolved references
5587@cindex unresolved references and @option{-nostdlib}
5588@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
5589@cindex @option{-nodefaultlibs} and unresolved references
5590@cindex unresolved references and @option{-nodefaultlibs}
5591One of the standard libraries bypassed by @option{-nostdlib} and
5592@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
0c2d1a2a 5593that GCC uses to overcome shortcomings of particular machines, or special
74291a4b 5594needs for some languages.
b11cc610
JM
5595(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
5596Collection (GCC) Internals},
74291a4b 5597for more discussion of @file{libgcc.a}.)
74291a4b 5598In most cases, you need @file{libgcc.a} even when you want to avoid
630d3d5a
JM
5599other standard libraries. In other words, when you specify @option{-nostdlib}
5600or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
0c2d1a2a 5601This ensures that you have no unresolved references to internal GCC
74291a4b 5602library subroutines. (For example, @samp{__main}, used to ensure C++
b11cc610
JM
5603constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
5604GNU Compiler Collection (GCC) Internals}.)
74291a4b 5605
24a4dd31
JJ
5606@item -pie
5607@opindex pie
5608Produce a position independent executable on targets which support it.
5609For predictable results, you must also specify the same set of options
5610that were used to generate code (@option{-fpie}, @option{-fPIE},
5611or model suboptions) when you specify this option.
5612
74291a4b 5613@item -s
cd3bb277 5614@opindex s
74291a4b
MM
5615Remove all symbol table and relocation information from the executable.
5616
5617@item -static
cd3bb277 5618@opindex static
74291a4b
MM
5619On systems that support dynamic linking, this prevents linking with the shared
5620libraries. On other systems, this option has no effect.
5621
5622@item -shared
cd3bb277 5623@opindex shared
74291a4b 5624Produce a shared object which can then be linked with other objects to
1d3b0e2c 5625form an executable. Not all systems support this option. For predictable
02f52e19 5626results, you must also specify the same set of options that were used to
630d3d5a 5627generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
2642624b 5628when you specify this option.@footnote{On some systems, @samp{gcc -shared}
767094dd 5629needs to build supplementary stub code for constructors to work. On
2642624b 5630multi-libbed systems, @samp{gcc -shared} must select the correct support
1d3b0e2c 5631libraries to link against. Failing to supply the correct flags may lead
767094dd 5632to subtle defects. Supplying them in cases where they are not necessary
1d3b0e2c 5633is innocuous.}
74291a4b 5634
9db0819e
RH
5635@item -shared-libgcc
5636@itemx -static-libgcc
cd3bb277
JM
5637@opindex shared-libgcc
5638@opindex static-libgcc
9db0819e
RH
5639On systems that provide @file{libgcc} as a shared library, these options
5640force the use of either the shared or static version respectively.
5641If no shared version of @file{libgcc} was built when the compiler was
5642configured, these options have no effect.
5643
5644There are several situations in which an application should use the
5645shared @file{libgcc} instead of the static version. The most common
5646of these is when the application wishes to throw and catch exceptions
5647across different shared libraries. In that case, each of the libraries
5648as well as the application itself should use the shared @file{libgcc}.
5649
5c181756
AO
5650Therefore, the G++ and GCJ drivers automatically add
5651@option{-shared-libgcc} whenever you build a shared library or a main
5652executable, because C++ and Java programs typically use exceptions, so
5653this is the right thing to do.
5654
5655If, instead, you use the GCC driver to create shared libraries, you may
5656find that they will not always be linked with the shared @file{libgcc}.
d3144423
EB
5657If GCC finds, at its configuration time, that you have a non-GNU linker
5658or a GNU linker that does not support option @option{--eh-frame-hdr},
5659it will link the shared version of @file{libgcc} into shared libraries
5660by default. Otherwise, it will take advantage of the linker and optimize
5661away the linking with the shared version of @file{libgcc}, linking with
5662the static version of libgcc by default. This allows exceptions to
5663propagate through such shared libraries, without incurring relocation
5664costs at library load time.
5c181756
AO
5665
5666However, if a library or main executable is supposed to throw or catch
5667exceptions, you must link it using the G++ or GCJ driver, as appropriate
5668for the languages used in the program, or using the option
5669@option{-shared-libgcc}, such that it is linked with the shared
049f6ec9 5670@file{libgcc}.
9db0819e 5671
74291a4b 5672@item -symbolic
cd3bb277 5673@opindex symbolic
74291a4b
MM
5674Bind references to global symbols when building a shared object. Warn
5675about any unresolved references (unless overridden by the link editor
5676option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
5677this option.
5678
5679@item -Xlinker @var{option}
cd3bb277 5680@opindex Xlinker
74291a4b 5681Pass @var{option} as an option to the linker. You can use this to
0c2d1a2a 5682supply system-specific linker options which GCC does not know how to
74291a4b
MM
5683recognize.
5684
5685If you want to pass an option that takes an argument, you must use
630d3d5a
JM
5686@option{-Xlinker} twice, once for the option and once for the argument.
5687For example, to pass @option{-assert definitions}, you must write
74291a4b 5688@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
630d3d5a 5689@option{-Xlinker "-assert definitions"}, because this passes the entire
74291a4b
MM
5690string as a single argument, which is not what the linker expects.
5691
aee96fe9 5692@item -Wl,@var{option}
cd3bb277 5693@opindex Wl
74291a4b
MM
5694Pass @var{option} as an option to the linker. If @var{option} contains
5695commas, it is split into multiple options at the commas.
5696
5697@item -u @var{symbol}
cd3bb277 5698@opindex u
74291a4b 5699Pretend the symbol @var{symbol} is undefined, to force linking of
630d3d5a 5700library modules to define it. You can use @option{-u} multiple times with
74291a4b
MM
5701different symbols to force loading of additional library modules.
5702@end table
5703
5704@node Directory Options
5705@section Options for Directory Search
5706@cindex directory options
5707@cindex options, directory search
5708@cindex search path
5709
5710These options specify directories to search for header files, for
5711libraries and for parts of the compiler:
5712
2642624b 5713@table @gcctabopt
74291a4b 5714@item -I@var{dir}
cd3bb277 5715@opindex I
861bb6c1
JL
5716Add the directory @var{dir} to the head of the list of directories to be
5717searched for header files. This can be used to override a system header
5718file, substituting your own version, since these directories are
d0a5eb32
RK
5719searched before the system header file directories. However, you should
5720not use this option to add directories that contain vendor-supplied
767094dd 5721system header files (use @option{-isystem} for that). If you use more than
630d3d5a 5722one @option{-I} option, the directories are scanned in left-to-right
74291a4b
MM
5723order; the standard system directories come after.
5724
dbead49c 5725If a standard system include directory, or a directory specified with
48209ce5
JDA
5726@option{-isystem}, is also specified with @option{-I}, the @option{-I}
5727option will be ignored. The directory will still be searched but as a
5728system directory at its normal position in the system include chain.
5729This is to ensure that GCC's procedure to fix buggy system headers and
3364c33b 5730the ordering for the include_next directive are not inadvertently changed.
48209ce5
JDA
5731If you really need to change the search order for system directories,
5732use the @option{-nostdinc} and/or @option{-isystem} options.
dbead49c 5733
4bed3787
MS
5734@item -iquote@var{dir}
5735@opindex iquote
5736Add the directory @var{dir} to the head of the list of directories to
5737be searched for header files only for the case of @samp{#include
5738"@var{file}"}; they are not searched for @samp{#include <@var{file}>},
5739otherwise just like @option{-I}.
74291a4b
MM
5740
5741@item -L@var{dir}
cd3bb277 5742@opindex L
74291a4b 5743Add directory @var{dir} to the list of directories to be searched
630d3d5a 5744for @option{-l}.
74291a4b
MM
5745
5746@item -B@var{prefix}
cd3bb277 5747@opindex B
74291a4b
MM
5748This option specifies where to find the executables, libraries,
5749include files, and data files of the compiler itself.
5750
5751The compiler driver program runs one or more of the subprograms
5752@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
5753@var{prefix} as a prefix for each program it tries to run, both with and
5754without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
5755
5756For each subprogram to be run, the compiler driver first tries the
630d3d5a 5757@option{-B} prefix, if any. If that name is not found, or if @option{-B}
74291a4b 5758was not specified, the driver tries two standard prefixes, which are
8e5f33ff 5759@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc/}. If neither of
74291a4b
MM
5760those results in a file name that is found, the unmodified program
5761name is searched for using the directories specified in your
bedc7537 5762@env{PATH} environment variable.
74291a4b 5763
07804c3b
NC
5764The compiler will check to see if the path provided by the @option{-B}
5765refers to a directory, and if necessary it will add a directory
5766separator character at the end of the path.
5767
630d3d5a 5768@option{-B} prefixes that effectively specify directory names also apply
74291a4b 5769to libraries in the linker, because the compiler translates these
630d3d5a 5770options into @option{-L} options for the linker. They also apply to
74291a4b 5771includes files in the preprocessor, because the compiler translates these
630d3d5a 5772options into @option{-isystem} options for the preprocessor. In this case,
74291a4b
MM
5773the compiler appends @samp{include} to the prefix.
5774
5775The run-time support file @file{libgcc.a} can also be searched for using
630d3d5a 5776the @option{-B} prefix, if needed. If it is not found there, the two
74291a4b
MM
5777standard prefixes above are tried, and that is all. The file is left
5778out of the link if it is not found by those means.
5779
630d3d5a 5780Another way to specify a prefix much like the @option{-B} prefix is to use
bedc7537 5781the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
74291a4b 5782Variables}.
861bb6c1 5783
07804c3b 5784As a special kludge, if the path provided by @option{-B} is
bf4eebe0
NC
5785@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
57869, then it will be replaced by @file{[dir/]include}. This is to help
7dac2f89 5787with boot-strapping the compiler.
07804c3b 5788
861bb6c1 5789@item -specs=@var{file}
cd3bb277 5790@opindex specs
861bb6c1
JL
5791Process @var{file} after the compiler reads in the standard @file{specs}
5792file, in order to override the defaults that the @file{gcc} driver
5793program uses when determining what switches to pass to @file{cc1},
5794@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
630d3d5a 5795@option{-specs=@var{file}} can be specified on the command line, and they
861bb6c1 5796are processed in order, from left to right.
4bed3787
MS
5797
5798@item -I-
5799@opindex I-
5800This option has been deprecated. Please use @option{-iquote} instead for
5801@option{-I} directories before the @option{-I-} and remove the @option{-I-}.
5802Any directories you specify with @option{-I} options before the @option{-I-}
5803option are searched only for the case of @samp{#include "@var{file}"};
5804they are not searched for @samp{#include <@var{file}>}.
5805
5806If additional directories are specified with @option{-I} options after
5807the @option{-I-}, these directories are searched for all @samp{#include}
5808directives. (Ordinarily @emph{all} @option{-I} directories are used
5809this way.)
5810
5811In addition, the @option{-I-} option inhibits the use of the current
5812directory (where the current input file came from) as the first search
5813directory for @samp{#include "@var{file}"}. There is no way to
5814override this effect of @option{-I-}. With @option{-I.} you can specify
5815searching the directory which was current when the compiler was
5816invoked. That is not exactly the same as what the preprocessor does
5817by default, but it is often satisfactory.
5818
5819@option{-I-} does not inhibit the use of the standard system directories
5820for header files. Thus, @option{-I-} and @option{-nostdinc} are
5821independent.
74291a4b
MM
5822@end table
5823
ee457005
JM
5824@c man end
5825
a743d340
NC
5826@node Spec Files
5827@section Specifying subprocesses and the switches to pass to them
5828@cindex Spec Files
d2d42a91 5829
bedc7537 5830@command{gcc} is a driver program. It performs its job by invoking a
a743d340
NC
5831sequence of other programs to do the work of compiling, assembling and
5832linking. GCC interprets its command-line parameters and uses these to
5833deduce which programs it should invoke, and which command-line options
c21cd8b1 5834it ought to place on their command lines. This behavior is controlled
a743d340
NC
5835by @dfn{spec strings}. In most cases there is one spec string for each
5836program that GCC can invoke, but a few programs have multiple spec
c21cd8b1 5837strings to control their behavior. The spec strings built into GCC can
630d3d5a 5838be overridden by using the @option{-specs=} command-line switch to specify
a743d340
NC
5839a spec file.
5840
5841@dfn{Spec files} are plaintext files that are used to construct spec
5842strings. They consist of a sequence of directives separated by blank
5843lines. The type of directive is determined by the first non-whitespace
5844character on the line and it can be one of the following:
5845
5846@table @code
5847@item %@var{command}
5848Issues a @var{command} to the spec file processor. The commands that can
02f52e19 5849appear here are:
a743d340
NC
5850
5851@table @code
5852@item %include <@var{file}>
5853@cindex %include
5854Search for @var{file} and insert its text at the current point in the
5855specs file.
5856
5857@item %include_noerr <@var{file}>
5858@cindex %include_noerr
5859Just like @samp{%include}, but do not generate an error message if the include
5860file cannot be found.
5861
5862@item %rename @var{old_name} @var{new_name}
5863@cindex %rename
5864Rename the spec string @var{old_name} to @var{new_name}.
5865
5866@end table
5867
5868@item *[@var{spec_name}]:
5869This tells the compiler to create, override or delete the named spec
5870string. All lines after this directive up to the next directive or
5871blank line are considered to be the text for the spec string. If this
5872results in an empty string then the spec will be deleted. (Or, if the
5873spec did not exist, then nothing will happened.) Otherwise, if the spec
5874does not currently exist a new spec will be created. If the spec does
5875exist then its contents will be overridden by the text of this
5876directive, unless the first character of that text is the @samp{+}
5877character, in which case the text will be appended to the spec.
5878
5879@item [@var{suffix}]:
5880Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
5881and up to the next directive or blank line are considered to make up the
02f52e19 5882spec string for the indicated suffix. When the compiler encounters an
a743d340
NC
5883input file with the named suffix, it will processes the spec string in
5884order to work out how to compile that file. For example:
5885
5886@smallexample
5887.ZZ:
5888z-compile -input %i
5889@end smallexample
5890
5891This says that any input file whose name ends in @samp{.ZZ} should be
5892passed to the program @samp{z-compile}, which should be invoked with the
630d3d5a 5893command-line switch @option{-input} and with the result of performing the
a743d340
NC
5894@samp{%i} substitution. (See below.)
5895
5896As an alternative to providing a spec string, the text that follows a
5897suffix directive can be one of the following:
5898
5899@table @code
5900@item @@@var{language}
5901This says that the suffix is an alias for a known @var{language}. This is
bedc7537 5902similar to using the @option{-x} command-line switch to GCC to specify a
a743d340
NC
5903language explicitly. For example:
5904
5905@smallexample
5906.ZZ:
5907@@c++
5908@end smallexample
5909
5910Says that .ZZ files are, in fact, C++ source files.
5911
5912@item #@var{name}
5913This causes an error messages saying:
5914
5915@smallexample
5916@var{name} compiler not installed on this system.
5917@end smallexample
5918@end table
5919
5920GCC already has an extensive list of suffixes built into it.
5921This directive will add an entry to the end of the list of suffixes, but
5922since the list is searched from the end backwards, it is effectively
5923possible to override earlier entries using this technique.
5924
5925@end table
5926
5927GCC has the following spec strings built into it. Spec files can
5928override these strings or create their own. Note that individual
02f52e19 5929targets can also add their own spec strings to this list.
a743d340
NC
5930
5931@smallexample
5932asm Options to pass to the assembler
5933asm_final Options to pass to the assembler post-processor
5934cpp Options to pass to the C preprocessor
5935cc1 Options to pass to the C compiler
5936cc1plus Options to pass to the C++ compiler
5937endfile Object files to include at the end of the link
5938link Options to pass to the linker
5939lib Libraries to include on the command line to the linker
5940libgcc Decides which GCC support library to pass to the linker
5941linker Sets the name of the linker
5942predefines Defines to be passed to the C preprocessor
310668e8
JM
5943signed_char Defines to pass to CPP to say whether @code{char} is signed
5944 by default
a743d340
NC
5945startfile Object files to include at the start of the link
5946@end smallexample
5947
5948Here is a small example of a spec file:
5949
5950@smallexample
5951%rename lib old_lib
5952
5953*lib:
5954--start-group -lgcc -lc -leval1 --end-group %(old_lib)
5955@end smallexample
5956
5957This example renames the spec called @samp{lib} to @samp{old_lib} and
5958then overrides the previous definition of @samp{lib} with a new one.
5959The new definition adds in some extra command-line options before
5960including the text of the old definition.
5961
5962@dfn{Spec strings} are a list of command-line options to be passed to their
5963corresponding program. In addition, the spec strings can contain
5964@samp{%}-prefixed sequences to substitute variable text or to
5965conditionally insert text into the command line. Using these constructs
5966it is possible to generate quite complex command lines.
5967
5968Here is a table of all defined @samp{%}-sequences for spec
5969strings. Note that spaces are not generated automatically around the
5970results of expanding these sequences. Therefore you can concatenate them
02f52e19 5971together or combine them with constant text in a single argument.
a743d340
NC
5972
5973@table @code
5974@item %%
5975Substitute one @samp{%} into the program name or argument.
5976
5977@item %i
5978Substitute the name of the input file being processed.
5979
5980@item %b
5981Substitute the basename of the input file being processed.
5982This is the substring up to (and not including) the last period
5983and not including the directory.
5984
371e300b
NC
5985@item %B
5986This is the same as @samp{%b}, but include the file suffix (text after
5987the last period).
5988
a743d340
NC
5989@item %d
5990Marks the argument containing or following the @samp{%d} as a
5991temporary file name, so that that file will be deleted if GCC exits
5992successfully. Unlike @samp{%g}, this contributes no text to the
02f52e19 5993argument.
a743d340
NC
5994
5995@item %g@var{suffix}
5996Substitute a file name that has suffix @var{suffix} and is chosen
5997once per compilation, and mark the argument in the same way as
5998@samp{%d}. To reduce exposure to denial-of-service attacks, the file
02f52e19 5999name is now chosen in a way that is hard to predict even when previously
695ac33f 6000chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
a743d340
NC
6001might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
6002the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
6003treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
6004was simply substituted with a file name chosen once per compilation,
6005without regard to any appended suffix (which was therefore treated
6006just like ordinary text), making such attacks more likely to succeed.
6007
6008@item %u@var{suffix}
6009Like @samp{%g}, but generates a new temporary file name even if
6010@samp{%u@var{suffix}} was already seen.
6011
6012@item %U@var{suffix}
6013Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
6014new one if there is no such last file name. In the absence of any
6015@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
695ac33f 6016the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
a743d340
NC
6017would involve the generation of two distinct file names, one
6018for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
6019simply substituted with a file name chosen for the previous @samp{%u},
6020without regard to any appended suffix.
6021
4977bab6 6022@item %j@var{suffix}
aee96fe9 6023Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
371e300b
NC
6024writable, and if save-temps is off; otherwise, substitute the name
6025of a temporary file, just like @samp{%u}. This temporary file is not
6026meant for communication between processes, but rather as a junk
6027disposal mechanism.
6028
4977bab6
ZW
6029@item %|@var{suffix}
6030@itemx %m@var{suffix}
6031Like @samp{%g}, except if @option{-pipe} is in effect. In that case
6032@samp{%|} substitutes a single dash and @samp{%m} substitutes nothing at
6033all. These are the two most common ways to instruct a program that it
6034should read from standard input or write to standard output. If you
6035need something more elaborate you can use an @samp{%@{pipe:@code{X}@}}
6036construct: see for example @file{f/lang-specs.h}.
6037
371e300b
NC
6038@item %.@var{SUFFIX}
6039Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
767094dd 6040when it is subsequently output with @samp{%*}. @var{SUFFIX} is
371e300b
NC
6041terminated by the next space or %.
6042
a743d340
NC
6043@item %w
6044Marks the argument containing or following the @samp{%w} as the
6045designated output file of this compilation. This puts the argument
6046into the sequence of arguments that @samp{%o} will substitute later.
6047
6048@item %o
6049Substitutes the names of all the output files, with spaces
6050automatically placed around them. You should write spaces
6051around the @samp{%o} as well or the results are undefined.
6052@samp{%o} is for use in the specs for running the linker.
6053Input files whose names have no recognized suffix are not compiled
6054at all, but they are included among the output files, so they will
6055be linked.
6056
6057@item %O
6058Substitutes the suffix for object files. Note that this is
6059handled specially when it immediately follows @samp{%g, %u, or %U},
6060because of the need for those to form complete file names. The
6061handling is such that @samp{%O} is treated exactly as if it had already
6062been substituted, except that @samp{%g, %u, and %U} do not currently
6063support additional @var{suffix} characters following @samp{%O} as they would
6064following, for example, @samp{.o}.
6065
6066@item %p
6067Substitutes the standard macro predefinitions for the
6068current target machine. Use this when running @code{cpp}.
6069
6070@item %P
6071Like @samp{%p}, but puts @samp{__} before and after the name of each
6072predefined macro, except for macros that start with @samp{__} or with
c1030c7c 6073@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
161d7b59 6074C@.
a743d340
NC
6075
6076@item %I
047d636f
DJ
6077Substitute any of @option{-iprefix} (made from @env{GCC_EXEC_PREFIX}),
6078@option{-isysroot} (made from @env{TARGET_SYSTEM_ROOT}), and
6079@option{-isystem} (made from @env{COMPILER_PATH} and @option{-B} options)
6080as necessary.
a743d340
NC
6081
6082@item %s
6083Current argument is the name of a library or startup file of some sort.
6084Search for that file in a standard list of directories and substitute
02f52e19 6085the full name found.
a743d340
NC
6086
6087@item %e@var{str}
6088Print @var{str} as an error message. @var{str} is terminated by a newline.
6089Use this when inconsistent options are detected.
6090
a743d340
NC
6091@item %(@var{name})
6092Substitute the contents of spec string @var{name} at this point.
6093
6094@item %[@var{name}]
630d3d5a 6095Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
a743d340
NC
6096
6097@item %x@{@var{option}@}
6098Accumulate an option for @samp{%X}.
6099
6100@item %X
630d3d5a 6101Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
a743d340
NC
6102spec string.
6103
6104@item %Y
630d3d5a 6105Output the accumulated assembler options specified by @option{-Wa}.
a743d340
NC
6106
6107@item %Z
630d3d5a 6108Output the accumulated preprocessor options specified by @option{-Wp}.
a743d340 6109
a743d340
NC
6110@item %a
6111Process the @code{asm} spec. This is used to compute the
6112switches to be passed to the assembler.
6113
6114@item %A
6115Process the @code{asm_final} spec. This is a spec string for
6116passing switches to an assembler post-processor, if such a program is
6117needed.
6118
6119@item %l
6120Process the @code{link} spec. This is the spec for computing the
6121command line passed to the linker. Typically it will make use of the
6122@samp{%L %G %S %D and %E} sequences.
6123
6124@item %D
630d3d5a 6125Dump out a @option{-L} option for each directory that GCC believes might
a743d340 6126contain startup files. If the target supports multilibs then the
02f52e19 6127current multilib directory will be prepended to each of these paths.
a743d340 6128
371e300b 6129@item %M
c771326b 6130Output the multilib directory with directory separators replaced with
695ac33f
JM
6131@samp{_}. If multilib directories are not set, or the multilib directory is
6132@file{.} then this option emits nothing.
371e300b 6133
a743d340
NC
6134@item %L
6135Process the @code{lib} spec. This is a spec string for deciding which
02f52e19 6136libraries should be included on the command line to the linker.
a743d340
NC
6137
6138@item %G
6139Process the @code{libgcc} spec. This is a spec string for deciding
02f52e19 6140which GCC support library should be included on the command line to the linker.
a743d340
NC
6141
6142@item %S
6143Process the @code{startfile} spec. This is a spec for deciding which
6144object files should be the first ones passed to the linker. Typically
02f52e19 6145this might be a file named @file{crt0.o}.
a743d340
NC
6146
6147@item %E
6148Process the @code{endfile} spec. This is a spec string that specifies
02f52e19 6149the last object files that will be passed to the linker.
a743d340
NC
6150
6151@item %C
6152Process the @code{cpp} spec. This is used to construct the arguments
6153to be passed to the C preprocessor.
6154
a743d340
NC
6155@item %1
6156Process the @code{cc1} spec. This is used to construct the options to be
6157passed to the actual C compiler (@samp{cc1}).
6158
6159@item %2
6160Process the @code{cc1plus} spec. This is used to construct the options to be
6161passed to the actual C++ compiler (@samp{cc1plus}).
6162
6163@item %*
6164Substitute the variable part of a matched option. See below.
6165Note that each comma in the substituted string is replaced by
6166a single space.
6167
4977bab6
ZW
6168@item %<@code{S}
6169Remove all occurrences of @code{-S} from the command line. Note---this
6170command is position dependent. @samp{%} commands in the spec string
6171before this one will see @code{-S}, @samp{%} commands in the spec string
6172after this one will not.
6173
f3226a90
JT
6174@item %:@var{function}(@var{args})
6175Call the named function @var{function}, passing it @var{args}.
6176@var{args} is first processed as a nested spec string, then split
6177into an argument vector in the usual fashion. The function returns
6178a string which is processed as if it had appeared literally as part
6179of the current spec.
6180
6181The following built-in spec functions are provided:
6182
6183@table @code
6184@item @code{if-exists}
6185The @code{if-exists} spec function takes one argument, an absolute
6186pathname to a file. If the file exists, @code{if-exists} returns the
6187pathname. Here is a small example of its usage:
6188
6189@smallexample
6190*startfile:
6191crt0%O%s %:if-exists(crti%O%s) crtbegin%O%s
6192@end smallexample
152a5a9c
JT
6193
6194@item @code{if-exists-else}
6195The @code{if-exists-else} spec function is similar to the @code{if-exists}
6196spec function, except that it takes two arguments. The first argument is
6197an absolute pathname to a file. If the file exists, @code{if-exists-else}
6198returns the pathname. If it does not exist, it returns the second argument.
6199This way, @code{if-exists-else} can be used to select one file or another,
6200based on the existence of the first. Here is a small example of its usage:
6201
daf2f129 6202@smallexample
152a5a9c 6203*startfile:
f5034c5e
JM
6204crt0%O%s %:if-exists(crti%O%s) \
6205%:if-exists-else(crtbeginT%O%s crtbegin%O%s)
152a5a9c 6206@end smallexample
daf2f129 6207@end table
f3226a90 6208
a743d340 6209@item %@{@code{S}@}
161d7b59 6210Substitutes the @code{-S} switch, if that switch was given to GCC@.
a743d340
NC
6211If that switch was not specified, this substitutes nothing. Note that
6212the leading dash is omitted when specifying this option, and it is
6213automatically inserted if the substitution is performed. Thus the spec
630d3d5a
JM
6214string @samp{%@{foo@}} would match the command-line option @option{-foo}
6215and would output the command line option @option{-foo}.
a743d340
NC
6216
6217@item %W@{@code{S}@}
6218Like %@{@code{S}@} but mark last argument supplied within as a file to be
02f52e19 6219deleted on failure.
a743d340
NC
6220
6221@item %@{@code{S}*@}
6222Substitutes all the switches specified to GCC whose names start
6223with @code{-S}, but which also take an argument. This is used for
695ac33f 6224switches like @option{-o}, @option{-D}, @option{-I}, etc.
630d3d5a 6225GCC considers @option{-o foo} as being
a743d340 6226one switch whose names starts with @samp{o}. %@{o*@} would substitute this
02f52e19 6227text, including the space. Thus two arguments would be generated.
a743d340 6228
371e300b
NC
6229@item %@{@code{S}*&@code{T}*@}
6230Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
6231(the order of @code{S} and @code{T} in the spec is not significant).
6232There can be any number of ampersand-separated variables; for each the
6233wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
6234
a743d340 6235@item %@{@code{S}:@code{X}@}
4977bab6 6236Substitutes @code{X}, if the @samp{-S} switch was given to GCC@.
a743d340
NC
6237
6238@item %@{!@code{S}:@code{X}@}
4977bab6 6239Substitutes @code{X}, if the @samp{-S} switch was @emph{not} given to GCC@.
a743d340 6240
4977bab6
ZW
6241@item %@{@code{S}*:@code{X}@}
6242Substitutes @code{X} if one or more switches whose names start with
6243@code{-S} are specified to GCC@. Normally @code{X} is substituted only
6244once, no matter how many such switches appeared. However, if @code{%*}
6245appears somewhere in @code{X}, then @code{X} will be substituted once
6246for each matching switch, with the @code{%*} replaced by the part of
6247that switch that matched the @code{*}.
a743d340
NC
6248
6249@item %@{.@code{S}:@code{X}@}
4977bab6 6250Substitutes @code{X}, if processing a file with suffix @code{S}.
a743d340
NC
6251
6252@item %@{!.@code{S}:@code{X}@}
4977bab6 6253Substitutes @code{X}, if @emph{not} processing a file with suffix @code{S}.
a743d340
NC
6254
6255@item %@{@code{S}|@code{P}:@code{X}@}
4977bab6
ZW
6256Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.
6257This may be combined with @samp{!}, @samp{.}, and @code{*} sequences as well,
6258although they have a stronger binding than the @samp{|}. If @code{%*}
6259appears in @code{X}, all of the alternatives must be starred, and only
6260the first matching alternative is substituted.
6261
6262For example, a spec string like this:
a743d340
NC
6263
6264@smallexample
6265%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
6266@end smallexample
6267
6268will output the following command-line options from the following input
6269command-line options:
6270
6271@smallexample
6272fred.c -foo -baz
6273jim.d -bar -boggle
6274-d fred.c -foo -baz -boggle
6275-d jim.d -bar -baz -boggle
6276@end smallexample
6277
4977bab6
ZW
6278@item %@{S:X; T:Y; :D@}
6279
c0cbdbd9
KH
6280If @code{S} was given to GCC, substitutes @code{X}; else if @code{T} was
6281given to GCC, substitutes @code{Y}; else substitutes @code{D}. There can
daf2f129 6282be as many clauses as you need. This may be combined with @code{.},
4977bab6
ZW
6283@code{!}, @code{|}, and @code{*} as needed.
6284
6285
a743d340
NC
6286@end table
6287
4977bab6
ZW
6288The conditional text @code{X} in a %@{@code{S}:@code{X}@} or similar
6289construct may contain other nested @samp{%} constructs or spaces, or
6290even newlines. They are processed as usual, as described above.
6291Trailing white space in @code{X} is ignored. White space may also
6292appear anywhere on the left side of the colon in these constructs,
6293except between @code{.} or @code{*} and the corresponding word.
a743d340 6294
4977bab6
ZW
6295The @option{-O}, @option{-f}, @option{-m}, and @option{-W} switches are
6296handled specifically in these constructs. If another value of
6297@option{-O} or the negated form of a @option{-f}, @option{-m}, or
6298@option{-W} switch is found later in the command line, the earlier
6299switch value is ignored, except with @{@code{S}*@} where @code{S} is
6300just one letter, which passes all matching options.
a743d340 6301
4977bab6
ZW
6302The character @samp{|} at the beginning of the predicate text is used to
6303indicate that a command should be piped to the following command, but
6304only if @option{-pipe} is specified.
a743d340
NC
6305
6306It is built into GCC which switches take arguments and which do not.
6307(You might think it would be useful to generalize this to allow each
6308compiler's spec to say which switches take arguments. But this cannot
6309be done in a consistent fashion. GCC cannot even decide which input
6310files have been specified without knowing which switches take arguments,
6311and it must know which input files to compile in order to tell which
02f52e19 6312compilers to run).
a743d340 6313
630d3d5a 6314GCC also knows implicitly that arguments starting in @option{-l} are to be
a743d340
NC
6315treated as compiler output files, and passed to the linker in their
6316proper position among the other output files.
6317
ee457005
JM
6318@c man begin OPTIONS
6319
74291a4b
MM
6320@node Target Options
6321@section Specifying Target Machine and Compiler Version
6322@cindex target options
6323@cindex cross compiling
6324@cindex specifying machine version
6325@cindex specifying compiler version and target machine
6326@cindex compiler version, specifying
6327@cindex target machine, specifying
6328
37a4aa31
GK
6329The usual way to run GCC is to run the executable called @file{gcc}, or
6330@file{<machine>-gcc} when cross-compiling, or
6331@file{<machine>-gcc-<version>} to run a version other than the one that
6332was installed last. Sometimes this is inconvenient, so GCC provides
6333options that will switch to another cross-compiler or version.
74291a4b 6334
2642624b 6335@table @gcctabopt
74291a4b 6336@item -b @var{machine}
cd3bb277 6337@opindex b
74291a4b 6338The argument @var{machine} specifies the target machine for compilation.
74291a4b
MM
6339
6340The value to use for @var{machine} is the same as was specified as the
0c2d1a2a 6341machine type when configuring GCC as a cross-compiler. For
74291a4b
MM
6342example, if a cross-compiler was configured with @samp{configure
6343i386v}, meaning to compile for an 80386 running System V, then you
630d3d5a 6344would specify @option{-b i386v} to run that cross compiler.
74291a4b 6345
37a4aa31
GK
6346@item -V @var{version}
6347@opindex V
6348The argument @var{version} specifies which version of GCC to run.
6349This is useful when multiple versions are installed. For example,
6350@var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
74291a4b
MM
6351@end table
6352
37a4aa31
GK
6353The @option{-V} and @option{-b} options work by running the
6354@file{<machine>-gcc-<version>} executable, so there's no real reason to
6355use them if you can just run that directly.
74291a4b
MM
6356
6357@node Submodel Options
6358@section Hardware Models and Configurations
6359@cindex submodel options
6360@cindex specifying hardware config
6361@cindex hardware models and configurations, specifying
6362@cindex machine dependent options
6363
630d3d5a 6364Earlier we discussed the standard option @option{-b} which chooses among
74291a4b 6365different installed compilers for completely different target
8aeea6e6 6366machines, such as VAX vs.@: 68000 vs.@: 80386.
74291a4b
MM
6367
6368In addition, each of these target machine types can have its own
6369special options, starting with @samp{-m}, to choose among various
6370hardware models or configurations---for example, 68010 vs 68020,
6371floating coprocessor or none. A single installed version of the
6372compiler can compile for any model or configuration, according to the
6373options specified.
6374
6375Some configurations of the compiler also support additional special
6376options, usually for compatibility with other compilers on the same
6377platform.
6378
74291a4b
MM
6379These options are defined by the macro @code{TARGET_SWITCHES} in the
6380machine description. The default for the options is also defined by
6381that macro, which enables you to change the defaults.
74291a4b 6382
39bc1876
NS
6383@c This list is ordered alphanumerically by subsection name.
6384@c It should be the same order and spelling as these options are listed
6385@c in Machine Dependent Options
6386
74291a4b 6387@menu
39bc1876 6388* ARC Options::
74291a4b 6389* ARM Options::
39bc1876
NS
6390* AVR Options::
6391* CRIS Options::
48aec0bc 6392* Darwin Options::
74291a4b 6393* DEC Alpha Options::
d7c23cdc 6394* DEC Alpha/VMS Options::
39bc1876 6395* FRV Options::
74291a4b 6396* H8/300 Options::
39bc1876
NS
6397* HPPA Options::
6398* i386 and x86-64 Options::
6399* IA-64 Options::
6400* M32R/D Options::
6401* M680x0 Options::
6402* M68hc1x Options::
6403* MCore Options::
6404* MIPS Options::
6405* MMIX Options::
6406* MN10300 Options::
6407* NS32K Options::
6408* PDP-11 Options::
6409* PowerPC Options::
6410* RS/6000 and PowerPC Options::
6411* S/390 and zSeries Options::
74291a4b 6412* SH Options::
39bc1876 6413* SPARC Options::
74291a4b 6414* System V Options::
282a61e6 6415* TMS320C3x/C4x Options::
f84271d9 6416* V850 Options::
39bc1876
NS
6417* VAX Options::
6418* x86-64 Options::
69a0611f 6419* Xstormy16 Options::
03984308 6420* Xtensa Options::
39bc1876 6421* zSeries Options::
74291a4b
MM
6422@end menu
6423
39bc1876
NS
6424@node ARC Options
6425@subsection ARC Options
6426@cindex ARC Options
74291a4b 6427
39bc1876 6428These options are defined for ARC implementations:
74291a4b 6429
2642624b 6430@table @gcctabopt
39bc1876
NS
6431@item -EL
6432@opindex EL
6433Compile code for little endian mode. This is the default.
74cf1c6d 6434
39bc1876
NS
6435@item -EB
6436@opindex EB
6437Compile code for big endian mode.
74291a4b 6438
39bc1876
NS
6439@item -mmangle-cpu
6440@opindex mmangle-cpu
6441Prepend the name of the cpu to all public symbol names.
6442In multiple-processor systems, there are many ARC variants with different
6443instruction and register set characteristics. This flag prevents code
6444compiled for one cpu to be linked with code compiled for another.
6445No facility exists for handling variants that are ``almost identical''.
6446This is an all or nothing option.
74291a4b 6447
39bc1876
NS
6448@item -mcpu=@var{cpu}
6449@opindex mcpu
6450Compile code for ARC variant @var{cpu}.
6451Which variants are supported depend on the configuration.
6452All variants support @option{-mcpu=base}, this is the default.
74291a4b 6453
39bc1876
NS
6454@item -mtext=@var{text-section}
6455@itemx -mdata=@var{data-section}
6456@itemx -mrodata=@var{readonly-data-section}
6457@opindex mtext
6458@opindex mdata
6459@opindex mrodata
6460Put functions, data, and readonly data in @var{text-section},
6461@var{data-section}, and @var{readonly-data-section} respectively
6462by default. This can be overridden with the @code{section} attribute.
6463@xref{Variable Attributes}.
74291a4b 6464
39bc1876 6465@end table
74291a4b 6466
39bc1876
NS
6467@node ARM Options
6468@subsection ARM Options
6469@cindex ARM options
74291a4b 6470
39bc1876
NS
6471These @samp{-m} options are defined for Advanced RISC Machines (ARM)
6472architectures:
74cf1c6d 6473
39bc1876
NS
6474@table @gcctabopt
6475@item -mabi=@var{name}
6476@opindex mabi
6477Generate code for the specified ABI. Permissible values are: @samp{apcs-gnu},
6478@samp{atpcs}, @samp{aapcs} and @samp{iwmmxt}.
74cf1c6d 6479
39bc1876
NS
6480@item -mapcs-frame
6481@opindex mapcs-frame
6482Generate a stack frame that is compliant with the ARM Procedure Call
6483Standard for all functions, even if this is not strictly necessary for
6484correct execution of the code. Specifying @option{-fomit-frame-pointer}
6485with this option will cause the stack frames not to be generated for
6486leaf functions. The default is @option{-mno-apcs-frame}.
74291a4b 6487
39bc1876
NS
6488@item -mapcs
6489@opindex mapcs
6490This is a synonym for @option{-mapcs-frame}.
74291a4b 6491
39bc1876
NS
6492@ignore
6493@c not currently implemented
6494@item -mapcs-stack-check
6495@opindex mapcs-stack-check
6496Generate code to check the amount of stack space available upon entry to
6497every function (that actually uses some stack space). If there is
6498insufficient space available then either the function
6499@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
6500called, depending upon the amount of stack space required. The run time
6501system is required to provide these functions. The default is
6502@option{-mno-apcs-stack-check}, since this produces smaller code.
74cf1c6d 6503
39bc1876
NS
6504@c not currently implemented
6505@item -mapcs-float
6506@opindex mapcs-float
6507Pass floating point arguments using the float point registers. This is
6508one of the variants of the APCS@. This option is recommended if the
6509target hardware has a floating point unit or if a lot of floating point
6510arithmetic is going to be performed by the code. The default is
6511@option{-mno-apcs-float}, since integer only code is slightly increased in
6512size if @option{-mapcs-float} is used.
74291a4b 6513
39bc1876
NS
6514@c not currently implemented
6515@item -mapcs-reentrant
6516@opindex mapcs-reentrant
6517Generate reentrant, position independent code. The default is
6518@option{-mno-apcs-reentrant}.
6519@end ignore
74291a4b 6520
39bc1876
NS
6521@item -mthumb-interwork
6522@opindex mthumb-interwork
6523Generate code which supports calling between the ARM and Thumb
6524instruction sets. Without this option the two instruction sets cannot
6525be reliably used inside one program. The default is
6526@option{-mno-thumb-interwork}, since slightly larger code is generated
6527when @option{-mthumb-interwork} is specified.
6528
6529@item -mno-sched-prolog
6530@opindex mno-sched-prolog
6531Prevent the reordering of instructions in the function prolog, or the
6532merging of those instruction with the instructions in the function's
6533body. This means that all functions will start with a recognizable set
6534of instructions (or in fact one of a choice from a small set of
6535different function prologues), and this information can be used to
6536locate the start if functions inside an executable piece of code. The
6537default is @option{-msched-prolog}.
6538
6539@item -mhard-float
6540@opindex mhard-float
6541Generate output containing floating point instructions. This is the
6542default.
861bb6c1 6543
74291a4b 6544@item -msoft-float
cd3bb277 6545@opindex msoft-float
74291a4b 6546Generate output containing library calls for floating point.
39bc1876 6547@strong{Warning:} the requisite libraries are not available for all ARM
74291a4b 6548targets. Normally the facilities of the machine's usual C compiler are
39bc1876
NS
6549used, but this cannot be done directly in cross-compilation. You must make
6550your own arrangements to provide suitable library functions for
6551cross-compilation.
74291a4b 6552
39bc1876
NS
6553@option{-msoft-float} changes the calling convention in the output file;
6554therefore, it is only useful if you compile @emph{all} of a program with
6555this option. In particular, you need to compile @file{libgcc.a}, the
6556library that comes with GCC, with @option{-msoft-float} in order for
6557this to work.
74291a4b 6558
39bc1876
NS
6559@item -mfloat-abi=@var{name}
6560@opindex mfloat-abi
6561Specifies which ABI to use for floating point values. Permissible values
6562are: @samp{soft}, @samp{softfp} and @samp{hard}.
74291a4b 6563
39bc1876
NS
6564@samp{soft} and @samp{hard} are equivalent to @option{-msoft-float}
6565and @option{-mhard-float} respectively. @samp{softfp} allows the generation
6566of floating point instructions, but still uses the soft-float calling
6567conventions.
74291a4b 6568
39bc1876
NS
6569@item -mlittle-endian
6570@opindex mlittle-endian
6571Generate code for a processor running in little-endian mode. This is
6572the default for all standard configurations.
74291a4b 6573
39bc1876
NS
6574@item -mbig-endian
6575@opindex mbig-endian
6576Generate code for a processor running in big-endian mode; the default is
6577to compile code for a little-endian processor.
74291a4b 6578
39bc1876
NS
6579@item -mwords-little-endian
6580@opindex mwords-little-endian
6581This option only applies when generating code for big-endian processors.
6582Generate code for a little-endian word order but a big-endian byte
6583order. That is, a byte order of the form @samp{32107654}. Note: this
6584option should only be used if you require compatibility with code for
6585big-endian ARM processors generated by versions of the compiler prior to
65862.8.
74291a4b 6587
39bc1876
NS
6588@item -mcpu=@var{name}
6589@opindex mcpu
6590This specifies the name of the target ARM processor. GCC uses this name
6591to determine what kind of instructions it can emit when generating
6592assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
6593@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6594@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6595@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6596@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6597@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6598@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6599@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
f9e8581a
RE
6600@samp{arm920t}, @samp{arm922t}, @samp{arm946es}, @samp{arm966es},
6601@samp{arm968es}, @samp{arm926ejs}, @samp{arm940t}, @samp{arm9tdmi},
39bc1876 6602@samp{arm10tdmi}, @samp{arm1020t}, @samp{arm1026ejs},
f9e8581a 6603@samp{arm10e}, @samp{arm1020e}, @samp{arm1022e},
39bc1876
NS
6604@samp{arm1136js}, @samp{arm1136jfs} ,@samp{xscale}, @samp{iwmmxt},
6605@samp{ep9312}.
74291a4b 6606
39bc1876
NS
6607@itemx -mtune=@var{name}
6608@opindex mtune
6609This option is very similar to the @option{-mcpu=} option, except that
6610instead of specifying the actual target processor type, and hence
6611restricting which instructions can be used, it specifies that GCC should
6612tune the performance of the code as if the target were of the type
6613specified in this option, but still choosing the instructions that it
6614will generate based on the cpu specified by a @option{-mcpu=} option.
6615For some ARM implementations better performance can be obtained by using
6616this option.
861bb6c1 6617
39bc1876
NS
6618@item -march=@var{name}
6619@opindex march
6620This specifies the name of the target ARM architecture. GCC uses this
6621name to determine what kind of instructions it can emit when generating
6622assembly code. This option can be used in conjunction with or instead
6623of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
6624@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6625@samp{armv5}, @samp{armv5t}, @samp{armv5te}, @samp{armv6}, @samp{armv6j},
6626@samp{iwmmxt}, @samp{ep9312}.
861bb6c1 6627
39bc1876
NS
6628@item -mfpu=@var{name}
6629@itemx -mfpe=@var{number}
6630@itemx -mfp=@var{number}
6631@opindex mfpu
6632@opindex mfpe
6633@opindex mfp
6634This specifies what floating point hardware (or hardware emulation) is
6635available on the target. Permissible names are: @samp{fpa}, @samp{fpe2},
6636@samp{fpe3}, @samp{maverick}, @samp{vfp}. @option{-mfp} and @option{-mfpe}
6637are synonyms for @option{-mfpu}=@samp{fpe}@var{number}, for compatibility
6638with older versions of GCC@.
861bb6c1 6639
39bc1876
NS
6640If @option{-msoft-float} is specified this specifies the format of
6641floating point values.
fb868474 6642
39bc1876
NS
6643@item -mstructure-size-boundary=@var{n}
6644@opindex mstructure-size-boundary
6645The size of all structures and unions will be rounded up to a multiple
6646of the number of bits set by this option. Permissible values are 8, 32
6647and 64. The default value varies for different toolchains. For the COFF
6648targeted toolchain the default value is 8. A value of 64 is only allowed
6649if the underlying ABI supports it.
b71733d5 6650
39bc1876
NS
6651Specifying the larger number can produce faster, more efficient code, but
6652can also increase the size of the program. Different values are potentially
6653incompatible. Code compiled with one value cannot necessarily expect to
6654work with code or libraries compiled with another value, if they exchange
6655information using structures or unions.
24f9c4df 6656
39bc1876
NS
6657@item -mabort-on-noreturn
6658@opindex mabort-on-noreturn
6659Generate a call to the function @code{abort} at the end of a
6660@code{noreturn} function. It will be executed if the function tries to
6661return.
24f9c4df 6662
39bc1876
NS
6663@item -mlong-calls
6664@itemx -mno-long-calls
6665@opindex mlong-calls
6666@opindex mno-long-calls
6667Tells the compiler to perform function calls by first loading the
6668address of the function into a register and then performing a subroutine
6669call on this register. This switch is needed if the target function
6670will lie outside of the 64 megabyte addressing range of the offset based
6671version of subroutine call instruction.
24f9c4df 6672
39bc1876
NS
6673Even if this switch is enabled, not all function calls will be turned
6674into long calls. The heuristic is that static functions, functions
6675which have the @samp{short-call} attribute, functions that are inside
6676the scope of a @samp{#pragma no_long_calls} directive and functions whose
6677definitions have already been compiled within the current compilation
6678unit, will not be turned into long calls. The exception to this rule is
6679that weak function definitions, functions with the @samp{long-call}
6680attribute or the @samp{section} attribute, and functions that are within
6681the scope of a @samp{#pragma long_calls} directive, will always be
6682turned into long calls.
24f9c4df 6683
39bc1876
NS
6684This feature is not enabled by default. Specifying
6685@option{-mno-long-calls} will restore the default behavior, as will
6686placing the function calls within the scope of a @samp{#pragma
6687long_calls_off} directive. Note these switches have no effect on how
6688the compiler generates code to handle function calls via function
6689pointers.
24f9c4df 6690
39bc1876
NS
6691@item -mnop-fun-dllimport
6692@opindex mnop-fun-dllimport
6693Disable support for the @code{dllimport} attribute.
74291a4b 6694
39bc1876
NS
6695@item -msingle-pic-base
6696@opindex msingle-pic-base
6697Treat the register used for PIC addressing as read-only, rather than
6698loading it in the prologue for each function. The run-time system is
6699responsible for initializing this register with an appropriate value
6700before execution begins.
2856c3e3 6701
39bc1876
NS
6702@item -mpic-register=@var{reg}
6703@opindex mpic-register
6704Specify the register to be used for PIC addressing. The default is R10
6705unless stack-checking is enabled, when R9 is used.
2856c3e3 6706
39bc1876
NS
6707@item -mcirrus-fix-invalid-insns
6708@opindex mcirrus-fix-invalid-insns
6709@opindex mno-cirrus-fix-invalid-insns
6710Insert NOPs into the instruction stream to in order to work around
6711problems with invalid Maverick instruction combinations. This option
6712is only valid if the @option{-mcpu=ep9312} option has been used to
6713enable generation of instructions for the Cirrus Maverick floating
6714point co-processor. This option is not enabled by default, since the
6715problem is only present in older Maverick implementations. The default
6716can be re-enabled by use of the @option{-mno-cirrus-fix-invalid-insns}
6717switch.
2856c3e3 6718
39bc1876
NS
6719@item -mpoke-function-name
6720@opindex mpoke-function-name
6721Write the name of each function into the text section, directly
6722preceding the function prologue. The generated code is similar to this:
2856c3e3 6723
39bc1876
NS
6724@smallexample
6725 t0
6726 .ascii "arm_poke_function_name", 0
6727 .align
6728 t1
6729 .word 0xff000000 + (t1 - t0)
6730 arm_poke_function_name
6731 mov ip, sp
6732 stmfd sp!, @{fp, ip, lr, pc@}
6733 sub fp, ip, #4
6734@end smallexample
f077f169 6735
39bc1876
NS
6736When performing a stack backtrace, code can inspect the value of
6737@code{pc} stored at @code{fp + 0}. If the trace function then looks at
6738location @code{pc - 12} and the top 8 bits are set, then we know that
6739there is a function name embedded immediately preceding this location
6740and has length @code{((pc[-3]) & 0xff000000)}.
2856c3e3 6741
39bc1876
NS
6742@item -mthumb
6743@opindex mthumb
6744Generate code for the 16-bit Thumb instruction set. The default is to
6745use the 32-bit ARM instruction set.
8a0b86f5 6746
39bc1876
NS
6747@item -mtpcs-frame
6748@opindex mtpcs-frame
6749Generate a stack frame that is compliant with the Thumb Procedure Call
6750Standard for all non-leaf functions. (A leaf function is one that does
6751not call any other functions.) The default is @option{-mno-tpcs-frame}.
058edcdb 6752
39bc1876
NS
6753@item -mtpcs-leaf-frame
6754@opindex mtpcs-leaf-frame
6755Generate a stack frame that is compliant with the Thumb Procedure Call
6756Standard for all leaf functions. (A leaf function is one that does
6757not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
2856c3e3 6758
39bc1876
NS
6759@item -mcallee-super-interworking
6760@opindex mcallee-super-interworking
6761Gives all externally visible functions in the file being compiled an ARM
6762instruction set header which switches to Thumb mode before executing the
6763rest of the function. This allows these functions to be called from
6764non-interworking code.
6765
6766@item -mcaller-super-interworking
6767@opindex mcaller-super-interworking
6768Allows calls via function pointers (including virtual functions) to
6769execute correctly regardless of whether the target code has been
6770compiled for interworking or not. There is a small overhead in the cost
6771of executing a function pointer if this option is enabled.
2856c3e3
SC
6772
6773@end table
6774
39bc1876
NS
6775@node AVR Options
6776@subsection AVR Options
6777@cindex AVR Options
74291a4b 6778
39bc1876 6779These options are defined for AVR implementations:
74291a4b 6780
2642624b 6781@table @gcctabopt
39bc1876
NS
6782@item -mmcu=@var{mcu}
6783@opindex mmcu
6784Specify ATMEL AVR instruction set or MCU type.
74291a4b 6785
39bc1876
NS
6786Instruction set avr1 is for the minimal AVR core, not supported by the C
6787compiler, only for assembler programs (MCU types: at90s1200, attiny10,
6788attiny11, attiny12, attiny15, attiny28).
74291a4b 6789
39bc1876
NS
6790Instruction set avr2 (default) is for the classic AVR core with up to
67918K program memory space (MCU types: at90s2313, at90s2323, attiny22,
6792at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
6793at90c8534, at90s8535).
74291a4b 6794
39bc1876
NS
6795Instruction set avr3 is for the classic AVR core with up to 128K program
6796memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
74291a4b 6797
39bc1876
NS
6798Instruction set avr4 is for the enhanced AVR core with up to 8K program
6799memory space (MCU types: atmega8, atmega83, atmega85).
74291a4b 6800
39bc1876
NS
6801Instruction set avr5 is for the enhanced AVR core with up to 128K program
6802memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
6803atmega64, atmega128, at43usb355, at94k).
74291a4b 6804
39bc1876
NS
6805@item -msize
6806@opindex msize
6807Output instruction sizes to the asm file.
74291a4b 6808
39bc1876
NS
6809@item -minit-stack=@var{N}
6810@opindex minit-stack
6811Specify the initial stack address, which may be a symbol or numeric value,
6812@samp{__stack} is the default.
74291a4b 6813
39bc1876
NS
6814@item -mno-interrupts
6815@opindex mno-interrupts
6816Generated code is not compatible with hardware interrupts.
6817Code size will be smaller.
74291a4b 6818
39bc1876
NS
6819@item -mcall-prologues
6820@opindex mcall-prologues
6821Functions prologues/epilogues expanded as call to appropriate
6822subroutines. Code size will be smaller.
74291a4b 6823
39bc1876
NS
6824@item -mno-tablejump
6825@opindex mno-tablejump
6826Do not generate tablejump insns which sometimes increase code size.
74291a4b 6827
39bc1876
NS
6828@item -mtiny-stack
6829@opindex mtiny-stack
6830Change only the low 8 bits of the stack pointer.
74291a4b 6831
39bc1876
NS
6832@item -mint8
6833@opindex mint8
6834Assume int to be 8 bit integer. This affects the sizes of all types: A
6835char will be 1 byte, an int will be 1 byte, an long will be 2 bytes
6836and long long will be 4 bytes. Please note that this option does not
6837comply to the C standards, but it will provide you with smaller code
6838size.
6839@end table
74291a4b 6840
39bc1876
NS
6841@node CRIS Options
6842@subsection CRIS Options
6843@cindex CRIS Options
74291a4b 6844
39bc1876 6845These options are defined specifically for the CRIS ports.
74291a4b 6846
39bc1876
NS
6847@table @gcctabopt
6848@item -march=@var{architecture-type}
6849@itemx -mcpu=@var{architecture-type}
6850@opindex march
6851@opindex mcpu
6852Generate code for the specified architecture. The choices for
6853@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
6854respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
6855Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
6856@samp{v10}.
c219ddf7 6857
39bc1876
NS
6858@item -mtune=@var{architecture-type}
6859@opindex mtune
6860Tune to @var{architecture-type} everything applicable about the generated
6861code, except for the ABI and the set of available instructions. The
6862choices for @var{architecture-type} are the same as for
6863@option{-march=@var{architecture-type}}.
54284728 6864
39bc1876
NS
6865@item -mmax-stack-frame=@var{n}
6866@opindex mmax-stack-frame
6867Warn when the stack frame of a function exceeds @var{n} bytes.
54284728 6868
39bc1876
NS
6869@item -melinux-stacksize=@var{n}
6870@opindex melinux-stacksize
6871Only available with the @samp{cris-axis-aout} target. Arranges for
6872indications in the program to the kernel loader that the stack of the
6873program should be set to @var{n} bytes.
54284728 6874
39bc1876
NS
6875@item -metrax4
6876@itemx -metrax100
6877@opindex metrax4
6878@opindex metrax100
6879The options @option{-metrax4} and @option{-metrax100} are synonyms for
6880@option{-march=v3} and @option{-march=v8} respectively.
c0498f43 6881
39bc1876
NS
6882@item -mmul-bug-workaround
6883@itemx -mno-mul-bug-workaround
6884@opindex mmul-bug-workaround
6885@opindex mno-mul-bug-workaround
6886Work around a bug in the @code{muls} and @code{mulu} instructions for CPU
6887models where it applies. This option is active by default.
c0498f43 6888
39bc1876
NS
6889@item -mpdebug
6890@opindex mpdebug
6891Enable CRIS-specific verbose debug-related information in the assembly
6892code. This option also has the effect to turn off the @samp{#NO_APP}
6893formatted-code indicator to the assembler at the beginning of the
6894assembly file.
c0498f43 6895
39bc1876
NS
6896@item -mcc-init
6897@opindex mcc-init
6898Do not use condition-code results from previous instruction; always emit
6899compare and test instructions before use of condition codes.
74291a4b 6900
39bc1876
NS
6901@item -mno-side-effects
6902@opindex mno-side-effects
6903Do not emit instructions with side-effects in addressing modes other than
6904post-increment.
238b11b5 6905
39bc1876
NS
6906@item -mstack-align
6907@itemx -mno-stack-align
6908@itemx -mdata-align
6909@itemx -mno-data-align
6910@itemx -mconst-align
6911@itemx -mno-const-align
6912@opindex mstack-align
6913@opindex mno-stack-align
6914@opindex mdata-align
6915@opindex mno-data-align
6916@opindex mconst-align
6917@opindex mno-const-align
6918These options (no-options) arranges (eliminate arrangements) for the
6919stack-frame, individual data and constants to be aligned for the maximum
6920single data access size for the chosen CPU model. The default is to
6921arrange for 32-bit alignment. ABI details such as structure layout are
6922not affected by these options.
238b11b5 6923
39bc1876
NS
6924@item -m32-bit
6925@itemx -m16-bit
6926@itemx -m8-bit
6927@opindex m32-bit
6928@opindex m16-bit
6929@opindex m8-bit
6930Similar to the stack- data- and const-align options above, these options
6931arrange for stack-frame, writable data and constants to all be 32-bit,
693216-bit or 8-bit aligned. The default is 32-bit alignment.
238b11b5 6933
39bc1876
NS
6934@item -mno-prologue-epilogue
6935@itemx -mprologue-epilogue
6936@opindex mno-prologue-epilogue
6937@opindex mprologue-epilogue
6938With @option{-mno-prologue-epilogue}, the normal function prologue and
6939epilogue that sets up the stack-frame are omitted and no return
6940instructions or return sequences are generated in the code. Use this
6941option only together with visual inspection of the compiled code: no
6942warnings or errors are generated when call-saved registers must be saved,
6943or storage for local variable needs to be allocated.
238b11b5 6944
39bc1876
NS
6945@item -mno-gotplt
6946@itemx -mgotplt
6947@opindex mno-gotplt
6948@opindex mgotplt
6949With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
6950instruction sequences that load addresses for functions from the PLT part
6951of the GOT rather than (traditional on other architectures) calls to the
6952PLT. The default is @option{-mgotplt}.
238b11b5 6953
39bc1876
NS
6954@item -maout
6955@opindex maout
6956Legacy no-op option only recognized with the cris-axis-aout target.
c0498f43 6957
39bc1876
NS
6958@item -melf
6959@opindex melf
6960Legacy no-op option only recognized with the cris-axis-elf and
6961cris-axis-linux-gnu targets.
74291a4b 6962
39bc1876
NS
6963@item -melinux
6964@opindex melinux
6965Only recognized with the cris-axis-aout target, where it selects a
6966GNU/linux-like multilib, include files and instruction set for
6967@option{-march=v8}.
ded17aad 6968
39bc1876
NS
6969@item -mlinux
6970@opindex mlinux
6971Legacy no-op option only recognized with the cris-axis-linux-gnu target.
ded17aad 6972
39bc1876
NS
6973@item -sim
6974@opindex sim
6975This option, recognized for the cris-axis-aout and cris-axis-elf arranges
6976to link with input-output functions from a simulator library. Code,
6977initialized data and zero-initialized data are allocated consecutively.
74291a4b 6978
39bc1876
NS
6979@item -sim2
6980@opindex sim2
6981Like @option{-sim}, but pass linker options to locate initialized data at
69820x40000000 and zero-initialized data at 0x80000000.
74291a4b
MM
6983@end table
6984
39bc1876
NS
6985@node Darwin Options
6986@subsection Darwin Options
6987@cindex Darwin options
74291a4b 6988
39bc1876
NS
6989These options are defined for all architectures running the Darwin operating
6990system. They are useful for compatibility with other Mac OS compilers.
74291a4b 6991
2642624b 6992@table @gcctabopt
39bc1876
NS
6993@item -F@var{dir}
6994@opindex F
6995Add the framework directory @var{dir} to the head of the list of
6996directories to be searched for header files. These directories are
6997interleaved with those specified by @option{-I} options and are
6998scanned in a left-to-right order.
5848830f 6999
39bc1876
NS
7000A framework directory is a directory with frameworks in it. A
7001framework is a directory with a @samp{"Headers"} and/or
7002@samp{"PrivateHeaders"} directory contained directly in it that ends
7003in @samp{".framework"}. The name of a framework is the name of this
7004directory excluding the @samp{".framework"}. Headers associated with
7005the framework are found in one of those two directories, with
7006@samp{"Headers"} being searched first. A subframework is a framework
7007directory that is in a framework's @samp{"Frameworks"} directory.
7008Includes of subframework headers can only appear in a header of a
7009framework that contains the subframework, or in a sibling subframework
7010header. Two subframeworks are siblings if they occur in the same
7011framework. A subframework should not have the same name as a
7012framework, a warning will be issued if this is violated. Currently a
7013subframework cannot have subframeworks, in the future, the mechanism
7014may be extended to support this. The standard frameworks can be found
3e558e80
MS
7015in @samp{"/System/Library/Frameworks"} and
7016@samp{"/Library/Frameworks"}. An example include looks like
39bc1876
NS
7017@code{#include <Framework/header.h>}, where @samp{Framework} denotes
7018the name of the framework and header.h is found in the
7019@samp{"PrivateHeaders"} or @samp{"Headers"} directory.
157a620e 7020
7aded944
DP
7021@item -gused
7022@opindex -gused
7023Emit debugging information for symbols that are used. For STABS
7024debugging format, this enables @option{-feliminate-unused-debug-symbols}.
7025This is by default ON.
7026
7027@item -gfull
7028@opindex -gfull
7029Emit debugging information for all symbols and types.
7030
8f4220dc
MA
7031@item -mone-byte-bool
7032@opindex -mone-byte-bool
7033Override the defaults for @samp{bool} so that @samp{sizeof(bool)==1}.
7034By default @samp{sizeof(bool)} is @samp{4} when compiling for
7035Darwin/PowerPC and @samp{1} when compiling for Darwin/x86, so this
7036option has no effect on x86.
7037
7038@strong{Warning:} The @option{-mone-byte-bool} switch causes GCC
7039to generate code that is not binary compatible with code generated
7040without that switch. Using this switch may require recompiling all
7041other modules in a program, including system libraries. Use this
7042switch to conform to a non-default data model.
7043
699c914a
MS
7044@item -mfix-and-continue
7045@itemx -ffix-and-continue
7046@itemx -findirect-data
7047@opindex mfix-and-continue
7048@opindex ffix-and-continue
7049@opindex findirect-data
7050Generate code suitable for fast turn around development. Needed to
7051enable gdb to dynamically load @code{.o} files into already running
7052programs. @option{-findirect-data} and @option{-ffix-and-continue}
7053are provided for backwards compatibility.
7054
39bc1876
NS
7055@item -all_load
7056@opindex all_load
7057Loads all members of static archive libraries.
7058See man ld(1) for more information.
74291a4b 7059
39bc1876
NS
7060@item -arch_errors_fatal
7061@opindex arch_errors_fatal
7062Cause the errors having to do with files that have the wrong architecture
7063to be fatal.
157a620e 7064
39bc1876
NS
7065@item -bind_at_load
7066@opindex bind_at_load
7067Causes the output file to be marked such that the dynamic linker will
7068bind all undefined references when the file is loaded or launched.
157a620e 7069
39bc1876
NS
7070@item -bundle
7071@opindex bundle
7072Produce a Mach-o bundle format file.
7073See man ld(1) for more information.
157a620e 7074
39bc1876
NS
7075@item -bundle_loader @var{executable}
7076@opindex bundle_loader
7077This specifies the @var{executable} that will be loading the build
7078output file being linked. See man ld(1) for more information.
157a620e 7079
39bc1876
NS
7080@item -allowable_client @var{client_name}
7081@itemx -arch_only
157a620e 7082
39bc1876
NS
7083@itemx -client_name
7084@itemx -compatibility_version
7085@itemx -current_version
5079843a 7086@itemx -dead_strip
39bc1876
NS
7087@itemx -dependency-file
7088@itemx -dylib_file
7089@itemx -dylinker_install_name
7090@itemx -dynamic
7091@itemx -dynamiclib
7092@itemx -exported_symbols_list
7093@itemx -filelist
7094@itemx -flat_namespace
7095@itemx -force_cpusubtype_ALL
7096@itemx -force_flat_namespace
7097@itemx -headerpad_max_install_names
7098@itemx -image_base
7099@itemx -init
7100@itemx -install_name
7101@itemx -keep_private_externs
7102@itemx -multi_module
7103@itemx -multiply_defined
7104@itemx -multiply_defined_unused
7105@itemx -noall_load
89aa5a20 7106@itemx -no_dead_strip_inits_and_terms
39bc1876
NS
7107@itemx -nofixprebinding
7108@itemx -nomultidefs
7109@itemx -noprebind
7110@itemx -noseglinkedit
7111@itemx -pagezero_size
7112@itemx -prebind
7113@itemx -prebind_all_twolevel_modules
7114@itemx -private_bundle
7115@itemx -read_only_relocs
7116@itemx -sectalign
7117@itemx -sectobjectsymbols
7118@itemx -whyload
7119@itemx -seg1addr
7120@itemx -sectcreate
7121@itemx -sectobjectsymbols
7122@itemx -sectorder
7123@itemx -seg_addr_table
7124@itemx -seg_addr_table_filename
7125@itemx -seglinkedit
7126@itemx -segprot
7127@itemx -segs_read_only_addr
7128@itemx -segs_read_write_addr
7129@itemx -single_module
7130@itemx -static
7131@itemx -sub_library
7132@itemx -sub_umbrella
7133@itemx -twolevel_namespace
7134@itemx -umbrella
7135@itemx -undefined
7136@itemx -unexported_symbols_list
7137@itemx -weak_reference_mismatches
7138@itemx -whatsloaded
74291a4b 7139
39bc1876
NS
7140@opindex allowable_client
7141@opindex arch_only
7142@opindex client_name
7143@opindex compatibility_version
7144@opindex current_version
5079843a 7145@opindex dead_strip
39bc1876
NS
7146@opindex dependency-file
7147@opindex dylib_file
7148@opindex dylinker_install_name
7149@opindex dynamic
7150@opindex dynamiclib
7151@opindex exported_symbols_list
7152@opindex filelist
7153@opindex flat_namespace
7154@opindex force_cpusubtype_ALL
7155@opindex force_flat_namespace
7156@opindex headerpad_max_install_names
7157@opindex image_base
7158@opindex init
7159@opindex install_name
7160@opindex keep_private_externs
7161@opindex multi_module
7162@opindex multiply_defined
7163@opindex multiply_defined_unused
7164@opindex noall_load
5079843a 7165@opindex no_dead_strip_inits_and_terms
39bc1876
NS
7166@opindex nofixprebinding
7167@opindex nomultidefs
7168@opindex noprebind
7169@opindex noseglinkedit
7170@opindex pagezero_size
7171@opindex prebind
7172@opindex prebind_all_twolevel_modules
7173@opindex private_bundle
7174@opindex read_only_relocs
7175@opindex sectalign
7176@opindex sectobjectsymbols
7177@opindex whyload
7178@opindex seg1addr
7179@opindex sectcreate
7180@opindex sectobjectsymbols
7181@opindex sectorder
7182@opindex seg_addr_table
7183@opindex seg_addr_table_filename
7184@opindex seglinkedit
7185@opindex segprot
7186@opindex segs_read_only_addr
7187@opindex segs_read_write_addr
7188@opindex single_module
7189@opindex static
7190@opindex sub_library
7191@opindex sub_umbrella
7192@opindex twolevel_namespace
7193@opindex umbrella
7194@opindex undefined
7195@opindex unexported_symbols_list
7196@opindex weak_reference_mismatches
7197@opindex whatsloaded
7198
7199These options are available for Darwin linker. Darwin linker man page
7200describes them in detail.
7201@end table
7202
7203@node DEC Alpha Options
7204@subsection DEC Alpha Options
7205
7206These @samp{-m} options are defined for the DEC Alpha implementations:
7207
7208@table @gcctabopt
7209@item -mno-soft-float
7210@itemx -msoft-float
7211@opindex mno-soft-float
cd3bb277 7212@opindex msoft-float
39bc1876
NS
7213Use (do not use) the hardware floating-point instructions for
7214floating-point operations. When @option{-msoft-float} is specified,
7215functions in @file{libgcc.a} will be used to perform floating-point
7216operations. Unless they are replaced by routines that emulate the
7217floating-point operations, or compiled in such a way as to call such
7218emulations routines, these routines will issue floating-point
7219operations. If you are compiling for an Alpha without floating-point
7220operations, you must ensure that the library is built so as not to call
7221them.
74291a4b 7222
39bc1876
NS
7223Note that Alpha implementations without floating-point operations are
7224required to have floating-point registers.
74291a4b 7225
39bc1876
NS
7226@item -mfp-reg
7227@itemx -mno-fp-regs
7228@opindex mfp-reg
7229@opindex mno-fp-regs
7230Generate code that uses (does not use) the floating-point register set.
7231@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
7232register set is not used, floating point operands are passed in integer
7233registers as if they were integers and floating-point results are passed
7234in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
7235so any function with a floating-point argument or return value called by code
7236compiled with @option{-mno-fp-regs} must also be compiled with that
7237option.
9b66ebb1 7238
39bc1876
NS
7239A typical use of this option is building a kernel that does not use,
7240and hence need not save and restore, any floating-point registers.
9b66ebb1 7241
39bc1876
NS
7242@item -mieee
7243@opindex mieee
7244The Alpha architecture implements floating-point hardware optimized for
7245maximum performance. It is mostly compliant with the IEEE floating
7246point standard. However, for full compliance, software assistance is
7247required. This option generates code fully IEEE compliant code
7248@emph{except} that the @var{inexact-flag} is not maintained (see below).
7249If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
7250defined during compilation. The resulting code is less efficient but is
7251able to correctly support denormalized numbers and exceptional IEEE
7252values such as not-a-number and plus/minus infinity. Other Alpha
7253compilers call this option @option{-ieee_with_no_inexact}.
74291a4b 7254
39bc1876
NS
7255@item -mieee-with-inexact
7256@opindex mieee-with-inexact
7257This is like @option{-mieee} except the generated code also maintains
7258the IEEE @var{inexact-flag}. Turning on this option causes the
7259generated code to implement fully-compliant IEEE math. In addition to
7260@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
7261macro. On some Alpha implementations the resulting code may execute
7262significantly slower than the code generated by default. Since there is
7263very little code that depends on the @var{inexact-flag}, you should
7264normally not specify this option. Other Alpha compilers call this
7265option @option{-ieee_with_inexact}.
74291a4b 7266
39bc1876
NS
7267@item -mfp-trap-mode=@var{trap-mode}
7268@opindex mfp-trap-mode
7269This option controls what floating-point related traps are enabled.
7270Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
7271The trap mode can be set to one of four values:
74291a4b 7272
39bc1876
NS
7273@table @samp
7274@item n
7275This is the default (normal) setting. The only traps that are enabled
7276are the ones that cannot be disabled in software (e.g., division by zero
7277trap).
62b10bbc 7278
39bc1876
NS
7279@item u
7280In addition to the traps enabled by @samp{n}, underflow traps are enabled
7281as well.
157a620e 7282
39bc1876
NS
7283@item su
7284Like @samp{su}, but the instructions are marked to be safe for software
7285completion (see Alpha architecture manual for details).
157a620e 7286
39bc1876
NS
7287@item sui
7288Like @samp{su}, but inexact traps are enabled as well.
7289@end table
9b66ebb1 7290
39bc1876
NS
7291@item -mfp-rounding-mode=@var{rounding-mode}
7292@opindex mfp-rounding-mode
7293Selects the IEEE rounding mode. Other Alpha compilers call this option
7294@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
7295of:
157a620e 7296
39bc1876
NS
7297@table @samp
7298@item n
7299Normal IEEE rounding mode. Floating point numbers are rounded towards
7300the nearest machine number or towards the even machine number in case
7301of a tie.
5848830f 7302
39bc1876
NS
7303@item m
7304Round towards minus infinity.
157a620e 7305
39bc1876
NS
7306@item c
7307Chopped rounding mode. Floating point numbers are rounded towards zero.
f5a1b0d2 7308
39bc1876
NS
7309@item d
7310Dynamic rounding mode. A field in the floating point control register
7311(@var{fpcr}, see Alpha architecture reference manual) controls the
7312rounding mode in effect. The C library initializes this register for
7313rounding towards plus infinity. Thus, unless your program modifies the
7314@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
7315@end table
c27ba912 7316
39bc1876
NS
7317@item -mtrap-precision=@var{trap-precision}
7318@opindex mtrap-precision
7319In the Alpha architecture, floating point traps are imprecise. This
7320means without software assistance it is impossible to recover from a
7321floating trap and program execution normally needs to be terminated.
7322GCC can generate code that can assist operating system trap handlers
7323in determining the exact location that caused a floating point trap.
7324Depending on the requirements of an application, different levels of
7325precisions can be selected:
c27ba912 7326
39bc1876
NS
7327@table @samp
7328@item p
7329Program precision. This option is the default and means a trap handler
7330can only identify which program caused a floating point exception.
c27ba912 7331
39bc1876
NS
7332@item f
7333Function precision. The trap handler can determine the function that
7334caused a floating point exception.
62b10bbc 7335
39bc1876
NS
7336@item i
7337Instruction precision. The trap handler can determine the exact
7338instruction that caused a floating point exception.
7339@end table
ed0e6530 7340
39bc1876
NS
7341Other Alpha compilers provide the equivalent options called
7342@option{-scope_safe} and @option{-resumption_safe}.
ed0e6530 7343
39bc1876
NS
7344@item -mieee-conformant
7345@opindex mieee-conformant
7346This option marks the generated code as IEEE conformant. You must not
7347use this option unless you also specify @option{-mtrap-precision=i} and either
7348@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
7349is to emit the line @samp{.eflag 48} in the function prologue of the
7350generated assembly file. Under DEC Unix, this has the effect that
7351IEEE-conformant math library routines will be linked in.
9b6b54e2 7352
39bc1876
NS
7353@item -mbuild-constants
7354@opindex mbuild-constants
7355Normally GCC examines a 32- or 64-bit integer constant to
7356see if it can construct it from smaller constants in two or three
7357instructions. If it cannot, it will output the constant as a literal and
7358generate code to load it from the data segment at runtime.
74291a4b 7359
39bc1876
NS
7360Use this option to require GCC to construct @emph{all} integer constants
7361using code, even if it takes more instructions (the maximum is six).
157a620e 7362
39bc1876
NS
7363You would typically use this option to build a shared library dynamic
7364loader. Itself a shared library, it must relocate itself in memory
7365before it can find the variables and constants in its own data segment.
7366
7367@item -malpha-as
7368@itemx -mgas
7369@opindex malpha-as
7370@opindex mgas
7371Select whether to generate code to be assembled by the vendor-supplied
7372assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
7373
7374@item -mbwx
7375@itemx -mno-bwx
7376@itemx -mcix
7377@itemx -mno-cix
7378@itemx -mfix
7379@itemx -mno-fix
7380@itemx -mmax
7381@itemx -mno-max
7382@opindex mbwx
7383@opindex mno-bwx
7384@opindex mcix
7385@opindex mno-cix
7386@opindex mfix
7387@opindex mno-fix
7388@opindex mmax
7389@opindex mno-max
7390Indicate whether GCC should generate code to use the optional BWX,
7391CIX, FIX and MAX instruction sets. The default is to use the instruction
7392sets supported by the CPU type specified via @option{-mcpu=} option or that
7393of the CPU on which GCC was built if none was specified.
157a620e 7394
39bc1876
NS
7395@item -mfloat-vax
7396@itemx -mfloat-ieee
7397@opindex mfloat-vax
7398@opindex mfloat-ieee
7399Generate code that uses (does not use) VAX F and G floating point
7400arithmetic instead of IEEE single and double precision.
157a620e 7401
39bc1876
NS
7402@item -mexplicit-relocs
7403@itemx -mno-explicit-relocs
7404@opindex mexplicit-relocs
7405@opindex mno-explicit-relocs
7406Older Alpha assemblers provided no way to generate symbol relocations
7407except via assembler macros. Use of these macros does not allow
7408optimal instruction scheduling. GNU binutils as of version 2.12
7409supports a new syntax that allows the compiler to explicitly mark
7410which relocations should apply to which instructions. This option
7411is mostly useful for debugging, as GCC detects the capabilities of
7412the assembler when it is built and sets the default accordingly.
157a620e 7413
39bc1876
NS
7414@item -msmall-data
7415@itemx -mlarge-data
7416@opindex msmall-data
7417@opindex mlarge-data
7418When @option{-mexplicit-relocs} is in effect, static data is
7419accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
7420is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
7421(the @code{.sdata} and @code{.sbss} sections) and are accessed via
742216-bit relocations off of the @code{$gp} register. This limits the
7423size of the small data area to 64KB, but allows the variables to be
7424directly accessed via a single instruction.
62b10bbc 7425
39bc1876
NS
7426The default is @option{-mlarge-data}. With this option the data area
7427is limited to just below 2GB. Programs that require more than 2GB of
7428data must use @code{malloc} or @code{mmap} to allocate the data in the
7429heap instead of in the program's data segment.
62b10bbc 7430
39bc1876
NS
7431When generating code for shared libraries, @option{-fpic} implies
7432@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
4bdc1ac7 7433
39bc1876
NS
7434@item -msmall-text
7435@itemx -mlarge-text
7436@opindex msmall-text
7437@opindex mlarge-text
7438When @option{-msmall-text} is used, the compiler assumes that the
7439code of the entire program (or shared library) fits in 4MB, and is
7440thus reachable with a branch instruction. When @option{-msmall-data}
7441is used, the compiler can assume that all local symbols share the
7442same @code{$gp} value, and thus reduce the number of instructions
7443required for a function call from 4 to 1.
157a620e 7444
39bc1876 7445The default is @option{-mlarge-text}.
d2d42a91 7446
39bc1876
NS
7447@item -mcpu=@var{cpu_type}
7448@opindex mcpu
7449Set the instruction set and instruction scheduling parameters for
7450machine type @var{cpu_type}. You can specify either the @samp{EV}
7451style name or the corresponding chip number. GCC supports scheduling
7452parameters for the EV4, EV5 and EV6 family of processors and will
7453choose the default values for the instruction set from the processor
7454you specify. If you do not specify a processor type, GCC will default
7455to the processor on which the compiler was built.
6d6d0fa0 7456
39bc1876 7457Supported values for @var{cpu_type} are
6d6d0fa0 7458
39bc1876
NS
7459@table @samp
7460@item ev4
7461@itemx ev45
7462@itemx 21064
7463Schedules as an EV4 and has no instruction set extensions.
ecff22ab 7464
39bc1876
NS
7465@item ev5
7466@itemx 21164
7467Schedules as an EV5 and has no instruction set extensions.
705ac34f 7468
39bc1876
NS
7469@item ev56
7470@itemx 21164a
7471Schedules as an EV5 and supports the BWX extension.
705ac34f 7472
39bc1876
NS
7473@item pca56
7474@itemx 21164pc
7475@itemx 21164PC
7476Schedules as an EV5 and supports the BWX and MAX extensions.
c474f76b 7477
39bc1876
NS
7478@item ev6
7479@itemx 21264
7480Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
ecff22ab 7481
39bc1876
NS
7482@item ev67
7483@itemx 21264a
7484Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
6d6d0fa0
JL
7485@end table
7486
39bc1876
NS
7487@item -mtune=@var{cpu_type}
7488@opindex mtune
7489Set only the instruction scheduling parameters for machine type
7490@var{cpu_type}. The instruction set is not changed.
ecff22ab 7491
39bc1876
NS
7492@item -mmemory-latency=@var{time}
7493@opindex mmemory-latency
7494Sets the latency the scheduler should assume for typical memory
7495references as seen by the application. This number is highly
7496dependent on the memory access patterns used by the application
7497and the size of the external cache on the machine.
861bb6c1 7498
39bc1876 7499Valid options for @var{time} are
6975bd2c 7500
39bc1876
NS
7501@table @samp
7502@item @var{number}
7503A decimal number representing clock cycles.
98180123 7504
39bc1876
NS
7505@item L1
7506@itemx L2
7507@itemx L3
7508@itemx main
7509The compiler contains estimates of the number of clock cycles for
7510``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
7511(also called Dcache, Scache, and Bcache), as well as to main memory.
7512Note that L3 is only valid for EV5.
de41e41c 7513
39bc1876
NS
7514@end table
7515@end table
861bb6c1 7516
39bc1876
NS
7517@node DEC Alpha/VMS Options
7518@subsection DEC Alpha/VMS Options
861bb6c1 7519
39bc1876 7520These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
861bb6c1 7521
39bc1876
NS
7522@table @gcctabopt
7523@item -mvms-return-codes
7524@opindex mvms-return-codes
7525Return VMS condition codes from main. The default is to return POSIX
7526style condition (e.g.@ error) codes.
7527@end table
861bb6c1 7528
39bc1876
NS
7529@node FRV Options
7530@subsection FRV Options
7531@cindex FRV Options
861bb6c1 7532
39bc1876
NS
7533@table @gcctabopt
7534@item -mgpr-32
7535@opindex mgpr-32
861bb6c1 7536
39bc1876 7537Only use the first 32 general purpose registers.
861bb6c1 7538
39bc1876
NS
7539@item -mgpr-64
7540@opindex mgpr-64
861bb6c1 7541
39bc1876 7542Use all 64 general purpose registers.
861bb6c1 7543
39bc1876
NS
7544@item -mfpr-32
7545@opindex mfpr-32
861bb6c1 7546
39bc1876 7547Use only the first 32 floating point registers.
ad126521 7548
39bc1876
NS
7549@item -mfpr-64
7550@opindex mfpr-64
ad126521 7551
39bc1876 7552Use all 64 floating point registers
ad126521 7553
39bc1876
NS
7554@item -mhard-float
7555@opindex mhard-float
ad126521 7556
39bc1876 7557Use hardware instructions for floating point operations.
ad126521 7558
39bc1876
NS
7559@item -msoft-float
7560@opindex msoft-float
ad126521 7561
39bc1876 7562Use library routines for floating point operations.
ad126521 7563
39bc1876
NS
7564@item -malloc-cc
7565@opindex malloc-cc
ad126521 7566
39bc1876 7567Dynamically allocate condition code registers.
ad126521 7568
39bc1876
NS
7569@item -mfixed-cc
7570@opindex mfixed-cc
861bb6c1 7571
39bc1876
NS
7572Do not try to dynamically allocate condition code registers, only
7573use @code{icc0} and @code{fcc0}.
74291a4b 7574
39bc1876
NS
7575@item -mdword
7576@opindex mdword
74291a4b 7577
39bc1876 7578Change ABI to use double word insns.
74291a4b 7579
39bc1876
NS
7580@item -mno-dword
7581@opindex mno-dword
74291a4b 7582
39bc1876 7583Do not use double word instructions.
74291a4b 7584
39bc1876
NS
7585@item -mdouble
7586@opindex mdouble
74291a4b 7587
39bc1876 7588Use floating point double instructions.
7fe90e7b 7589
39bc1876
NS
7590@item -mno-double
7591@opindex mno-double
74291a4b 7592
39bc1876 7593Do not use floating point double instructions.
74291a4b 7594
39bc1876
NS
7595@item -mmedia
7596@opindex mmedia
74291a4b 7597
39bc1876 7598Use media instructions.
9c34dbbf 7599
39bc1876
NS
7600@item -mno-media
7601@opindex mno-media
74291a4b 7602
39bc1876 7603Do not use media instructions.
74291a4b 7604
39bc1876
NS
7605@item -mmuladd
7606@opindex mmuladd
9c34dbbf 7607
39bc1876 7608Use multiply and add/subtract instructions.
66188a7e 7609
39bc1876
NS
7610@item -mno-muladd
7611@opindex mno-muladd
74291a4b 7612
39bc1876 7613Do not use multiply and add/subtract instructions.
74291a4b 7614
d711cf67
JDA
7615@item -mfdpic
7616@opindex mfdpic
7617
7618Select the FDPIC ABI, that uses function descriptors to represent
7619pointers to functions. Without any PIC/PIE-related options, it
7620implies @option{-fPIE}. With @option{-fpic} or @option{-fpie}, it
7621assumes GOT entries and small data are within a 12-bit range from the
7622GOT base address; with @option{-fPIC} or @option{-fPIE}, GOT offsets
7623are computed with 32 bits.
7624
7625@item -minline-plt
7626@opindex minline-plt
7627
7628Enable inlining of PLT entries in function calls to functions that are
7629not known to bind locally. It has no effect without @option{-mfdpic}.
7630It's enabled by default if optimizing for speed and compiling for
7631shared libraries (i.e., @option{-fPIC} or @option{-fpic}), or when an
7632optimization option such as @option{-O3} or above is present in the
7633command line.
7634
7635@item -mgprel-ro
7636@opindex mgprel-ro
7637
7638Enable the use of @code{GPREL} relocations in the FDPIC ABI for data
7639that is known to be in read-only sections. It's enabled by default,
7640except for @option{-fpic} or @option{-fpie}: even though it may help
7641make the global offset table smaller, it trades 1 instruction for 4.
7642With @option{-fPIC} or @option{-fPIE}, it trades 3 instructions for 4,
7643one of which may be shared by multiple symbols, and it avoids the need
7644for a GOT entry for the referenced symbol, so it's more likely to be a
7645win. If it is not, @option{-mno-gprel-ro} can be used to disable it.
7646
7647@item -multilib-library-pic
7648@opindex multilib-library-pic
7649
7650Link with the (library, not FD) pic libraries. It's implied by
7651@option{-mlibrary-pic}, as well as by @option{-fPIC} and
7652@option{-fpic} without @option{-mfdpic}. You should never have to use
7653it explicitly.
7654
7655@item -mlinked-fp
7656@opindex mlinked-fp
7657
7658Follow the EABI requirement of always creating a frame pointer whenever
7659a stack frame is allocated. This option is enabled by default and can
7660be disabled with @option{-mno-linked-fp}.
7661
39bc1876
NS
7662@item -mlibrary-pic
7663@opindex mlibrary-pic
0ac081f6 7664
39bc1876 7665Generate position-independent EABI code.
6c8875e5 7666
39bc1876
NS
7667@item -macc-4
7668@opindex macc-4
6c8875e5 7669
39bc1876 7670Use only the first four media accumulator registers.
6c8875e5 7671
39bc1876
NS
7672@item -macc-8
7673@opindex macc-8
993f19a8 7674
39bc1876 7675Use all eight media accumulator registers.
5da702b1 7676
39bc1876
NS
7677@item -mpack
7678@opindex mpack
74291a4b 7679
39bc1876 7680Pack VLIW instructions.
74291a4b 7681
39bc1876
NS
7682@item -mno-pack
7683@opindex mno-pack
74291a4b 7684
39bc1876 7685Do not pack VLIW instructions.
7fe90e7b 7686
39bc1876
NS
7687@item -mno-eflags
7688@opindex mno-eflags
74291a4b 7689
39bc1876 7690Do not mark ABI switches in e_flags.
861bb6c1 7691
39bc1876
NS
7692@item -mcond-move
7693@opindex mcond-move
6184e8a4 7694
39bc1876 7695Enable the use of conditional-move instructions (default).
74291a4b 7696
39bc1876
NS
7697This switch is mainly for debugging the compiler and will likely be removed
7698in a future version.
74291a4b 7699
39bc1876
NS
7700@item -mno-cond-move
7701@opindex mno-cond-move
74291a4b 7702
39bc1876 7703Disable the use of conditional-move instructions.
861bb6c1 7704
39bc1876
NS
7705This switch is mainly for debugging the compiler and will likely be removed
7706in a future version.
861bb6c1 7707
39bc1876
NS
7708@item -mscc
7709@opindex mscc
74291a4b 7710
39bc1876 7711Enable the use of conditional set instructions (default).
74291a4b 7712
39bc1876
NS
7713This switch is mainly for debugging the compiler and will likely be removed
7714in a future version.
74291a4b 7715
39bc1876
NS
7716@item -mno-scc
7717@opindex mno-scc
74291a4b 7718
39bc1876 7719Disable the use of conditional set instructions.
74291a4b 7720
39bc1876
NS
7721This switch is mainly for debugging the compiler and will likely be removed
7722in a future version.
74291a4b 7723
39bc1876
NS
7724@item -mcond-exec
7725@opindex mcond-exec
74291a4b 7726
39bc1876 7727Enable the use of conditional execution (default).
74291a4b 7728
39bc1876
NS
7729This switch is mainly for debugging the compiler and will likely be removed
7730in a future version.
ab82a49f 7731
39bc1876
NS
7732@item -mno-cond-exec
7733@opindex mno-cond-exec
79ae11c4 7734
39bc1876 7735Disable the use of conditional execution.
daf2f129 7736
39bc1876
NS
7737This switch is mainly for debugging the compiler and will likely be removed
7738in a future version.
cbe26ab8 7739
39bc1876
NS
7740@item -mvliw-branch
7741@opindex mvliw-branch
7742
7743Run a pass to pack branches into VLIW instructions (default).
7744
7745This switch is mainly for debugging the compiler and will likely be removed
7746in a future version.
7747
7748@item -mno-vliw-branch
7749@opindex mno-vliw-branch
7750
7751Do not run a pass to pack branches into VLIW instructions.
7752
7753This switch is mainly for debugging the compiler and will likely be removed
7754in a future version.
74291a4b 7755
39bc1876
NS
7756@item -mmulti-cond-exec
7757@opindex mmulti-cond-exec
74291a4b 7758
39bc1876
NS
7759Enable optimization of @code{&&} and @code{||} in conditional execution
7760(default).
74291a4b 7761
39bc1876
NS
7762This switch is mainly for debugging the compiler and will likely be removed
7763in a future version.
74291a4b 7764
39bc1876
NS
7765@item -mno-multi-cond-exec
7766@opindex mno-multi-cond-exec
74291a4b 7767
39bc1876 7768Disable optimization of @code{&&} and @code{||} in conditional execution.
48180d68 7769
39bc1876
NS
7770This switch is mainly for debugging the compiler and will likely be removed
7771in a future version.
edf1b3f3 7772
39bc1876
NS
7773@item -mnested-cond-exec
7774@opindex mnested-cond-exec
9904592e 7775
39bc1876 7776Enable nested conditional execution optimizations (default).
9904592e 7777
39bc1876
NS
7778This switch is mainly for debugging the compiler and will likely be removed
7779in a future version.
0ac081f6 7780
39bc1876
NS
7781@item -mno-nested-cond-exec
7782@opindex mno-nested-cond-exec
76a773f3 7783
39bc1876 7784Disable nested conditional execution optimizations.
74291a4b 7785
39bc1876
NS
7786This switch is mainly for debugging the compiler and will likely be removed
7787in a future version.
74291a4b 7788
39bc1876
NS
7789@item -mtomcat-stats
7790@opindex mtomcat-stats
e9a25f70 7791
39bc1876 7792Cause gas to print out tomcat statistics.
e9a25f70 7793
39bc1876
NS
7794@item -mcpu=@var{cpu}
7795@opindex mcpu
74291a4b 7796
39bc1876
NS
7797Select the processor type for which to generate code. Possible values are
7798@samp{simple}, @samp{tomcat}, @samp{fr500}, @samp{fr400}, @samp{fr300},
7799@samp{frv}.
bff46771 7800
39bc1876 7801@end table
8d8269fa 7802
39bc1876
NS
7803@node H8/300 Options
7804@subsection H8/300 Options
74291a4b 7805
39bc1876 7806These @samp{-m} options are defined for the H8/300 implementations:
74291a4b 7807
39bc1876
NS
7808@table @gcctabopt
7809@item -mrelax
7810@opindex mrelax
7811Shorten some address references at link time, when possible; uses the
7812linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
7813ld, Using ld}, for a fuller description.
74291a4b 7814
39bc1876
NS
7815@item -mh
7816@opindex mh
7817Generate code for the H8/300H@.
74291a4b 7818
39bc1876
NS
7819@item -ms
7820@opindex ms
7821Generate code for the H8S@.
74291a4b 7822
39bc1876
NS
7823@item -mn
7824@opindex mn
7825Generate code for the H8S and H8/300H in the normal mode. This switch
7826must be used either with -mh or -ms.
74291a4b 7827
39bc1876
NS
7828@item -ms2600
7829@opindex ms2600
7830Generate code for the H8S/2600. This switch must be used with @option{-ms}.
74291a4b 7831
39bc1876
NS
7832@item -mint32
7833@opindex mint32
7834Make @code{int} data 32 bits by default.
74291a4b 7835
39bc1876
NS
7836@item -malign-300
7837@opindex malign-300
7838On the H8/300H and H8S, use the same alignment rules as for the H8/300.
7839The default for the H8/300H and H8S is to align longs and floats on 4
7840byte boundaries.
7841@option{-malign-300} causes them to be aligned on 2 byte boundaries.
7842This option has no effect on the H8/300.
7843@end table
f5a1b0d2 7844
39bc1876
NS
7845@node HPPA Options
7846@subsection HPPA Options
7847@cindex HPPA Options
a5c76ee6 7848
39bc1876 7849These @samp{-m} options are defined for the HPPA family of computers:
a5c76ee6 7850
39bc1876
NS
7851@table @gcctabopt
7852@item -march=@var{architecture-type}
7853@opindex march
7854Generate code for the specified architecture. The choices for
7855@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
78561.1, and @samp{2.0} for PA 2.0 processors. Refer to
7857@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
7858architecture option for your machine. Code compiled for lower numbered
7859architectures will run on higher numbered architectures, but not the
7860other way around.
7861
39bc1876
NS
7862@item -mpa-risc-1-0
7863@itemx -mpa-risc-1-1
7864@itemx -mpa-risc-2-0
7865@opindex mpa-risc-1-0
7866@opindex mpa-risc-1-1
7867@opindex mpa-risc-2-0
7868Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
5a26b329 7869
39bc1876
NS
7870@item -mbig-switch
7871@opindex mbig-switch
7872Generate code suitable for big switch tables. Use this option only if
7873the assembler/linker complain about out of range branches within a switch
7874table.
efdba735 7875
39bc1876
NS
7876@item -mjump-in-delay
7877@opindex mjump-in-delay
7878Fill delay slots of function calls with unconditional jump instructions
7879by modifying the return pointer for the function call to be the target
7880of the conditional jump.
a5c76ee6 7881
39bc1876
NS
7882@item -mdisable-fpregs
7883@opindex mdisable-fpregs
7884Prevent floating point registers from being used in any manner. This is
7885necessary for compiling kernels which perform lazy context switching of
7886floating point registers. If you use this option and attempt to perform
7887floating point operations, the compiler will abort.
0a379b7a 7888
39bc1876
NS
7889@item -mdisable-indexing
7890@opindex mdisable-indexing
7891Prevent the compiler from using indexing address modes. This avoids some
7892rather obscure problems when compiling MIG generated code under MACH@.
f5a1b0d2 7893
39bc1876
NS
7894@item -mno-space-regs
7895@opindex mno-space-regs
7896Generate code that assumes the target has no space registers. This allows
7897GCC to generate faster indirect calls and use unscaled index address modes.
d2d42a91 7898
39bc1876 7899Such code is suitable for level 0 PA systems and kernels.
d2d42a91 7900
39bc1876
NS
7901@item -mfast-indirect-calls
7902@opindex mfast-indirect-calls
7903Generate code that assumes calls never cross space boundaries. This
7904allows GCC to emit code which performs faster indirect calls.
f08a3544 7905
39bc1876
NS
7906This option will not work in the presence of shared libraries or nested
7907functions.
f08a3544 7908
a2017852
JDA
7909@item -mfixed-range=@var{register-range}
7910@opindex mfixed-range
7911Generate code treating the given register range as fixed registers.
7912A fixed register is one that the register allocator can not use. This is
7913useful when compiling kernel code. A register range is specified as
7914two registers separated by a dash. Multiple register ranges can be
7915specified separated by a comma.
7916
39bc1876
NS
7917@item -mlong-load-store
7918@opindex mlong-load-store
7919Generate 3-instruction load and store sequences as sometimes required by
7920the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
7921the HP compilers.
61c85ff1 7922
39bc1876
NS
7923@item -mportable-runtime
7924@opindex mportable-runtime
7925Use the portable calling conventions proposed by HP for ELF systems.
61c85ff1 7926
39bc1876
NS
7927@item -mgas
7928@opindex mgas
7929Enable the use of assembler directives only GAS understands.
61c85ff1 7930
39bc1876
NS
7931@item -mschedule=@var{cpu-type}
7932@opindex mschedule
7933Schedule code according to the constraints for the machine type
7934@var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
7935@samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}. Refer
7936to @file{/usr/lib/sched.models} on an HP-UX system to determine the
7937proper scheduling option for your machine. The default scheduling is
7938@samp{8000}.
61c85ff1 7939
39bc1876
NS
7940@item -mlinker-opt
7941@opindex mlinker-opt
7942Enable the optimization pass in the HP-UX linker. Note this makes symbolic
7943debugging impossible. It also triggers a bug in the HP-UX 8 and HP-UX 9
7944linkers in which they give bogus error messages when linking some programs.
61c85ff1 7945
39bc1876
NS
7946@item -msoft-float
7947@opindex msoft-float
7948Generate output containing library calls for floating point.
7949@strong{Warning:} the requisite libraries are not available for all HPPA
7950targets. Normally the facilities of the machine's usual C compiler are
7951used, but this cannot be done directly in cross-compilation. You must make
7952your own arrangements to provide suitable library functions for
7953cross-compilation. The embedded target @samp{hppa1.1-*-pro}
7954does provide software floating point support.
31775d31 7955
39bc1876
NS
7956@option{-msoft-float} changes the calling convention in the output file;
7957therefore, it is only useful if you compile @emph{all} of a program with
7958this option. In particular, you need to compile @file{libgcc.a}, the
7959library that comes with GCC, with @option{-msoft-float} in order for
7960this to work.
61c85ff1 7961
39bc1876
NS
7962@item -msio
7963@opindex msio
7964Generate the predefine, @code{_SIO}, for server IO. The default is
7965@option{-mwsio}. This generates the predefines, @code{__hp9000s700},
7966@code{__hp9000s700__} and @code{_WSIO}, for workstation IO. These
7967options are available under HP-UX and HI-UX.
7968
7969@item -mgnu-ld
7970@opindex gnu-ld
7971Use GNU ld specific options. This passes @option{-shared} to ld when
7972building a shared library. It is the default when GCC is configured,
7973explicitly or implicitly, with the GNU linker. This option does not
7974have any affect on which ld is called, it only changes what parameters
7975are passed to that ld. The ld that is called is determined by the
7976@option{--with-ld} configure option, GCC's program search path, and
7977finally by the user's @env{PATH}. The linker used by GCC can be printed
7978using @samp{which `gcc -print-prog-name=ld`}.
48aec0bc 7979
39bc1876
NS
7980@item -mhp-ld
7981@opindex hp-ld
7982Use HP ld specific options. This passes @option{-b} to ld when building
7983a shared library and passes @option{+Accept TypeMismatch} to ld on all
7984links. It is the default when GCC is configured, explicitly or
7985implicitly, with the HP linker. This option does not have any affect on
7986which ld is called, it only changes what parameters are passed to that
7987ld. The ld that is called is determined by the @option{--with-ld}
7988configure option, GCC's program search path, and finally by the user's
7989@env{PATH}. The linker used by GCC can be printed using @samp{which
7990`gcc -print-prog-name=ld`}.
48aec0bc 7991
39bc1876
NS
7992@item -mlong-calls
7993@opindex mno-long-calls
7994Generate code that uses long call sequences. This ensures that a call
7995is always able to reach linker generated stubs. The default is to generate
7996long calls only when the distance from the call site to the beginning
7997of the function or translation unit, as the case may be, exceeds a
7998predefined limit set by the branch type being used. The limits for
7999normal calls are 7,600,000 and 240,000 bytes, respectively for the
8000PA 2.0 and PA 1.X architectures. Sibcalls are always limited at
8001240,000 bytes.
a27fb29b 8002
39bc1876
NS
8003Distances are measured from the beginning of functions when using the
8004@option{-ffunction-sections} option, or when using the @option{-mgas}
8005and @option{-mno-portable-runtime} options together under HP-UX with
8006the SOM linker.
7dac2f89 8007
39bc1876
NS
8008It is normally not desirable to use this option as it will degrade
8009performance. However, it may be useful in large applications,
8010particularly when partial linking is used to build the application.
74291a4b 8011
39bc1876
NS
8012The types of long calls used depends on the capabilities of the
8013assembler and linker, and the type of code being generated. The
8014impact on systems that support long absolute calls, and long pic
8015symbol-difference or pc-relative calls should be relatively small.
8016However, an indirect call is used on 32-bit ELF systems in pic code
8017and it is quite long.
74291a4b 8018
d711cf67
JDA
8019@item -munix=@var{unix-std}
8020@opindex march
8021Generate compiler predefines and select a startfile for the specified
8022UNIX standard. The choices for @var{unix-std} are @samp{93}, @samp{95}
8023and @samp{98}. @samp{93} is supported on all HP-UX versions. @samp{95}
8024is available on HP-UX 10.10 and later. @samp{98} is available on HP-UX
802511.11 and later. The default values are @samp{93} for HP-UX 10.00,
8026@samp{95} for HP-UX 10.10 though to 11.00, and @samp{98} for HP-UX 11.11
8027and later.
8028
8029@option{-munix=93} provides the same predefines as GCC 3.3 and 3.4.
8030@option{-munix=95} provides additional predefines for @code{XOPEN_UNIX}
8031and @code{_XOPEN_SOURCE_EXTENDED}, and the startfile @file{unix95.o}.
8032@option{-munix=98} provides additional predefines for @code{_XOPEN_UNIX},
8033@code{_XOPEN_SOURCE_EXTENDED}, @code{_INCLUDE__STDC_A1_SOURCE} and
8034@code{_INCLUDE_XOPEN_SOURCE_500}, and the startfile @file{unix98.o}.
8035
8036It is @emph{important} to note that this option changes the interfaces
8037for various library routines. It also affects the operational behavior
8038of the C library. Thus, @emph{extreme} care is needed in using this
8039option.
8040
8041Library code that is intended to operate with more than one UNIX
8042standard must test, set and restore the variable @var{__xpg4_extended_mask}
8043as appropriate. Most GNU software doesn't provide this capability.
8044
39bc1876
NS
8045@item -nolibdld
8046@opindex nolibdld
8047Suppress the generation of link options to search libdld.sl when the
8048@option{-static} option is specified on HP-UX 10 and later.
8049
8050@item -static
8051@opindex static
8052The HP-UX implementation of setlocale in libc has a dependency on
8053libdld.sl. There isn't an archive version of libdld.sl. Thus,
8054when the @option{-static} option is specified, special link options
8055are needed to resolve this dependency.
8056
8057On HP-UX 10 and later, the GCC driver adds the necessary options to
8058link with libdld.sl when the @option{-static} option is specified.
8059This causes the resulting binary to be dynamic. On the 64-bit port,
8060the linkers generate dynamic binaries by default in any case. The
8061@option{-nolibdld} option can be used to prevent the GCC driver from
8062adding these link options.
8063
8064@item -threads
8065@opindex threads
8066Add support for multithreading with the @dfn{dce thread} library
8067under HP-UX. This option sets flags for both the preprocessor and
8068linker.
8069@end table
8070
8071@node i386 and x86-64 Options
8072@subsection Intel 386 and AMD x86-64 Options
8073@cindex i386 Options
8074@cindex x86-64 Options
8075@cindex Intel 386 Options
8076@cindex AMD x86-64 Options
8077
8078These @samp{-m} options are defined for the i386 and x86-64 family of
8079computers:
8080
8081@table @gcctabopt
8082@item -mtune=@var{cpu-type}
8083@opindex mtune
8084Tune to @var{cpu-type} everything applicable about the generated code, except
8085for the ABI and the set of available instructions. The choices for
8086@var{cpu-type} are:
8087@table @emph
8088@item i386
8089Original Intel's i386 CPU.
8090@item i486
8091Intel's i486 CPU. (No scheduling is implemented for this chip.)
8092@item i586, pentium
8093Intel Pentium CPU with no MMX support.
8094@item pentium-mmx
8095Intel PentiumMMX CPU based on Pentium core with MMX instruction set support.
8096@item i686, pentiumpro
8097Intel PentiumPro CPU.
8098@item pentium2
8099Intel Pentium2 CPU based on PentiumPro core with MMX instruction set support.
8100@item pentium3, pentium3m
8101Intel Pentium3 CPU based on PentiumPro core with MMX and SSE instruction set
8102support.
8103@item pentium-m
8104Low power version of Intel Pentium3 CPU with MMX, SSE and SSE2 instruction set
8105support. Used by Centrino notebooks.
8106@item pentium4, pentium4m
8107Intel Pentium4 CPU with MMX, SSE and SSE2 instruction set support.
8108@item prescott
8109Improved version of Intel Pentium4 CPU with MMX, SSE, SSE2 and SSE3 instruction
8110set support.
8111@item nocona
8112Improved version of Intel Pentium4 CPU with 64-bit extensions, MMX, SSE,
8113SSE2 and SSE3 instruction set support.
8114@item k6
8115AMD K6 CPU with MMX instruction set support.
8116@item k6-2, k6-3
8117Improved versions of AMD K6 CPU with MMX and 3dNOW! instruction set support.
8118@item athlon, athlon-tbird
8119AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and SSE prefetch instructions
8120support.
8121@item athlon-4, athlon-xp, athlon-mp
8122Improved AMD Athlon CPU with MMX, 3dNOW!, enhanced 3dNOW! and full SSE
8123instruction set support.
8124@item k8, opteron, athlon64, athlon-fx
8125AMD K8 core based CPUs with x86-64 instruction set support. (This supersets
8126MMX, SSE, SSE2, 3dNOW!, enhanced 3dNOW! and 64-bit instruction set extensions.)
8127@item winchip-c6
8128IDT Winchip C6 CPU, dealt in same way as i486 with additional MMX instruction
8129set support.
8130@item winchip2
8131IDT Winchip2 CPU, dealt in same way as i486 with additional MMX and 3dNOW!
8132instruction set support.
8133@item c3
8134Via C3 CPU with MMX and 3dNOW! instruction set support. (No scheduling is
8135implemented for this chip.)
8136@item c3-2
8137Via C3-2 CPU with MMX and SSE instruction set support. (No scheduling is
8138implemented for this chip.)
8139@end table
8140
8141While picking a specific @var{cpu-type} will schedule things appropriately
8142for that particular chip, the compiler will not generate any code that
8143does not run on the i386 without the @option{-march=@var{cpu-type}} option
8144being used.
8145
8146@item -march=@var{cpu-type}
8147@opindex march
8148Generate instructions for the machine type @var{cpu-type}. The choices
8149for @var{cpu-type} are the same as for @option{-mtune}. Moreover,
8150specifying @option{-march=@var{cpu-type}} implies @option{-mtune=@var{cpu-type}}.
74291a4b 8151
39bc1876
NS
8152@item -mcpu=@var{cpu-type}
8153@opindex mcpu
8154A deprecated synonym for @option{-mtune}.
3398f47f 8155
39bc1876
NS
8156@item -m386
8157@itemx -m486
8158@itemx -mpentium
8159@itemx -mpentiumpro
8160@opindex m386
8161@opindex m486
8162@opindex mpentium
8163@opindex mpentiumpro
8164These options are synonyms for @option{-mtune=i386}, @option{-mtune=i486},
8165@option{-mtune=pentium}, and @option{-mtune=pentiumpro} respectively.
8166These synonyms are deprecated.
74291a4b 8167
39bc1876
NS
8168@item -mfpmath=@var{unit}
8169@opindex march
8170Generate floating point arithmetics for selected unit @var{unit}. The choices
8171for @var{unit} are:
2d2a50c3 8172
39bc1876
NS
8173@table @samp
8174@item 387
8175Use the standard 387 floating point coprocessor present majority of chips and
8176emulated otherwise. Code compiled with this option will run almost everywhere.
8177The temporary results are computed in 80bit precision instead of precision
8178specified by the type resulting in slightly different results compared to most
8179of other chips. See @option{-ffloat-store} for more detailed description.
74291a4b 8180
39bc1876 8181This is the default choice for i386 compiler.
74291a4b 8182
39bc1876
NS
8183@item sse
8184Use scalar floating point instructions present in the SSE instruction set.
8185This instruction set is supported by Pentium3 and newer chips, in the AMD line
8186by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
8187instruction set supports only single precision arithmetics, thus the double and
8188extended precision arithmetics is still done using 387. Later version, present
8189only in Pentium4 and the future AMD x86-64 chips supports double precision
8190arithmetics too.
a27fb29b 8191
39bc1876
NS
8192For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
8193@option{-msse2} switches to enable SSE extensions and make this option
8194effective. For x86-64 compiler, these extensions are enabled by default.
3398f47f 8195
39bc1876
NS
8196The resulting code should be considerably faster in the majority of cases and avoid
8197the numerical instability problems of 387 code, but may break some existing
8198code that expects temporaries to be 80bit.
cd3f11a6 8199
39bc1876 8200This is the default choice for the x86-64 compiler.
74291a4b 8201
39bc1876
NS
8202@item sse,387
8203Attempt to utilize both instruction sets at once. This effectively double the
8204amount of available registers and on chips with separate execution units for
8205387 and SSE the execution resources too. Use this option with care, as it is
8206still experimental, because the GCC register allocator does not model separate
8207functional units well resulting in instable performance.
8208@end table
ee692410 8209
39bc1876
NS
8210@item -masm=@var{dialect}
8211@opindex masm=@var{dialect}
8212Output asm instructions using selected @var{dialect}. Supported choices are
8213@samp{intel} or @samp{att} (the default one).
ee692410 8214
39bc1876
NS
8215@item -mieee-fp
8216@itemx -mno-ieee-fp
8217@opindex mieee-fp
8218@opindex mno-ieee-fp
8219Control whether or not the compiler uses IEEE floating point
8220comparisons. These handle correctly the case where the result of a
8221comparison is unordered.
ee692410 8222
39bc1876
NS
8223@item -msoft-float
8224@opindex msoft-float
8225Generate output containing library calls for floating point.
8226@strong{Warning:} the requisite libraries are not part of GCC@.
8227Normally the facilities of the machine's usual C compiler are used, but
8228this can't be done directly in cross-compilation. You must make your
8229own arrangements to provide suitable library functions for
8230cross-compilation.
ee692410 8231
39bc1876
NS
8232On machines where a function returns floating point results in the 80387
8233register stack, some floating point opcodes may be emitted even if
8234@option{-msoft-float} is used.
ee692410 8235
39bc1876
NS
8236@item -mno-fp-ret-in-387
8237@opindex mno-fp-ret-in-387
8238Do not use the FPU registers for return values of functions.
ee692410 8239
39bc1876
NS
8240The usual calling convention has functions return values of types
8241@code{float} and @code{double} in an FPU register, even if there
8242is no FPU@. The idea is that the operating system should emulate
8243an FPU@.
5a4b3afd 8244
39bc1876
NS
8245The option @option{-mno-fp-ret-in-387} causes such values to be returned
8246in ordinary CPU registers instead.
5a4b3afd 8247
39bc1876
NS
8248@item -mno-fancy-math-387
8249@opindex mno-fancy-math-387
8250Some 387 emulators do not support the @code{sin}, @code{cos} and
8251@code{sqrt} instructions for the 387. Specify this option to avoid
8252generating those instructions. This option is the default on FreeBSD,
8253OpenBSD and NetBSD@. This option is overridden when @option{-march}
8254indicates that the target cpu will always have an FPU and so the
8255instruction will not need emulation. As of revision 2.6.1, these
8256instructions are not generated unless you also use the
8257@option{-funsafe-math-optimizations} switch.
5a4b3afd 8258
39bc1876
NS
8259@item -malign-double
8260@itemx -mno-align-double
8261@opindex malign-double
8262@opindex mno-align-double
8263Control whether GCC aligns @code{double}, @code{long double}, and
8264@code{long long} variables on a two word boundary or a one word
8265boundary. Aligning @code{double} variables on a two word boundary will
8266produce code that runs somewhat faster on a @samp{Pentium} at the
8267expense of more memory.
5a4b3afd 8268
39bc1876
NS
8269@strong{Warning:} if you use the @option{-malign-double} switch,
8270structures containing the above types will be aligned differently than
8271the published application binary interface specifications for the 386
8272and will not be binary compatible with structures in code compiled
8273without that switch.
5a4b3afd 8274
39bc1876
NS
8275@item -m96bit-long-double
8276@itemx -m128bit-long-double
8277@opindex m96bit-long-double
8278@opindex m128bit-long-double
8279These switches control the size of @code{long double} type. The i386
8280application binary interface specifies the size to be 96 bits,
8281so @option{-m96bit-long-double} is the default in 32 bit mode.
5a4b3afd 8282
39bc1876
NS
8283Modern architectures (Pentium and newer) would prefer @code{long double}
8284to be aligned to an 8 or 16 byte boundary. In arrays or structures
8285conforming to the ABI, this would not be possible. So specifying a
8286@option{-m128bit-long-double} will align @code{long double}
8287to a 16 byte boundary by padding the @code{long double} with an additional
828832 bit zero.
5a4b3afd 8289
39bc1876
NS
8290In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as
8291its ABI specifies that @code{long double} is to be aligned on 16 byte boundary.
5a4b3afd 8292
39bc1876
NS
8293Notice that neither of these options enable any extra precision over the x87
8294standard of 80 bits for a @code{long double}.
5a4b3afd 8295
39bc1876
NS
8296@strong{Warning:} if you override the default value for your target ABI, the
8297structures and arrays containing @code{long double} variables will change
8298their size as well as function calling convention for function taking
8299@code{long double} will be modified. Hence they will not be binary
8300compatible with arrays or structures in code compiled without that switch.
5a4b3afd 8301
5a4b3afd 8302
39bc1876
NS
8303@item -msvr3-shlib
8304@itemx -mno-svr3-shlib
8305@opindex msvr3-shlib
8306@opindex mno-svr3-shlib
8307Control whether GCC places uninitialized local variables into the
8308@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them
8309into @code{bss}. These options are meaningful only on System V Release 3.
5a4b3afd 8310
39bc1876
NS
8311@item -mrtd
8312@opindex mrtd
8313Use a different function-calling convention, in which functions that
8314take a fixed number of arguments return with the @code{ret} @var{num}
8315instruction, which pops their arguments while returning. This saves one
8316instruction in the caller since there is no need to pop the arguments
8317there.
5a4b3afd 8318
39bc1876
NS
8319You can specify that an individual function is called with this calling
8320sequence with the function attribute @samp{stdcall}. You can also
8321override the @option{-mrtd} option by using the function attribute
8322@samp{cdecl}. @xref{Function Attributes}.
74291a4b 8323
39bc1876
NS
8324@strong{Warning:} this calling convention is incompatible with the one
8325normally used on Unix, so you cannot use it if you need to call
8326libraries compiled with the Unix compiler.
74291a4b 8327
39bc1876
NS
8328Also, you must provide function prototypes for all functions that
8329take variable numbers of arguments (including @code{printf});
8330otherwise incorrect code will be generated for calls to those
8331functions.
02f52e19 8332
39bc1876
NS
8333In addition, seriously incorrect code will result if you call a
8334function with too many arguments. (Normally, extra arguments are
8335harmlessly ignored.)
1cf959cb 8336
39bc1876
NS
8337@item -mregparm=@var{num}
8338@opindex mregparm
8339Control how many registers are used to pass integer arguments. By
8340default, no registers are used to pass arguments, and at most 3
8341registers can be used. You can control this behavior for a specific
8342function by using the function attribute @samp{regparm}.
8343@xref{Function Attributes}.
1cf959cb 8344
39bc1876
NS
8345@strong{Warning:} if you use this switch, and
8346@var{num} is nonzero, then you must build all modules with the same
8347value, including any libraries. This includes the system libraries and
8348startup modules.
5a4b3afd 8349
39bc1876
NS
8350@item -mpreferred-stack-boundary=@var{num}
8351@opindex mpreferred-stack-boundary
8352Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
8353byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
8354the default is 4 (16 bytes or 128 bits), except when optimizing for code
8355size (@option{-Os}), in which case the default is the minimum correct
8356alignment (4 bytes for x86, and 8 bytes for x86-64).
5a4b3afd 8357
39bc1876
NS
8358On Pentium and PentiumPro, @code{double} and @code{long double} values
8359should be aligned to an 8 byte boundary (see @option{-malign-double}) or
8360suffer significant run time performance penalties. On Pentium III, the
8361Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
8362penalties if it is not 16 byte aligned.
5a4b3afd 8363
39bc1876
NS
8364To ensure proper alignment of this values on the stack, the stack boundary
8365must be as aligned as that required by any value stored on the stack.
8366Further, every function must be generated such that it keeps the stack
8367aligned. Thus calling a function compiled with a higher preferred
8368stack boundary from a function compiled with a lower preferred stack
8369boundary will most likely misalign the stack. It is recommended that
8370libraries that use callbacks always use the default setting.
5a4b3afd 8371
39bc1876
NS
8372This extra alignment does consume extra stack space, and generally
8373increases code size. Code that is sensitive to stack space usage, such
8374as embedded systems and operating system kernels, may want to reduce the
8375preferred alignment to @option{-mpreferred-stack-boundary=2}.
5a4b3afd 8376
39bc1876
NS
8377@item -mmmx
8378@itemx -mno-mmx
8379@item -msse
8380@itemx -mno-sse
8381@item -msse2
8382@itemx -mno-sse2
8383@item -msse3
8384@itemx -mno-sse3
8385@item -m3dnow
8386@itemx -mno-3dnow
8387@opindex mmmx
8388@opindex mno-mmx
8389@opindex msse
8390@opindex mno-sse
8391@opindex m3dnow
8392@opindex mno-3dnow
8393These switches enable or disable the use of built-in functions that allow
8394direct access to the MMX, SSE, SSE2, SSE3 and 3Dnow extensions of the
8395instruction set.
74291a4b 8396
39bc1876
NS
8397@xref{X86 Built-in Functions}, for details of the functions enabled
8398and disabled by these switches.
74291a4b 8399
39bc1876
NS
8400To have SSE/SSE2 instructions generated automatically from floating-point
8401code, see @option{-mfpmath=sse}.
74291a4b 8402
39bc1876
NS
8403@item -mpush-args
8404@itemx -mno-push-args
8405@opindex mpush-args
8406@opindex mno-push-args
8407Use PUSH operations to store outgoing parameters. This method is shorter
8408and usually equally fast as method using SUB/MOV operations and is enabled
8409by default. In some cases disabling it may improve performance because of
8410improved scheduling and reduced dependencies.
74291a4b 8411
39bc1876
NS
8412@item -maccumulate-outgoing-args
8413@opindex maccumulate-outgoing-args
8414If enabled, the maximum amount of space required for outgoing arguments will be
8415computed in the function prologue. This is faster on most modern CPUs
8416because of reduced dependencies, improved scheduling and reduced stack usage
8417when preferred stack boundary is not equal to 2. The drawback is a notable
8418increase in code size. This switch implies @option{-mno-push-args}.
63357d93 8419
39bc1876
NS
8420@item -mthreads
8421@opindex mthreads
8422Support thread-safe exception handling on @samp{Mingw32}. Code that relies
8423on thread-safe exception handling must compile and link all code with the
8424@option{-mthreads} option. When compiling, @option{-mthreads} defines
8425@option{-D_MT}; when linking, it links in a special thread helper library
8426@option{-lmingwthrd} which cleans up per thread exception handling data.
5ef1a99d 8427
39bc1876
NS
8428@item -mno-align-stringops
8429@opindex mno-align-stringops
8430Do not align destination of inlined string operations. This switch reduces
8431code size and improves performance in case the destination is already aligned,
8432but GCC doesn't know about it.
46490403 8433
39bc1876
NS
8434@item -minline-all-stringops
8435@opindex minline-all-stringops
8436By default GCC inlines string operations only when destination is known to be
8437aligned at least to 4 byte boundary. This enables more inlining, increase code
8438size, but may improve performance of code that depends on fast memcpy, strlen
8439and memset for short lengths.
c235ddf2 8440
39bc1876
NS
8441@item -momit-leaf-frame-pointer
8442@opindex momit-leaf-frame-pointer
8443Don't keep the frame pointer in a register for leaf functions. This
8444avoids the instructions to save, set up and restore frame pointers and
8445makes an extra register available in leaf functions. The option
8446@option{-fomit-frame-pointer} removes the frame pointer for all functions
8447which might make debugging harder.
c235ddf2 8448
39bc1876
NS
8449@item -mtls-direct-seg-refs
8450@itemx -mno-tls-direct-seg-refs
8451@opindex mtls-direct-seg-refs
8452Controls whether TLS variables may be accessed with offsets from the
8453TLS segment register (@code{%gs} for 32-bit, @code{%fs} for 64-bit),
8454or whether the thread base pointer must be added. Whether or not this
8455is legal depends on the operating system, and whether it maps the
8456segment to cover the entire TLS area.
beadc644 8457
39bc1876
NS
8458For systems that use GNU libc, the default is on.
8459@end table
af34e51e 8460
39bc1876
NS
8461These @samp{-m} switches are supported in addition to the above
8462on AMD x86-64 processors in 64-bit environments.
50d32cf6 8463
39bc1876
NS
8464@table @gcctabopt
8465@item -m32
8466@itemx -m64
8467@opindex m32
8468@opindex m64
8469Generate code for a 32-bit or 64-bit environment.
8470The 32-bit environment sets int, long and pointer to 32 bits and
8471generates code that runs on any i386 system.
8472The 64-bit environment sets int to 32 bits and long and pointer
8473to 64 bits and generates code for AMD's x86-64 architecture.
50d32cf6 8474
39bc1876
NS
8475@item -mno-red-zone
8476@opindex no-red-zone
8477Do not use a so called red zone for x86-64 code. The red zone is mandated
8478by the x86-64 ABI, it is a 128-byte area beyond the location of the
8479stack pointer that will not be modified by signal or interrupt handlers
8480and therefore can be used for temporary data without adjusting the stack
8481pointer. The flag @option{-mno-red-zone} disables this red zone.
dc884a86 8482
39bc1876
NS
8483@item -mcmodel=small
8484@opindex mcmodel=small
8485Generate code for the small code model: the program and its symbols must
8486be linked in the lower 2 GB of the address space. Pointers are 64 bits.
8487Programs can be statically or dynamically linked. This is the default
8488code model.
dc884a86 8489
39bc1876
NS
8490@item -mcmodel=kernel
8491@opindex mcmodel=kernel
8492Generate code for the kernel code model. The kernel runs in the
8493negative 2 GB of the address space.
8494This model has to be used for Linux kernel code.
8495
8496@item -mcmodel=medium
8497@opindex mcmodel=medium
8498Generate code for the medium model: The program is linked in the lower 2
8499GB of the address space but symbols can be located anywhere in the
8500address space. Programs can be statically or dynamically linked, but
8501building of shared libraries are not supported with the medium model.
8502
8503@item -mcmodel=large
8504@opindex mcmodel=large
8505Generate code for the large model: This model makes no assumptions
8506about addresses and sizes of sections. Currently GCC does not implement
8507this model.
74291a4b
MM
8508@end table
8509
39bc1876
NS
8510@node IA-64 Options
8511@subsection IA-64 Options
8512@cindex IA-64 Options
74291a4b 8513
39bc1876 8514These are the @samp{-m} options defined for the Intel IA-64 architecture.
74291a4b 8515
2642624b 8516@table @gcctabopt
39bc1876
NS
8517@item -mbig-endian
8518@opindex mbig-endian
8519Generate code for a big endian target. This is the default for HP-UX@.
6f670fde 8520
39bc1876
NS
8521@item -mlittle-endian
8522@opindex mlittle-endian
8523Generate code for a little endian target. This is the default for AIX5
8524and GNU/Linux.
a9f3e1a4 8525
39bc1876
NS
8526@item -mgnu-as
8527@itemx -mno-gnu-as
8528@opindex mgnu-as
8529@opindex mno-gnu-as
8530Generate (or don't) code for the GNU assembler. This is the default.
8531@c Also, this is the default if the configure option @option{--with-gnu-as}
8532@c is used.
9d913bbf 8533
39bc1876
NS
8534@item -mgnu-ld
8535@itemx -mno-gnu-ld
8536@opindex mgnu-ld
8537@opindex mno-gnu-ld
8538Generate (or don't) code for the GNU linker. This is the default.
8539@c Also, this is the default if the configure option @option{--with-gnu-ld}
8540@c is used.
a9f3e1a4 8541
39bc1876
NS
8542@item -mno-pic
8543@opindex mno-pic
8544Generate code that does not use a global pointer register. The result
8545is not position independent code, and violates the IA-64 ABI@.
74291a4b 8546
39bc1876
NS
8547@item -mvolatile-asm-stop
8548@itemx -mno-volatile-asm-stop
8549@opindex mvolatile-asm-stop
8550@opindex mno-volatile-asm-stop
8551Generate (or don't) a stop bit immediately before and after volatile asm
8552statements.
965f5423 8553
39bc1876
NS
8554@item -mb-step
8555@opindex mb-step
8556Generate code that works around Itanium B step errata.
965f5423 8557
39bc1876
NS
8558@item -mregister-names
8559@itemx -mno-register-names
8560@opindex mregister-names
8561@opindex mno-register-names
8562Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
8563the stacked registers. This may make assembler output more readable.
965f5423 8564
39bc1876
NS
8565@item -mno-sdata
8566@itemx -msdata
8567@opindex mno-sdata
8568@opindex msdata
8569Disable (or enable) optimizations that use the small data section. This may
8570be useful for working around optimizer bugs.
8571
8572@item -mconstant-gp
8573@opindex mconstant-gp
8574Generate code that uses a single constant global pointer value. This is
8575useful when compiling kernel code.
8576
8577@item -mauto-pic
8578@opindex mauto-pic
8579Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
8580This is useful when compiling firmware code.
8581
8582@item -minline-float-divide-min-latency
8583@opindex minline-float-divide-min-latency
8584Generate code for inline divides of floating point values
8585using the minimum latency algorithm.
965f5423 8586
39bc1876
NS
8587@item -minline-float-divide-max-throughput
8588@opindex minline-float-divide-max-throughput
8589Generate code for inline divides of floating point values
8590using the maximum throughput algorithm.
965f5423 8591
39bc1876
NS
8592@item -minline-int-divide-min-latency
8593@opindex minline-int-divide-min-latency
8594Generate code for inline divides of integer values
8595using the minimum latency algorithm.
965f5423 8596
39bc1876
NS
8597@item -minline-int-divide-max-throughput
8598@opindex minline-int-divide-max-throughput
8599Generate code for inline divides of integer values
8600using the maximum throughput algorithm.
965f5423 8601
39bc1876
NS
8602@item -mno-dwarf2-asm
8603@itemx -mdwarf2-asm
8604@opindex mno-dwarf2-asm
8605@opindex mdwarf2-asm
8606Don't (or do) generate assembler code for the DWARF2 line number debugging
8607info. This may be useful when not using the GNU assembler.
965f5423 8608
39bc1876
NS
8609@item -mfixed-range=@var{register-range}
8610@opindex mfixed-range
8611Generate code treating the given register range as fixed registers.
8612A fixed register is one that the register allocator can not use. This is
8613useful when compiling kernel code. A register range is specified as
8614two registers separated by a dash. Multiple register ranges can be
8615specified separated by a comma.
04e149ab 8616
39bc1876
NS
8617@item -mearly-stop-bits
8618@itemx -mno-early-stop-bits
8619@opindex mearly-stop-bits
8620@opindex mno-early-stop-bits
8621Allow stop bits to be placed earlier than immediately preceding the
8622instruction that triggered the stop bit. This can improve instruction
8623scheduling, but does not always do so.
8624@end table
74291a4b 8625
39bc1876
NS
8626@node M32R/D Options
8627@subsection M32R/D Options
8628@cindex M32R/D options
74291a4b 8629
39bc1876 8630These @option{-m} options are defined for Renesas M32R/D architectures:
74291a4b 8631
39bc1876
NS
8632@table @gcctabopt
8633@item -m32r2
8634@opindex m32r2
8635Generate code for the M32R/2@.
74291a4b 8636
39bc1876
NS
8637@item -m32rx
8638@opindex m32rx
8639Generate code for the M32R/X@.
74291a4b 8640
39bc1876
NS
8641@item -m32r
8642@opindex m32r
8643Generate code for the M32R@. This is the default.
74291a4b 8644
39bc1876
NS
8645@item -mmodel=small
8646@opindex mmodel=small
8647Assume all objects live in the lower 16MB of memory (so that their addresses
8648can be loaded with the @code{ld24} instruction), and assume all subroutines
8649are reachable with the @code{bl} instruction.
8650This is the default.
74291a4b 8651
39bc1876
NS
8652The addressability of a particular object can be set with the
8653@code{model} attribute.
74291a4b 8654
39bc1876
NS
8655@item -mmodel=medium
8656@opindex mmodel=medium
8657Assume objects may be anywhere in the 32-bit address space (the compiler
8658will generate @code{seth/add3} instructions to load their addresses), and
8659assume all subroutines are reachable with the @code{bl} instruction.
194734e9 8660
39bc1876
NS
8661@item -mmodel=large
8662@opindex mmodel=large
8663Assume objects may be anywhere in the 32-bit address space (the compiler
8664will generate @code{seth/add3} instructions to load their addresses), and
8665assume subroutines may not be reachable with the @code{bl} instruction
8666(the compiler will generate the much slower @code{seth/add3/jl}
8667instruction sequence).
a5f3dd66 8668
39bc1876
NS
8669@item -msdata=none
8670@opindex msdata=none
8671Disable use of the small data area. Variables will be put into
8672one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
8673@code{section} attribute has been specified).
8674This is the default.
a5f3dd66 8675
39bc1876
NS
8676The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
8677Objects may be explicitly put in the small data area with the
8678@code{section} attribute using one of these sections.
daf2f129 8679
39bc1876
NS
8680@item -msdata=sdata
8681@opindex msdata=sdata
8682Put small global and static data in the small data area, but do not
8683generate special code to reference them.
2b589241 8684
39bc1876
NS
8685@item -msdata=use
8686@opindex msdata=use
8687Put small global and static data in the small data area, and generate
8688special instructions to reference them.
2b589241 8689
39bc1876
NS
8690@item -G @var{num}
8691@opindex G
8692@cindex smaller data references
8693Put global and static objects less than or equal to @var{num} bytes
8694into the small data or bss sections instead of the normal data or bss
8695sections. The default value of @var{num} is 8.
8696The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
8697for this option to have any effect.
74291a4b 8698
39bc1876
NS
8699All modules should be compiled with the same @option{-G @var{num}} value.
8700Compiling with different values of @var{num} may or may not work; if it
8701doesn't the linker will give an error message---incorrect code will not be
8702generated.
74291a4b 8703
39bc1876
NS
8704@item -mdebug
8705@opindex mdebug
8706Makes the M32R specific code in the compiler display some statistics
8707that might help in debugging programs.
74291a4b 8708
39bc1876
NS
8709@item -malign-loops
8710@opindex malign-loops
8711Align all loops to a 32-byte boundary.
74291a4b 8712
39bc1876
NS
8713@item -mno-align-loops
8714@opindex mno-align-loops
8715Do not enforce a 32-byte alignment for loops. This is the default.
74291a4b 8716
39bc1876
NS
8717@item -missue-rate=@var{number}
8718@opindex missue-rate=@var{number}
8719Issue @var{number} instructions per cycle. @var{number} can only be 1
8720or 2.
74291a4b 8721
39bc1876
NS
8722@item -mbranch-cost=@var{number}
8723@opindex mbranch-cost=@var{number}
8724@var{number} can only be 1 or 2. If it is 1 then branches will be
8725preferred over conditional code, if it is 2, then the opposite will
8726apply.
74291a4b 8727
39bc1876
NS
8728@item -mflush-trap=@var{number}
8729@opindex mflush-trap=@var{number}
8730Specifies the trap number to use to flush the cache. The default is
873112. Valid numbers are between 0 and 15 inclusive.
74291a4b 8732
39bc1876
NS
8733@item -mno-flush-trap
8734@opindex mno-flush-trap
8735Specifies that the cache cannot be flushed by using a trap.
74291a4b 8736
39bc1876
NS
8737@item -mflush-func=@var{name}
8738@opindex mflush-func=@var{name}
8739Specifies the name of the operating system function to call to flush
8740the cache. The default is @emph{_flush_cache}, but a function call
8741will only be used if a trap is not available.
3af4bd89 8742
39bc1876
NS
8743@item -mno-flush-func
8744@opindex mno-flush-func
8745Indicates that there is no OS function for flushing the cache.
3af4bd89 8746
39bc1876 8747@end table
3af4bd89 8748
39bc1876
NS
8749@node M680x0 Options
8750@subsection M680x0 Options
8751@cindex M680x0 options
f22a97d2 8752
39bc1876
NS
8753These are the @samp{-m} options defined for the 68000 series. The default
8754values for these options depends on which style of 68000 was selected when
8755the compiler was configured; the defaults for the most common choices are
8756given below.
1255c85c 8757
39bc1876
NS
8758@table @gcctabopt
8759@item -m68000
8760@itemx -mc68000
8761@opindex m68000
8762@opindex mc68000
8763Generate output for a 68000. This is the default
8764when the compiler is configured for 68000-based systems.
1255c85c 8765
39bc1876
NS
8766Use this option for microcontrollers with a 68000 or EC000 core,
8767including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
7eafc329 8768
39bc1876
NS
8769@item -m68020
8770@itemx -mc68020
8771@opindex m68020
8772@opindex mc68020
8773Generate output for a 68020. This is the default
8774when the compiler is configured for 68020-based systems.
f73ad30e 8775
39bc1876
NS
8776@item -m68881
8777@opindex m68881
8778Generate output containing 68881 instructions for floating point.
8779This is the default for most 68020 systems unless @option{--nfp} was
8780specified when the compiler was configured.
f73ad30e 8781
39bc1876
NS
8782@item -m68030
8783@opindex m68030
8784Generate output for a 68030. This is the default when the compiler is
8785configured for 68030-based systems.
79f05c19 8786
39bc1876
NS
8787@item -m68040
8788@opindex m68040
8789Generate output for a 68040. This is the default when the compiler is
8790configured for 68040-based systems.
79f05c19 8791
39bc1876
NS
8792This option inhibits the use of 68881/68882 instructions that have to be
8793emulated by software on the 68040. Use this option if your 68040 does not
8794have code to emulate those instructions.
762e166b 8795
39bc1876
NS
8796@item -m68060
8797@opindex m68060
8798Generate output for a 68060. This is the default when the compiler is
8799configured for 68060-based systems.
74dc3e94 8800
39bc1876
NS
8801This option inhibits the use of 68020 and 68881/68882 instructions that
8802have to be emulated by software on the 68060. Use this option if your 68060
8803does not have code to emulate those instructions.
74dc3e94 8804
39bc1876
NS
8805@item -mcpu32
8806@opindex mcpu32
8807Generate output for a CPU32. This is the default
8808when the compiler is configured for CPU32-based systems.
3af4bd89 8809
39bc1876
NS
8810Use this option for microcontrollers with a
8811CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
881268336, 68340, 68341, 68349 and 68360.
14f73b5a 8813
39bc1876
NS
8814@item -m5200
8815@opindex m5200
8816Generate output for a 520X ``coldfire'' family cpu. This is the default
8817when the compiler is configured for 520X-based systems.
14f73b5a 8818
39bc1876
NS
8819Use this option for microcontroller with a 5200 core, including
8820the MCF5202, MCF5203, MCF5204 and MCF5202.
a7701995 8821
a7701995 8822
39bc1876
NS
8823@item -m68020-40
8824@opindex m68020-40
8825Generate output for a 68040, without using any of the new instructions.
8826This results in code which can run relatively efficiently on either a
882768020/68881 or a 68030 or a 68040. The generated code does use the
882868881 instructions that are emulated on the 68040.
a7701995 8829
39bc1876
NS
8830@item -m68020-60
8831@opindex m68020-60
8832Generate output for a 68060, without using any of the new instructions.
8833This results in code which can run relatively efficiently on either a
883468020/68881 or a 68030 or a 68040. The generated code does use the
883568881 instructions that are emulated on the 68060.
a7701995 8836
39bc1876
NS
8837@item -msoft-float
8838@opindex msoft-float
8839Generate output containing library calls for floating point.
8840@strong{Warning:} the requisite libraries are not available for all m68k
8841targets. Normally the facilities of the machine's usual C compiler are
8842used, but this can't be done directly in cross-compilation. You must
8843make your own arrangements to provide suitable library functions for
8844cross-compilation. The embedded targets @samp{m68k-*-aout} and
8845@samp{m68k-*-coff} do provide software floating point support.
14f73b5a 8846
39bc1876
NS
8847@item -mshort
8848@opindex mshort
8849Consider type @code{int} to be 16 bits wide, like @code{short int}.
8850Additionally, parameters passed on the stack are also aligned to a
885116-bit boundary even on targets whose API mandates promotion to 32-bit.
74291a4b 8852
39bc1876
NS
8853@item -mnobitfield
8854@opindex mnobitfield
8855Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
8856and @option{-m5200} options imply @w{@option{-mnobitfield}}.
74291a4b 8857
39bc1876
NS
8858@item -mbitfield
8859@opindex mbitfield
8860Do use the bit-field instructions. The @option{-m68020} option implies
8861@option{-mbitfield}. This is the default if you use a configuration
8862designed for a 68020.
8863
8864@item -mrtd
8865@opindex mrtd
8866Use a different function-calling convention, in which functions
8867that take a fixed number of arguments return with the @code{rtd}
8868instruction, which pops their arguments while returning. This
8869saves one instruction in the caller since there is no need to pop
8870the arguments there.
ea3bfbfe 8871
39bc1876
NS
8872This calling convention is incompatible with the one normally
8873used on Unix, so you cannot use it if you need to call libraries
8874compiled with the Unix compiler.
74291a4b 8875
39bc1876
NS
8876Also, you must provide function prototypes for all functions that
8877take variable numbers of arguments (including @code{printf});
8878otherwise incorrect code will be generated for calls to those
8879functions.
861bb6c1 8880
39bc1876
NS
8881In addition, seriously incorrect code will result if you call a
8882function with too many arguments. (Normally, extra arguments are
8883harmlessly ignored.)
74291a4b 8884
39bc1876
NS
8885The @code{rtd} instruction is supported by the 68010, 68020, 68030,
888668040, 68060 and CPU32 processors, but not by the 68000 or 5200.
74291a4b 8887
39bc1876
NS
8888@item -malign-int
8889@itemx -mno-align-int
8890@opindex malign-int
8891@opindex mno-align-int
8892Control whether GCC aligns @code{int}, @code{long}, @code{long long},
8893@code{float}, @code{double}, and @code{long double} variables on a 32-bit
8894boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
8895Aligning variables on 32-bit boundaries produces code that runs somewhat
8896faster on processors with 32-bit busses at the expense of more memory.
74291a4b 8897
39bc1876
NS
8898@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
8899align structures containing the above types differently than
8900most published application binary interface specifications for the m68k.
74291a4b 8901
39bc1876
NS
8902@item -mpcrel
8903@opindex mpcrel
8904Use the pc-relative addressing mode of the 68000 directly, instead of
8905using a global offset table. At present, this option implies @option{-fpic},
8906allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
8907not presently supported with @option{-mpcrel}, though this could be supported for
890868020 and higher processors.
74291a4b 8909
39bc1876
NS
8910@item -mno-strict-align
8911@itemx -mstrict-align
8912@opindex mno-strict-align
8913@opindex mstrict-align
8914Do not (do) assume that unaligned memory references will be handled by
8915the system.
74291a4b 8916
39bc1876
NS
8917@item -msep-data
8918Generate code that allows the data segment to be located in a different
8919area of memory from the text segment. This allows for execute in place in
8920an environment without virtual memory management. This option implies -fPIC.
74291a4b 8921
39bc1876
NS
8922@item -mno-sep-data
8923Generate code that assumes that the data segment follows the text segment.
8924This is the default.
74291a4b 8925
39bc1876
NS
8926@item -mid-shared-library
8927Generate code that supports shared libraries via the library ID method.
8928This allows for execute in place and shared libraries in an environment
8929without virtual memory management. This option implies -fPIC.
74291a4b 8930
39bc1876
NS
8931@item -mno-id-shared-library
8932Generate code that doesn't assume ID based shared libraries are being used.
8933This is the default.
74291a4b 8934
39bc1876
NS
8935@item -mshared-library-id=n
8936Specified the identification number of the ID based shared library being
8937compiled. Specifying a value of 0 will generate more compact code, specifying
8938other values will force the allocation of that number to the current
8939library but is no more space or time efficient than omitting this option.
74291a4b 8940
39bc1876 8941@end table
74291a4b 8942
39bc1876
NS
8943@node M68hc1x Options
8944@subsection M68hc1x Options
8945@cindex M68hc1x options
74291a4b 8946
39bc1876
NS
8947These are the @samp{-m} options defined for the 68hc11 and 68hc12
8948microcontrollers. The default values for these options depends on
8949which style of microcontroller was selected when the compiler was configured;
8950the defaults for the most common choices are given below.
c219e1da 8951
39bc1876
NS
8952@table @gcctabopt
8953@item -m6811
8954@itemx -m68hc11
8955@opindex m6811
8956@opindex m68hc11
8957Generate output for a 68HC11. This is the default
8958when the compiler is configured for 68HC11-based systems.
c5d3d49b 8959
39bc1876
NS
8960@item -m6812
8961@itemx -m68hc12
8962@opindex m6812
8963@opindex m68hc12
8964Generate output for a 68HC12. This is the default
8965when the compiler is configured for 68HC12-based systems.
c5d3d49b 8966
39bc1876
NS
8967@item -m68S12
8968@itemx -m68hcs12
8969@opindex m68S12
8970@opindex m68hcs12
8971Generate output for a 68HCS12.
c5d3d49b 8972
39bc1876
NS
8973@item -mauto-incdec
8974@opindex mauto-incdec
8975Enable the use of 68HC12 pre and post auto-increment and auto-decrement
8976addressing modes.
34208acf 8977
39bc1876
NS
8978@item -minmax
8979@itemx -nominmax
8980@opindex minmax
8981@opindex mnominmax
8982Enable the use of 68HC12 min and max instructions.
34208acf 8983
39bc1876
NS
8984@item -mlong-calls
8985@itemx -mno-long-calls
8986@opindex mlong-calls
8987@opindex mno-long-calls
8988Treat all calls as being far away (near). If calls are assumed to be
8989far away, the compiler will use the @code{call} instruction to
8990call a function and the @code{rtc} instruction for returning.
34208acf 8991
39bc1876
NS
8992@item -mshort
8993@opindex mshort
8994Consider type @code{int} to be 16 bits wide, like @code{short int}.
34208acf 8995
39bc1876
NS
8996@item -msoft-reg-count=@var{count}
8997@opindex msoft-reg-count
8998Specify the number of pseudo-soft registers which are used for the
8999code generation. The maximum number is 32. Using more pseudo-soft
9000register may or may not result in better code depending on the program.
9001The default is 4 for 68HC11 and 2 for 68HC12.
34208acf 9002
39bc1876 9003@end table
34208acf 9004
39bc1876
NS
9005@node MCore Options
9006@subsection MCore Options
9007@cindex MCore options
34208acf 9008
39bc1876
NS
9009These are the @samp{-m} options defined for the Motorola M*Core
9010processors.
34208acf 9011
39bc1876 9012@table @gcctabopt
34208acf 9013
39bc1876
NS
9014@item -mhardlit
9015@itemx -mno-hardlit
9016@opindex mhardlit
9017@opindex mno-hardlit
9018Inline constants into the code stream if it can be done in two
9019instructions or less.
34208acf 9020
39bc1876
NS
9021@item -mdiv
9022@itemx -mno-div
9023@opindex mdiv
9024@opindex mno-div
9025Use the divide instruction. (Enabled by default).
a02aa5b0 9026
39bc1876
NS
9027@item -mrelax-immediate
9028@itemx -mno-relax-immediate
9029@opindex mrelax-immediate
9030@opindex mno-relax-immediate
9031Allow arbitrary sized immediates in bit operations.
a02aa5b0 9032
39bc1876
NS
9033@item -mwide-bitfields
9034@itemx -mno-wide-bitfields
9035@opindex mwide-bitfields
9036@opindex mno-wide-bitfields
9037Always treat bit-fields as int-sized.
a02aa5b0 9038
39bc1876
NS
9039@item -m4byte-functions
9040@itemx -mno-4byte-functions
9041@opindex m4byte-functions
9042@opindex mno-4byte-functions
9043Force all functions to be aligned to a four byte boundary.
a02aa5b0 9044
39bc1876
NS
9045@item -mcallgraph-data
9046@itemx -mno-callgraph-data
9047@opindex mcallgraph-data
9048@opindex mno-callgraph-data
9049Emit callgraph information.
f401d0f5 9050
39bc1876
NS
9051@item -mslow-bytes
9052@itemx -mno-slow-bytes
9053@opindex mslow-bytes
9054@opindex mno-slow-bytes
9055Prefer word access when reading byte quantities.
f401d0f5 9056
39bc1876
NS
9057@item -mlittle-endian
9058@itemx -mbig-endian
9059@opindex mlittle-endian
9060@opindex mbig-endian
9061Generate code for a little endian target.
f401d0f5 9062
39bc1876
NS
9063@item -m210
9064@itemx -m340
9065@opindex m210
9066@opindex m340
9067Generate code for the 210 processor.
74291a4b
MM
9068@end table
9069
39bc1876
NS
9070@node MIPS Options
9071@subsection MIPS Options
9072@cindex MIPS options
74291a4b 9073
2642624b 9074@table @gcctabopt
74291a4b 9075
39bc1876
NS
9076@item -EB
9077@opindex EB
9078Generate big-endian code.
74291a4b 9079
39bc1876
NS
9080@item -EL
9081@opindex EL
9082Generate little-endian code. This is the default for @samp{mips*el-*-*}
9083configurations.
74291a4b 9084
39bc1876
NS
9085@item -march=@var{arch}
9086@opindex march
9087Generate code that will run on @var{arch}, which can be the name of a
9088generic MIPS ISA, or the name of a particular processor.
9089The ISA names are:
9090@samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4},
9091@samp{mips32}, @samp{mips32r2}, and @samp{mips64}.
9092The processor names are:
9093@samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
9094@samp{m4k},
9095@samp{r2000}, @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{r4400},
9096@samp{r4600}, @samp{r4650}, @samp{r6000}, @samp{r8000}, @samp{rm7000},
9097@samp{rm9000},
9098@samp{orion},
9099@samp{sb1},
9100@samp{vr4100}, @samp{vr4111}, @samp{vr4120}, @samp{vr4130}, @samp{vr4300},
9101@samp{vr5000}, @samp{vr5400} and @samp{vr5500}.
9102The special value @samp{from-abi} selects the
9103most compatible architecture for the selected ABI (that is,
9104@samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
74291a4b 9105
39bc1876
NS
9106In processor names, a final @samp{000} can be abbreviated as @samp{k}
9107(for example, @samp{-march=r2k}). Prefixes are optional, and
9108@samp{vr} may be written @samp{r}.
74291a4b 9109
39bc1876
NS
9110GCC defines two macros based on the value of this option. The first
9111is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
9112a string. The second has the form @samp{_MIPS_ARCH_@var{foo}},
9113where @var{foo} is the capitalized value of @samp{_MIPS_ARCH}@.
9114For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
9115to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
74291a4b 9116
39bc1876
NS
9117Note that the @samp{_MIPS_ARCH} macro uses the processor names given
9118above. In other words, it will have the full prefix and will not
9119abbreviate @samp{000} as @samp{k}. In the case of @samp{from-abi},
9120the macro names the resolved architecture (either @samp{"mips1"} or
9121@samp{"mips3"}). It names the default architecture when no
9122@option{-march} option is given.
74291a4b 9123
39bc1876
NS
9124@item -mtune=@var{arch}
9125@opindex mtune
9126Optimize for @var{arch}. Among other things, this option controls
9127the way instructions are scheduled, and the perceived cost of arithmetic
9128operations. The list of @var{arch} values is the same as for
9129@option{-march}.
74291a4b 9130
39bc1876
NS
9131When this option is not used, GCC will optimize for the processor
9132specified by @option{-march}. By using @option{-march} and
9133@option{-mtune} together, it is possible to generate code that will
9134run on a family of processors, but optimize the code for one
9135particular member of that family.
74291a4b 9136
39bc1876
NS
9137@samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
9138@samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
9139@samp{-march} ones described above.
74291a4b 9140
39bc1876
NS
9141@item -mips1
9142@opindex mips1
9143Equivalent to @samp{-march=mips1}.
74291a4b 9144
39bc1876
NS
9145@item -mips2
9146@opindex mips2
9147Equivalent to @samp{-march=mips2}.
74291a4b 9148
39bc1876
NS
9149@item -mips3
9150@opindex mips3
9151Equivalent to @samp{-march=mips3}.
74291a4b 9152
39bc1876
NS
9153@item -mips4
9154@opindex mips4
9155Equivalent to @samp{-march=mips4}.
9156
9157@item -mips32
9158@opindex mips32
9159Equivalent to @samp{-march=mips32}.
74291a4b 9160
39bc1876
NS
9161@item -mips32r2
9162@opindex mips32r2
9163Equivalent to @samp{-march=mips32r2}.
74291a4b 9164
39bc1876
NS
9165@item -mips64
9166@opindex mips64
9167Equivalent to @samp{-march=mips64}.
74291a4b 9168
39bc1876
NS
9169@item -mips16
9170@itemx -mno-mips16
9171@opindex mips16
9172@opindex mno-mips16
9173Use (do not use) the MIPS16 ISA.
74291a4b 9174
39bc1876
NS
9175@item -mabi=32
9176@itemx -mabi=o64
9177@itemx -mabi=n32
9178@itemx -mabi=64
9179@itemx -mabi=eabi
9180@opindex mabi=32
9181@opindex mabi=o64
9182@opindex mabi=n32
9183@opindex mabi=64
9184@opindex mabi=eabi
9185Generate code for the given ABI@.
74291a4b 9186
39bc1876
NS
9187Note that the EABI has a 32-bit and a 64-bit variant. GCC normally
9188generates 64-bit code when you select a 64-bit architecture, but you
9189can use @option{-mgp32} to get 32-bit code instead.
74291a4b 9190
39bc1876
NS
9191For information about the O64 ABI, see
9192@w{@uref{http://gcc.gnu.org/projects/mipso64-abi.html}}.
74291a4b 9193
39bc1876
NS
9194@item -mabicalls
9195@itemx -mno-abicalls
9196@opindex mabicalls
9197@opindex mno-abicalls
9198Generate (do not generate) SVR4-style position-independent code.
9199@option{-mabicalls} is the default for SVR4-based systems.
74291a4b 9200
39bc1876
NS
9201@item -mxgot
9202@itemx -mno-xgot
9203@opindex mxgot
9204@opindex mno-xgot
9205Lift (do not lift) the usual restrictions on the size of the global
9206offset table.
74291a4b 9207
39bc1876
NS
9208GCC normally uses a single instruction to load values from the GOT.
9209While this is relatively efficient, it will only work if the GOT
9210is smaller than about 64k. Anything larger will cause the linker
9211to report an error such as:
74291a4b 9212
39bc1876
NS
9213@cindex relocation truncated to fit (MIPS)
9214@smallexample
9215relocation truncated to fit: R_MIPS_GOT16 foobar
9216@end smallexample
74291a4b 9217
39bc1876
NS
9218If this happens, you should recompile your code with @option{-mxgot}.
9219It should then work with very large GOTs, although it will also be
9220less efficient, since it will take three instructions to fetch the
9221value of a global symbol.
956d6950 9222
39bc1876
NS
9223Note that some linkers can create multiple GOTs. If you have such a
9224linker, you should only need to use @option{-mxgot} when a single object
9225file accesses more than 64k's worth of GOT entries. Very few do.
956d6950 9226
39bc1876
NS
9227These options have no effect unless GCC is generating position
9228independent code.
956d6950 9229
39bc1876
NS
9230@item -mgp32
9231@opindex mgp32
9232Assume that general-purpose registers are 32 bits wide.
58605ba0 9233
39bc1876
NS
9234@item -mgp64
9235@opindex mgp64
9236Assume that general-purpose registers are 64 bits wide.
58605ba0 9237
39bc1876
NS
9238@item -mfp32
9239@opindex mfp32
9240Assume that floating-point registers are 32 bits wide.
58605ba0 9241
39bc1876
NS
9242@item -mfp64
9243@opindex mfp64
9244Assume that floating-point registers are 64 bits wide.
58605ba0 9245
39bc1876
NS
9246@item -mhard-float
9247@opindex mhard-float
9248Use floating-point coprocessor instructions.
58605ba0 9249
39bc1876
NS
9250@item -msoft-float
9251@opindex msoft-float
9252Do not use floating-point coprocessor instructions. Implement
9253floating-point calculations using library calls instead.
3094247f 9254
39bc1876
NS
9255@item -msingle-float
9256@opindex msingle-float
9257Assume that the floating-point coprocessor only supports single-precision
9258operations.
3094247f 9259
39bc1876
NS
9260@itemx -mdouble-float
9261@opindex mdouble-float
9262Assume that the floating-point coprocessor supports double-precision
9263operations. This is the default.
956d6950 9264
39bc1876
NS
9265@item -mint64
9266@opindex mint64
9267Force @code{int} and @code{long} types to be 64 bits wide. See
9268@option{-mlong32} for an explanation of the default and the way
9269that the pointer size is determined.
956d6950 9270
39bc1876
NS
9271@item -mlong64
9272@opindex mlong64
9273Force @code{long} types to be 64 bits wide. See @option{-mlong32} for
9274an explanation of the default and the way that the pointer size is
9275determined.
956d6950 9276
39bc1876
NS
9277@item -mlong32
9278@opindex mlong32
9279Force @code{long}, @code{int}, and pointer types to be 32 bits wide.
956d6950 9280
39bc1876
NS
9281The default size of @code{int}s, @code{long}s and pointers depends on
9282the ABI@. All the supported ABIs use 32-bit @code{int}s. The n64 ABI
9283uses 64-bit @code{long}s, as does the 64-bit EABI; the others use
928432-bit @code{long}s. Pointers are the same size as @code{long}s,
9285or the same size as integer registers, whichever is smaller.
956d6950 9286
39bc1876
NS
9287@item -G @var{num}
9288@opindex G
9289@cindex smaller data references (MIPS)
9290@cindex gp-relative references (MIPS)
9291Put global and static items less than or equal to @var{num} bytes into
9292the small data or bss section instead of the normal data or bss section.
9293This allows the data to be accessed using a single instruction.
9294
9295All modules should be compiled with the same @option{-G @var{num}}
9296value.
956d6950 9297
39bc1876
NS
9298@item -membedded-data
9299@itemx -mno-embedded-data
9300@opindex membedded-data
9301@opindex mno-embedded-data
9302Allocate variables to the read-only data section first if possible, then
9303next in the small data section if possible, otherwise in data. This gives
9304slightly slower code than the default, but reduces the amount of RAM required
9305when executing, and thus may be preferred for some embedded systems.
58605ba0 9306
39bc1876
NS
9307@item -muninit-const-in-rodata
9308@itemx -mno-uninit-const-in-rodata
9309@opindex muninit-const-in-rodata
9310@opindex mno-uninit-const-in-rodata
9311Put uninitialized @code{const} variables in the read-only data section.
9312This option is only meaningful in conjunction with @option{-membedded-data}.
4f69985c 9313
39bc1876
NS
9314@item -msplit-addresses
9315@itemx -mno-split-addresses
9316@opindex msplit-addresses
9317@opindex mno-split-addresses
9318Enable (disable) use of the @code{%hi()} and @code{%lo()} assembler
9319relocation operators. This option has been superceded by
9320@option{-mexplicit-relocs} but is retained for backwards compatibility.
58605ba0 9321
39bc1876
NS
9322@item -mexplicit-relocs
9323@itemx -mno-explicit-relocs
9324@opindex mexplicit-relocs
9325@opindex mno-explicit-relocs
9326Use (do not use) assembler relocation operators when dealing with symbolic
9327addresses. The alternative, selected by @option{-mno-explicit-relocs},
9328is to use assembler macros instead.
4f69985c 9329
12e4afe4
RS
9330@option{-mexplicit-relocs} is the default if GCC was configured
9331to use an assembler that supports relocation operators.
4f69985c 9332
39bc1876
NS
9333@item -mcheck-zero-division
9334@itemx -mno-check-zero-division
9335@opindex mcheck-zero-division
9336@opindex mno-check-zero-division
9337Trap (do not trap) on integer division by zero. The default is
9338@option{-mcheck-zero-division}.
4f69985c 9339
39bc1876
NS
9340@item -mmemcpy
9341@itemx -mno-memcpy
9342@opindex mmemcpy
9343@opindex mno-memcpy
9344Force (do not force) the use of @code{memcpy()} for non-trivial block
9345moves. The default is @option{-mno-memcpy}, which allows GCC to inline
9346most constant-sized copies.
74291a4b 9347
39bc1876
NS
9348@item -mlong-calls
9349@itemx -mno-long-calls
9350@opindex mlong-calls
9351@opindex mno-long-calls
9352Disable (do not disable) use of the @code{jal} instruction. Calling
9353functions using @code{jal} is more efficient but requires the caller
9354and callee to be in the same 256 megabyte segment.
d7c23cdc 9355
39bc1876
NS
9356This option has no effect on abicalls code. The default is
9357@option{-mno-long-calls}.
d7c23cdc 9358
39bc1876
NS
9359@item -mmad
9360@itemx -mno-mad
9361@opindex mmad
9362@opindex mno-mad
9363Enable (disable) use of the @code{mad}, @code{madu} and @code{mul}
9364instructions, as provided by the R4650 ISA.
d7c23cdc 9365
39bc1876
NS
9366@item -mfused-madd
9367@itemx -mno-fused-madd
9368@opindex mfused-madd
9369@opindex mno-fused-madd
9370Enable (disable) use of the floating point multiply-accumulate
9371instructions, when they are available. The default is
9372@option{-mfused-madd}.
74291a4b 9373
39bc1876
NS
9374When multiply-accumulate instructions are used, the intermediate
9375product is calculated to infinite precision and is not subject to
9376the FCSR Flush to Zero bit. This may be undesirable in some
9377circumstances.
74291a4b 9378
39bc1876
NS
9379@item -nocpp
9380@opindex nocpp
9381Tell the MIPS assembler to not run its preprocessor over user
9382assembler files (with a @samp{.s} suffix) when assembling them.
74291a4b 9383
39bc1876
NS
9384@item -mfix-r4000
9385@itemx -mno-fix-r4000
9386@opindex mfix-r4000
9387@opindex mno-fix-r4000
9388Work around certain R4000 CPU errata:
9389@itemize @minus
9390@item
9391A double-word or a variable shift may give an incorrect result if executed
9392immediately after starting an integer division.
9393@item
9394A double-word or a variable shift may give an incorrect result if executed
9395while an integer multiplication is in progress.
9396@item
9397An integer division may give an incorrect result if started in a delay slot
9398of a taken branch or a jump.
9399@end itemize
74291a4b 9400
39bc1876
NS
9401@item -mfix-r4400
9402@itemx -mno-fix-r4400
9403@opindex mfix-r4400
9404@opindex mno-fix-r4400
9405Work around certain R4400 CPU errata:
9406@itemize @minus
9407@item
9408A double-word or a variable shift may give an incorrect result if executed
9409immediately after starting an integer division.
9410@end itemize
dcb9d1f0 9411
39bc1876
NS
9412@item -mfix-vr4120
9413@itemx -mno-fix-vr4120
9414@opindex mfix-vr4120
9415Work around certain VR4120 errata:
9416@itemize @minus
9417@item
9418@code{dmultu} does not always produce the correct result.
9419@item
9420@code{div} and @code{ddiv} do not always produce the correct result if one
9421of the operands is negative.
9422@end itemize
9423The workarounds for the division errata rely on special functions in
9424@file{libgcc.a}. At present, these functions are only provided by
9425the @code{mips64vr*-elf} configurations.
39ba95b5 9426
39bc1876
NS
9427Other VR4120 errata require a nop to be inserted between certain pairs of
9428instructions. These errata are handled by the assembler, not by GCC itself.
17f0f8fa 9429
39bc1876
NS
9430@item -mfix-sb1
9431@itemx -mno-fix-sb1
9432@opindex mfix-sb1
9433Work around certain SB-1 CPU core errata.
9434(This flag currently works around the SB-1 revision 2
9435``F1'' and ``F2'' floating point errata.)
74291a4b 9436
39bc1876
NS
9437@item -mflush-func=@var{func}
9438@itemx -mno-flush-func
9439@opindex mflush-func
9440Specifies the function to call to flush the I and D caches, or to not
9441call any such function. If called, the function must take the same
9442arguments as the common @code{_flush_func()}, that is, the address of the
9443memory range for which the cache is being flushed, the size of the
9444memory range, and the number 3 (to flush both caches). The default
9445depends on the target GCC was configured for, but commonly is either
9446@samp{_flush_func} or @samp{__cpu_flush}.
74291a4b 9447
39bc1876
NS
9448@item -mbranch-likely
9449@itemx -mno-branch-likely
9450@opindex mbranch-likely
9451@opindex mno-branch-likely
9452Enable or disable use of Branch Likely instructions, regardless of the
9453default for the selected architecture. By default, Branch Likely
9454instructions may be generated if they are supported by the selected
9455architecture. An exception is for the MIPS32 and MIPS64 architectures
9456and processors which implement those architectures; for those, Branch
9457Likely instructions will not be generated by default because the MIPS32
9458and MIPS64 architectures specifically deprecate their use.
74291a4b 9459
39bc1876
NS
9460@item -mfp-exceptions
9461@itemx -mno-fp-exceptions
9462@opindex mfp-exceptions
9463Specifies whether FP exceptions are enabled. This affects how we schedule
9464FP instructions for some processors. The default is that FP exceptions are
9465enabled.
74291a4b 9466
39bc1876
NS
9467For instance, on the SB-1, if FP exceptions are disabled, and we are emitting
946864-bit code, then we can use both FP pipes. Otherwise, we can only use one
9469FP pipe.
74291a4b 9470
39bc1876
NS
9471@item -mvr4130-align
9472@itemx -mno-vr4130-align
9473@opindex mvr4130-align
9474The VR4130 pipeline is two-way superscalar, but can only issue two
9475instructions together if the first one is 8-byte aligned. When this
9476option is enabled, GCC will align pairs of instructions that it
9477thinks should execute in parallel.
74291a4b 9478
39bc1876
NS
9479This option only has an effect when optimizing for the VR4130.
9480It normally makes code faster, but at the expense of making it bigger.
9481It is enabled by default at optimization level @option{-O3}.
9482@end table
3a8699c7 9483
39bc1876
NS
9484@node MMIX Options
9485@subsection MMIX Options
9486@cindex MMIX Options
74291a4b 9487
39bc1876 9488These options are defined for the MMIX:
74291a4b 9489
39bc1876
NS
9490@table @gcctabopt
9491@item -mlibfuncs
9492@itemx -mno-libfuncs
9493@opindex mlibfuncs
9494@opindex mno-libfuncs
9495Specify that intrinsic library functions are being compiled, passing all
9496values in registers, no matter the size.
3cadd778 9497
39bc1876
NS
9498@item -mepsilon
9499@itemx -mno-epsilon
9500@opindex mepsilon
9501@opindex mno-epsilon
9502Generate floating-point comparison instructions that compare with respect
9503to the @code{rE} epsilon register.
3cadd778 9504
39bc1876
NS
9505@item -mabi=mmixware
9506@itemx -mabi=gnu
9507@opindex mabi-mmixware
9508@opindex mabi=gnu
9509Generate code that passes function parameters and return values that (in
9510the called function) are seen as registers @code{$0} and up, as opposed to
9511the GNU ABI which uses global registers @code{$231} and up.
3cadd778 9512
39bc1876
NS
9513@item -mzero-extend
9514@itemx -mno-zero-extend
9515@opindex mzero-extend
9516@opindex mno-zero-extend
9517When reading data from memory in sizes shorter than 64 bits, use (do not
9518use) zero-extending load instructions by default, rather than
9519sign-extending ones.
3cadd778 9520
39bc1876
NS
9521@item -mknuthdiv
9522@itemx -mno-knuthdiv
9523@opindex mknuthdiv
9524@opindex mno-knuthdiv
9525Make the result of a division yielding a remainder have the same sign as
9526the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
9527remainder follows the sign of the dividend. Both methods are
9528arithmetically valid, the latter being almost exclusively used.
74291a4b 9529
39bc1876
NS
9530@item -mtoplevel-symbols
9531@itemx -mno-toplevel-symbols
9532@opindex mtoplevel-symbols
9533@opindex mno-toplevel-symbols
9534Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
9535code can be used with the @code{PREFIX} assembly directive.
74291a4b 9536
39bc1876
NS
9537@item -melf
9538@opindex melf
9539Generate an executable in the ELF format, rather than the default
9540@samp{mmo} format used by the @command{mmix} simulator.
3d5a0820 9541
39bc1876
NS
9542@item -mbranch-predict
9543@itemx -mno-branch-predict
9544@opindex mbranch-predict
9545@opindex mno-branch-predict
9546Use (do not use) the probable-branch instructions, when static branch
9547prediction indicates a probable branch.
3cadd778 9548
39bc1876
NS
9549@item -mbase-addresses
9550@itemx -mno-base-addresses
9551@opindex mbase-addresses
9552@opindex mno-base-addresses
9553Generate (do not generate) code that uses @emph{base addresses}. Using a
9554base address automatically generates a request (handled by the assembler
9555and the linker) for a constant to be set up in a global register. The
9556register is used for one or more base address requests within the range 0
9557to 255 from the value held in the register. The generally leads to short
9558and fast code, but the number of different data items that can be
9559addressed is limited. This means that a program that uses lots of static
9560data may require @option{-mno-base-addresses}.
3cadd778 9561
39bc1876
NS
9562@item -msingle-exit
9563@itemx -mno-single-exit
9564@opindex msingle-exit
9565@opindex mno-single-exit
9566Force (do not force) generated code to have a single exit point in each
9567function.
9568@end table
3cadd778 9569
39bc1876
NS
9570@node MN10300 Options
9571@subsection MN10300 Options
9572@cindex MN10300 options
3cadd778 9573
39bc1876 9574These @option{-m} options are defined for Matsushita MN10300 architectures:
3cadd778 9575
39bc1876
NS
9576@table @gcctabopt
9577@item -mmult-bug
9578@opindex mmult-bug
9579Generate code to avoid bugs in the multiply instructions for the MN10300
9580processors. This is the default.
c474f76b 9581
39bc1876
NS
9582@item -mno-mult-bug
9583@opindex mno-mult-bug
9584Do not generate code to avoid bugs in the multiply instructions for the
9585MN10300 processors.
3cadd778 9586
39bc1876
NS
9587@item -mam33
9588@opindex mam33
9589Generate code which uses features specific to the AM33 processor.
3cadd778 9590
39bc1876
NS
9591@item -mno-am33
9592@opindex mno-am33
9593Do not generate code which uses features specific to the AM33 processor. This
9594is the default.
1a66cd67 9595
39bc1876
NS
9596@item -mno-crt0
9597@opindex mno-crt0
9598Do not link in the C run-time initialization object file.
93ca1662 9599
39bc1876
NS
9600@item -mrelax
9601@opindex mrelax
9602Indicate to the linker that it should perform a relaxation optimization pass
9603to shorten branches, calls and absolute memory addresses. This option only
9604has an effect when used on the command line for the final link step.
9605
9606This option makes symbolic debugging impossible.
74291a4b
MM
9607@end table
9608
39bc1876
NS
9609@node NS32K Options
9610@subsection NS32K Options
9611@cindex NS32K options
74291a4b 9612
39bc1876
NS
9613These are the @samp{-m} options defined for the 32000 series. The default
9614values for these options depends on which style of 32000 was selected when
9615the compiler was configured; the defaults for the most common choices are
9616given below.
74291a4b 9617
2642624b 9618@table @gcctabopt
39bc1876
NS
9619@item -m32032
9620@itemx -m32032
9621@opindex m32032
9622@opindex m32032
9623Generate output for a 32032. This is the default
9624when the compiler is configured for 32032 and 32016 based systems.
74291a4b 9625
39bc1876
NS
9626@item -m32332
9627@itemx -m32332
9628@opindex m32332
9629@opindex m32332
9630Generate output for a 32332. This is the default
9631when the compiler is configured for 32332-based systems.
74291a4b 9632
39bc1876
NS
9633@item -m32532
9634@itemx -m32532
9635@opindex m32532
9636@opindex m32532
9637Generate output for a 32532. This is the default
9638when the compiler is configured for 32532-based systems.
74291a4b 9639
39bc1876
NS
9640@item -m32081
9641@opindex m32081
9642Generate output containing 32081 instructions for floating point.
9643This is the default for all systems.
74291a4b 9644
39bc1876
NS
9645@item -m32381
9646@opindex m32381
9647Generate output containing 32381 instructions for floating point. This
9648also implies @option{-m32081}. The 32381 is only compatible with the 32332
9649and 32532 cpus. This is the default for the pc532-netbsd configuration.
9650
9651@item -mmulti-add
9652@opindex mmulti-add
9653Try and generate multiply-add floating point instructions @code{polyF}
9654and @code{dotF}. This option is only available if the @option{-m32381}
9655option is in effect. Using these instructions requires changes to
9656register allocation which generally has a negative impact on
9657performance. This option should only be enabled when compiling code
9658particularly likely to make heavy use of multiply-add instructions.
9659
9660@item -mnomulti-add
9661@opindex mnomulti-add
9662Do not try and generate multiply-add floating point instructions
9663@code{polyF} and @code{dotF}. This is the default on all platforms.
74291a4b 9664
39bc1876
NS
9665@item -msoft-float
9666@opindex msoft-float
9667Generate output containing library calls for floating point.
9668@strong{Warning:} the requisite libraries may not be available.
282a61e6 9669
39bc1876
NS
9670@item -mieee-compare
9671@itemx -mno-ieee-compare
9672@opindex mieee-compare
9673@opindex mno-ieee-compare
9674Control whether or not the compiler uses IEEE floating point
9675comparisons. These handle correctly the case where the result of a
9676comparison is unordered.
9677@strong{Warning:} the requisite kernel support may not be available.
282a61e6 9678
39bc1876
NS
9679@item -mnobitfield
9680@opindex mnobitfield
9681Do not use the bit-field instructions. On some machines it is faster to
9682use shifting and masking operations. This is the default for the pc532.
282a61e6 9683
39bc1876
NS
9684@item -mbitfield
9685@opindex mbitfield
9686Do use the bit-field instructions. This is the default for all platforms
9687except the pc532.
282a61e6 9688
39bc1876
NS
9689@item -mrtd
9690@opindex mrtd
9691Use a different function-calling convention, in which functions
9692that take a fixed number of arguments return pop their
9693arguments on return with the @code{ret} instruction.
282a61e6 9694
39bc1876
NS
9695This calling convention is incompatible with the one normally
9696used on Unix, so you cannot use it if you need to call libraries
9697compiled with the Unix compiler.
282a61e6 9698
39bc1876
NS
9699Also, you must provide function prototypes for all functions that
9700take variable numbers of arguments (including @code{printf});
9701otherwise incorrect code will be generated for calls to those
9702functions.
282a61e6 9703
39bc1876
NS
9704In addition, seriously incorrect code will result if you call a
9705function with too many arguments. (Normally, extra arguments are
9706harmlessly ignored.)
282a61e6 9707
39bc1876 9708This option takes its name from the 680x0 @code{rtd} instruction.
282a61e6 9709
282a61e6 9710
39bc1876
NS
9711@item -mregparam
9712@opindex mregparam
9713Use a different function-calling convention where the first two arguments
9714are passed in registers.
282a61e6 9715
39bc1876
NS
9716This calling convention is incompatible with the one normally
9717used on Unix, so you cannot use it if you need to call libraries
9718compiled with the Unix compiler.
282a61e6 9719
39bc1876
NS
9720@item -mnoregparam
9721@opindex mnoregparam
9722Do not pass any arguments in registers. This is the default for all
9723targets.
282a61e6 9724
39bc1876
NS
9725@item -msb
9726@opindex msb
9727It is OK to use the sb as an index register which is always loaded with
9728zero. This is the default for the pc532-netbsd target.
282a61e6 9729
39bc1876
NS
9730@item -mnosb
9731@opindex mnosb
9732The sb register is not available for use or has not been initialized to
9733zero by the run time system. This is the default for all targets except
9734the pc532-netbsd. It is also implied whenever @option{-mhimem} or
9735@option{-fpic} is set.
282a61e6 9736
39bc1876
NS
9737@item -mhimem
9738@opindex mhimem
9739Many ns32000 series addressing modes use displacements of up to 512MB@.
9740If an address is above 512MB then displacements from zero can not be used.
9741This option causes code to be generated which can be loaded above 512MB@.
9742This may be useful for operating systems or ROM code.
282a61e6 9743
39bc1876
NS
9744@item -mnohimem
9745@opindex mnohimem
9746Assume code will be loaded in the first 512MB of virtual address space.
9747This is the default for all platforms.
282a61e6
MH
9748
9749@end table
9750
39bc1876
NS
9751@node PDP-11 Options
9752@subsection PDP-11 Options
9753@cindex PDP-11 Options
f84271d9 9754
39bc1876 9755These options are defined for the PDP-11:
f84271d9 9756
2642624b 9757@table @gcctabopt
39bc1876
NS
9758@item -mfpu
9759@opindex mfpu
9760Use hardware FPP floating point. This is the default. (FIS floating
9761point on the PDP-11/40 is not supported.)
f84271d9 9762
39bc1876
NS
9763@item -msoft-float
9764@opindex msoft-float
9765Do not use hardware floating point.
f84271d9 9766
39bc1876
NS
9767@item -mac0
9768@opindex mac0
9769Return floating-point results in ac0 (fr0 in Unix assembler syntax).
f84271d9 9770
39bc1876
NS
9771@item -mno-ac0
9772@opindex mno-ac0
9773Return floating-point results in memory. This is the default.
9774
9775@item -m40
9776@opindex m40
9777Generate code for a PDP-11/40.
9778
9779@item -m45
9780@opindex m45
9781Generate code for a PDP-11/45. This is the default.
f84271d9 9782
39bc1876
NS
9783@item -m10
9784@opindex m10
9785Generate code for a PDP-11/10.
f84271d9 9786
39bc1876
NS
9787@item -mbcopy-builtin
9788@opindex bcopy-builtin
70128ad9 9789Use inline @code{movmemhi} patterns for copying memory. This is the
39bc1876 9790default.
f84271d9 9791
39bc1876
NS
9792@item -mbcopy
9793@opindex mbcopy
70128ad9 9794Do not use inline @code{movmemhi} patterns for copying memory.
02f52e19 9795
39bc1876
NS
9796@item -mint16
9797@itemx -mno-int32
9798@opindex mint16
9799@opindex mno-int32
9800Use 16-bit @code{int}. This is the default.
48f0be1b 9801
39bc1876
NS
9802@item -mint32
9803@itemx -mno-int16
9804@opindex mint32
9805@opindex mno-int16
9806Use 32-bit @code{int}.
b4378319 9807
39bc1876
NS
9808@item -mfloat64
9809@itemx -mno-float32
9810@opindex mfloat64
9811@opindex mno-float32
9812Use 64-bit @code{float}. This is the default.
b4378319 9813
39bc1876
NS
9814@item -mfloat32
9815@itemx -mno-float64
9816@opindex mfloat32
9817@opindex mno-float64
9818Use 32-bit @code{float}.
daf2f129 9819
39bc1876
NS
9820@item -mabshi
9821@opindex mabshi
9822Use @code{abshi2} pattern. This is the default.
232830b7 9823
39bc1876
NS
9824@item -mno-abshi
9825@opindex mno-abshi
9826Do not use @code{abshi2} pattern.
b4378319 9827
39bc1876
NS
9828@item -mbranch-expensive
9829@opindex mbranch-expensive
9830Pretend that branches are expensive. This is for experimenting with
9831code generation only.
b4378319 9832
39bc1876
NS
9833@item -mbranch-cheap
9834@opindex mbranch-cheap
9835Do not pretend that branches are expensive. This is the default.
b4378319 9836
39bc1876
NS
9837@item -msplit
9838@opindex msplit
9839Generate code for a system with split I&D.
b4378319 9840
39bc1876
NS
9841@item -mno-split
9842@opindex mno-split
9843Generate code for a system without split I&D. This is the default.
f84271d9 9844
39bc1876
NS
9845@item -munix-asm
9846@opindex munix-asm
9847Use Unix assembler syntax. This is the default when configured for
9848@samp{pdp11-*-bsd}.
56b2d7a7 9849
39bc1876
NS
9850@item -mdec-asm
9851@opindex mdec-asm
9852Use DEC assembler syntax. This is the default when configured for any
9853PDP-11 target other than @samp{pdp11-*-bsd}.
9854@end table
56b2d7a7 9855
39bc1876
NS
9856@node PowerPC Options
9857@subsection PowerPC Options
9858@cindex PowerPC options
56b2d7a7 9859
39bc1876 9860These are listed under @xref{RS/6000 and PowerPC Options}.
56b2d7a7 9861
39bc1876
NS
9862@node RS/6000 and PowerPC Options
9863@subsection IBM RS/6000 and PowerPC Options
9864@cindex RS/6000 and PowerPC Options
9865@cindex IBM RS/6000 and PowerPC Options
56b2d7a7 9866
39bc1876
NS
9867These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
9868@table @gcctabopt
9869@item -mpower
9870@itemx -mno-power
9871@itemx -mpower2
9872@itemx -mno-power2
9873@itemx -mpowerpc
9874@itemx -mno-powerpc
9875@itemx -mpowerpc-gpopt
9876@itemx -mno-powerpc-gpopt
9877@itemx -mpowerpc-gfxopt
9878@itemx -mno-powerpc-gfxopt
9879@itemx -mpowerpc64
9880@itemx -mno-powerpc64
9881@opindex mpower
9882@opindex mno-power
9883@opindex mpower2
9884@opindex mno-power2
9885@opindex mpowerpc
9886@opindex mno-powerpc
9887@opindex mpowerpc-gpopt
9888@opindex mno-powerpc-gpopt
9889@opindex mpowerpc-gfxopt
9890@opindex mno-powerpc-gfxopt
9891@opindex mpowerpc64
9892@opindex mno-powerpc64
9893GCC supports two related instruction set architectures for the
9894RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
9895instructions supported by the @samp{rios} chip set used in the original
9896RS/6000 systems and the @dfn{PowerPC} instruction set is the
9897architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
9898the IBM 4xx microprocessors.
56b2d7a7 9899
39bc1876
NS
9900Neither architecture is a subset of the other. However there is a
9901large common subset of instructions supported by both. An MQ
9902register is included in processors supporting the POWER architecture.
56b2d7a7 9903
39bc1876
NS
9904You use these options to specify which instructions are available on the
9905processor you are using. The default value of these options is
9906determined when configuring GCC@. Specifying the
9907@option{-mcpu=@var{cpu_type}} overrides the specification of these
9908options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
9909rather than the options listed above.
56b2d7a7 9910
39bc1876
NS
9911The @option{-mpower} option allows GCC to generate instructions that
9912are found only in the POWER architecture and to use the MQ register.
9913Specifying @option{-mpower2} implies @option{-power} and also allows GCC
9914to generate instructions that are present in the POWER2 architecture but
9915not the original POWER architecture.
83575957 9916
39bc1876
NS
9917The @option{-mpowerpc} option allows GCC to generate instructions that
9918are found only in the 32-bit subset of the PowerPC architecture.
9919Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
9920GCC to use the optional PowerPC architecture instructions in the
9921General Purpose group, including floating-point square root. Specifying
9922@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
9923use the optional PowerPC architecture instructions in the Graphics
9924group, including floating-point select.
83575957 9925
39bc1876
NS
9926The @option{-mpowerpc64} option allows GCC to generate the additional
992764-bit instructions that are found in the full PowerPC64 architecture
9928and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
9929@option{-mno-powerpc64}.
83575957 9930
39bc1876
NS
9931If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
9932will use only the instructions in the common subset of both
9933architectures plus some special AIX common-mode calls, and will not use
9934the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
9935permits GCC to use any instruction from either architecture and to
9936allow use of the MQ register; specify this for the Motorola MPC601.
83575957 9937
39bc1876
NS
9938@item -mnew-mnemonics
9939@itemx -mold-mnemonics
9940@opindex mnew-mnemonics
9941@opindex mold-mnemonics
9942Select which mnemonics to use in the generated assembler code. With
9943@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
9944the PowerPC architecture. With @option{-mold-mnemonics} it uses the
9945assembler mnemonics defined for the POWER architecture. Instructions
9946defined in only one architecture have only one mnemonic; GCC uses that
9947mnemonic irrespective of which of these options is specified.
83575957 9948
39bc1876
NS
9949GCC defaults to the mnemonics appropriate for the architecture in
9950use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
9951value of these option. Unless you are building a cross-compiler, you
9952should normally not specify either @option{-mnew-mnemonics} or
9953@option{-mold-mnemonics}, but should instead accept the default.
83575957 9954
39bc1876
NS
9955@item -mcpu=@var{cpu_type}
9956@opindex mcpu
9957Set architecture type, register usage, choice of mnemonics, and
9958instruction scheduling parameters for machine type @var{cpu_type}.
9959Supported values for @var{cpu_type} are @samp{401}, @samp{403},
9960@samp{405}, @samp{405fp}, @samp{440}, @samp{440fp}, @samp{505},
9961@samp{601}, @samp{602}, @samp{603}, @samp{603e}, @samp{604},
9962@samp{604e}, @samp{620}, @samp{630}, @samp{740}, @samp{7400},
9963@samp{7450}, @samp{750}, @samp{801}, @samp{821}, @samp{823},
9964@samp{860}, @samp{970}, @samp{common}, @samp{ec603e}, @samp{G3},
9965@samp{G4}, @samp{G5}, @samp{power}, @samp{power2}, @samp{power3},
9966@samp{power4}, @samp{power5}, @samp{powerpc}, @samp{powerpc64},
9967@samp{rios}, @samp{rios1}, @samp{rios2}, @samp{rsc}, and @samp{rs64a}.
83575957 9968
39bc1876
NS
9969@option{-mcpu=common} selects a completely generic processor. Code
9970generated under this option will run on any POWER or PowerPC processor.
9971GCC will use only the instructions in the common subset of both
9972architectures, and will not use the MQ register. GCC assumes a generic
9973processor model for scheduling purposes.
83575957 9974
39bc1876
NS
9975@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
9976@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
9977PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
9978types, with an appropriate, generic processor model assumed for
9979scheduling purposes.
83575957 9980
39bc1876
NS
9981The other options specify a specific processor. Code generated under
9982those options will run best on that processor, and may not run at all on
9983others.
83575957 9984
39bc1876
NS
9985The @option{-mcpu} options automatically enable or disable the
9986following options: @option{-maltivec}, @option{-mhard-float},
9987@option{-mmfcrf}, @option{-mmultiple}, @option{-mnew-mnemonics},
9988@option{-mpower}, @option{-mpower2}, @option{-mpowerpc64},
9989@option{-mpowerpc-gpopt}, @option{-mpowerpc-gfxopt},
9990@option{-mstring}. The particular options set for any particular CPU
9991will vary between compiler versions, depending on what setting seems
9992to produce optimal code for that CPU; it doesn't necessarily reflect
9993the actual hardware's capabilities. If you wish to set an individual
9994option to a particular value, you may specify it after the
9995@option{-mcpu} option, like @samp{-mcpu=970 -mno-altivec}.
5d7c2819 9996
39bc1876
NS
9997On AIX, the @option{-maltivec} and @option{-mpowerpc64} options are
9998not enabled or disabled by the @option{-mcpu} option at present, since
9999AIX does not have full support for these options. You may still
10000enable or disable them individually if you're sure it'll work in your
10001environment.
83575957 10002
39bc1876
NS
10003@item -mtune=@var{cpu_type}
10004@opindex mtune
10005Set the instruction scheduling parameters for machine type
10006@var{cpu_type}, but do not set the architecture type, register usage, or
10007choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
10008values for @var{cpu_type} are used for @option{-mtune} as for
10009@option{-mcpu}. If both are specified, the code generated will use the
10010architecture, registers, and mnemonics set by @option{-mcpu}, but the
10011scheduling parameters set by @option{-mtune}.
83575957 10012
39bc1876
NS
10013@item -maltivec
10014@itemx -mno-altivec
10015@opindex maltivec
10016@opindex mno-altivec
10017These switches enable or disable the use of built-in functions that
10018allow access to the AltiVec instruction set. You may also need to set
10019@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
10020enhancements.
83575957 10021
39bc1876
NS
10022@item -mabi=spe
10023@opindex mabi=spe
10024Extend the current ABI with SPE ABI extensions. This does not change
10025the default ABI, instead it adds the SPE ABI extensions to the current
10026ABI@.
83575957 10027
39bc1876
NS
10028@item -mabi=no-spe
10029@opindex mabi=no-spe
10030Disable Booke SPE ABI extensions for the current ABI.
83575957 10031
39bc1876
NS
10032@item -misel=@var{yes/no}
10033@itemx -misel
10034@opindex misel
10035This switch enables or disables the generation of ISEL instructions.
83575957 10036
39bc1876
NS
10037@item -mspe=@var{yes/no}
10038@itemx -mspe
10039@opindex mspe
10040This switch enables or disables the generation of SPE simd
10041instructions.
83575957 10042
39bc1876
NS
10043@item -mfloat-gprs=@var{yes/no}
10044@itemx -mfloat-gprs
10045@opindex mfloat-gprs
10046This switch enables or disables the generation of floating point
10047operations on the general purpose registers for architectures that
10048support it. This option is currently only available on the MPC8540.
83575957 10049
49bd1d27
SS
10050@item -m32
10051@itemx -m64
10052@opindex m32
10053@opindex m64
10054Generate code for 32-bit or 64-bit environments of Darwin and SVR4
10055targets (including GNU/Linux). The 32-bit environment sets int, long
10056and pointer to 32 bits and generates code that runs on any PowerPC
10057variant. The 64-bit environment sets int to 32 bits and long and
10058pointer to 64 bits, and generates code for PowerPC64, as for
10059@option{-mpowerpc64}.
10060
39bc1876
NS
10061@item -mfull-toc
10062@itemx -mno-fp-in-toc
10063@itemx -mno-sum-in-toc
10064@itemx -mminimal-toc
10065@opindex mfull-toc
10066@opindex mno-fp-in-toc
10067@opindex mno-sum-in-toc
10068@opindex mminimal-toc
10069Modify generation of the TOC (Table Of Contents), which is created for
10070every executable file. The @option{-mfull-toc} option is selected by
10071default. In that case, GCC will allocate at least one TOC entry for
10072each unique non-automatic variable reference in your program. GCC
10073will also place floating-point constants in the TOC@. However, only
1007416,384 entries are available in the TOC@.
83575957 10075
39bc1876
NS
10076If you receive a linker error message that saying you have overflowed
10077the available TOC space, you can reduce the amount of TOC space used
10078with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
10079@option{-mno-fp-in-toc} prevents GCC from putting floating-point
10080constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
10081generate code to calculate the sum of an address and a constant at
10082run-time instead of putting that sum into the TOC@. You may specify one
10083or both of these options. Each causes GCC to produce very slightly
10084slower and larger code at the expense of conserving TOC space.
83575957 10085
39bc1876
NS
10086If you still run out of space in the TOC even when you specify both of
10087these options, specify @option{-mminimal-toc} instead. This option causes
10088GCC to make only one TOC entry for every file. When you specify this
10089option, GCC will produce code that is slower and larger but which
10090uses extremely little TOC space. You may wish to use this option
10091only on files that contain less frequently executed code.
83575957 10092
39bc1876
NS
10093@item -maix64
10094@itemx -maix32
10095@opindex maix64
10096@opindex maix32
10097Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
10098@code{long} type, and the infrastructure needed to support them.
10099Specifying @option{-maix64} implies @option{-mpowerpc64} and
10100@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
10101implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
83575957 10102
39bc1876
NS
10103@item -mxl-call
10104@itemx -mno-xl-call
10105@opindex mxl-call
10106@opindex mno-xl-call
10107On AIX, pass floating-point arguments to prototyped functions beyond the
10108register save area (RSA) on the stack in addition to argument FPRs. The
10109AIX calling convention was extended but not initially documented to
10110handle an obscure K&R C case of calling a function that takes the
10111address of its arguments with fewer arguments than declared. AIX XL
10112compilers access floating point arguments which do not fit in the
10113RSA from the stack when a subroutine is compiled without
10114optimization. Because always storing floating-point arguments on the
10115stack is inefficient and rarely needed, this option is not enabled by
10116default and only is necessary when calling subroutines compiled by AIX
10117XL compilers without optimization.
83575957 10118
39bc1876
NS
10119@item -mpe
10120@opindex mpe
10121Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
10122application written to use message passing with special startup code to
10123enable the application to run. The system must have PE installed in the
10124standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
10125must be overridden with the @option{-specs=} option to specify the
10126appropriate directory location. The Parallel Environment does not
10127support threads, so the @option{-mpe} option and the @option{-pthread}
10128option are incompatible.
83575957 10129
39bc1876
NS
10130@item -malign-natural
10131@itemx -malign-power
10132@opindex malign-natural
10133@opindex malign-power
10134On AIX, Darwin, and 64-bit PowerPC GNU/Linux, the option
10135@option{-malign-natural} overrides the ABI-defined alignment of larger
10136types, such as floating-point doubles, on their natural size-based boundary.
10137The option @option{-malign-power} instructs GCC to follow the ABI-specified
10138alignment rules. GCC defaults to the standard alignment defined in the ABI.
83575957 10139
39bc1876
NS
10140@item -msoft-float
10141@itemx -mhard-float
10142@opindex msoft-float
10143@opindex mhard-float
10144Generate code that does not use (uses) the floating-point register set.
10145Software floating point emulation is provided if you use the
10146@option{-msoft-float} option, and pass the option to GCC when linking.
83575957 10147
39bc1876
NS
10148@item -mmultiple
10149@itemx -mno-multiple
10150@opindex mmultiple
10151@opindex mno-multiple
10152Generate code that uses (does not use) the load multiple word
10153instructions and the store multiple word instructions. These
10154instructions are generated by default on POWER systems, and not
10155generated on PowerPC systems. Do not use @option{-mmultiple} on little
10156endian PowerPC systems, since those instructions do not work when the
10157processor is in little endian mode. The exceptions are PPC740 and
10158PPC750 which permit the instructions usage in little endian mode.
83575957 10159
39bc1876
NS
10160@item -mstring
10161@itemx -mno-string
10162@opindex mstring
10163@opindex mno-string
10164Generate code that uses (does not use) the load string instructions
10165and the store string word instructions to save multiple registers and
10166do small block moves. These instructions are generated by default on
10167POWER systems, and not generated on PowerPC systems. Do not use
10168@option{-mstring} on little endian PowerPC systems, since those
10169instructions do not work when the processor is in little endian mode.
10170The exceptions are PPC740 and PPC750 which permit the instructions
10171usage in little endian mode.
052a4b28 10172
39bc1876
NS
10173@item -mupdate
10174@itemx -mno-update
10175@opindex mupdate
10176@opindex mno-update
10177Generate code that uses (does not use) the load or store instructions
10178that update the base register to the address of the calculated memory
10179location. These instructions are generated by default. If you use
10180@option{-mno-update}, there is a small window between the time that the
10181stack pointer is updated and the address of the previous frame is
10182stored, which means code that walks the stack frame across interrupts or
10183signals may get corrupted data.
052a4b28 10184
39bc1876
NS
10185@item -mfused-madd
10186@itemx -mno-fused-madd
10187@opindex mfused-madd
10188@opindex mno-fused-madd
10189Generate code that uses (does not use) the floating point multiply and
10190accumulate instructions. These instructions are generated by default if
10191hardware floating is used.
3a69a7d5 10192
39bc1876
NS
10193@item -mno-bit-align
10194@itemx -mbit-align
10195@opindex mno-bit-align
10196@opindex mbit-align
10197On System V.4 and embedded PowerPC systems do not (do) force structures
10198and unions that contain bit-fields to be aligned to the base type of the
10199bit-field.
3a69a7d5 10200
39bc1876
NS
10201For example, by default a structure containing nothing but 8
10202@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
10203boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
10204the structure would be aligned to a 1 byte boundary and be one byte in
10205size.
3a69a7d5 10206
39bc1876
NS
10207@item -mno-strict-align
10208@itemx -mstrict-align
10209@opindex mno-strict-align
10210@opindex mstrict-align
10211On System V.4 and embedded PowerPC systems do not (do) assume that
10212unaligned memory references will be handled by the system.
3a69a7d5 10213
39bc1876
NS
10214@item -mrelocatable
10215@itemx -mno-relocatable
10216@opindex mrelocatable
10217@opindex mno-relocatable
10218On embedded PowerPC systems generate code that allows (does not allow)
10219the program to be relocated to a different address at runtime. If you
10220use @option{-mrelocatable} on any module, all objects linked together must
10221be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
3a69a7d5 10222
39bc1876
NS
10223@item -mrelocatable-lib
10224@itemx -mno-relocatable-lib
10225@opindex mrelocatable-lib
10226@opindex mno-relocatable-lib
10227On embedded PowerPC systems generate code that allows (does not allow)
10228the program to be relocated to a different address at runtime. Modules
10229compiled with @option{-mrelocatable-lib} can be linked with either modules
10230compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
10231with modules compiled with the @option{-mrelocatable} options.
052a4b28 10232
39bc1876
NS
10233@item -mno-toc
10234@itemx -mtoc
10235@opindex mno-toc
10236@opindex mtoc
10237On System V.4 and embedded PowerPC systems do not (do) assume that
10238register 2 contains a pointer to a global area pointing to the addresses
10239used in the program.
052a4b28 10240
39bc1876
NS
10241@item -mlittle
10242@itemx -mlittle-endian
10243@opindex mlittle
10244@opindex mlittle-endian
10245On System V.4 and embedded PowerPC systems compile code for the
10246processor in little endian mode. The @option{-mlittle-endian} option is
10247the same as @option{-mlittle}.
052a4b28 10248
39bc1876
NS
10249@item -mbig
10250@itemx -mbig-endian
10251@opindex mbig
10252@opindex mbig-endian
10253On System V.4 and embedded PowerPC systems compile code for the
10254processor in big endian mode. The @option{-mbig-endian} option is
10255the same as @option{-mbig}.
052a4b28 10256
39bc1876
NS
10257@item -mdynamic-no-pic
10258@opindex mdynamic-no-pic
10259On Darwin and Mac OS X systems, compile code so that it is not
10260relocatable, but that its external references are relocatable. The
10261resulting code is suitable for applications, but not shared
10262libraries.
3a69a7d5 10263
39bc1876
NS
10264@item -mprioritize-restricted-insns=@var{priority}
10265@opindex mprioritize-restricted-insns
10266This option controls the priority that is assigned to
10267dispatch-slot restricted instructions during the second scheduling
10268pass. The argument @var{priority} takes the value @var{0/1/2} to assign
10269@var{no/highest/second-highest} priority to dispatch slot restricted
10270instructions.
3a69a7d5 10271
39bc1876
NS
10272@item -msched-costly-dep=@var{dependence_type}
10273@opindex msched-costly-dep
10274This option controls which dependences are considered costly
10275by the target during instruction scheduling. The argument
10276@var{dependence_type} takes one of the following values:
10277@var{no}: no dependence is costly,
10278@var{all}: all dependences are costly,
10279@var{true_store_to_load}: a true dependence from store to load is costly,
10280@var{store_to_load}: any dependence from store to load is costly,
10281@var{number}: any dependence which latency >= @var{number} is costly.
11338cda 10282
39bc1876
NS
10283@item -minsert-sched-nops=@var{scheme}
10284@opindex minsert-sched-nops
10285This option controls which nop insertion scheme will be used during
10286the second scheduling pass. The argument @var{scheme} takes one of the
10287following values:
10288@var{no}: Don't insert nops.
10289@var{pad}: Pad with nops any dispatch group which has vacant issue slots,
10290according to the scheduler's grouping.
10291@var{regroup_exact}: Insert nops to force costly dependent insns into
10292separate groups. Insert exactly as many nops as needed to force an insn
10293to a new group, according to the estimated processor grouping.
10294@var{number}: Insert nops to force costly dependent insns into
10295separate groups. Insert @var{number} nops to force an insn to a new group.
052a4b28 10296
39bc1876
NS
10297@item -mcall-sysv
10298@opindex mcall-sysv
10299On System V.4 and embedded PowerPC systems compile code using calling
10300conventions that adheres to the March 1995 draft of the System V
10301Application Binary Interface, PowerPC processor supplement. This is the
10302default unless you configured GCC using @samp{powerpc-*-eabiaix}.
789a3090 10303
39bc1876
NS
10304@item -mcall-sysv-eabi
10305@opindex mcall-sysv-eabi
10306Specify both @option{-mcall-sysv} and @option{-meabi} options.
789a3090 10307
39bc1876
NS
10308@item -mcall-sysv-noeabi
10309@opindex mcall-sysv-noeabi
10310Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
789a3090 10311
39bc1876
NS
10312@item -mcall-solaris
10313@opindex mcall-solaris
10314On System V.4 and embedded PowerPC systems compile code for the Solaris
10315operating system.
789a3090 10316
39bc1876
NS
10317@item -mcall-linux
10318@opindex mcall-linux
10319On System V.4 and embedded PowerPC systems compile code for the
10320Linux-based GNU system.
789a3090 10321
39bc1876
NS
10322@item -mcall-gnu
10323@opindex mcall-gnu
10324On System V.4 and embedded PowerPC systems compile code for the
10325Hurd-based GNU system.
789a3090 10326
39bc1876
NS
10327@item -mcall-netbsd
10328@opindex mcall-netbsd
10329On System V.4 and embedded PowerPC systems compile code for the
10330NetBSD operating system.
789a3090 10331
39bc1876
NS
10332@item -maix-struct-return
10333@opindex maix-struct-return
10334Return all structures in memory (as specified by the AIX ABI)@.
789a3090 10335
39bc1876
NS
10336@item -msvr4-struct-return
10337@opindex msvr4-struct-return
10338Return structures smaller than 8 bytes in registers (as specified by the
10339SVR4 ABI)@.
789a3090 10340
39bc1876
NS
10341@item -mabi=altivec
10342@opindex mabi=altivec
10343Extend the current ABI with AltiVec ABI extensions. This does not
10344change the default ABI, instead it adds the AltiVec ABI extensions to
10345the current ABI@.
789a3090 10346
39bc1876
NS
10347@item -mabi=no-altivec
10348@opindex mabi=no-altivec
10349Disable AltiVec ABI extensions for the current ABI.
789a3090 10350
39bc1876
NS
10351@item -mprototype
10352@itemx -mno-prototype
10353@opindex mprototype
10354@opindex mno-prototype
10355On System V.4 and embedded PowerPC systems assume that all calls to
10356variable argument functions are properly prototyped. Otherwise, the
10357compiler must insert an instruction before every non prototyped call to
10358set or clear bit 6 of the condition code register (@var{CR}) to
10359indicate whether floating point values were passed in the floating point
10360registers in case the function takes a variable arguments. With
10361@option{-mprototype}, only calls to prototyped variable argument functions
10362will set or clear the bit.
83575957 10363
39bc1876
NS
10364@item -msim
10365@opindex msim
10366On embedded PowerPC systems, assume that the startup module is called
10367@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
10368@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
10369configurations.
df6194d4 10370
39bc1876
NS
10371@item -mmvme
10372@opindex mmvme
10373On embedded PowerPC systems, assume that the startup module is called
10374@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
10375@file{libc.a}.
df6194d4 10376
39bc1876
NS
10377@item -mads
10378@opindex mads
10379On embedded PowerPC systems, assume that the startup module is called
10380@file{crt0.o} and the standard C libraries are @file{libads.a} and
10381@file{libc.a}.
df6194d4 10382
39bc1876
NS
10383@item -myellowknife
10384@opindex myellowknife
10385On embedded PowerPC systems, assume that the startup module is called
10386@file{crt0.o} and the standard C libraries are @file{libyk.a} and
10387@file{libc.a}.
df6194d4 10388
39bc1876
NS
10389@item -mvxworks
10390@opindex mvxworks
10391On System V.4 and embedded PowerPC systems, specify that you are
10392compiling for a VxWorks system.
df6194d4 10393
39bc1876
NS
10394@item -mwindiss
10395@opindex mwindiss
10396Specify that you are compiling for the WindISS simulation environment.
df6194d4 10397
39bc1876
NS
10398@item -memb
10399@opindex memb
10400On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
10401header to indicate that @samp{eabi} extended relocations are used.
df6194d4 10402
39bc1876
NS
10403@item -meabi
10404@itemx -mno-eabi
10405@opindex meabi
10406@opindex mno-eabi
10407On System V.4 and embedded PowerPC systems do (do not) adhere to the
10408Embedded Applications Binary Interface (eabi) which is a set of
10409modifications to the System V.4 specifications. Selecting @option{-meabi}
10410means that the stack is aligned to an 8 byte boundary, a function
10411@code{__eabi} is called to from @code{main} to set up the eabi
10412environment, and the @option{-msdata} option can use both @code{r2} and
10413@code{r13} to point to two separate small data areas. Selecting
10414@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
10415do not call an initialization function from @code{main}, and the
10416@option{-msdata} option will only use @code{r13} to point to a single
10417small data area. The @option{-meabi} option is on by default if you
10418configured GCC using one of the @samp{powerpc*-*-eabi*} options.
df6194d4 10419
39bc1876
NS
10420@item -msdata=eabi
10421@opindex msdata=eabi
10422On System V.4 and embedded PowerPC systems, put small initialized
10423@code{const} global and static data in the @samp{.sdata2} section, which
10424is pointed to by register @code{r2}. Put small initialized
10425non-@code{const} global and static data in the @samp{.sdata} section,
10426which is pointed to by register @code{r13}. Put small uninitialized
10427global and static data in the @samp{.sbss} section, which is adjacent to
10428the @samp{.sdata} section. The @option{-msdata=eabi} option is
10429incompatible with the @option{-mrelocatable} option. The
10430@option{-msdata=eabi} option also sets the @option{-memb} option.
df6194d4 10431
39bc1876
NS
10432@item -msdata=sysv
10433@opindex msdata=sysv
10434On System V.4 and embedded PowerPC systems, put small global and static
10435data in the @samp{.sdata} section, which is pointed to by register
10436@code{r13}. Put small uninitialized global and static data in the
10437@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
10438The @option{-msdata=sysv} option is incompatible with the
10439@option{-mrelocatable} option.
df6194d4 10440
39bc1876 10441@item -msdata=default
df6194d4 10442@itemx -msdata
39bc1876 10443@opindex msdata=default
cd3bb277 10444@opindex msdata
39bc1876
NS
10445On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
10446compile code the same as @option{-msdata=eabi}, otherwise compile code the
10447same as @option{-msdata=sysv}.
df6194d4 10448
39bc1876
NS
10449@item -msdata-data
10450@opindex msdata-data
10451On System V.4 and embedded PowerPC systems, put small global and static
10452data in the @samp{.sdata} section. Put small uninitialized global and
10453static data in the @samp{.sbss} section. Do not use register @code{r13}
10454to address small data however. This is the default behavior unless
10455other @option{-msdata} options are used.
df6194d4 10456
39bc1876
NS
10457@item -msdata=none
10458@itemx -mno-sdata
10459@opindex msdata=none
10460@opindex mno-sdata
10461On embedded PowerPC systems, put all initialized global and static data
10462in the @samp{.data} section, and all uninitialized data in the
10463@samp{.bss} section.
df6194d4 10464
39bc1876
NS
10465@item -G @var{num}
10466@opindex G
10467@cindex smaller data references (PowerPC)
10468@cindex .sdata/.sdata2 references (PowerPC)
10469On embedded PowerPC systems, put global and static items less than or
10470equal to @var{num} bytes into the small data or bss sections instead of
10471the normal data or bss section. By default, @var{num} is 8. The
10472@option{-G @var{num}} switch is also passed to the linker.
10473All modules should be compiled with the same @option{-G @var{num}} value.
dcffbade 10474
39bc1876
NS
10475@item -mregnames
10476@itemx -mno-regnames
10477@opindex mregnames
10478@opindex mno-regnames
10479On System V.4 and embedded PowerPC systems do (do not) emit register
10480names in the assembly language output using symbolic forms.
dcffbade 10481
39bc1876
NS
10482@item -mlongcall
10483@itemx -mno-longcall
10484@opindex mlongcall
10485@opindex mno-longcall
10486Default to making all function calls indirectly, using a register, so
10487that functions which reside further than 32 megabytes (33,554,432
10488bytes) from the current location can be called. This setting can be
10489overridden by the @code{shortcall} function attribute, or by
10490@code{#pragma longcall(0)}.
dcffbade 10491
39bc1876
NS
10492Some linkers are capable of detecting out-of-range calls and generating
10493glue code on the fly. On these systems, long calls are unnecessary and
10494generate slower code. As of this writing, the AIX linker can do this,
10495as can the GNU linker for PowerPC/64. It is planned to add this feature
10496to the GNU linker for 32-bit PowerPC systems as well.
df6194d4 10497
39bc1876
NS
10498On Darwin/PPC systems, @code{#pragma longcall} will generate ``jbsr
10499callee, L42'', plus a ``branch island'' (glue code). The two target
10500addresses represent the callee and the ``branch island.'' The
10501Darwin/PPC linker will prefer the first address and generate a ``bl
10502callee'' if the PPC ``bl'' instruction will reach the callee directly;
10503otherwise, the linker will generate ``bl L42'' to call the ``branch
10504island.'' The ``branch island'' is appended to the body of the
10505calling function; it computes the full 32-bit address of the callee
10506and jumps to it.
df6194d4 10507
39bc1876
NS
10508On Mach-O (Darwin) systems, this option directs the compiler emit to
10509the glue for every direct call, and the Darwin linker decides whether
10510to use or discard it.
10511
10512In the future, we may cause GCC to ignore all longcall specifications
10513when the linker is known to generate glue.
10514
10515@item -pthread
10516@opindex pthread
10517Adds support for multithreading with the @dfn{pthreads} library.
10518This option sets flags for both the preprocessor and linker.
30028c85 10519
df6194d4
JW
10520@end table
10521
91abf72d
HP
10522@node S/390 and zSeries Options
10523@subsection S/390 and zSeries Options
10524@cindex S/390 and zSeries Options
10525
10526These are the @samp{-m} options defined for the S/390 and zSeries architecture.
10527
10528@table @gcctabopt
10529@item -mhard-float
10530@itemx -msoft-float
10531@opindex mhard-float
10532@opindex msoft-float
10533Use (do not use) the hardware floating-point instructions and registers
10534for floating-point operations. When @option{-msoft-float} is specified,
10535functions in @file{libgcc.a} will be used to perform floating-point
10536operations. When @option{-mhard-float} is specified, the compiler
10537generates IEEE floating-point instructions. This is the default.
10538
10539@item -mbackchain
10540@itemx -mno-backchain
adf39f8f 10541@itemx -mkernel-backchain
91abf72d
HP
10542@opindex mbackchain
10543@opindex mno-backchain
adf39f8f
AK
10544@opindex mkernel-backchain
10545In order to provide a backchain the address of the caller's frame
10546is stored within the callee's stack frame.
10547A backchain may be needed to allow debugging using tools that do not understand
10548DWARF-2 call frame information.
10549For @option{-mno-backchain} no backchain is maintained at all which is the
10550default.
10551If one of the other options is present the backchain pointer is placed either
10552on top of the stack frame (@option{-mkernel-backchain}) or on
10553the bottom (@option{-mbackchain}).
10554Beside the different backchain location @option{-mkernel-backchain}
10555also changes stack frame layout breaking the ABI. This option
10556is intended to be used for code which internally needs a backchain but has
10557to get by with a limited stack size e.g. the linux kernel.
10558Internal unwinding code not using DWARF-2 info has to be able to locate the
10559return address of a function. That will be eased be the fact that
10560the return address of a function is placed two words below the backchain
10561pointer.
91abf72d
HP
10562
10563@item -msmall-exec
10564@itemx -mno-small-exec
10565@opindex msmall-exec
10566@opindex mno-small-exec
f282ffb3
JM
10567Generate (or do not generate) code using the @code{bras} instruction
10568to do subroutine calls.
91abf72d
HP
10569This only works reliably if the total executable size does not
10570exceed 64k. The default is to use the @code{basr} instruction instead,
10571which does not have this limitation.
10572
10573@item -m64
10574@itemx -m31
10575@opindex m64
10576@opindex m31
10577When @option{-m31} is specified, generate code compliant to the
95fef11f
JM
10578GNU/Linux for S/390 ABI@. When @option{-m64} is specified, generate
10579code compliant to the GNU/Linux for zSeries ABI@. This allows GCC in
91abf72d 10580particular to generate 64-bit instructions. For the @samp{s390}
f282ffb3 10581targets, the default is @option{-m31}, while the @samp{s390x}
91abf72d
HP
10582targets default to @option{-m64}.
10583
1fec52be
HP
10584@item -mzarch
10585@itemx -mesa
10586@opindex mzarch
10587@opindex mesa
daf2f129
JM
10588When @option{-mzarch} is specified, generate code using the
10589instructions available on z/Architecture.
10590When @option{-mesa} is specified, generate code using the
1fec52be
HP
10591instructions available on ESA/390. Note that @option{-mesa} is
10592not possible with @option{-m64}.
95fef11f 10593When generating code compliant to the GNU/Linux for S/390 ABI,
f13e0d4e 10594the default is @option{-mesa}. When generating code compliant
95fef11f 10595to the GNU/Linux for zSeries ABI, the default is @option{-mzarch}.
1fec52be 10596
91abf72d
HP
10597@item -mmvcle
10598@itemx -mno-mvcle
10599@opindex mmvcle
10600@opindex mno-mvcle
f282ffb3 10601Generate (or do not generate) code using the @code{mvcle} instruction
3364c33b 10602to perform block moves. When @option{-mno-mvcle} is specified,
91abf72d
HP
10603use a @code{mvc} loop instead. This is the default.
10604
10605@item -mdebug
10606@itemx -mno-debug
10607@opindex mdebug
10608@opindex mno-debug
10609Print (or do not print) additional debug information when compiling.
10610The default is to not print debug information.
10611
f13e0d4e 10612@item -march=@var{cpu-type}
1fec52be 10613@opindex march
f13e0d4e 10614Generate code that will run on @var{cpu-type}, which is the name of a system
1fec52be 10615representing a certain processor type. Possible values for
f13e0d4e
UW
10616@var{cpu-type} are @samp{g5}, @samp{g6}, @samp{z900}, and @samp{z990}.
10617When generating code using the instructions available on z/Architecture,
10618the default is @option{-march=z900}. Otherwise, the default is
10619@option{-march=g5}.
1fec52be 10620
f13e0d4e 10621@item -mtune=@var{cpu-type}
35082351 10622@opindex mtune
1fec52be 10623Tune to @var{cpu-type} everything applicable about the generated code,
f13e0d4e
UW
10624except for the ABI and the set of available instructions.
10625The list of @var{cpu-type} values is the same as for @option{-march}.
10626The default is the value used for @option{-march}.
1fec52be 10627
f26c1794
EC
10628@item -mtpf-trace
10629@itemx -mno-tpf-trace
10630@opindex mtpf-trace
10631@opindex mno-tpf-trace
10632Generate code that adds (does not add) in TPF OS specific branches to trace
10633routines in the operating system. This option is off by default, even
10634when compiling for the TPF OS.
10635
f2d226e1
AK
10636@item -mfused-madd
10637@itemx -mno-fused-madd
10638@opindex mfused-madd
10639@opindex mno-fused-madd
10640Generate code that uses (does not use) the floating point multiply and
10641accumulate instructions. These instructions are generated by default if
10642hardware floating point is used.
d75f90f1
AK
10643
10644@item -mwarn-framesize=@var{framesize}
10645@opindex mwarn-framesize
10646Emit a warning if the current function exceeds the given frame size. Because
10647this is a compile time check it doesn't need to be a real problem when the program
10648runs. It is intended to identify functions which most probably cause
10649a stack overflow. It is useful to be used in an environment with limited stack
10650size e.g. the linux kernel.
10651
10652@item -mwarn-dynamicstack
10653@opindex mwarn-dynamicstack
10654Emit a warning if the function calls alloca or uses dynamically
10655sized arrays. This is generally a bad idea with a limited stack size.
10656
10657@item -mstack-guard=@var{stack-guard}
10658@item -mstack-size=@var{stack-size}
10659@opindex mstack-guard
10660@opindex mstack-size
10661These arguments always have to be used in conjunction. If they are present the s390
10662back end emits additional instructions in the function prologue which trigger a trap
10663if the stack size is @var{stack-guard} bytes above the @var{stack-size}
10664(remember that the stack on s390 grows downward). These options are intended to
10665be used to help debugging stack overflow problems. The additionally emitted code
10666cause only little overhead and hence can also be used in production like systems
10667without greater performance degradation. The given values have to be exact
10668powers of 2 and @var{stack-size} has to be greater than @var{stack-guard}.
10669In order to be efficient the extra code makes the assumption that the stack starts
10670at an address aligned to the value given by @var{stack-size}.
91abf72d
HP
10671@end table
10672
39bc1876
NS
10673@node SH Options
10674@subsection SH Options
bcf684c7 10675
39bc1876 10676These @samp{-m} options are defined for the SH implementations:
bcf684c7 10677
5d22c1a5 10678@table @gcctabopt
39bc1876
NS
10679@item -m1
10680@opindex m1
10681Generate code for the SH1.
9f85bca7 10682
39bc1876
NS
10683@item -m2
10684@opindex m2
10685Generate code for the SH2.
9f85bca7 10686
39bc1876
NS
10687@item -m2e
10688Generate code for the SH2e.
9f85bca7 10689
39bc1876
NS
10690@item -m3
10691@opindex m3
10692Generate code for the SH3.
9f85bca7 10693
39bc1876
NS
10694@item -m3e
10695@opindex m3e
10696Generate code for the SH3e.
9f85bca7 10697
39bc1876
NS
10698@item -m4-nofpu
10699@opindex m4-nofpu
10700Generate code for the SH4 without a floating-point unit.
9f85bca7 10701
39bc1876
NS
10702@item -m4-single-only
10703@opindex m4-single-only
10704Generate code for the SH4 with a floating-point unit that only
10705supports single-precision arithmetic.
9f85bca7 10706
39bc1876
NS
10707@item -m4-single
10708@opindex m4-single
10709Generate code for the SH4 assuming the floating-point unit is in
10710single-precision mode by default.
9f85bca7 10711
39bc1876
NS
10712@item -m4
10713@opindex m4
10714Generate code for the SH4.
9f85bca7 10715
312209c6
AO
10716@item -m4a-nofpu
10717@opindex m4a-nofpu
10718Generate code for the SH4al-dsp, or for a SH4a in such a way that the
10719floating-point unit is not used.
10720
10721@item -m4a-single-only
10722@opindex m4a-single-only
10723Generate code for the SH4a, in such a way that no double-precision
10724floating point operations are used.
10725
10726@item -m4a-single
10727@opindex m4a-single
10728Generate code for the SH4a assuming the floating-point unit is in
10729single-precision mode by default.
10730
10731@item -m4a
10732@opindex m4a
10733Generate code for the SH4a.
10734
10735@item -m4al
10736@opindex m4al
10737Same as @option{-m4a-nofpu}, except that it implicitly passes
10738@option{-dsp} to the assembler. GCC doesn't generate any DSP
10739instructions at the moment.
10740
39bc1876
NS
10741@item -mb
10742@opindex mb
10743Compile code for the processor in big endian mode.
9f85bca7 10744
39bc1876
NS
10745@item -ml
10746@opindex ml
10747Compile code for the processor in little endian mode.
9f85bca7 10748
39bc1876
NS
10749@item -mdalign
10750@opindex mdalign
10751Align doubles at 64-bit boundaries. Note that this changes the calling
10752conventions, and thus some functions from the standard C library will
10753not work unless you recompile it first with @option{-mdalign}.
9f85bca7 10754
39bc1876
NS
10755@item -mrelax
10756@opindex mrelax
10757Shorten some address references at link time, when possible; uses the
10758linker option @option{-relax}.
9f85bca7 10759
39bc1876
NS
10760@item -mbigtable
10761@opindex mbigtable
10762Use 32-bit offsets in @code{switch} tables. The default is to use
1076316-bit offsets.
9f85bca7 10764
39bc1876
NS
10765@item -mfmovd
10766@opindex mfmovd
10767Enable the use of the instruction @code{fmovd}.
9f85bca7 10768
39bc1876
NS
10769@item -mhitachi
10770@opindex mhitachi
10771Comply with the calling conventions defined by Renesas.
9f85bca7 10772
2acc29bd
NC
10773@item -mrenesas
10774@opindex mhitachi
10775Comply with the calling conventions defined by Renesas.
10776
10777@item -mno-renesas
10778@opindex mhitachi
10779Comply with the calling conventions defined for GCC before the Renesas
10780conventions were available. This option is the default for all
10781targets of the SH toolchain except for @samp{sh-symbianelf}.
10782
39bc1876
NS
10783@item -mnomacsave
10784@opindex mnomacsave
10785Mark the @code{MAC} register as call-clobbered, even if
10786@option{-mhitachi} is given.
9f85bca7 10787
39bc1876
NS
10788@item -mieee
10789@opindex mieee
10790Increase IEEE-compliance of floating-point code.
9f85bca7 10791
39bc1876
NS
10792@item -misize
10793@opindex misize
10794Dump instruction size and location in the assembly code.
9f85bca7 10795
39bc1876
NS
10796@item -mpadstruct
10797@opindex mpadstruct
10798This option is deprecated. It pads structures to multiple of 4 bytes,
10799which is incompatible with the SH ABI@.
9f85bca7 10800
39bc1876
NS
10801@item -mspace
10802@opindex mspace
10803Optimize for space instead of speed. Implied by @option{-Os}.
9f85bca7 10804
39bc1876
NS
10805@item -mprefergot
10806@opindex mprefergot
10807When generating position-independent code, emit function calls using
10808the Global Offset Table instead of the Procedure Linkage Table.
9f85bca7 10809
39bc1876
NS
10810@item -musermode
10811@opindex musermode
10812Generate a library function call to invalidate instruction cache
10813entries, after fixing up a trampoline. This library function call
10814doesn't assume it can write to the whole memory address space. This
10815is the default when the target is @code{sh-*-linux*}.
9f85bca7
JM
10816@end table
10817
39bc1876
NS
10818@node SPARC Options
10819@subsection SPARC Options
10820@cindex SPARC options
69a0611f 10821
39bc1876 10822These @samp{-m} options are supported on the SPARC:
69a0611f
GK
10823
10824@table @gcctabopt
39bc1876
NS
10825@item -mno-app-regs
10826@itemx -mapp-regs
10827@opindex mno-app-regs
10828@opindex mapp-regs
10829Specify @option{-mapp-regs} to generate output using the global registers
108302 through 4, which the SPARC SVR4 ABI reserves for applications. This
10831is the default.
69a0611f 10832
39bc1876
NS
10833To be fully SVR4 ABI compliant at the cost of some performance loss,
10834specify @option{-mno-app-regs}. You should compile libraries and system
10835software with this option.
70899148 10836
39bc1876
NS
10837@item -mfpu
10838@itemx -mhard-float
10839@opindex mfpu
10840@opindex mhard-float
10841Generate output containing floating point instructions. This is the
10842default.
70899148 10843
39bc1876
NS
10844@item -mno-fpu
10845@itemx -msoft-float
10846@opindex mno-fpu
10847@opindex msoft-float
10848Generate output containing library calls for floating point.
10849@strong{Warning:} the requisite libraries are not available for all SPARC
10850targets. Normally the facilities of the machine's usual C compiler are
10851used, but this cannot be done directly in cross-compilation. You must make
10852your own arrangements to provide suitable library functions for
10853cross-compilation. The embedded targets @samp{sparc-*-aout} and
10854@samp{sparclite-*-*} do provide software floating point support.
70899148 10855
39bc1876
NS
10856@option{-msoft-float} changes the calling convention in the output file;
10857therefore, it is only useful if you compile @emph{all} of a program with
10858this option. In particular, you need to compile @file{libgcc.a}, the
10859library that comes with GCC, with @option{-msoft-float} in order for
10860this to work.
70899148 10861
39bc1876
NS
10862@item -mhard-quad-float
10863@opindex mhard-quad-float
10864Generate output containing quad-word (long double) floating point
10865instructions.
70899148 10866
39bc1876
NS
10867@item -msoft-quad-float
10868@opindex msoft-quad-float
10869Generate output containing library calls for quad-word (long double)
10870floating point instructions. The functions called are those specified
10871in the SPARC ABI@. This is the default.
70899148 10872
39bc1876
NS
10873As of this writing, there are no SPARC implementations that have hardware
10874support for the quad-word floating point instructions. They all invoke
10875a trap handler for one of these instructions, and then the trap handler
10876emulates the effect of the instruction. Because of the trap handler overhead,
10877this is much slower than calling the ABI library routines. Thus the
10878@option{-msoft-quad-float} option is the default.
70899148 10879
39bc1876
NS
10880@item -mno-unaligned-doubles
10881@itemx -munaligned-doubles
10882@opindex mno-unaligned-doubles
10883@opindex munaligned-doubles
10884Assume that doubles have 8 byte alignment. This is the default.
70899148 10885
39bc1876
NS
10886With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
10887alignment only if they are contained in another type, or if they have an
10888absolute address. Otherwise, it assumes they have 4 byte alignment.
10889Specifying this option avoids some rare compatibility problems with code
10890generated by other compilers. It is not the default because it results
10891in a performance loss, especially for floating point code.
70899148 10892
39bc1876
NS
10893@item -mno-faster-structs
10894@itemx -mfaster-structs
10895@opindex mno-faster-structs
10896@opindex mfaster-structs
10897With @option{-mfaster-structs}, the compiler assumes that structures
10898should have 8 byte alignment. This enables the use of pairs of
10899@code{ldd} and @code{std} instructions for copies in structure
10900assignment, in place of twice as many @code{ld} and @code{st} pairs.
10901However, the use of this changed alignment directly violates the SPARC
10902ABI@. Thus, it's intended only for use on targets where the developer
10903acknowledges that their resulting code will not be directly in line with
10904the rules of the ABI@.
70899148 10905
39bc1876
NS
10906@item -mimpure-text
10907@opindex mimpure-text
10908@option{-mimpure-text}, used in addition to @option{-shared}, tells
10909the compiler to not pass @option{-z text} to the linker when linking a
10910shared object. Using this option, you can link position-dependent
10911code into a shared object.
70899148 10912
39bc1876
NS
10913@option{-mimpure-text} suppresses the ``relocations remain against
10914allocatable but non-writable sections'' linker error message.
10915However, the necessary relocations will trigger copy-on-write, and the
10916shared object is not actually shared across processes. Instead of
10917using @option{-mimpure-text}, you should compile all source code with
10918@option{-fpic} or @option{-fPIC}.
10919
10920This option is only available on SunOS and Solaris.
10921
10922@item -mcpu=@var{cpu_type}
10923@opindex mcpu
10924Set the instruction set, register set, and instruction scheduling parameters
10925for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
10926@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
10927@samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
10928@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
10929@samp{ultrasparc3}.
70899148 10930
39bc1876
NS
10931Default instruction scheduling parameters are used for values that select
10932an architecture and not an implementation. These are @samp{v7}, @samp{v8},
10933@samp{sparclite}, @samp{sparclet}, @samp{v9}.
70899148 10934
39bc1876
NS
10935Here is a list of each supported architecture and their supported
10936implementations.
70899148 10937
39bc1876
NS
10938@smallexample
10939 v7: cypress
10940 v8: supersparc, hypersparc
10941 sparclite: f930, f934, sparclite86x
10942 sparclet: tsc701
10943 v9: ultrasparc, ultrasparc3
10944@end smallexample
70899148 10945
39bc1876
NS
10946By default (unless configured otherwise), GCC generates code for the V7
10947variant of the SPARC architecture. With @option{-mcpu=cypress}, the compiler
10948additionally optimizes it for the Cypress CY7C602 chip, as used in the
10949SPARCStation/SPARCServer 3xx series. This is also appropriate for the older
10950SPARCStation 1, 2, IPX etc.
70899148 10951
39bc1876
NS
10952With @option{-mcpu=v8}, GCC generates code for the V8 variant of the SPARC
10953architecture. The only difference from V7 code is that the compiler emits
10954the integer multiply and integer divide instructions which exist in SPARC-V8
10955but not in SPARC-V7. With @option{-mcpu=supersparc}, the compiler additionally
10956optimizes it for the SuperSPARC chip, as used in the SPARCStation 10, 1000 and
109572000 series.
70899148 10958
39bc1876
NS
10959With @option{-mcpu=sparclite}, GCC generates code for the SPARClite variant of
10960the SPARC architecture. This adds the integer multiply, integer divide step
10961and scan (@code{ffs}) instructions which exist in SPARClite but not in SPARC-V7.
10962With @option{-mcpu=f930}, the compiler additionally optimizes it for the
10963Fujitsu MB86930 chip, which is the original SPARClite, with no FPU. With
10964@option{-mcpu=f934}, the compiler additionally optimizes it for the Fujitsu
10965MB86934 chip, which is the more recent SPARClite with FPU.
70899148 10966
39bc1876
NS
10967With @option{-mcpu=sparclet}, GCC generates code for the SPARClet variant of
10968the SPARC architecture. This adds the integer multiply, multiply/accumulate,
10969integer divide step and scan (@code{ffs}) instructions which exist in SPARClet
10970but not in SPARC-V7. With @option{-mcpu=tsc701}, the compiler additionally
10971optimizes it for the TEMIC SPARClet chip.
70899148 10972
39bc1876
NS
10973With @option{-mcpu=v9}, GCC generates code for the V9 variant of the SPARC
10974architecture. This adds 64-bit integer and floating-point move instructions,
109753 additional floating-point condition code registers and conditional move
10976instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
10977optimizes it for the Sun UltraSPARC I/II chips. With
10978@option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
10979Sun UltraSPARC III chip.
70899148 10980
39bc1876
NS
10981@item -mtune=@var{cpu_type}
10982@opindex mtune
10983Set the instruction scheduling parameters for machine type
10984@var{cpu_type}, but do not set the instruction set or register set that the
10985option @option{-mcpu=@var{cpu_type}} would.
70899148 10986
39bc1876
NS
10987The same values for @option{-mcpu=@var{cpu_type}} can be used for
10988@option{-mtune=@var{cpu_type}}, but the only useful values are those
10989that select a particular cpu implementation. Those are @samp{cypress},
10990@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
10991@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
10992@samp{ultrasparc3}.
70899148 10993
39bc1876
NS
10994@item -mv8plus
10995@itemx -mno-v8plus
10996@opindex mv8plus
10997@opindex mno-v8plus
10998With @option{-mv8plus}, GCC generates code for the SPARC-V8+ ABI. The
10999difference from the V8 ABI is that the global and out registers are
11000considered 64-bit wide. This is enabled by default on Solaris in 32-bit
11001mode for all SPARC-V9 processors.
70899148 11002
39bc1876
NS
11003@item -mvis
11004@itemx -mno-vis
11005@opindex mvis
11006@opindex mno-vis
11007With @option{-mvis}, GCC generates code that takes advantage of the UltraSPARC
11008Visual Instruction Set extensions. The default is @option{-mno-vis}.
11009@end table
70899148 11010
39bc1876
NS
11011These @samp{-m} options are supported in addition to the above
11012on SPARC-V9 processors in 64-bit environments:
70899148 11013
39bc1876
NS
11014@table @gcctabopt
11015@item -mlittle-endian
11016@opindex mlittle-endian
11017Generate code for a processor running in little-endian mode. It is only
11018available for a few configurations and most notably not on Solaris.
70899148 11019
39bc1876
NS
11020@item -m32
11021@itemx -m64
11022@opindex m32
11023@opindex m64
11024Generate code for a 32-bit or 64-bit environment.
11025The 32-bit environment sets int, long and pointer to 32 bits.
11026The 64-bit environment sets int to 32 bits and long and pointer
11027to 64 bits.
70899148 11028
39bc1876
NS
11029@item -mcmodel=medlow
11030@opindex mcmodel=medlow
11031Generate code for the Medium/Low code model: 64-bit addresses, programs
11032must be linked in the low 32 bits of memory. Programs can be statically
11033or dynamically linked.
70899148 11034
39bc1876
NS
11035@item -mcmodel=medmid
11036@opindex mcmodel=medmid
11037Generate code for the Medium/Middle code model: 64-bit addresses, programs
11038must be linked in the low 44 bits of memory, the text and data segments must
11039be less than 2GB in size and the data segment must be located within 2GB of
11040the text segment.
70899148 11041
39bc1876
NS
11042@item -mcmodel=medany
11043@opindex mcmodel=medany
11044Generate code for the Medium/Anywhere code model: 64-bit addresses, programs
11045may be linked anywhere in memory, the text and data segments must be less
11046than 2GB in size and the data segment must be located within 2GB of the
11047text segment.
70899148 11048
39bc1876
NS
11049@item -mcmodel=embmedany
11050@opindex mcmodel=embmedany
11051Generate code for the Medium/Anywhere code model for embedded systems:
1105264-bit addresses, the text and data segments must be less than 2GB in
11053size, both starting anywhere in memory (determined at link time). The
11054global register %g4 points to the base of the data segment. Programs
11055are statically linked and PIC is not supported.
70899148 11056
39bc1876
NS
11057@item -mstack-bias
11058@itemx -mno-stack-bias
11059@opindex mstack-bias
11060@opindex mno-stack-bias
11061With @option{-mstack-bias}, GCC assumes that the stack pointer, and
11062frame pointer if present, are offset by @minus{}2047 which must be added back
11063when making stack frame references. This is the default in 64-bit mode.
11064Otherwise, assume no such offset is present.
11065@end table
70899148 11066
6bfb2f93
EB
11067These switches are supported in addition to the above on Solaris:
11068
11069@table @gcctabopt
11070@item -threads
11071@opindex threads
11072Add support for multithreading using the Solaris threads library. This
11073option sets flags for both the preprocessor and linker. This option does
11074not affect the thread safety of object code produced by the compiler or
11075that of libraries supplied with it.
11076
11077@item -pthreads
11078@opindex pthreads
11079Add support for multithreading using the POSIX threads library. This
11080option sets flags for both the preprocessor and linker. This option does
11081not affect the thread safety of object code produced by the compiler or
11082that of libraries supplied with it.
11083@end table
11084
39bc1876
NS
11085@node System V Options
11086@subsection Options for System V
70899148 11087
39bc1876
NS
11088These additional options are available on System V Release 4 for
11089compatibility with other compilers on those systems:
70899148 11090
39bc1876
NS
11091@table @gcctabopt
11092@item -G
11093@opindex G
11094Create a shared object.
11095It is recommended that @option{-symbolic} or @option{-shared} be used instead.
70899148 11096
39bc1876
NS
11097@item -Qy
11098@opindex Qy
11099Identify the versions of each tool used by the compiler, in a
11100@code{.ident} assembler directive in the output.
70899148 11101
39bc1876
NS
11102@item -Qn
11103@opindex Qn
11104Refrain from adding @code{.ident} directives to the output file (this is
11105the default).
70899148 11106
39bc1876
NS
11107@item -YP,@var{dirs}
11108@opindex YP
11109Search the directories @var{dirs}, and no others, for libraries
11110specified with @option{-l}.
70899148 11111
39bc1876
NS
11112@item -Ym,@var{dir}
11113@opindex Ym
11114Look in the directory @var{dir} to find the M4 preprocessor.
11115The assembler uses this option.
11116@c This is supposed to go with a -Yd for predefined M4 macro files, but
11117@c the generic assembler that comes with Solaris takes just -Ym.
11118@end table
70899148 11119
39bc1876
NS
11120@node TMS320C3x/C4x Options
11121@subsection TMS320C3x/C4x Options
11122@cindex TMS320C3x/C4x Options
70899148 11123
39bc1876 11124These @samp{-m} options are defined for TMS320C3x/C4x implementations:
70899148 11125
39bc1876 11126@table @gcctabopt
70899148 11127
39bc1876
NS
11128@item -mcpu=@var{cpu_type}
11129@opindex mcpu
11130Set the instruction set, register set, and instruction scheduling
11131parameters for machine type @var{cpu_type}. Supported values for
11132@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
11133@samp{c44}. The default is @samp{c40} to generate code for the
11134TMS320C40.
70899148 11135
39bc1876
NS
11136@item -mbig-memory
11137@itemx -mbig
11138@itemx -msmall-memory
11139@itemx -msmall
11140@opindex mbig-memory
11141@opindex mbig
11142@opindex msmall-memory
11143@opindex msmall
11144Generates code for the big or small memory model. The small memory
11145model assumed that all data fits into one 64K word page. At run-time
11146the data page (DP) register must be set to point to the 64K page
11147containing the .bss and .data program sections. The big memory model is
11148the default and requires reloading of the DP register for every direct
11149memory access.
70899148 11150
39bc1876
NS
11151@item -mbk
11152@itemx -mno-bk
11153@opindex mbk
11154@opindex mno-bk
11155Allow (disallow) allocation of general integer operands into the block
11156count register BK@.
70899148 11157
39bc1876
NS
11158@item -mdb
11159@itemx -mno-db
11160@opindex mdb
11161@opindex mno-db
11162Enable (disable) generation of code using decrement and branch,
11163DBcond(D), instructions. This is enabled by default for the C4x. To be
11164on the safe side, this is disabled for the C3x, since the maximum
11165iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
11166@math{2^{23}} times on the C3x?). Note that GCC will try to reverse a loop so
11167that it can utilize the decrement and branch instruction, but will give
11168up if there is more than one memory reference in the loop. Thus a loop
11169where the loop counter is decremented can generate slightly more
11170efficient code, in cases where the RPTB instruction cannot be utilized.
70899148 11171
39bc1876
NS
11172@item -mdp-isr-reload
11173@itemx -mparanoid
11174@opindex mdp-isr-reload
11175@opindex mparanoid
11176Force the DP register to be saved on entry to an interrupt service
11177routine (ISR), reloaded to point to the data section, and restored on
11178exit from the ISR@. This should not be required unless someone has
11179violated the small memory model by modifying the DP register, say within
11180an object library.
70899148 11181
39bc1876
NS
11182@item -mmpyi
11183@itemx -mno-mpyi
11184@opindex mmpyi
11185@opindex mno-mpyi
11186For the C3x use the 24-bit MPYI instruction for integer multiplies
11187instead of a library call to guarantee 32-bit results. Note that if one
11188of the operands is a constant, then the multiplication will be performed
11189using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x,
11190then squaring operations are performed inline instead of a library call.
70899148 11191
39bc1876
NS
11192@item -mfast-fix
11193@itemx -mno-fast-fix
11194@opindex mfast-fix
11195@opindex mno-fast-fix
11196The C3x/C4x FIX instruction to convert a floating point value to an
11197integer value chooses the nearest integer less than or equal to the
11198floating point value rather than to the nearest integer. Thus if the
11199floating point number is negative, the result will be incorrectly
11200truncated an additional code is necessary to detect and correct this
11201case. This option can be used to disable generation of the additional
11202code required to correct the result.
70899148 11203
39bc1876
NS
11204@item -mrptb
11205@itemx -mno-rptb
11206@opindex mrptb
11207@opindex mno-rptb
11208Enable (disable) generation of repeat block sequences using the RPTB
11209instruction for zero overhead looping. The RPTB construct is only used
11210for innermost loops that do not call functions or jump across the loop
11211boundaries. There is no advantage having nested RPTB loops due to the
11212overhead required to save and restore the RC, RS, and RE registers.
11213This is enabled by default with @option{-O2}.
70899148 11214
39bc1876
NS
11215@item -mrpts=@var{count}
11216@itemx -mno-rpts
11217@opindex mrpts
11218@opindex mno-rpts
11219Enable (disable) the use of the single instruction repeat instruction
11220RPTS@. If a repeat block contains a single instruction, and the loop
11221count can be guaranteed to be less than the value @var{count}, GCC will
11222emit a RPTS instruction instead of a RPTB@. If no value is specified,
11223then a RPTS will be emitted even if the loop count cannot be determined
11224at compile time. Note that the repeated instruction following RPTS does
11225not have to be reloaded from memory each iteration, thus freeing up the
11226CPU buses for operands. However, since interrupts are blocked by this
11227instruction, it is disabled by default.
70899148 11228
39bc1876
NS
11229@item -mloop-unsigned
11230@itemx -mno-loop-unsigned
11231@opindex mloop-unsigned
11232@opindex mno-loop-unsigned
11233The maximum iteration count when using RPTS and RPTB (and DB on the C40)
11234is @math{2^{31} + 1} since these instructions test if the iteration count is
11235negative to terminate the loop. If the iteration count is unsigned
11236there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
11237exceeded. This switch allows an unsigned iteration count.
70899148 11238
39bc1876
NS
11239@item -mti
11240@opindex mti
11241Try to emit an assembler syntax that the TI assembler (asm30) is happy
11242with. This also enforces compatibility with the API employed by the TI
11243C3x C compiler. For example, long doubles are passed as structures
11244rather than in floating point registers.
70899148 11245
39bc1876
NS
11246@item -mregparm
11247@itemx -mmemparm
11248@opindex mregparm
11249@opindex mmemparm
11250Generate code that uses registers (stack) for passing arguments to functions.
11251By default, arguments are passed in registers where possible rather
11252than by pushing arguments on to the stack.
70899148 11253
39bc1876
NS
11254@item -mparallel-insns
11255@itemx -mno-parallel-insns
11256@opindex mparallel-insns
11257@opindex mno-parallel-insns
11258Allow the generation of parallel instructions. This is enabled by
11259default with @option{-O2}.
70899148 11260
39bc1876
NS
11261@item -mparallel-mpy
11262@itemx -mno-parallel-mpy
11263@opindex mparallel-mpy
11264@opindex mno-parallel-mpy
11265Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
11266provided @option{-mparallel-insns} is also specified. These instructions have
11267tight register constraints which can pessimize the code generation
11268of large functions.
70899148 11269
39bc1876 11270@end table
70899148 11271
39bc1876
NS
11272@node V850 Options
11273@subsection V850 Options
11274@cindex V850 Options
70899148 11275
39bc1876 11276These @samp{-m} options are defined for V850 implementations:
70899148 11277
39bc1876
NS
11278@table @gcctabopt
11279@item -mlong-calls
11280@itemx -mno-long-calls
11281@opindex mlong-calls
11282@opindex mno-long-calls
11283Treat all calls as being far away (near). If calls are assumed to be
11284far away, the compiler will always load the functions address up into a
11285register, and call indirect through the pointer.
70899148 11286
39bc1876
NS
11287@item -mno-ep
11288@itemx -mep
11289@opindex mno-ep
11290@opindex mep
11291Do not optimize (do optimize) basic blocks that use the same index
11292pointer 4 or more times to copy pointer into the @code{ep} register, and
11293use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
11294option is on by default if you optimize.
70899148 11295
39bc1876
NS
11296@item -mno-prolog-function
11297@itemx -mprolog-function
11298@opindex mno-prolog-function
11299@opindex mprolog-function
11300Do not use (do use) external functions to save and restore registers
11301at the prologue and epilogue of a function. The external functions
11302are slower, but use less code space if more than one function saves
11303the same number of registers. The @option{-mprolog-function} option
11304is on by default if you optimize.
70899148 11305
39bc1876
NS
11306@item -mspace
11307@opindex mspace
11308Try to make the code as small as possible. At present, this just turns
11309on the @option{-mep} and @option{-mprolog-function} options.
70899148 11310
39bc1876
NS
11311@item -mtda=@var{n}
11312@opindex mtda
11313Put static or global variables whose size is @var{n} bytes or less into
11314the tiny data area that register @code{ep} points to. The tiny data
11315area can hold up to 256 bytes in total (128 bytes for byte references).
70899148 11316
39bc1876
NS
11317@item -msda=@var{n}
11318@opindex msda
11319Put static or global variables whose size is @var{n} bytes or less into
11320the small data area that register @code{gp} points to. The small data
11321area can hold up to 64 kilobytes.
70899148 11322
39bc1876
NS
11323@item -mzda=@var{n}
11324@opindex mzda
11325Put static or global variables whose size is @var{n} bytes or less into
11326the first 32 kilobytes of memory.
70899148 11327
39bc1876
NS
11328@item -mv850
11329@opindex mv850
11330Specify that the target processor is the V850.
70899148 11331
39bc1876
NS
11332@item -mbig-switch
11333@opindex mbig-switch
11334Generate code suitable for big switch tables. Use this option only if
11335the assembler/linker complain about out of range branches within a switch
11336table.
70899148 11337
39bc1876
NS
11338@item -mapp-regs
11339@opindex mapp-regs
11340This option will cause r2 and r5 to be used in the code generated by
11341the compiler. This setting is the default.
70899148 11342
39bc1876
NS
11343@item -mno-app-regs
11344@opindex mno-app-regs
11345This option will cause r2 and r5 to be treated as fixed registers.
70899148 11346
39bc1876
NS
11347@item -mv850e1
11348@opindex mv850e1
11349Specify that the target processor is the V850E1. The preprocessor
11350constants @samp{__v850e1__} and @samp{__v850e__} will be defined if
11351this option is used.
70899148 11352
39bc1876
NS
11353@item -mv850e
11354@opindex mv850e
11355Specify that the target processor is the V850E. The preprocessor
11356constant @samp{__v850e__} will be defined if this option is used.
70899148 11357
39bc1876
NS
11358If neither @option{-mv850} nor @option{-mv850e} nor @option{-mv850e1}
11359are defined then a default target processor will be chosen and the
11360relevant @samp{__v850*__} preprocessor constant will be defined.
70899148 11361
39bc1876
NS
11362The preprocessor constants @samp{__v850} and @samp{__v851__} are always
11363defined, regardless of which processor variant is the target.
70899148 11364
39bc1876
NS
11365@item -mdisable-callt
11366@opindex mdisable-callt
11367This option will suppress generation of the CALLT instruction for the
11368v850e and v850e1 flavors of the v850 architecture. The default is
11369@option{-mno-disable-callt} which allows the CALLT instruction to be used.
70899148 11370
39bc1876 11371@end table
70899148 11372
39bc1876
NS
11373@node VAX Options
11374@subsection VAX Options
11375@cindex VAX options
70899148 11376
39bc1876 11377These @samp{-m} options are defined for the VAX:
70899148 11378
39bc1876
NS
11379@table @gcctabopt
11380@item -munix
11381@opindex munix
11382Do not output certain jump instructions (@code{aobleq} and so on)
11383that the Unix assembler for the VAX cannot handle across long
11384ranges.
70899148 11385
39bc1876
NS
11386@item -mgnu
11387@opindex mgnu
11388Do output those jump instructions, on the assumption that you
11389will assemble with the GNU assembler.
70899148 11390
39bc1876
NS
11391@item -mg
11392@opindex mg
11393Output code for g-format floating point numbers instead of d-format.
11394@end table
70899148 11395
39bc1876
NS
11396@node x86-64 Options
11397@subsection x86-64 Options
11398@cindex x86-64 options
70899148 11399
39bc1876 11400These are listed under @xref{i386 and x86-64 Options}.
70899148 11401
39bc1876
NS
11402@node Xstormy16 Options
11403@subsection Xstormy16 Options
11404@cindex Xstormy16 Options
70899148 11405
39bc1876 11406These options are defined for Xstormy16:
70899148 11407
39bc1876
NS
11408@table @gcctabopt
11409@item -msim
11410@opindex msim
11411Choose startup files and linker script suitable for the simulator.
70899148
BS
11412@end table
11413
03984308
BW
11414@node Xtensa Options
11415@subsection Xtensa Options
11416@cindex Xtensa Options
11417
6cedbe44 11418These options are supported for Xtensa targets:
03984308
BW
11419
11420@table @gcctabopt
f42f5a1b
BW
11421@item -mconst16
11422@itemx -mno-const16
11423@opindex mconst16
11424@opindex mno-const16
6c2e8d1c
BW
11425Enable or disable use of @code{CONST16} instructions for loading
11426constant values. The @code{CONST16} instruction is currently not a
11427standard option from Tensilica. When enabled, @code{CONST16}
11428instructions are always used in place of the standard @code{L32R}
11429instructions. The use of @code{CONST16} is enabled by default only if
11430the @code{L32R} instruction is not available.
11431
03984308
BW
11432@item -mfused-madd
11433@itemx -mno-fused-madd
11434@opindex mfused-madd
11435@opindex mno-fused-madd
11436Enable or disable use of fused multiply/add and multiply/subtract
11437instructions in the floating-point option. This has no effect if the
11438floating-point option is not also enabled. Disabling fused multiply/add
11439and multiply/subtract instructions forces the compiler to use separate
11440instructions for the multiply and add/subtract operations. This may be
11441desirable in some cases where strict IEEE 754-compliant results are
11442required: the fused multiply add/subtract instructions do not round the
11443intermediate result, thereby producing results with @emph{more} bits of
11444precision than specified by the IEEE standard. Disabling fused multiply
11445add/subtract instructions also ensures that the program output is not
11446sensitive to the compiler's ability to combine multiply and add/subtract
11447operations.
11448
03984308
BW
11449@item -mtext-section-literals
11450@itemx -mno-text-section-literals
11451@opindex mtext-section-literals
11452@opindex mno-text-section-literals
11453Control the treatment of literal pools. The default is
11454@option{-mno-text-section-literals}, which places literals in a separate
11455section in the output file. This allows the literal pool to be placed
11456in a data RAM/ROM, and it also allows the linker to combine literal
11457pools from separate object files to remove redundant literals and
11458improve code size. With @option{-mtext-section-literals}, the literals
11459are interspersed in the text section in order to keep them as close as
11460possible to their references. This may be necessary for large assembly
11461files.
11462
11463@item -mtarget-align
11464@itemx -mno-target-align
11465@opindex mtarget-align
11466@opindex mno-target-align
11467When this option is enabled, GCC instructs the assembler to
11468automatically align instructions to reduce branch penalties at the
11469expense of some code density. The assembler attempts to widen density
11470instructions to align branch targets and the instructions following call
11471instructions. If there are not enough preceding safe density
11472instructions to align a target, no widening will be performed. The
11473default is @option{-mtarget-align}. These options do not affect the
11474treatment of auto-aligned instructions like @code{LOOP}, which the
11475assembler will always align, either by widening density instructions or
11476by inserting no-op instructions.
11477
11478@item -mlongcalls
11479@itemx -mno-longcalls
11480@opindex mlongcalls
11481@opindex mno-longcalls
11482When this option is enabled, GCC instructs the assembler to translate
11483direct calls to indirect calls unless it can determine that the target
11484of a direct call is in the range allowed by the call instruction. This
11485translation typically occurs for calls to functions in other source
11486files. Specifically, the assembler translates a direct @code{CALL}
11487instruction into an @code{L32R} followed by a @code{CALLX} instruction.
11488The default is @option{-mno-longcalls}. This option should be used in
11489programs where the call target can potentially be out of range. This
11490option is implemented in the assembler, not the compiler, so the
11491assembly code generated by GCC will still show direct call
11492instructions---look at the disassembled object code to see the actual
11493instructions. Note that the assembler will use an indirect call for
11494every cross-file call, not just those that really will be out of range.
11495@end table
11496
39bc1876
NS
11497@node zSeries Options
11498@subsection zSeries Options
11499@cindex zSeries options
11500
11501These are listed under @xref{S/390 and zSeries Options}.
11502
74291a4b
MM
11503@node Code Gen Options
11504@section Options for Code Generation Conventions
11505@cindex code generation conventions
11506@cindex options, code generation
11507@cindex run-time options
11508
11509These machine-independent options control the interface conventions
11510used in code generation.
11511
11512Most of them have both positive and negative forms; the negative form
630d3d5a 11513of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
74291a4b
MM
11514one of the forms is listed---the one which is not the default. You
11515can figure out the other form by either removing @samp{no-} or adding
11516it.
11517
2642624b 11518@table @gcctabopt
d4463dfc
JQ
11519@item -fbounds-check
11520@opindex fbounds-check
11521For front-ends that support it, generate additional code to check that
11522indices used to access arrays are within the declared range. This is
11523currently only supported by the Java and Fortran 77 front-ends, where
11524this option defaults to true and false respectively.
11525
11526@item -ftrapv
11527@opindex ftrapv
11528This option generates traps for signed overflow on addition, subtraction,
11529multiplication operations.
11530
4fa26a60
RS
11531@item -fwrapv
11532@opindex fwrapv
11533This option instructs the compiler to assume that signed arithmetic
11534overflow of addition, subtraction and multiplication wraps around
c0cbdbd9 11535using twos-complement representation. This flag enables some optimizations
4fa26a60
RS
11536and disables other. This option is enabled by default for the Java
11537front-end, as required by the Java language specification.
11538
956d6950 11539@item -fexceptions
cd3bb277 11540@opindex fexceptions
767094dd 11541Enable exception handling. Generates extra code needed to propagate
f0523f02 11542exceptions. For some targets, this implies GCC will generate frame
c5c76735
JL
11543unwind information for all functions, which can produce significant data
11544size overhead, although it does not affect execution. If you do not
f0523f02 11545specify this option, GCC will enable it by default for languages like
90ecce3e 11546C++ which normally require exception handling, and disable it for
c5c76735
JL
11547languages like C that do not normally require it. However, you may need
11548to enable this option when compiling C code that needs to interoperate
11549properly with exception handlers written in C++. You may also wish to
11550disable this option if you are compiling older C++ programs that don't
11551use exception handling.
956d6950 11552
6cfc0341
RH
11553@item -fnon-call-exceptions
11554@opindex fnon-call-exceptions
11555Generate code that allows trapping instructions to throw exceptions.
11556Note that this requires platform-specific runtime support that does
11557not exist everywhere. Moreover, it only allows @emph{trapping}
e979f9e8 11558instructions to throw exceptions, i.e.@: memory references or floating
6cfc0341
RH
11559point instructions. It does not allow exceptions to be thrown from
11560arbitrary signal handlers such as @code{SIGALRM}.
11561
14a774a9 11562@item -funwind-tables
cd3bb277 11563@opindex funwind-tables
bedc7537 11564Similar to @option{-fexceptions}, except that it will just generate any needed
14a774a9
RK
11565static data, but will not affect the generated code in any other way.
11566You will normally not enable this option; instead, a language processor
11567that needs this handling would enable it on your behalf.
11568
b932f770 11569@item -fasynchronous-unwind-tables
2a9dc917 11570@opindex fasynchronous-unwind-tables
b932f770
JH
11571Generate unwind table in dwarf2 format, if supported by target machine. The
11572table is exact at each instruction boundary, so it can be used for stack
11573unwinding from asynchronous events (such as debugger or garbage collector).
11574
74291a4b 11575@item -fpcc-struct-return
cd3bb277 11576@opindex fpcc-struct-return
74291a4b
MM
11577Return ``short'' @code{struct} and @code{union} values in memory like
11578longer ones, rather than in registers. This convention is less
11579efficient, but it has the advantage of allowing intercallability between
a9c60612
JJ
11580GCC-compiled files and files compiled with other compilers, particularly
11581the Portable C Compiler (pcc).
74291a4b
MM
11582
11583The precise convention for returning structures in memory depends
11584on the target configuration macros.
11585
11586Short structures and unions are those whose size and alignment match
11587that of some integer type.
11588
a9c60612
JJ
11589@strong{Warning:} code compiled with the @option{-fpcc-struct-return}
11590switch is not binary compatible with code compiled with the
11591@option{-freg-struct-return} switch.
11592Use it to conform to a non-default application binary interface.
11593
74291a4b 11594@item -freg-struct-return
cd3bb277 11595@opindex freg-struct-return
9c34dbbf
ZW
11596Return @code{struct} and @code{union} values in registers when possible.
11597This is more efficient for small structures than
11598@option{-fpcc-struct-return}.
74291a4b 11599
9c34dbbf 11600If you specify neither @option{-fpcc-struct-return} nor
630d3d5a 11601@option{-freg-struct-return}, GCC defaults to whichever convention is
0c2d1a2a 11602standard for the target. If there is no standard convention, GCC
9c34dbbf
ZW
11603defaults to @option{-fpcc-struct-return}, except on targets where GCC is
11604the principal compiler. In those cases, we can choose the standard, and
11605we chose the more efficient register return alternative.
74291a4b 11606
a9c60612
JJ
11607@strong{Warning:} code compiled with the @option{-freg-struct-return}
11608switch is not binary compatible with code compiled with the
11609@option{-fpcc-struct-return} switch.
11610Use it to conform to a non-default application binary interface.
11611
74291a4b 11612@item -fshort-enums
cd3bb277 11613@opindex fshort-enums
74291a4b
MM
11614Allocate to an @code{enum} type only as many bytes as it needs for the
11615declared range of possible values. Specifically, the @code{enum} type
11616will be equivalent to the smallest integer type which has enough room.
11617
a9c60612
JJ
11618@strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
11619code that is not binary compatible with code generated without that switch.
11620Use it to conform to a non-default application binary interface.
11621
74291a4b 11622@item -fshort-double
cd3bb277 11623@opindex fshort-double
74291a4b
MM
11624Use the same size for @code{double} as for @code{float}.
11625
a9c60612
JJ
11626@strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
11627code that is not binary compatible with code generated without that switch.
11628Use it to conform to a non-default application binary interface.
11629
11630@item -fshort-wchar
11631@opindex fshort-wchar
11632Override the underlying type for @samp{wchar_t} to be @samp{short
11633unsigned int} instead of the default for the target. This option is
11634useful for building programs to run under WINE@.
11635
11636@strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
11637code that is not binary compatible with code generated without that switch.
11638Use it to conform to a non-default application binary interface.
11639
74291a4b 11640@item -fshared-data
cd3bb277 11641@opindex fshared-data
74291a4b
MM
11642Requests that the data and non-@code{const} variables of this
11643compilation be shared data rather than private data. The distinction
11644makes sense only on certain operating systems, where shared data is
11645shared between processes running the same program, while private data
11646exists in one copy per process.
11647
11648@item -fno-common
cd3bb277 11649@opindex fno-common
90ecce3e 11650In C, allocate even uninitialized global variables in the data section of the
74291a4b
MM
11651object file, rather than generating them as common blocks. This has the
11652effect that if the same variable is declared (without @code{extern}) in
11653two different compilations, you will get an error when you link them.
11654The only reason this might be useful is if you wish to verify that the
11655program will work on other systems which always work this way.
11656
11657@item -fno-ident
cd3bb277 11658@opindex fno-ident
74291a4b
MM
11659Ignore the @samp{#ident} directive.
11660
74291a4b 11661@item -finhibit-size-directive
cd3bb277 11662@opindex finhibit-size-directive
74291a4b
MM
11663Don't output a @code{.size} assembler directive, or anything else that
11664would cause trouble if the function is split in the middle, and the
11665two halves are placed at locations far apart in memory. This option is
11666used when compiling @file{crtstuff.c}; you should not need to use it
11667for anything else.
11668
11669@item -fverbose-asm
cd3bb277 11670@opindex fverbose-asm
74291a4b
MM
11671Put extra commentary information in the generated assembly code to
11672make it more readable. This option is generally only of use to those
11673who actually need to read the generated assembly code (perhaps while
11674debugging the compiler itself).
11675
630d3d5a 11676@option{-fno-verbose-asm}, the default, causes the
74291a4b
MM
11677extra information to be omitted and is useful when comparing two assembler
11678files.
11679
74291a4b 11680@item -fpic
cd3bb277 11681@opindex fpic
74291a4b
MM
11682@cindex global offset table
11683@cindex PIC
11684Generate position-independent code (PIC) suitable for use in a shared
11685library, if supported for the target machine. Such code accesses all
161d7b59 11686constant addresses through a global offset table (GOT)@. The dynamic
861bb6c1 11687loader resolves the GOT entries when the program starts (the dynamic
0c2d1a2a 11688loader is not part of GCC; it is part of the operating system). If
861bb6c1
JL
11689the GOT size for the linked executable exceeds a machine-specific
11690maximum size, you get an error message from the linker indicating that
630d3d5a 11691@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
b6e69d94 11692instead. (These maximums are 8k on the SPARC and 32k
861bb6c1 11693on the m68k and RS/6000. The 386 has no such limit.)
74291a4b
MM
11694
11695Position-independent code requires special support, and therefore works
0c2d1a2a 11696only on certain machines. For the 386, GCC supports PIC for System V
74291a4b
MM
11697but not for the Sun 386i. Code generated for the IBM RS/6000 is always
11698position-independent.
11699
74291a4b 11700@item -fPIC
cd3bb277 11701@opindex fPIC
74291a4b
MM
11702If supported for the target machine, emit position-independent code,
11703suitable for dynamic linking and avoiding any limit on the size of the
b6e69d94 11704global offset table. This option makes a difference on the m68k
981f6289 11705and the SPARC.
74291a4b
MM
11706
11707Position-independent code requires special support, and therefore works
11708only on certain machines.
11709
24a4dd31
JJ
11710@item -fpie
11711@itemx -fPIE
11712@opindex fpie
11713@opindex fPIE
11714These options are similar to @option{-fpic} and @option{-fPIC}, but
11715generated position independent code can be only linked into executables.
11716Usually these options are used when @option{-pie} GCC option will be
11717used during linking.
11718
74291a4b 11719@item -ffixed-@var{reg}
cd3bb277 11720@opindex ffixed
74291a4b
MM
11721Treat the register named @var{reg} as a fixed register; generated code
11722should never refer to it (except perhaps as a stack pointer, frame
11723pointer or in some other fixed role).
11724
11725@var{reg} must be the name of a register. The register names accepted
11726are machine-specific and are defined in the @code{REGISTER_NAMES}
11727macro in the machine description macro file.
11728
11729This flag does not have a negative form, because it specifies a
11730three-way choice.
11731
11732@item -fcall-used-@var{reg}
cd3bb277 11733@opindex fcall-used
956d6950 11734Treat the register named @var{reg} as an allocable register that is
74291a4b
MM
11735clobbered by function calls. It may be allocated for temporaries or
11736variables that do not live across a call. Functions compiled this way
11737will not save and restore the register @var{reg}.
11738
cb2fdc84
GRK
11739It is an error to used this flag with the frame pointer or stack pointer.
11740Use of this flag for other registers that have fixed pervasive roles in
11741the machine's execution model will produce disastrous results.
74291a4b
MM
11742
11743This flag does not have a negative form, because it specifies a
11744three-way choice.
11745
11746@item -fcall-saved-@var{reg}
cd3bb277 11747@opindex fcall-saved
956d6950 11748Treat the register named @var{reg} as an allocable register saved by
74291a4b
MM
11749functions. It may be allocated even for temporaries or variables that
11750live across a call. Functions compiled this way will save and restore
11751the register @var{reg} if they use it.
11752
cb2fdc84
GRK
11753It is an error to used this flag with the frame pointer or stack pointer.
11754Use of this flag for other registers that have fixed pervasive roles in
11755the machine's execution model will produce disastrous results.
74291a4b
MM
11756
11757A different sort of disaster will result from the use of this flag for
11758a register in which function values may be returned.
11759
11760This flag does not have a negative form, because it specifies a
11761three-way choice.
11762
11763@item -fpack-struct
cd3bb277 11764@opindex fpack-struct
a9c60612
JJ
11765Pack all structure members together without holes.
11766
11767@strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
11768code that is not binary compatible with code generated without that switch.
3364c33b 11769Additionally, it makes the code suboptimal.
a9c60612 11770Use it to conform to a non-default application binary interface.
74291a4b 11771
07417085 11772@item -finstrument-functions
cd3bb277 11773@opindex finstrument-functions
07417085
KR
11774Generate instrumentation calls for entry and exit to functions. Just
11775after function entry and just before function exit, the following
11776profiling functions will be called with the address of the current
11777function and its call site. (On some platforms,
11778@code{__builtin_return_address} does not work beyond the current
11779function, so the call site information may not be available to the
11780profiling functions otherwise.)
11781
3ab51846 11782@smallexample
310668e8
JM
11783void __cyg_profile_func_enter (void *this_fn,
11784 void *call_site);
11785void __cyg_profile_func_exit (void *this_fn,
11786 void *call_site);
3ab51846 11787@end smallexample
07417085
KR
11788
11789The first argument is the address of the start of the current function,
11790which may be looked up exactly in the symbol table.
11791
11792This instrumentation is also done for functions expanded inline in other
11793functions. The profiling calls will indicate where, conceptually, the
11794inline function is entered and exited. This means that addressable
11795versions of such functions must be available. If all your uses of a
11796function are expanded inline, this may mean an additional expansion of
11797code size. If you use @samp{extern inline} in your C code, an
11798addressable version of such functions must be provided. (This is
11799normally the case anyways, but if you get lucky and the optimizer always
11800expands the functions inline, you might have gotten away without
11801providing static copies.)
11802
11803A function may be given the attribute @code{no_instrument_function}, in
11804which case this instrumentation will not be done. This can be used, for
11805example, for the profiling functions listed above, high-priority
11806interrupt routines, and any functions from which the profiling functions
11807cannot safely be called (perhaps signal handlers, if the profiling
11808routines generate output or allocate memory).
11809
861bb6c1 11810@item -fstack-check
cd3bb277 11811@opindex fstack-check
861bb6c1
JL
11812Generate code to verify that you do not go beyond the boundary of the
11813stack. You should specify this flag if you are running in an
11814environment with multiple threads, but only rarely need to specify it in
11815a single-threaded environment since stack overflow is automatically
11816detected on nearly all systems if there is only one stack.
11817
a157febd
GK
11818Note that this switch does not actually cause checking to be done; the
11819operating system must do that. The switch causes generation of code
11820to ensure that the operating system sees the stack being extended.
11821
11822@item -fstack-limit-register=@var{reg}
11823@itemx -fstack-limit-symbol=@var{sym}
11824@itemx -fno-stack-limit
cd3bb277
JM
11825@opindex fstack-limit-register
11826@opindex fstack-limit-symbol
11827@opindex fno-stack-limit
a157febd
GK
11828Generate code to ensure that the stack does not grow beyond a certain value,
11829either the value of a register or the address of a symbol. If the stack
11830would grow beyond the value, a signal is raised. For most targets,
11831the signal is raised before the stack overruns the boundary, so
11832it is possible to catch the signal without taking special precautions.
11833
9c34dbbf
ZW
11834For instance, if the stack starts at absolute address @samp{0x80000000}
11835and grows downwards, you can use the flags
11836@option{-fstack-limit-symbol=__stack_limit} and
11837@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
11838of 128KB@. Note that this may only work with the GNU linker.
a157febd 11839
e5eb27e5
JL
11840@cindex aliasing of parameters
11841@cindex parameters, aliased
11842@item -fargument-alias
04afd9d6
JL
11843@itemx -fargument-noalias
11844@itemx -fargument-noalias-global
cd3bb277
JM
11845@opindex fargument-alias
11846@opindex fargument-noalias
11847@opindex fargument-noalias-global
e5eb27e5
JL
11848Specify the possible relationships among parameters and between
11849parameters and global data.
11850
630d3d5a 11851@option{-fargument-alias} specifies that arguments (parameters) may
9c34dbbf 11852alias each other and may alias global storage.@*
630d3d5a 11853@option{-fargument-noalias} specifies that arguments do not alias
9c34dbbf 11854each other, but may alias global storage.@*
630d3d5a 11855@option{-fargument-noalias-global} specifies that arguments do not
e5eb27e5
JL
11856alias each other and do not alias global storage.
11857
11858Each language will automatically use whatever option is required by
11859the language standard. You should not need to use these options yourself.
19283265
RH
11860
11861@item -fleading-underscore
cd3bb277 11862@opindex fleading-underscore
695ac33f 11863This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19283265
RH
11864change the way C symbols are represented in the object file. One use
11865is to help link with legacy assembly code.
11866
a9c60612
JJ
11867@strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
11868generate code that is not binary compatible with code generated without that
11869switch. Use it to conform to a non-default application binary interface.
11870Not all targets provide complete support for this switch.
3d78f2e9
RH
11871
11872@item -ftls-model=@var{model}
11873Alter the thread-local storage model to be used (@pxref{Thread-Local}).
11874The @var{model} argument should be one of @code{global-dynamic},
11875@code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
11876
11877The default without @option{-fpic} is @code{initial-exec}; with
11878@option{-fpic} the default is @code{global-dynamic}.
d7afec4b
ND
11879
11880@item -fvisibility=@var{default|internal|hidden|protected}
11881@opindex fvisibility
11882Set the default ELF image symbol visibility to the specified option - all
11883symbols will be marked with this unless overrided within the code.
11884Using this feature can very substantially improve linking and
11885load times of shared object libraries, produce more optimised
11886code, provide near-perfect API export and prevent symbol clashes.
11887It is @strong{strongly} recommended that you use this in any shared objects
11888you distribute.
11889
11890Despite the nomenclature, @code{default} always means public ie;
11891available to be linked against from outside the shared object.
11892@code{protected} and @code{internal} are pretty useless in real-world
11893usage so the only other commonly used option will be @code{hidden}.
11894The default if -fvisibility isn't specified is @code{default} ie; make every
11895symbol public - this causes the same behaviour as previous versions of
11896GCC.
11897
11898A good explanation of the benefits offered by ensuring ELF
11899symbols have the correct visibility is given by ``How To Write
11900Shared Libraries'' by Ulrich Drepper (which can be found at
11901@w{@uref{http://people.redhat.com/~drepper/}}) - however a superior
11902solution made possible by this option to marking things hidden when
11903the default is public is to make the default hidden and mark things
11904public. This is the norm with DLL's on Windows and with @option{-fvisibility=hidden}
11905and @code{__attribute__ ((visibility("default")))} instead of
11906@code{__declspec(dllexport)} you get almost identical semantics with
11907identical syntax. This is a great boon to those working with
11908cross-platform projects.
11909
11910For those adding visibility support to existing code, you may find
11911@samp{#pragma GCC visibility} of use. This works by you enclosing
11912the declarations you wish to set visibility for with (for example)
11913@samp{#pragma GCC visibility push(hidden)} and
11914@samp{#pragma GCC visibility pop}. These can be nested up to sixteen
11915times. Bear in mind that symbol visibility should be viewed @strong{as
11916part of the API interface contract} and thus all new code should
11917always specify visibility when it is not the default ie; declarations
11918only for use within the local DSO should @strong{always} be marked explicitly
11919as hidden as so to avoid PLT indirection overheads - making this
11920abundantly clear also aids readability and self-documentation of the code.
11921Note that due to ISO C++ specification requirements, operator new and
11922operator delete must always be of default visibility.
11923
11924An overview of these techniques, their benefits and how to use them
11925is at @w{@uref{http://www.nedprod.com/programs/gccvisibility.html}}.
11926
74291a4b
MM
11927@end table
11928
ee457005
JM
11929@c man end
11930
74291a4b 11931@node Environment Variables
0c2d1a2a 11932@section Environment Variables Affecting GCC
74291a4b
MM
11933@cindex environment variables
11934
ee457005 11935@c man begin ENVIRONMENT
0c2d1a2a
JB
11936This section describes several environment variables that affect how GCC
11937operates. Some of them work by specifying directories or prefixes to use
767094dd 11938when searching for various kinds of files. Some are used to specify other
46103ab4 11939aspects of the compilation environment.
74291a4b 11940
74291a4b 11941Note that you can also specify places to search using options such as
630d3d5a 11942@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
74291a4b 11943take precedence over places specified using environment variables, which
161d7b59 11944in turn take precedence over those specified by the configuration of GCC@.
b11cc610
JM
11945@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
11946GNU Compiler Collection (GCC) Internals}.
74291a4b 11947
bedc7537 11948@table @env
ab87f8c8
JL
11949@item LANG
11950@itemx LC_CTYPE
11951@c @itemx LC_COLLATE
11952@itemx LC_MESSAGES
11953@c @itemx LC_MONETARY
11954@c @itemx LC_NUMERIC
11955@c @itemx LC_TIME
11956@itemx LC_ALL
11957@findex LANG
11958@findex LC_CTYPE
11959@c @findex LC_COLLATE
11960@findex LC_MESSAGES
11961@c @findex LC_MONETARY
11962@c @findex LC_NUMERIC
11963@c @findex LC_TIME
11964@findex LC_ALL
11965@cindex locale
0c2d1a2a
JB
11966These environment variables control the way that GCC uses
11967localization information that allow GCC to work with different
11968national conventions. GCC inspects the locale categories
bedc7537 11969@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
ab87f8c8
JL
11970so. These locale categories can be set to any value supported by your
11971installation. A typical value is @samp{en_UK} for English in the United
11972Kingdom.
11973
bedc7537 11974The @env{LC_CTYPE} environment variable specifies character
0c2d1a2a 11975classification. GCC uses it to determine the character boundaries in
ab87f8c8
JL
11976a string; this is needed for some multibyte encodings that contain quote
11977and escape characters that would otherwise be interpreted as a string
11978end or escape.
11979
bedc7537 11980The @env{LC_MESSAGES} environment variable specifies the language to
ab87f8c8
JL
11981use in diagnostic messages.
11982
bedc7537
NC
11983If the @env{LC_ALL} environment variable is set, it overrides the value
11984of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
11985and @env{LC_MESSAGES} default to the value of the @env{LANG}
0c2d1a2a 11986environment variable. If none of these variables are set, GCC
ab87f8c8
JL
11987defaults to traditional C English behavior.
11988
74291a4b
MM
11989@item TMPDIR
11990@findex TMPDIR
bedc7537 11991If @env{TMPDIR} is set, it specifies the directory to use for temporary
0c2d1a2a 11992files. GCC uses temporary files to hold the output of one stage of
74291a4b
MM
11993compilation which is to be used as input to the next stage: for example,
11994the output of the preprocessor, which is the input to the compiler
11995proper.
11996
11997@item GCC_EXEC_PREFIX
11998@findex GCC_EXEC_PREFIX
bedc7537 11999If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
74291a4b
MM
12000names of the subprograms executed by the compiler. No slash is added
12001when this prefix is combined with the name of a subprogram, but you can
12002specify a prefix that ends with a slash if you wish.
12003
f0523f02 12004If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
0deb20df
TT
12005an appropriate prefix to use based on the pathname it was invoked with.
12006
0c2d1a2a 12007If GCC cannot find the subprogram using the specified prefix, it
74291a4b
MM
12008tries looking in the usual places for the subprogram.
12009
bedc7537 12010The default value of @env{GCC_EXEC_PREFIX} is
8e5f33ff 12011@file{@var{prefix}/lib/gcc/} where @var{prefix} is the value
74291a4b
MM
12012of @code{prefix} when you ran the @file{configure} script.
12013
630d3d5a 12014Other prefixes specified with @option{-B} take precedence over this prefix.
74291a4b
MM
12015
12016This prefix is also used for finding files such as @file{crt0.o} that are
12017used for linking.
12018
12019In addition, the prefix is used in an unusual way in finding the
12020directories to search for header files. For each of the standard
8e5f33ff 12021directories whose name normally begins with @samp{/usr/local/lib/gcc}
bedc7537 12022(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
74291a4b 12023replacing that beginning with the specified prefix to produce an
630d3d5a 12024alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
74291a4b
MM
12025@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
12026These alternate directories are searched first; the standard directories
12027come next.
12028
12029@item COMPILER_PATH
12030@findex COMPILER_PATH
bedc7537
NC
12031The value of @env{COMPILER_PATH} is a colon-separated list of
12032directories, much like @env{PATH}. GCC tries the directories thus
74291a4b 12033specified when searching for subprograms, if it can't find the
bedc7537 12034subprograms using @env{GCC_EXEC_PREFIX}.
74291a4b
MM
12035
12036@item LIBRARY_PATH
12037@findex LIBRARY_PATH
bedc7537
NC
12038The value of @env{LIBRARY_PATH} is a colon-separated list of
12039directories, much like @env{PATH}. When configured as a native compiler,
0c2d1a2a 12040GCC tries the directories thus specified when searching for special
bedc7537 12041linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
0c2d1a2a 12042using GCC also uses these directories when searching for ordinary
630d3d5a
JM
12043libraries for the @option{-l} option (but directories specified with
12044@option{-L} come first).
74291a4b 12045
56f48ce9
DB
12046@item LANG
12047@findex LANG
12048@cindex locale definition
767094dd 12049This variable is used to pass locale information to the compiler. One way in
56f48ce9
DB
12050which this information is used is to determine the character set to be used
12051when character literals, string literals and comments are parsed in C and C++.
12052When the compiler is configured to allow multibyte characters,
bedc7537 12053the following values for @env{LANG} are recognized:
56f48ce9 12054
2642624b 12055@table @samp
56f48ce9
DB
12056@item C-JIS
12057Recognize JIS characters.
12058@item C-SJIS
12059Recognize SJIS characters.
12060@item C-EUCJP
12061Recognize EUCJP characters.
12062@end table
12063
bedc7537 12064If @env{LANG} is not defined, or if it has some other value, then the
56f48ce9
DB
12065compiler will use mblen and mbtowc as defined by the default locale to
12066recognize and translate multibyte characters.
74291a4b
MM
12067@end table
12068
40adaa27
NB
12069@noindent
12070Some additional environments variables affect the behavior of the
12071preprocessor.
12072
12073@include cppenv.texi
12074
9d86bffc
JM
12075@c man end
12076
17211ab5
GK
12077@node Precompiled Headers
12078@section Using Precompiled Headers
12079@cindex precompiled headers
12080@cindex speed of compilation
12081
12082Often large projects have many header files that are included in every
12083source file. The time the compiler takes to process these header files
12084over and over again can account for nearly all of the time required to
12085build the project. To make builds faster, GCC allows users to
12086`precompile' a header file; then, if builds can use the precompiled
12087header file they will be much faster.
12088
f7b6f250
MM
12089@strong{Caution:} There are a few known situations where GCC will
12090crash when trying to use a precompiled header. If you have trouble
12091with a precompiled header, you should remove the precompiled header
12092and compile without it. In addition, please use GCC's on-line
12093defect-tracking system to report any problems you encounter with
12094precompiled headers. @xref{Bugs}.
12095
17211ab5
GK
12096To create a precompiled header file, simply compile it as you would any
12097other file, if necessary using the @option{-x} option to make the driver
12098treat it as a C or C++ header file. You will probably want to use a
12099tool like @command{make} to keep the precompiled header up-to-date when
12100the headers it contains change.
12101
12102A precompiled header file will be searched for when @code{#include} is
12103seen in the compilation. As it searches for the included file
24726b96 12104(@pxref{Search Path,,Search Path,cpp,The C Preprocessor}) the
17211ab5
GK
12105compiler looks for a precompiled header in each directory just before it
12106looks for the include file in that directory. The name searched for is
d8fad4ea 12107the name specified in the @code{#include} with @samp{.gch} appended. If
17211ab5
GK
12108the precompiled header file can't be used, it is ignored.
12109
12110For instance, if you have @code{#include "all.h"}, and you have
d8fad4ea 12111@file{all.h.gch} in the same directory as @file{all.h}, then the
17211ab5
GK
12112precompiled header file will be used if possible, and the original
12113header will be used otherwise.
12114
12115Alternatively, you might decide to put the precompiled header file in a
12116directory and use @option{-I} to ensure that directory is searched
12117before (or instead of) the directory containing the original header.
12118Then, if you want to check that the precompiled header file is always
12119used, you can put a file of the same name as the original header in this
12120directory containing an @code{#error} command.
12121
12122This also works with @option{-include}. So yet another way to use
12123precompiled headers, good for projects not designed with precompiled
12124header files in mind, is to simply take most of the header files used by
12125a project, include them from another header file, precompile that header
12126file, and @option{-include} the precompiled header. If the header files
12127have guards against multiple inclusion, they will be skipped because
12128they've already been included (in the precompiled header).
12129
12130If you need to precompile the same header file for different
12131languages, targets, or compiler options, you can instead make a
d8fad4ea 12132@emph{directory} named like @file{all.h.gch}, and put each precompiled
54e109ed
GK
12133header in the directory, perhaps using @option{-o}. It doesn't matter
12134what you call the files in the directory, every precompiled header in
12135the directory will be considered. The first precompiled header
12136encountered in the directory that is valid for this compilation will
12137be used; they're searched in no particular order.
17211ab5
GK
12138
12139There are many other possibilities, limited only by your imagination,
12140good sense, and the constraints of your build system.
12141
12142A precompiled header file can be used only when these conditions apply:
12143
12144@itemize
12145@item
12146Only one precompiled header can be used in a particular compilation.
54e109ed 12147
17211ab5
GK
12148@item
12149A precompiled header can't be used once the first C token is seen. You
12150can have preprocessor directives before a precompiled header; you can
12151even include a precompiled header from inside another header, so long as
12152there are no C tokens before the @code{#include}.
54e109ed 12153
17211ab5
GK
12154@item
12155The precompiled header file must be produced for the same language as
12156the current compilation. You can't use a C precompiled header for a C++
12157compilation.
54e109ed 12158
17211ab5
GK
12159@item
12160The precompiled header file must be produced by the same compiler
12161version and configuration as the current compilation is using.
12162The easiest way to guarantee this is to use the same compiler binary
12163for creating and using precompiled headers.
54e109ed 12164
17211ab5 12165@item
54e109ed
GK
12166Any macros defined before the precompiled header is included must
12167either be defined in the same way as when the precompiled header was
12168generated, or must not affect the precompiled header, which usually
12169means that the they don't appear in the precompiled header at all.
12170
12171The @option{-D} option is one way to define a macro before a
12172precompiled header is included; using a @code{#define} can also do it.
12173There are also some options that define macros implicitly, like
12174@option{-O} and @option{-Wdeprecated}; the same rule applies to macros
12175defined this way.
12176
12177@item If debugging information is output when using the precompiled
12178header, using @option{-g} or similar, the same kind of debugging information
12179must have been output when building the precompiled header. However,
12180a precompiled header built using @option{-g} can be used in a compilation
12181when no debugging information is being output.
12182
12183@item The same @option{-m} options must generally be used when building
12184and using the precompiled header. @xref{Submodel Options},
12185for any cases where this rule is relaxed.
12186
12187@item Each of the following options must be the same when building and using
12188the precompiled header:
12189
12190@gccoptlist{-fexceptions -funit-at-a-time}
12191
17211ab5 12192@item
54e109ed
GK
12193Some other command-line options starting with @option{-f},
12194@option{-p}, or @option{-O} must be defined in the same way as when
12195the precompiled header was generated. At present, it's not clear
12196which options are safe to change and which are not; the safest choice
12197is to use exactly the same options when generating and using the
12198precompiled header. The following are known to be safe:
12199
c0d578e6 12200@gccoptlist{-fpreprocessed -pedantic-errors}
54e109ed 12201
17211ab5
GK
12202@end itemize
12203
54e109ed
GK
12204For all of these except the last, the compiler will automatically
12205ignore the precompiled header if the conditions aren't met. If you
12206find an option combination that doesn't work and doesn't cause the
12207precompiled header to be ignored, please consider filing a bug report,
12208see @ref{Bugs}.
17211ab5 12209
c0d578e6
GK
12210If you do use differing options when generating and using the
12211precompiled header, the actual behaviour will be a mixture of the
12212behaviour for the options. For instance, if you use @option{-g} to
12213generate the precompiled header but not when using it, you may or may
12214not get debugging information for routines in the precompiled header.
12215
74291a4b
MM
12216@node Running Protoize
12217@section Running Protoize
12218
161d7b59 12219The program @code{protoize} is an optional part of GCC@. You can use
c1030c7c 12220it to add prototypes to a program, thus converting the program to ISO
74291a4b
MM
12221C in one respect. The companion program @code{unprotoize} does the
12222reverse: it removes argument types from any prototypes that are found.
12223
12224When you run these programs, you must specify a set of source files as
12225command line arguments. The conversion programs start out by compiling
12226these files to see what functions they define. The information gathered
12227about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
12228
12229After scanning comes actual conversion. The specified files are all
12230eligible to be converted; any files they include (whether sources or
12231just headers) are eligible as well.
12232
12233But not all the eligible files are converted. By default,
12234@code{protoize} and @code{unprotoize} convert only source and header
12235files in the current directory. You can specify additional directories
630d3d5a 12236whose files should be converted with the @option{-d @var{directory}}
74291a4b 12237option. You can also specify particular files to exclude with the
630d3d5a 12238@option{-x @var{file}} option. A file is converted if it is eligible, its
74291a4b
MM
12239directory name matches one of the specified directory names, and its
12240name within the directory has not been excluded.
12241
12242Basic conversion with @code{protoize} consists of rewriting most
12243function definitions and function declarations to specify the types of
12244the arguments. The only ones not rewritten are those for varargs
12245functions.
12246
12247@code{protoize} optionally inserts prototype declarations at the
12248beginning of the source file, to make them available for any calls that
12249precede the function's definition. Or it can insert prototype
12250declarations with block scope in the blocks where undeclared functions
12251are called.
12252
12253Basic conversion with @code{unprotoize} consists of rewriting most
12254function declarations to remove any argument types, and rewriting
c1030c7c 12255function definitions to the old-style pre-ISO form.
74291a4b
MM
12256
12257Both conversion programs print a warning for any function declaration or
12258definition that they can't convert. You can suppress these warnings
630d3d5a 12259with @option{-q}.
74291a4b
MM
12260
12261The output from @code{protoize} or @code{unprotoize} replaces the
12262original source file. The original file is renamed to a name ending
02f52e19 12263with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
a7db8bbb
MK
12264without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav}
12265for DOS) file already exists, then the source file is simply discarded.
74291a4b 12266
0c2d1a2a 12267@code{protoize} and @code{unprotoize} both depend on GCC itself to
74291a4b 12268scan the program and collect information about the functions it uses.
0c2d1a2a 12269So neither of these programs will work until GCC is installed.
74291a4b
MM
12270
12271Here is a table of the options you can use with @code{protoize} and
12272@code{unprotoize}. Each option works with both programs unless
12273otherwise stated.
12274
12275@table @code
12276@item -B @var{directory}
12277Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
12278usual directory (normally @file{/usr/local/lib}). This file contains
12279prototype information about standard system functions. This option
12280applies only to @code{protoize}.
12281
12282@item -c @var{compilation-options}
05739753 12283Use @var{compilation-options} as the options when running @command{gcc} to
630d3d5a 12284produce the @samp{.X} files. The special option @option{-aux-info} is
05739753 12285always passed in addition, to tell @command{gcc} to write a @samp{.X} file.
74291a4b
MM
12286
12287Note that the compilation options must be given as a single argument to
12288@code{protoize} or @code{unprotoize}. If you want to specify several
05739753 12289@command{gcc} options, you must quote the entire set of compilation options
74291a4b
MM
12290to make them a single word in the shell.
12291
05739753 12292There are certain @command{gcc} arguments that you cannot use, because they
630d3d5a
JM
12293would produce the wrong kind of output. These include @option{-g},
12294@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
74291a4b
MM
12295the @var{compilation-options}, they are ignored.
12296
12297@item -C
a7db8bbb 12298Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
02f52e19 12299systems) instead of @samp{.c}. This is convenient if you are converting
ee77eda5 12300a C program to C++. This option applies only to @code{protoize}.
74291a4b
MM
12301
12302@item -g
12303Add explicit global declarations. This means inserting explicit
12304declarations at the beginning of each source file for each function
12305that is called in the file and was not declared. These declarations
12306precede the first function definition that contains a call to an
12307undeclared function. This option applies only to @code{protoize}.
12308
12309@item -i @var{string}
12310Indent old-style parameter declarations with the string @var{string}.
12311This option applies only to @code{protoize}.
12312
12313@code{unprotoize} converts prototyped function definitions to old-style
12314function definitions, where the arguments are declared between the
12315argument list and the initial @samp{@{}. By default, @code{unprotoize}
12316uses five spaces as the indentation. If you want to indent with just
630d3d5a 12317one space instead, use @option{-i " "}.
74291a4b
MM
12318
12319@item -k
12320Keep the @samp{.X} files. Normally, they are deleted after conversion
12321is finished.
12322
12323@item -l
630d3d5a 12324Add explicit local declarations. @code{protoize} with @option{-l} inserts
74291a4b
MM
12325a prototype declaration for each function in each block which calls the
12326function without any declaration. This option applies only to
12327@code{protoize}.
12328
12329@item -n
12330Make no real changes. This mode just prints information about the conversions
630d3d5a 12331that would have been done without @option{-n}.
74291a4b
MM
12332
12333@item -N
12334Make no @samp{.save} files. The original files are simply deleted.
12335Use this option with caution.
12336
12337@item -p @var{program}
12338Use the program @var{program} as the compiler. Normally, the name
12339@file{gcc} is used.
12340
12341@item -q
12342Work quietly. Most warnings are suppressed.
12343
12344@item -v
05739753 12345Print the version number, just like @option{-v} for @command{gcc}.
74291a4b
MM
12346@end table
12347
12348If you need special compiler options to compile one of your program's
12349source files, then you should generate that file's @samp{.X} file
05739753 12350specially, by running @command{gcc} on that source file with the
630d3d5a 12351appropriate options and the option @option{-aux-info}. Then run
74291a4b
MM
12352@code{protoize} on the entire set of files. @code{protoize} will use
12353the existing @samp{.X} file because it is newer than the source file.
12354For example:
12355
3ab51846 12356@smallexample
b1018de6 12357gcc -Dfoo=bar file1.c -aux-info file1.X
74291a4b 12358protoize *.c
3ab51846 12359@end smallexample
74291a4b
MM
12360
12361@noindent
12362You need to include the special files along with the rest in the
12363@code{protoize} command, even though their @samp{.X} files already
12364exist, because otherwise they won't get converted.
12365
12366@xref{Protoize Caveats}, for more information on how to use
12367@code{protoize} successfully.