]> gcc.gnu.org Git - gcc.git/blame - gcc/doc/invoke.texi
configure.host: Disable the interpreter for Darwin.
[gcc.git] / gcc / doc / invoke.texi
CommitLineData
d0a5eb32
RK
1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2@c 2000, 2001 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,
21c7361e 91998, 1999, 2000, 2001 Free Software Foundation, Inc.
9d86bffc 10
77bd67cb
JM
11Permission is granted to copy, distribute and/or modify this document
12under the terms of the GNU Free Documentation License, Version 1.1 or
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),
9d86bffc
JM
46cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
47and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
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
56See the Info entry for @file{gcc}, or
161d7b59 57@w{@uref{http://gcc.gnu.org/thanks.html}}, for contributors to GCC@.
2642624b 58@c man end
9d86bffc
JM
59@end ignore
60
74291a4b 61@node Invoking GCC
0c2d1a2a
JB
62@chapter GCC Command Options
63@cindex GCC command options
74291a4b 64@cindex command options
0c2d1a2a 65@cindex options, GCC command
74291a4b 66
9d86bffc
JM
67@c man begin DESCRIPTION
68
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++.
60de6385 124* Objective-C Dialect Options:: Variations on Objective-C.
764dbbf2 125* Language Independent Options:: Controlling how diagnostics should be
02f52e19 126 formatted.
74291a4b
MM
127* Warning Options:: How picky should the compiler be?
128* Debugging Options:: Symbol tables, measurements, and debugging dumps.
129* Optimize Options:: How much optimization?
130* Preprocessor Options:: Controlling header files and macro definitions.
131 Also, getting dependency information for Make.
132* Assembler Options:: Passing options to the assembler.
133* Link Options:: Specifying libraries and so on.
134* Directory Options:: Where to find header files and libraries.
135 Where to find the compiler executable files.
a743d340 136* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 137* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
138* Submodel Options:: Specifying minor hardware or convention variations,
139 such as 68010 vs 68020.
140* Code Gen Options:: Specifying conventions for function calls, data layout
141 and register usage.
0c2d1a2a 142* Environment Variables:: Env vars that affect GCC.
74291a4b
MM
143* Running Protoize:: Automatically adding or removing function prototypes.
144@end menu
145
4bc1997b
JM
146@c man begin OPTIONS
147
74291a4b
MM
148@node Option Summary
149@section Option Summary
150
151Here is a summary of all the options, grouped by type. Explanations are
152in the following sections.
153
154@table @emph
155@item Overall Options
156@xref{Overall Options,,Options Controlling the Kind of Output}.
4bc1997b
JM
157@gccoptlist{
158-c -S -E -o @var{file} -pipe -pass-exit-codes -x @var{language} @gol
159-v --target-help --help}
74291a4b
MM
160
161@item C Language Options
162@xref{C Dialect Options,,Options Controlling C Dialect}.
4bc1997b 163@gccoptlist{
b1018de6 164-ansi -std=@var{standard} -aux-info @var{filename} @gol
7d14c755 165-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
4bc1997b
JM
166-fhosted -ffreestanding @gol
167-trigraphs -traditional -traditional-cpp @gol
168-fallow-single-precision -fcond-mismatch @gol
169-fsigned-bitfields -fsigned-char @gol
170-funsigned-bitfields -funsigned-char @gol
171-fwritable-strings -fshort-wchar}
74291a4b
MM
172
173@item C++ Language Options
174@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
4bc1997b
JM
175@gccoptlist{
176-fno-access-control -fcheck-new -fconserve-space @gol
aa0cc562
JM
177-fno-const-strings -fdollars-in-identifiers @gol
178-fno-elide-constructors @gol
4bc1997b
JM
179-fno-enforce-eh-specs -fexternal-templates @gol
180-falt-external-templates @gol
1dbb6023 181-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
90ecce3e 182-fno-implicit-templates @gol
4bc1997b
JM
183-fno-implicit-inline-templates @gol
184-fno-implement-inlines -fms-extensions @gol
aa0cc562 185-fno-nonansi-builtins -fno-operator-names @gol
4bc1997b 186-fno-optional-diags -fpermissive @gol
aa0cc562 187-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
90ecce3e 188-fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol
4bc1997b
JM
189-fno-default-inline -Wctor-dtor-privacy @gol
190-Wnon-virtual-dtor -Wreorder @gol
191-Weffc++ -Wno-deprecated @gol
192-Wno-non-template-friend -Wold-style-cast @gol
193-Woverloaded-virtual -Wno-pmf-conversions @gol
194-Wsign-promo -Wsynth}
74291a4b 195
60de6385
SS
196@item Objective-C Language Options
197@xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
198@gccoptlist{
630d3d5a 199-fconstant-string-class=@var{class-name} @gol
310668e8 200-fgnu-runtime -fnext-runtime -gen-decls @gol
60de6385
SS
201-Wno-protocol -Wselector}
202
764dbbf2
GDR
203@item Language Independent Options
204@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
4bc1997b
JM
205@gccoptlist{
206-fmessage-length=@var{n} @gol
207-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
764dbbf2 208
74291a4b
MM
209@item Warning Options
210@xref{Warning Options,,Options to Request or Suppress Warnings}.
4bc1997b
JM
211@gccoptlist{
212-fsyntax-only -pedantic -pedantic-errors @gol
213-w -W -Wall -Waggregate-return @gol
214-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol
6c36d76b 215-Wconversion -Wdisabled-optimization -Wdiv-by-zero -Werror @gol
4bc1997b 216-Wfloat-equal -Wformat -Wformat=2 @gol
feb48bde
JM
217-Wformat-nonliteral -Wformat-security @gol
218-Wimplicit -Wimplicit-int @gol
4bc1997b
JM
219-Wimplicit-function-declaration @gol
220-Werror-implicit-function-declaration @gol
221-Wimport -Winline @gol
222-Wlarger-than-@var{len} -Wlong-long @gol
1f0c3120 223-Wmain -Wmissing-braces -Wmissing-declarations @gol
4bc1997b 224-Wmissing-format-attribute -Wmissing-noreturn @gol
feb48bde 225-Wmultichar -Wno-format-extra-args -Wno-format-y2k @gol
4bc1997b 226-Wno-import -Wpacked -Wpadded @gol
310668e8 227-Wparentheses -Wpointer-arith -Wredundant-decls @gol
4bc1997b
JM
228-Wreturn-type -Wsequence-point -Wshadow @gol
229-Wsign-compare -Wswitch -Wsystem-headers @gol
230-Wtrigraphs -Wundef -Wuninitialized @gol
231-Wunknown-pragmas -Wunreachable-code @gol
232-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
233-Wunused-value -Wunused-variable -Wwrite-strings}
74291a4b 234
fe50c0eb 235@item C-only Warning Options
4bc1997b 236@gccoptlist{
310668e8
JM
237-Wbad-function-cast -Wmissing-prototypes -Wnested-externs @gol
238-Wstrict-prototypes -Wtraditional}
fe50c0eb 239
74291a4b
MM
240@item Debugging Options
241@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
4bc1997b 242@gccoptlist{
8456b95a 243-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
92989aed 244-fdump-unnumbered
aee96fe9 245-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
22367161
NS
246-fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
247-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
e76b4820 248-fmem-report -fpretend-float @gol
1f0c3120 249-fprofile-arcs -ftest-coverage -ftime-report @gol
4bc1997b 250-g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol
5f98259a 251-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
4bc1997b 252-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
b1018de6 253-print-multi-directory -print-multi-lib @gol
4bc1997b
JM
254-print-prog-name=@var{program} -print-search-dirs -Q @gol
255-save-temps -time}
74291a4b
MM
256
257@item Optimization Options
258@xref{Optimize Options,,Options that Control Optimization}.
4bc1997b
JM
259@gccoptlist{
260-falign-functions=@var{n} -falign-jumps=@var{n} @gol
261-falign-labels=@var{n} -falign-loops=@var{n} @gol
8582c27b 262-fbranch-probabilities -fcaller-saves -fcprop-registers @gol
62d285ff 263-fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol
4bc1997b
JM
264-fdelayed-branch -fdelete-null-pointer-checks @gol
265-fexpensive-optimizations -ffast-math -ffloat-store @gol
feb48bde
JM
266-fforce-addr -fforce-mem -ffunction-sections @gol
267-fgcse -fgcse-lm -fgcse-sm @gol
4bc1997b 268-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol
201556f0
JJ
269-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
270-fmove-all-movables -fno-default-inline -fno-defer-pop @gol
feb48bde 271-fno-function-cse -fno-guess-branch-probability @gol
6cfc0341 272-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
de6c5979 273-funsafe-math-optimizations -fno-trapping-math @gol
4bc1997b 274-fomit-frame-pointer -foptimize-register-move @gol
0dd0e980 275-foptimize-sibling-calls -fprefetch-loop-arrays -freduce-all-givs @gol
4bc1997b
JM
276-fregmove -frename-registers @gol
277-frerun-cse-after-loop -frerun-loop-opt @gol
278-fschedule-insns -fschedule-insns2 @gol
0b47e4c1 279-fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol
4bc1997b 280-fstrength-reduce -fstrict-aliasing -fthread-jumps -ftrapv @gol
86be733d 281-funroll-all-loops -funroll-loops @gol
3af64fd6 282--param @var{name}=@var{value}
4bc1997b 283-O -O0 -O1 -O2 -O3 -Os}
74291a4b
MM
284
285@item Preprocessor Options
286@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
4bc1997b
JM
287@gccoptlist{
288-$ -A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol
289-C -dD -dI -dM -dN @gol
290-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
291-idirafter @var{dir} @gol
292-include @var{file} -imacros @var{file} @gol
293-iprefix @var{file} -iwithprefix @var{dir} @gol
bdd42dd9 294-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
4bc1997b 295-M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol
aee96fe9 296-trigraphs -undef -U@var{macro} -Wp,@var{option}}
74291a4b
MM
297
298@item Assembler Option
299@xref{Assembler Options,,Passing Options to the Assembler}.
4bc1997b 300@gccoptlist{
aee96fe9 301-Wa,@var{option}}
74291a4b
MM
302
303@item Linker Options
304@xref{Link Options,,Options for Linking}.
4bc1997b
JM
305@gccoptlist{
306@var{object-file-name} -l@var{library} @gol
307-nostartfiles -nodefaultlibs -nostdlib @gol
308-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
aee96fe9 309-Wl,@var{option} -Xlinker @var{option} @gol
4bc1997b 310-u @var{symbol}}
74291a4b
MM
311
312@item Directory Options
313@xref{Directory Options,,Options for Directory Search}.
4bc1997b
JM
314@gccoptlist{
315-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}}
74291a4b
MM
316
317@item Target Options
318@c I wrote this xref this way to avoid overfull hbox. -- rms
319@xref{Target Options}.
4bc1997b
JM
320@gccoptlist{
321-b @var{machine} -V @var{version}}
74291a4b
MM
322
323@item Machine Dependent Options
324@xref{Submodel Options,,Hardware Models and Configurations}.
74291a4b 325@emph{M680x0 Options}
4bc1997b
JM
326@gccoptlist{
327-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
feb48bde 328-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol
310668e8
JM
329-mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol
330-malign-int -mstrict-align}
74291a4b 331
2856c3e3 332@emph{M68hc1x Options}
4bc1997b
JM
333@gccoptlist{
334-m6811 -m6812 -m68hc11 -m68hc12 @gol
335-mauto-incdec -mshort -msoft-reg-count=@var{count}}
2856c3e3 336
74291a4b 337@emph{VAX Options}
4bc1997b
JM
338@gccoptlist{
339-mg -mgnu -munix}
74291a4b
MM
340
341@emph{SPARC Options}
4bc1997b 342@gccoptlist{
630d3d5a
JM
343-mcpu=@var{cpu-type} @gol
344-mtune=@var{cpu-type} @gol
345-mcmodel=@var{code-model} @gol
4bc1997b
JM
346-m32 -m64 @gol
347-mapp-regs -mbroken-saverestore -mcypress @gol
feb48bde 348-mepilogue -mfaster-structs -mflat @gol
4bc1997b
JM
349-mfpu -mhard-float -mhard-quad-float @gol
350-mimpure-text -mlive-g0 -mno-app-regs @gol
310668e8
JM
351-mno-epilogue -mno-faster-structs -mno-flat -mno-fpu @gol
352-mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol
4bc1997b
JM
353-msoft-float -msoft-quad-float -msparclite -mstack-bias @gol
354-msupersparc -munaligned-doubles -mv8}
74291a4b
MM
355
356@emph{Convex Options}
4bc1997b
JM
357@gccoptlist{
358-mc1 -mc2 -mc32 -mc34 -mc38 @gol
359-margcount -mnoargcount @gol
360-mlong32 -mlong64 @gol
361-mvolatile-cache -mvolatile-nocache}
74291a4b
MM
362
363@emph{AMD29K Options}
4bc1997b
JM
364@gccoptlist{
365-m29000 -m29050 -mbw -mnbw -mdw -mndw @gol
366-mlarge -mnormal -msmall @gol
367-mkernel-registers -mno-reuse-arg-regs @gol
368-mno-stack-check -mno-storem-bug @gol
369-mreuse-arg-regs -msoft-float -mstack-check @gol
370-mstorem-bug -muser-registers}
74291a4b
MM
371
372@emph{ARM Options}
4bc1997b 373@gccoptlist{
310668e8
JM
374-mapcs-frame -mno-apcs-frame @gol
375-mapcs-26 -mapcs-32 @gol
376-mapcs-stack-check -mno-apcs-stack-check @gol
377-mapcs-float -mno-apcs-float @gol
378-mapcs-reentrant -mno-apcs-reentrant @gol
379-msched-prolog -mno-sched-prolog @gol
380-mlittle-endian -mbig-endian -mwords-little-endian @gol
381-malignment-traps -mno-alignment-traps @gol
382-msoft-float -mhard-float -mfpe @gol
383-mthumb-interwork -mno-thumb-interwork @gol
384-mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol
247f8561 385-mstructure-size-boundary=@var{n} @gol
310668e8 386-mbsd -mxopen -mno-symrename @gol
4bc1997b 387-mabort-on-noreturn @gol
310668e8
JM
388-mlong-calls -mno-long-calls @gol
389-msingle-pic-base -mno-single-pic-base @gol
247f8561
PB
390-mpic-register=@var{reg} @gol
391-mnop-fun-dllimport @gol
392-mpoke-function-name @gol
310668e8
JM
393-mthumb -marm @gol
394-mtpcs-frame -mtpcs-leaf-frame @gol
395-mcaller-super-interworking -mcallee-super-interworking }
74291a4b 396
ecff22ab 397@emph{MN10200 Options}
4bc1997b
JM
398@gccoptlist{
399-mrelax}
ecff22ab 400
6d6d0fa0 401@emph{MN10300 Options}
4bc1997b 402@gccoptlist{
c474f76b
AO
403-mmult-bug -mno-mult-bug @gol
404-mam33 -mno-am33 @gol
405-mno-crt0 -mrelax}
6d6d0fa0 406
861bb6c1 407@emph{M32R/D Options}
4bc1997b 408@gccoptlist{
98180123 409-m32rx -m32r -mcode-model=@var{model-type} -msdata=@var{sdata-type} @gol
4bc1997b 410-G @var{num}}
861bb6c1 411
74291a4b 412@emph{M88K Options}
4bc1997b
JM
413@gccoptlist{
414-m88000 -m88100 -m88110 -mbig-pic @gol
415-mcheck-zero-division -mhandle-large-shift @gol
416-midentify-revision -mno-check-zero-division @gol
417-mno-ocs-debug-info -mno-ocs-frame-position @gol
418-mno-optimize-arg-area -mno-serialize-volatile @gol
419-mno-underscores -mocs-debug-info @gol
420-mocs-frame-position -moptimize-arg-area @gol
421-mserialize-volatile -mshort-data-@var{num} -msvr3 @gol
422-msvr4 -mtrap-large-shift -muse-div-instruction @gol
423-mversion-03.00 -mwarn-passed-structs}
74291a4b
MM
424
425@emph{RS/6000 and PowerPC Options}
4bc1997b 426@gccoptlist{
630d3d5a
JM
427-mcpu=@var{cpu-type} @gol
428-mtune=@var{cpu-type} @gol
4bc1997b
JM
429-mpower -mno-power -mpower2 -mno-power2 @gol
430-mpowerpc -mpowerpc64 -mno-powerpc @gol
0ac081f6 431-maltivec -mno-altivec @gol
4bc1997b
JM
432-mpowerpc-gpopt -mno-powerpc-gpopt @gol
433-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
434-mnew-mnemonics -mold-mnemonics @gol
435-mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc @gol
0a379b7a 436-m64 -m32 -mxl-call -mno-xl-call -mpe @gol
4bc1997b
JM
437-msoft-float -mhard-float -mmultiple -mno-multiple @gol
438-mstring -mno-string -mupdate -mno-update @gol
439-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
440-mstrict-align -mno-strict-align -mrelocatable @gol
441-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
442-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
9c34dbbf 443-mcall-aix -mcall-sysv -mcall-netbsd @gol
9904592e 444-maix-struct-return -msvr4-struct-return
0ac081f6 445-mabi=altivec @gol
9c34dbbf 446-mprototype -mno-prototype @gol
4bc1997b 447-msim -mmvme -mads -myellowknife -memb -msdata @gol
0a379b7a 448-msdata=@var{opt} -mvxworks -G @var{num} -pthread}
74291a4b
MM
449
450@emph{RT Options}
4bc1997b
JM
451@gccoptlist{
452-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol
453-mfull-fp-blocks -mhc-struct-return -min-line-mul @gol
454-mminimum-fp-blocks -mnohc-struct-return}
74291a4b
MM
455
456@emph{MIPS Options}
4bc1997b 457@gccoptlist{
7dac2f89
EC
458-mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol
459-mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol
13fac94a
GK
460-membedded-pic -mfp32 -mfp64 -mfused-madd -mno-fused-madd @gol
461-mgas -mgp32 -mgp64 @gol
4bc1997b 462-mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol
feb48bde 463-mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol
4bc1997b 464-mmips-as -mmips-tfile -mno-abicalls @gol
feb48bde
JM
465-mno-embedded-data -mno-uninit-const-in-rodata @gol
466-mno-embedded-pic -mno-gpopt -mno-long-calls @gol
4bc1997b
JM
467-mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol
468-mrnames -msoft-float @gol
469-m4650 -msingle-float -mmad @gol
470-mstats -EL -EB -G @var{num} -nocpp @gol
feb48bde 471-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol
d490e8ad 472-mfix7000 -mno-crt0 -mflush-func=@var{func} -mno-flush-func}
74291a4b 473
14f73b5a 474@emph{i386 and x86-64 Options}
4bc1997b 475@gccoptlist{
965f5423 476-mcpu=@var{cpu-type} -march=@var{cpu-type} -mfpmath=@var{unit} @gol
c93e80a5 477-masm=@var{dialect} -mno-fancy-math-387 @gol
4bc1997b
JM
478-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol
479-mno-wide-multiply -mrtd -malign-double @gol
3e18fdf6 480-mpreferred-stack-boundary=@var{num} @gol
965f5423 481-mmmx -msse -msse2 -msse-math -m3dnow @gol
feb48bde
JM
482-mthreads -mno-align-stringops -minline-all-stringops @gol
483-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
14f73b5a
JH
484-m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol
485-mno-red-zone@gol
486-m32 -m64}
74291a4b
MM
487
488@emph{HPPA Options}
4bc1997b 489@gccoptlist{
630d3d5a 490-march=@var{architecture-type} @gol
feb48bde
JM
491-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
492-mfast-indirect-calls -mgas -mjump-in-delay @gol
4bc1997b
JM
493-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
494-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
feb48bde 495-mno-jump-in-delay -mno-long-load-store @gol
4bc1997b 496-mno-portable-runtime -mno-soft-float @gol
feb48bde
JM
497-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
498-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
630d3d5a 499-mschedule=@var{cpu-type} -mspace-regs}
74291a4b
MM
500
501@emph{Intel 960 Options}
4bc1997b 502@gccoptlist{
630d3d5a 503-m@var{cpu-type} -masm-compat -mclean-linkage @gol
4bc1997b
JM
504-mcode-align -mcomplex-addr -mleaf-procedures @gol
505-mic-compat -mic2.0-compat -mic3.0-compat @gol
506-mintel-asm -mno-clean-linkage -mno-code-align @gol
507-mno-complex-addr -mno-leaf-procedures @gol
508-mno-old-align -mno-strict-align -mno-tail-call @gol
509-mnumerics -mold-align -msoft-float -mstrict-align @gol
510-mtail-call}
74291a4b
MM
511
512@emph{DEC Alpha Options}
4bc1997b 513@gccoptlist{
310668e8
JM
514-mfp-regs -mno-fp-regs -mno-soft-float -msoft-float @gol
515-malpha-as -mgas @gol
4bc1997b
JM
516-mieee -mieee-with-inexact -mieee-conformant @gol
517-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
518-mtrap-precision=@var{mode} -mbuild-constants @gol
630d3d5a 519-mcpu=@var{cpu-type} @gol
310668e8 520-mbwx -mno-bwx -mcix -mno-cix -mmax -mno-max @gol
4bc1997b 521-mmemory-latency=@var{time}}
74291a4b 522
d7c23cdc
DR
523@emph{DEC Alpha/VMS Options}
524@gccoptlist{
525-mvms-return-codes}
526
74291a4b 527@emph{Clipper Options}
4bc1997b
JM
528@gccoptlist{
529-mc300 -mc400}
74291a4b
MM
530
531@emph{H8/300 Options}
4bc1997b 532@gccoptlist{
310668e8 533-mrelax -mh -ms -mint32 -malign-300}
74291a4b
MM
534
535@emph{SH Options}
4bc1997b
JM
536@gccoptlist{
537-m1 -m2 -m3 -m3e @gol
538-m4-nofpu -m4-single-only -m4-single -m4 @gol
539-mb -ml -mdalign -mrelax @gol
540-mbigtable -mfmovd -mhitachi -mnomacsave @gol
c474f76b
AO
541-mieee -misize -mpadstruct -mspace @gol
542-mprefergot -musermode}
74291a4b
MM
543
544@emph{System V Options}
4bc1997b 545@gccoptlist{
aee96fe9 546-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
74291a4b 547
56b2d7a7 548@emph{ARC Options}
4bc1997b
JM
549@gccoptlist{
550-EB -EL @gol
630d3d5a
JM
551-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
552-mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
56b2d7a7 553
282a61e6 554@emph{TMS320C3x/C4x Options}
4bc1997b 555@gccoptlist{
310668e8
JM
556-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol
557-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol
558-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol
559-mparallel-insns -mparallel-mpy -mpreserve-float}
282a61e6 560
f84271d9 561@emph{V850 Options}
4bc1997b 562@gccoptlist{
310668e8
JM
563-mlong-calls -mno-long-calls -mep -mno-ep @gol
564-mprolog-function -mno-prolog-function -mspace @gol
565-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
566-mv850 -mbig-switch}
83575957
ID
567
568@emph{NS32K Options}
4bc1997b 569@gccoptlist{
310668e8 570-m32032 -m32332 -m32532 -m32081 -m32381 @gol
feb48bde 571-mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol
310668e8
JM
572-mregparam -mnoregparam -msb -mnosb @gol
573-mbitfield -mnobitfield -mhimem -mnohimem}
789a3090 574
052a4b28 575@emph{AVR Options}
4bc1997b 576@gccoptlist{
310668e8
JM
577-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
578-mcall-prologues -mno-tablejump -mtiny-stack}
052a4b28 579
789a3090 580@emph{MCore Options}
4bc1997b 581@gccoptlist{
feb48bde 582-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
310668e8
JM
583-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
584-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
585-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
586-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
f84271d9 587
bcf684c7
HPN
588@emph{MMIX Options}
589@gccoptlist{
590-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
591-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
592-melf}
593
df6194d4
JW
594@emph{IA-64 Options}
595@gccoptlist{
310668e8
JM
596-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
597-mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol
598-mconstant-gp -mauto-pic -minline-divide-min-latency @gol
599-minline-divide-max-throughput -mno-dwarf2-asm @gol
630d3d5a 600-mfixed-range=@var{register-range}}
df6194d4 601
91abf72d
HP
602@emph{S/390 and zSeries Options}
603@gccoptlist{
604-mhard-float -msoft-float -mbackchain -mno-backchain @gol
605-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
606-m64 -m31 -mdebug -mno-debug}
607
0b85d816
HPN
608@emph{CRIS Options}
609@gccoptlist{
610-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
611-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
612-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
613-mstack-align -mdata-align -mconst-align @gol
614-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
615-melf -maout -melinux -mlinux -sim -sim2}
616
74291a4b
MM
617@item Code Generation Options
618@xref{Code Gen Options,,Options for Code Generation Conventions}.
4bc1997b
JM
619@gccoptlist{
620-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
6cfc0341 621-ffixed-@var{reg} -fexceptions @gol
b932f770 622-fnon-call-exceptions -funwind-tables -fasynchronous-unwind-tables @gol
4bc1997b 623-finhibit-size-directive -finstrument-functions @gol
4bc1997b
JM
624-fno-common -fno-ident -fno-gnu-linker @gol
625-fpcc-struct-return -fpic -fPIC @gol
626-freg-struct-return -fshared-data -fshort-enums @gol
310668e8
JM
627-fshort-double -fvolatile @gol
628-fvolatile-global -fvolatile-static @gol
4bc1997b
JM
629-fverbose-asm -fpack-struct -fstack-check @gol
630-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
631-fargument-alias -fargument-noalias @gol
310668e8 632-fargument-noalias-global -fleading-underscore}
74291a4b
MM
633@end table
634
635@menu
636* Overall Options:: Controlling the kind of output:
637 an executable, object files, assembler files,
638 or preprocessed source.
639* C Dialect Options:: Controlling the variant of C language compiled.
640* C++ Dialect Options:: Variations on C++.
60de6385 641* Objective-C Dialect Options:: Variations on Objective-C.
764dbbf2 642* Language Independent Options:: Controlling how diagnostics should be
02f52e19 643 formatted.
74291a4b
MM
644* Warning Options:: How picky should the compiler be?
645* Debugging Options:: Symbol tables, measurements, and debugging dumps.
646* Optimize Options:: How much optimization?
647* Preprocessor Options:: Controlling header files and macro definitions.
648 Also, getting dependency information for Make.
649* Assembler Options:: Passing options to the assembler.
650* Link Options:: Specifying libraries and so on.
651* Directory Options:: Where to find header files and libraries.
652 Where to find the compiler executable files.
a743d340 653* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 654* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
655@end menu
656
657@node Overall Options
658@section Options Controlling the Kind of Output
659
660Compilation can involve up to four stages: preprocessing, compilation
661proper, assembly and linking, always in that order. The first three
662stages apply to an individual source file, and end by producing an
663object file; linking combines all the object files (those newly
664compiled, and those specified as input) into an executable file.
665
666@cindex file name suffix
667For any given input file, the file name suffix determines what kind of
668compilation is done:
669
2642624b 670@table @gcctabopt
74291a4b
MM
671@item @var{file}.c
672C source code which must be preprocessed.
673
674@item @var{file}.i
675C source code which should not be preprocessed.
676
677@item @var{file}.ii
678C++ source code which should not be preprocessed.
679
680@item @var{file}.m
681Objective-C source code. Note that you must link with the library
682@file{libobjc.a} to make an Objective-C program work.
683
b9265ec1
JM
684@item @var{file}.mi
685Objective-C source code which should not be preprocessed.
686
74291a4b
MM
687@item @var{file}.h
688C header file (not to be compiled or linked).
689
690@item @var{file}.cc
b9265ec1 691@itemx @var{file}.cp
74291a4b
MM
692@itemx @var{file}.cxx
693@itemx @var{file}.cpp
b9265ec1 694@itemx @var{file}.c++
74291a4b
MM
695@itemx @var{file}.C
696C++ source code which must be preprocessed. Note that in @samp{.cxx},
697the last two letters must both be literally @samp{x}. Likewise,
161d7b59 698@samp{.C} refers to a literal capital C@.
74291a4b 699
b9265ec1
JM
700@item @var{file}.f
701@itemx @var{file}.for
702@itemx @var{file}.FOR
703Fortran source code which should not be preprocessed.
704
705@item @var{file}.F
706@itemx @var{file}.fpp
707@itemx @var{file}.FPP
708Fortran source code which must be preprocessed (with the traditional
709preprocessor).
710
711@item @var{file}.r
712Fortran source code which must be preprocessed with a RATFOR
161d7b59 713preprocessor (not included with GCC)@.
b9265ec1
JM
714
715@xref{Overall Options,,Options Controlling the Kind of Output, g77,
716Using and Porting GNU Fortran}, for more details of the handling of
717Fortran input files.
718
719@c FIXME: Descriptions of Java file types.
720@c @var{file}.java
721@c @var{file}.class
722@c @var{file}.zip
723@c @var{file}.jar
724
e23381df
GB
725@item @var{file}.ads
726Ada source code file which contains a library unit declaration (a
727declaration of a package, subprogram, or generic, or a generic
728instantiation), or a library unit renaming declaration (a package,
729generic, or subprogram renaming declaration). Such files are also
730called @dfn{specs}.
731
732@itemx @var{file}.adb
733Ada source code file containing a library unit body (a subprogram or
734package body). Such files are also called @dfn{bodies}.
735
b9265ec1 736@c GCC also knows about some suffixes for languages not yet included:
b9265ec1
JM
737@c Pascal:
738@c @var{file}.p
739@c @var{file}.pas
740
741@item @var{file}.ch
742@itemx @var{file}.chi
743CHILL source code (preprocessed with the traditional preprocessor).
744
74291a4b
MM
745@item @var{file}.s
746Assembler code.
747
748@item @var{file}.S
749Assembler code which must be preprocessed.
750
751@item @var{other}
752An object file to be fed straight into linking.
753Any file name with no recognized suffix is treated this way.
754@end table
755
cd3bb277 756@opindex x
630d3d5a 757You can specify the input language explicitly with the @option{-x} option:
74291a4b 758
2642624b 759@table @gcctabopt
74291a4b
MM
760@item -x @var{language}
761Specify explicitly the @var{language} for the following input files
762(rather than letting the compiler choose a default based on the file
763name suffix). This option applies to all following input files until
630d3d5a 764the next @option{-x} option. Possible values for @var{language} are:
74291a4b 765@example
b9265ec1
JM
766c c-header cpp-output
767c++ c++-cpp-output
768objective-c objc-cpp-output
74291a4b 769assembler assembler-with-cpp
e23381df
GB
770ada
771chill
b9265ec1 772f77 f77-cpp-input ratfor
e23381df 773java
74291a4b
MM
774@end example
775
776@item -x none
777Turn off any specification of a language, so that subsequent files are
630d3d5a 778handled according to their file name suffixes (as they are if @option{-x}
74291a4b 779has not been used at all).
14a774a9
RK
780
781@item -pass-exit-codes
cd3bb277 782@opindex pass-exit-codes
bedc7537 783Normally the @command{gcc} program will exit with the code of 1 if any
14a774a9 784phase of the compiler returns a non-success return code. If you specify
630d3d5a 785@option{-pass-exit-codes}, the @command{gcc} program will instead return with
14a774a9
RK
786numerically highest error produced by any phase that returned an error
787indication.
74291a4b
MM
788@end table
789
790If you only want some of the stages of compilation, you can use
630d3d5a
JM
791@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
792one of the options @option{-c}, @option{-S}, or @option{-E} to say where
bedc7537
NC
793@command{gcc} is to stop. Note that some combinations (for example,
794@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
74291a4b 795
2642624b 796@table @gcctabopt
74291a4b 797@item -c
cd3bb277 798@opindex c
74291a4b
MM
799Compile or assemble the source files, but do not link. The linking
800stage simply is not done. The ultimate output is in the form of an
801object file for each source file.
802
803By default, the object file name for a source file is made by replacing
804the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
805
806Unrecognized input files, not requiring compilation or assembly, are
807ignored.
808
809@item -S
cd3bb277 810@opindex S
74291a4b
MM
811Stop after the stage of compilation proper; do not assemble. The output
812is in the form of an assembler code file for each non-assembler input
813file specified.
814
815By default, the assembler file name for a source file is made by
816replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
817
818Input files that don't require compilation are ignored.
819
820@item -E
cd3bb277 821@opindex E
74291a4b
MM
822Stop after the preprocessing stage; do not run the compiler proper. The
823output is in the form of preprocessed source code, which is sent to the
824standard output.
825
826Input files which don't require preprocessing are ignored.
827
828@cindex output file option
829@item -o @var{file}
cd3bb277 830@opindex o
74291a4b
MM
831Place output in file @var{file}. This applies regardless to whatever
832sort of output is being produced, whether it be an executable file,
833an object file, an assembler file or preprocessed C code.
834
835Since only one output file can be specified, it does not make sense to
630d3d5a 836use @option{-o} when compiling more than one input file, unless you are
74291a4b
MM
837producing an executable file as output.
838
630d3d5a 839If @option{-o} is not specified, the default is to put an executable file
74291a4b
MM
840in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
841@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
bd819a4a 842all preprocessed C source on standard output.
74291a4b
MM
843
844@item -v
cd3bb277 845@opindex v
74291a4b
MM
846Print (on standard error output) the commands executed to run the stages
847of compilation. Also print the version number of the compiler driver
848program and of the preprocessor and the compiler proper.
849
850@item -pipe
cd3bb277 851@opindex pipe
74291a4b
MM
852Use pipes rather than temporary files for communication between the
853various stages of compilation. This fails to work on some systems where
854the assembler is unable to read from a pipe; but the GNU assembler has
855no trouble.
844642e6
NC
856
857@item --help
cd3bb277 858@opindex help
844642e6 859Print (on the standard output) a description of the command line options
bedc7537
NC
860understood by @command{gcc}. If the @option{-v} option is also specified
861then @option{--help} will also be passed on to the various processes
862invoked by @command{gcc}, so that they can display the command line options
863they accept. If the @option{-W} option is also specified then command
844642e6
NC
864line options which have no documentation associated with them will also
865be displayed.
10501d8f
CC
866
867@item --target-help
cd3bb277 868@opindex target-help
10501d8f
CC
869Print (on the standard output) a description of target specific command
870line options for each tool.
74291a4b
MM
871@end table
872
873@node Invoking G++
874@section Compiling C++ Programs
875
876@cindex suffixes for C++ source
877@cindex C++ source file suffixes
878C++ source files conventionally use one of the suffixes @samp{.C},
bba975d4 879@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
0c2d1a2a 880preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
bba975d4
JM
881files with these names and compiles them as C++ programs even if you
882call the compiler the same way as for compiling C programs (usually with
bedc7537 883the name @command{gcc}).
74291a4b
MM
884
885@findex g++
886@findex c++
887However, C++ programs often require class libraries as well as a
888compiler that understands the C++ language---and under some
889circumstances, you might want to compile programs from standard input,
890or otherwise without a suffix that flags them as C++ programs.
bedc7537 891@command{g++} is a program that calls GCC with the default language
e5e809f4 892set to C++, and automatically specifies linking against the C++
bedc7537
NC
893library. On many systems, @command{g++} is also
894installed with the name @command{c++}.
74291a4b 895
bedc7537 896@cindex invoking @command{g++}
74291a4b
MM
897When you compile C++ programs, you may specify many of the same
898command-line options that you use for compiling programs in any
899language; or command-line options meaningful for C and related
900languages; or options that are meaningful only for C++ programs.
901@xref{C Dialect Options,,Options Controlling C Dialect}, for
161d7b59 902explanations of options for languages related to C@.
74291a4b
MM
903@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
904explanations of options that are meaningful only for C++ programs.
905
906@node C Dialect Options
907@section Options Controlling C Dialect
908@cindex dialect options
909@cindex language dialect options
910@cindex options, dialect
911
912The following options control the dialect of C (or languages derived
2147b154 913from C, such as C++ and Objective-C) that the compiler accepts:
74291a4b 914
2642624b 915@table @gcctabopt
74291a4b 916@cindex ANSI support
c1030c7c 917@cindex ISO support
74291a4b 918@item -ansi
cd3bb277 919@opindex ansi
c1030c7c 920In C mode, support all ISO C89 programs. In C++ mode,
775afb25 921remove GNU extensions that conflict with ISO C++.
74291a4b 922
c1030c7c 923This turns off certain features of GCC that are incompatible with ISO
aee96fe9 924C89 (when compiling C code), or of standard C++ (when compiling C++ code),
0c2d1a2a 925such as the @code{asm} and @code{typeof} keywords, and
74291a4b
MM
926predefined macros such as @code{unix} and @code{vax} that identify the
927type of system you are using. It also enables the undesirable and
02f52e19 928rarely used ISO trigraph feature. For the C compiler,
0c2d1a2a 929it disables recognition of C++ style @samp{//} comments as well as
775afb25 930the @code{inline} keyword.
74291a4b
MM
931
932The alternate keywords @code{__asm__}, @code{__extension__},
933@code{__inline__} and @code{__typeof__} continue to work despite
630d3d5a 934@option{-ansi}. You would not want to use them in an ISO C program, of
74291a4b 935course, but it is useful to put them in header files that might be included
630d3d5a 936in compilations done with @option{-ansi}. Alternate predefined macros
74291a4b 937such as @code{__unix__} and @code{__vax__} are also available, with or
630d3d5a 938without @option{-ansi}.
74291a4b 939
630d3d5a
JM
940The @option{-ansi} option does not cause non-ISO programs to be
941rejected gratuitously. For that, @option{-pedantic} is required in
942addition to @option{-ansi}. @xref{Warning Options}.
74291a4b 943
630d3d5a 944The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
74291a4b
MM
945option is used. Some header files may notice this macro and refrain
946from declaring certain functions or defining certain macros that the
c1030c7c 947ISO standard doesn't call for; this is to avoid interfering with any
74291a4b
MM
948programs that might use these names for other things.
949
c771326b
JM
950Functions which would normally be built in but do not have semantics
951defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
630d3d5a 952functions with @option{-ansi} is used. @xref{Other Builtins,,Other
f0523f02 953built-in functions provided by GCC}, for details of the functions
01702459 954affected.
74291a4b 955
49419c8f 956@item -std=
cd3bb277 957@opindex std
aee96fe9
JM
958Determine the language standard. This option is currently only
959supported when compiling C@. A value for this option must be provided;
02f52e19 960possible values are
3932261a 961
ee457005 962@table @samp
aee96fe9
JM
963@item c89
964@itemx iso9899:1990
965ISO C89 (same as @option{-ansi}).
3043b30e
ML
966
967@item iso9899:199409
aee96fe9 968ISO C89 as modified in amendment 1.
3043b30e 969
49419c8f 970@item c99
aee96fe9
JM
971@itemx c9x
972@itemx iso9899:1999
973@itemx iso9899:199x
974ISO C99. Note that this standard is not yet fully supported; see
975@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
976names @samp{c9x} and @samp{iso9899:199x} are deprecated.
3043b30e
ML
977
978@item gnu89
aee96fe9 979Default, ISO C89 plus GNU extensions (including some C99 features).
3043b30e 980
49419c8f 981@item gnu99
7dac2f89 982@item gnu9x
d15a05b3
EC
983ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
984this will become the default. The name @samp{gnu9x} is deprecated.
49419c8f 985
ee457005 986@end table
3043b30e
ML
987
988Even when this option is not specified, you can still use some of the
989features of newer standards in so far as they do not conflict with
990previous C standards. For example, you may use @code{__restrict__} even
bedc7537 991when @option{-std=c99} is not specified.
3932261a 992
5490d604
JM
993The @option{-std} options specifying some version of ISO C have the same
994effects as @option{-ansi}, except that features that were not in ISO C89
995but are in the specified version (for example, @samp{//} comments and
996the @code{inline} keyword in ISO C99) are not disabled.
997
c1030c7c
JM
998@xref{Standards,,Language Standards Supported by GCC}, for details of
999these standard versions.
1000
b1018de6
AO
1001@item -aux-info @var{filename}
1002@opindex aux-info
1003Output to the given filename prototyped declarations for all functions
1004declared and/or defined in a translation unit, including those in header
161d7b59 1005files. This option is silently ignored in any language other than C@.
b1018de6
AO
1006
1007Besides declarations, the file indicates, in comments, the origin of
1008each declaration (source file and line), whether the declaration was
1009implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1010@samp{O} for old, respectively, in the first character after the line
1011number and the colon), and whether it came from a declaration or a
1012definition (@samp{C} or @samp{F}, respectively, in the following
1013character). In the case of function definitions, a K&R-style list of
1014arguments followed by their declarations is also provided, inside
1015comments, after the declaration.
1016
74291a4b 1017@item -fno-asm
cd3bb277 1018@opindex fno-asm
74291a4b
MM
1019Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1020keyword, so that code can use these words as identifiers. You can use
1021the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
630d3d5a 1022instead. @option{-ansi} implies @option{-fno-asm}.
74291a4b
MM
1023
1024In C++, this switch only affects the @code{typeof} keyword, since
1025@code{asm} and @code{inline} are standard keywords. You may want to
630d3d5a 1026use the @option{-fno-gnu-keywords} flag instead, which has the same
5490d604
JM
1027effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1028switch only affects the @code{asm} and @code{typeof} keywords, since
1029@code{inline} is a standard keyword in ISO C99.
74291a4b
MM
1030
1031@item -fno-builtin
7d14c755 1032@itemx -fno-builtin-@var{function} @r{(C and Objective-C only)}
cd3bb277 1033@opindex fno-builtin
c771326b
JM
1034@cindex built-in functions
1035Don't recognize built-in functions that do not begin with
01702459 1036@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
f0523f02 1037functions provided by GCC}, for details of the functions affected,
c771326b 1038including those which are not built-in functions when @option{-ansi} or
5490d604
JM
1039@option{-std} options for strict ISO C conformance are used because they
1040do not have an ISO standard meaning.
74291a4b 1041
c771326b 1042GCC normally generates special code to handle certain built-in functions
74291a4b
MM
1043more efficiently; for instance, calls to @code{alloca} may become single
1044instructions that adjust the stack directly, and calls to @code{memcpy}
1045may become inline copy loops. The resulting code is often both smaller
1046and faster, but since the function calls no longer appear as such, you
1047cannot set a breakpoint on those calls, nor can you change the behavior
1048of the functions by linking with a different library.
1049
630d3d5a 1050In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin}
0b1161fc 1051option has no effect. Therefore, in C++, the only way to get the
c771326b 1052optimization benefits of built-in functions is to call the function
0b1161fc 1053using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses
c771326b 1054built-in functions to implement many functions (like
0b1161fc
MM
1055@code{std::strchr}), so that you automatically get efficient code.
1056
7d14c755
JM
1057With the @option{-fno-builtin-@var{function}} option, not available
1058when compiling C++, only the built-in function @var{function} is
1059disabled. @var{function} must not begin with @samp{__builtin_}. If a
1060function is named this is not built-in in this version of GCC, this
1061option is ignored. There is no corresponding
1062@option{-fbuiltin-@var{function}} option; if you wish to enable
1063built-in functions selectively when using @option{-fno-builtin} or
1064@option{-ffreestanding}, you may define macros such as:
1065
1066@smallexample
1067#define abs(n) __builtin_abs ((n))
1068#define strcpy(d, s) __builtin_strcpy ((d), (s))
1069@end smallexample
1070
861bb6c1 1071@item -fhosted
cd3bb277 1072@opindex fhosted
861bb6c1
JL
1073@cindex hosted environment
1074
1075Assert that compilation takes place in a hosted environment. This implies
630d3d5a 1076@option{-fbuiltin}. A hosted environment is one in which the
861bb6c1
JL
1077entire standard library is available, and in which @code{main} has a return
1078type of @code{int}. Examples are nearly everything except a kernel.
630d3d5a 1079This is equivalent to @option{-fno-freestanding}.
861bb6c1
JL
1080
1081@item -ffreestanding
cd3bb277 1082@opindex ffreestanding
861bb6c1
JL
1083@cindex hosted environment
1084
1085Assert that compilation takes place in a freestanding environment. This
630d3d5a 1086implies @option{-fno-builtin}. A freestanding environment
861bb6c1
JL
1087is one in which the standard library may not exist, and program startup may
1088not necessarily be at @code{main}. The most obvious example is an OS kernel.
630d3d5a 1089This is equivalent to @option{-fno-hosted}.
861bb6c1 1090
c1030c7c
JM
1091@xref{Standards,,Language Standards Supported by GCC}, for details of
1092freestanding and hosted environments.
1093
74291a4b 1094@item -trigraphs
cd3bb277 1095@opindex trigraphs
3bce8a01
NB
1096Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1097options for strict ISO C conformance) implies @option{-trigraphs}.
74291a4b
MM
1098
1099@cindex traditional C language
1100@cindex C language, traditional
1101@item -traditional
cd3bb277 1102@opindex traditional
74291a4b
MM
1103Attempt to support some aspects of traditional C compilers.
1104Specifically:
1105
1106@itemize @bullet
1107@item
1108All @code{extern} declarations take effect globally even if they
1109are written inside of a function definition. This includes implicit
1110declarations of functions.
1111
1112@item
1113The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
1114and @code{volatile} are not recognized. (You can still use the
1115alternative keywords such as @code{__typeof__}, @code{__inline__}, and
1116so on.)
1117
1118@item
1119Comparisons between pointers and integers are always allowed.
1120
1121@item
1122Integer types @code{unsigned short} and @code{unsigned char} promote
1123to @code{unsigned int}.
1124
1125@item
1126Out-of-range floating point literals are not an error.
1127
1128@item
c1030c7c 1129Certain constructs which ISO regards as a single invalid preprocessing
74291a4b
MM
1130number, such as @samp{0xe-0xd}, are treated as expressions instead.
1131
1132@item
1133String ``constants'' are not necessarily constant; they are stored in
1134writable space, and identical looking constants are allocated
1135separately. (This is the same as the effect of
630d3d5a 1136@option{-fwritable-strings}.)
74291a4b
MM
1137
1138@cindex @code{longjmp} and automatic variables
1139@item
1140All automatic variables not declared @code{register} are preserved by
c1030c7c 1141@code{longjmp}. Ordinarily, GNU C follows ISO C: automatic variables
74291a4b
MM
1142not declared @code{volatile} may be clobbered.
1143
1144@item
cd3bb277
JM
1145@cindex @samp{\x}
1146@cindex @samp{\a}
74291a4b
MM
1147@cindex escape sequences, traditional
1148The character escape sequences @samp{\x} and @samp{\a} evaluate as the
1149literal characters @samp{x} and @samp{a} respectively. Without
630d3d5a 1150@w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal
74291a4b 1151representation of a character, and @samp{\a} produces a bell.
ad299d9b 1152@end itemize
74291a4b 1153
aa99bd09
JM
1154This option is deprecated and may be removed.
1155
630d3d5a 1156You may wish to use @option{-fno-builtin} as well as @option{-traditional}
c771326b 1157if your program uses names that are normally GNU C built-in functions for
74291a4b
MM
1158other purposes of its own.
1159
630d3d5a 1160You cannot use @option{-traditional} if you include any header files that
c1030c7c 1161rely on ISO C features. Some vendors are starting to ship systems with
630d3d5a 1162ISO C header files and you cannot use @option{-traditional} on such
74291a4b
MM
1163systems to compile files that include any system headers.
1164
9c34dbbf 1165The @option{-traditional} option also enables @option{-traditional-cpp}.
74291a4b
MM
1166
1167@item -traditional-cpp
cd3bb277 1168@opindex traditional-cpp
74291a4b 1169Attempt to support some aspects of traditional C preprocessors.
9c34dbbf 1170See the GNU CPP manual for details.
74291a4b
MM
1171
1172@item -fcond-mismatch
cd3bb277 1173@opindex fcond-mismatch
74291a4b 1174Allow conditional expressions with mismatched types in the second and
a7537031
JM
1175third arguments. The value of such an expression is void. This option
1176is not supported for C++.
74291a4b
MM
1177
1178@item -funsigned-char
cd3bb277 1179@opindex funsigned-char
74291a4b
MM
1180Let the type @code{char} be unsigned, like @code{unsigned char}.
1181
1182Each kind of machine has a default for what @code{char} should
1183be. It is either like @code{unsigned char} by default or like
1184@code{signed char} by default.
1185
1186Ideally, a portable program should always use @code{signed char} or
1187@code{unsigned char} when it depends on the signedness of an object.
1188But many programs have been written to use plain @code{char} and
1189expect it to be signed, or expect it to be unsigned, depending on the
1190machines they were written for. This option, and its inverse, let you
1191make such a program work with the opposite default.
1192
1193The type @code{char} is always a distinct type from each of
1194@code{signed char} or @code{unsigned char}, even though its behavior
1195is always just like one of those two.
1196
1197@item -fsigned-char
cd3bb277 1198@opindex fsigned-char
74291a4b
MM
1199Let the type @code{char} be signed, like @code{signed char}.
1200
630d3d5a
JM
1201Note that this is equivalent to @option{-fno-unsigned-char}, which is
1202the negative form of @option{-funsigned-char}. Likewise, the option
1203@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
74291a4b 1204
74291a4b
MM
1205@item -fsigned-bitfields
1206@itemx -funsigned-bitfields
1207@itemx -fno-signed-bitfields
1208@itemx -fno-unsigned-bitfields
cd3bb277
JM
1209@opindex fsigned-bitfields
1210@opindex funsigned-bitfields
1211@opindex fno-signed-bitfields
1212@opindex fno-unsigned-bitfields
c771326b 1213These options control whether a bit-field is signed or unsigned, when the
74291a4b 1214declaration does not use either @code{signed} or @code{unsigned}. By
c771326b 1215default, such a bit-field is signed, because this is consistent: the
74291a4b
MM
1216basic integer types such as @code{int} are signed types.
1217
c771326b 1218However, when @option{-traditional} is used, bit-fields are all unsigned
74291a4b
MM
1219no matter what.
1220
1221@item -fwritable-strings
cd3bb277 1222@opindex fwritable-strings
74291a4b
MM
1223Store string constants in the writable data segment and don't uniquize
1224them. This is for compatibility with old programs which assume they can
630d3d5a 1225write into string constants. The option @option{-traditional} also has
74291a4b
MM
1226this effect.
1227
1228Writing into string constants is a very bad idea; ``constants'' should
1229be constant.
1230
1231@item -fallow-single-precision
cd3bb277 1232@opindex fallow-single-precision
74291a4b 1233Do not promote single precision math operations to double precision,
630d3d5a 1234even when compiling with @option{-traditional}.
74291a4b
MM
1235
1236Traditional K&R C promotes all floating point operations to double
1237precision, regardless of the sizes of the operands. On the
1238architecture for which you are compiling, single precision may be faster
630d3d5a 1239than double precision. If you must use @option{-traditional}, but want
74291a4b
MM
1240to use single precision operations when the operands are single
1241precision, use this option. This option has no effect when compiling
c1030c7c 1242with ISO or GNU C conventions (the default).
74291a4b 1243
3e37bef5 1244@item -fshort-wchar
cd3bb277 1245@opindex fshort-wchar
3e37bef5
JM
1246Override the underlying type for @samp{wchar_t} to be @samp{short
1247unsigned int} instead of the default for the target. This option is
161d7b59 1248useful for building programs to run under WINE@.
74291a4b
MM
1249@end table
1250
1251@node C++ Dialect Options
1252@section Options Controlling C++ Dialect
1253
1254@cindex compiler options, C++
1255@cindex C++ options, command line
1256@cindex options, C++
1257This section describes the command-line options that are only meaningful
1258for C++ programs; but you can also use most of the GNU compiler options
1259regardless of what language your program is in. For example, you
1260might compile a file @code{firstClass.C} like this:
1261
1262@example
1dc5fc4b 1263g++ -g -frepo -O -c firstClass.C
74291a4b
MM
1264@end example
1265
1266@noindent
630d3d5a 1267In this example, only @option{-frepo} is an option meant
74291a4b 1268only for C++ programs; you can use the other options with any
161d7b59 1269language supported by GCC@.
74291a4b
MM
1270
1271Here is a list of options that are @emph{only} for compiling C++ programs:
1272
2642624b 1273@table @gcctabopt
74291a4b 1274@item -fno-access-control
cd3bb277 1275@opindex fno-access-control
74291a4b
MM
1276Turn off all access checking. This switch is mainly useful for working
1277around bugs in the access control code.
1278
74291a4b 1279@item -fcheck-new
cd3bb277 1280@opindex fcheck-new
74291a4b
MM
1281Check that the pointer returned by @code{operator new} is non-null
1282before attempting to modify the storage allocated. The current Working
1283Paper requires that @code{operator new} never return a null pointer, so
1284this check is normally unnecessary.
1285
1dc5fc4b
JM
1286An alternative to using this option is to specify that your
1287@code{operator new} does not throw any exceptions; if you declare it
aee96fe9 1288@samp{throw()}, G++ will check the return value. See also @samp{new
1dc5fc4b
JM
1289(nothrow)}.
1290
74291a4b 1291@item -fconserve-space
cd3bb277 1292@opindex fconserve-space
74291a4b
MM
1293Put uninitialized or runtime-initialized global variables into the
1294common segment, as C does. This saves space in the executable at the
1295cost of not diagnosing duplicate definitions. If you compile with this
1296flag and your program mysteriously crashes after @code{main()} has
1297completed, you may have an object that is being destroyed twice because
1298two definitions were merged.
1299
1dc5fc4b
JM
1300This option is no longer useful on most targets, now that support has
1301been added for putting variables into BSS without making them common.
1302
02f52e19 1303@item -fno-const-strings
cd3bb277 1304@opindex fno-const-strings
fcca588c
MM
1305Give string constants type @code{char *} instead of type @code{const
1306char *}. By default, G++ uses type @code{const char *} as required by
630d3d5a 1307the standard. Even if you use @option{-fno-const-strings}, you cannot
fcca588c 1308actually modify the value of a string constant, unless you also use
630d3d5a 1309@option{-fwritable-strings}.
fcca588c
MM
1310
1311This option might be removed in a future release of G++. For maximum
1312portability, you should structure your code so that it works with
1313string constants that have type @code{const char *}.
1314
74291a4b 1315@item -fdollars-in-identifiers
cd3bb277 1316@opindex fdollars-in-identifiers
74291a4b 1317Accept @samp{$} in identifiers. You can also explicitly prohibit use of
630d3d5a 1318@samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows
eb795509 1319@samp{$} by default on most target systems, but there are a few exceptions.)
74291a4b 1320Traditional C allowed the character @samp{$} to form part of
c1030c7c 1321identifiers. However, ISO C and C++ forbid @samp{$} in identifiers.
74291a4b 1322
1dc5fc4b 1323@item -fno-elide-constructors
cd3bb277 1324@opindex fno-elide-constructors
1dc5fc4b
JM
1325The C++ standard allows an implementation to omit creating a temporary
1326which is only used to initialize another object of the same type.
aee96fe9 1327Specifying this option disables that optimization, and forces G++ to
1dc5fc4b 1328call the copy constructor in all cases.
74291a4b 1329
dd1ba632 1330@item -fno-enforce-eh-specs
cd3bb277 1331@opindex fno-enforce-eh-specs
dd1ba632
JM
1332Don't check for violation of exception specifications at runtime. This
1333option violates the C++ standard, but may be useful for reducing code
1334size in production builds, much like defining @samp{NDEBUG}. The compiler
1335will still optimize based on the exception specifications.
1336
74291a4b 1337@item -fexternal-templates
cd3bb277 1338@opindex fexternal-templates
9c34dbbf
ZW
1339
1340Cause @samp{#pragma interface} and @samp{implementation} to apply to
1341template instantiation; template instances are emitted or not according
74291a4b
MM
1342to the location of the template definition. @xref{Template
1343Instantiation}, for more information.
1344
37f6b6bf
MM
1345This option is deprecated.
1346
74291a4b 1347@item -falt-external-templates
cd3bb277 1348@opindex falt-external-templates
9c34dbbf
ZW
1349Similar to @option{-fexternal-templates}, but template instances are
1350emitted or not according to the place where they are first instantiated.
74291a4b
MM
1351@xref{Template Instantiation}, for more information.
1352
37f6b6bf
MM
1353This option is deprecated.
1354
74291a4b 1355@item -ffor-scope
8c81598d 1356@itemx -fno-for-scope
cd3bb277
JM
1357@opindex ffor-scope
1358@opindex fno-for-scope
695ac33f 1359If @option{-ffor-scope} is specified, the scope of variables declared in
74291a4b 1360a @i{for-init-statement} is limited to the @samp{for} loop itself,
34527c47 1361as specified by the C++ standard.
695ac33f 1362If @option{-fno-for-scope} is specified, the scope of variables declared in
74291a4b 1363a @i{for-init-statement} extends to the end of the enclosing scope,
aee96fe9 1364as was the case in old versions of G++, and other (traditional)
74291a4b
MM
1365implementations of C++.
1366
1367The default if neither flag is given to follow the standard,
1368but to allow and give a warning for old-style code that would
1369otherwise be invalid, or have different behavior.
1370
1371@item -fno-gnu-keywords
cd3bb277 1372@opindex fno-gnu-keywords
9762e8a4 1373Do not recognize @code{typeof} as a keyword, so that code can use this
767094dd 1374word as an identifier. You can use the keyword @code{__typeof__} instead.
630d3d5a 1375@option{-ansi} implies @option{-fno-gnu-keywords}.
74291a4b 1376
1dc5fc4b 1377@item -fno-implicit-templates
cd3bb277 1378@opindex fno-implicit-templates
bba975d4 1379Never emit code for non-inline templates which are instantiated
e979f9e8 1380implicitly (i.e.@: by use); only emit code for explicit instantiations.
bba975d4
JM
1381@xref{Template Instantiation}, for more information.
1382
1383@item -fno-implicit-inline-templates
cd3bb277 1384@opindex fno-implicit-inline-templates
bba975d4
JM
1385Don't emit code for implicit instantiations of inline templates, either.
1386The default is to handle inlines differently so that compiles with and
1387without optimization will need the same set of explicit instantiations.
1dc5fc4b 1388
74291a4b 1389@item -fno-implement-inlines
cd3bb277 1390@opindex fno-implement-inlines
74291a4b
MM
1391To save space, do not emit out-of-line copies of inline functions
1392controlled by @samp{#pragma implementation}. This will cause linker
1393errors if these functions are not inlined everywhere they are called.
1394
631cf95d 1395@item -fms-extensions
cd3bb277 1396@opindex fms-extensions
32fb1fb2
PE
1397Disable pedantic warnings about constructs used in MFC, such as implicit
1398int and getting a pointer to member function via non-standard syntax.
631cf95d 1399
fcca588c 1400@item -fno-nonansi-builtins
cd3bb277 1401@opindex fno-nonansi-builtins
c771326b 1402Disable built-in declarations of functions that are not mandated by
161d7b59 1403ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
fcca588c
MM
1404@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1405
775afb25 1406@item -fno-operator-names
cd3bb277 1407@opindex fno-operator-names
775afb25 1408Do not treat the operator name keywords @code{and}, @code{bitand},
74291a4b 1409@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
775afb25 1410synonyms as keywords.
74291a4b 1411
4f8b4fd9 1412@item -fno-optional-diags
cd3bb277 1413@opindex fno-optional-diags
4f8b4fd9 1414Disable diagnostics that the standard says a compiler does not need to
aee96fe9 1415issue. Currently, the only such diagnostic issued by G++ is the one for
bba975d4 1416a name having multiple meanings within a class.
4f8b4fd9 1417
8c7707b0 1418@item -fpermissive
cd3bb277 1419@opindex fpermissive
8c7707b0 1420Downgrade messages about nonconformant code from errors to warnings. By
aee96fe9 1421default, G++ effectively sets @option{-pedantic-errors} without
630d3d5a 1422@option{-pedantic}; this option reverses that. This behavior and this
161d7b59 1423option are superseded by @option{-pedantic}, which works as it does for GNU C@.
8c7707b0 1424
8c81598d 1425@item -frepo
cd3bb277 1426@opindex frepo
9c34dbbf
ZW
1427Enable automatic template instantiation at link time. This option also
1428implies @option{-fno-implicit-templates}. @xref{Template
1429Instantiation}, for more information.
8c81598d 1430
8c7707b0 1431@item -fno-rtti
cd3bb277 1432@opindex fno-rtti
a7fbfcf9
JM
1433Disable generation of information about every class with virtual
1434functions for use by the C++ runtime type identification features
1435(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1436of the language, you can save some space by using this flag. Note that
1437exception handling uses the same information, but it will generate it as
1438needed.
8c7707b0 1439
fcca588c 1440@item -fstats
cd3bb277 1441@opindex fstats
fcca588c
MM
1442Emit statistics about front-end processing at the end of the compilation.
1443This information is generally only useful to the G++ development team.
1444
1dc5fc4b 1445@item -ftemplate-depth-@var{n}
cd3bb277 1446@opindex ftemplate-depth
1dc5fc4b
JM
1447Set the maximum instantiation depth for template classes to @var{n}.
1448A limit on the template instantiation depth is needed to detect
767094dd 1449endless recursions during template class instantiation. ANSI/ISO C++
1dc5fc4b
JM
1450conforming programs must not rely on a maximum depth greater than 17.
1451
fc693822 1452@item -fuse-cxa-atexit
cd3bb277 1453@opindex fuse-cxa-atexit
fc693822
MM
1454Register destructors for objects with static storage duration with the
1455@code{__cxa_atexit} function rather than the @code{atexit} function.
1456This option is required for fully standards-compliant handling of static
1457destructors, but will only work if your C library supports
1458@code{__cxa_atexit}.
1459
90ecce3e 1460@item -fvtable-gc
cd3bb277 1461@opindex fvtable-gc
90ecce3e
JM
1462Emit special relocations for vtables and virtual function references
1463so that the linker can identify unused virtual functions and zero out
1464vtable slots that refer to them. This is most useful with
630d3d5a 1465@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
90ecce3e 1466also discard the functions themselves.
f5a1b0d2 1467
90ecce3e 1468This optimization requires GNU as and GNU ld. Not all systems support
630d3d5a 1469this option. @option{-Wl,--gc-sections} is ignored without @option{-static}.
861bb6c1 1470
02f52e19 1471@item -fno-weak
cd3bb277 1472@opindex fno-weak
90ecce3e 1473Do not use weak symbol support, even if it is provided by the linker.
fcca588c
MM
1474By default, G++ will use weak symbols if they are available. This
1475option exists only for testing, and should not be used by end-users;
1476it will result in inferior code and has no benefits. This option may
1477be removed in a future release of G++.
1478
74291a4b 1479@item -nostdinc++
cd3bb277 1480@opindex nostdinc++
74291a4b
MM
1481Do not search for header files in the standard directories specific to
1482C++, but do still search the other standard directories. (This option
e5e809f4 1483is used when building the C++ library.)
74291a4b
MM
1484@end table
1485
1486In addition, these optimization, warning, and code generation options
1487have meanings only for C++ programs:
1488
2642624b 1489@table @gcctabopt
74291a4b 1490@item -fno-default-inline
cd3bb277 1491@opindex fno-default-inline
74291a4b 1492Do not assume @samp{inline} for functions defined inside a class scope.
1dc5fc4b
JM
1493@xref{Optimize Options,,Options That Control Optimization}. Note that these
1494functions will have linkage like inline functions; they just won't be
1495inlined by default.
74291a4b 1496
aee96fe9 1497@item -Wctor-dtor-privacy @r{(C++ only)}
cd3bb277 1498@opindex Wctor-dtor-privacy
bba975d4
JM
1499Warn when a class seems unusable, because all the constructors or
1500destructors in a class are private and the class has no friends or
1501public static member functions.
1502
aee96fe9 1503@item -Wnon-virtual-dtor @r{(C++ only)}
cd3bb277 1504@opindex Wnon-virtual-dtor
bba975d4
JM
1505Warn when a class declares a non-virtual destructor that should probably
1506be virtual, because it looks like the class will be used polymorphically.
1507
aee96fe9 1508@item -Wreorder @r{(C++ only)}
cd3bb277 1509@opindex Wreorder
bba975d4
JM
1510@cindex reordering, warning
1511@cindex warning for reordering of member initializers
1512Warn when the order of member initializers given in the code does not
1513match the order in which they must be executed. For instance:
1514
1515@smallexample
1516struct A @{
1517 int i;
1518 int j;
1519 A(): j (0), i (1) @{ @}
1520@};
1521@end smallexample
1522
1523Here the compiler will warn that the member initializers for @samp{i}
1524and @samp{j} will be rearranged to match the declaration order of the
1525members.
1526@end table
1527
630d3d5a 1528The following @option{-W@dots{}} options are not affected by @option{-Wall}.
bba975d4 1529
2642624b 1530@table @gcctabopt
aee96fe9 1531@item -Weffc++ @r{(C++ only)}
cd3bb277 1532@opindex Weffc++
bba975d4
JM
1533Warn about violations of various style guidelines from Scott Meyers'
1534@cite{Effective C++} books. If you use this option, you should be aware
1535that the standard library headers do not obey all of these guidelines;
1536you can use @samp{grep -v} to filter out those warnings.
1537
aee96fe9 1538@item -Wno-deprecated @r{(C++ only)}
cd3bb277 1539@opindex Wno-deprecated
767094dd 1540Do not warn about usage of deprecated features. @xref{Deprecated Features}.
2de45c06 1541
aee96fe9 1542@item -Wno-non-template-friend @r{(C++ only)}
cd3bb277 1543@opindex Wno-non-template-friend
bba975d4 1544Disable warnings when non-templatized friend functions are declared
767094dd 1545within a template. With the advent of explicit template specification
aee96fe9 1546support in G++, if the name of the friend is an unqualified-id (i.e.,
bba975d4 1547@samp{friend foo(int)}), the C++ language specification demands that the
767094dd 1548friend declare or define an ordinary, nontemplate function. (Section
aee96fe9 154914.5.3). Before G++ implemented explicit specification, unqualified-ids
bba975d4 1550could be interpreted as a particular specialization of a templatized
767094dd 1551function. Because this non-conforming behavior is no longer the default
aee96fe9 1552behavior for G++, @option{-Wnon-template-friend} allows the compiler to
bba975d4 1553check existing code for potential trouble spots, and is on by default.
2228d450 1554This new compiler behavior can be turned off with
630d3d5a 1555@option{-Wno-non-template-friend} which keeps the conformant compiler code
2228d450 1556but disables the helpful warning.
bba975d4 1557
aee96fe9 1558@item -Wold-style-cast @r{(C++ only)}
cd3bb277 1559@opindex Wold-style-cast
323728aa
NS
1560Warn if an old-style (C-style) cast to a non-void type is used within
1561a C++ program. The new-style casts (@samp{static_cast},
1562@samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1563unintended effects, and much easier to grep for.
bba975d4 1564
aee96fe9 1565@item -Woverloaded-virtual @r{(C++ only)}
cd3bb277 1566@opindex Woverloaded-virtual
bba975d4
JM
1567@cindex overloaded virtual fn, warning
1568@cindex warning for overloaded virtual fn
3747f3dc
MM
1569Warn when a function declaration hides virtual functions from a
1570base class. For example, in:
1571
1572@smallexample
1573struct A @{
1574 virtual void f();
1575@};
1576
1577struct B: public A @{
1578 void f(int);
1579@};
1580@end smallexample
1581
1582the @code{A} class version of @code{f} is hidden in @code{B}, and code
1583like this:
1584
1585@smallexample
1586B* b;
1587b->f();
1588@end smallexample
1589
1590will fail to compile.
bba975d4 1591
aee96fe9 1592@item -Wno-pmf-conversions @r{(C++ only)}
cd3bb277 1593@opindex Wno-pmf-conversions
bba975d4
JM
1594Disable the diagnostic for converting a bound pointer to member function
1595to a plain pointer.
1596
aee96fe9 1597@item -Wsign-promo @r{(C++ only)}
cd3bb277 1598@opindex Wsign-promo
bba975d4
JM
1599Warn when overload resolution chooses a promotion from unsigned or
1600enumeral type to a signed type over a conversion to an unsigned type of
aee96fe9 1601the same size. Previous versions of G++ would try to preserve
bba975d4
JM
1602unsignedness, but the standard mandates the current behavior.
1603
aee96fe9 1604@item -Wsynth @r{(C++ only)}
cd3bb277 1605@opindex Wsynth
bba975d4
JM
1606@cindex warning for synthesized methods
1607@cindex synthesized methods, warning
aee96fe9 1608Warn when G++'s synthesis behavior does not match that of cfront. For
bba975d4
JM
1609instance:
1610
1611@smallexample
1612struct A @{
1613 operator int ();
1614 A& operator = (int);
1615@};
1616
1617main ()
1618@{
1619 A a,b;
1620 a = b;
1621@}
1622@end smallexample
74291a4b 1623
aee96fe9 1624In this example, G++ will synthesize a default @samp{A& operator =
bba975d4 1625(const A&);}, while cfront will use the user-defined @samp{operator =}.
74291a4b
MM
1626@end table
1627
60de6385
SS
1628@node Objective-C Dialect Options
1629@section Options Controlling Objective-C Dialect
1630
1631@cindex compiler options, Objective-C
1632@cindex Objective-C options, command line
1633@cindex options, Objective-C
1634This section describes the command-line options that are only meaningful
1635for Objective-C programs; but you can also use most of the GNU compiler
1636options regardless of what language your program is in. For example,
1637you might compile a file @code{some_class.m} like this:
1638
1639@example
1640gcc -g -fgnu-runtime -O -c some_class.m
1641@end example
1642
1643@noindent
630d3d5a 1644In this example, only @option{-fgnu-runtime} is an option meant only for
60de6385 1645Objective-C programs; you can use the other options with any language
161d7b59 1646supported by GCC@.
60de6385
SS
1647
1648Here is a list of options that are @emph{only} for compiling Objective-C
1649programs:
1650
1651@table @gcctabopt
630d3d5a 1652@item -fconstant-string-class=@var{class-name}
cd3bb277 1653@opindex fconstant-string-class
630d3d5a 1654Use @var{class-name} as the name of the class to instantiate for each
695ac33f 1655literal string specified with the syntax @code{@@"@dots{}"}. The default
60de6385
SS
1656class name is @code{NXConstantString}.
1657
1658@item -fgnu-runtime
cd3bb277 1659@opindex fgnu-runtime
60de6385
SS
1660Generate object code compatible with the standard GNU Objective-C
1661runtime. This is the default for most types of systems.
1662
1663@item -fnext-runtime
cd3bb277 1664@opindex fnext-runtime
60de6385 1665Generate output compatible with the NeXT runtime. This is the default
161d7b59 1666for NeXT-based systems, including Darwin and Mac OS X@.
60de6385
SS
1667
1668@item -gen-decls
cd3bb277 1669@opindex gen-decls
60de6385
SS
1670Dump interface declarations for all classes seen in the source file to a
1671file named @file{@var{sourcename}.decl}.
1672
1673@item -Wno-protocol
cd3bb277 1674@opindex Wno-protocol
60de6385
SS
1675Do not warn if methods required by a protocol are not implemented
1676in the class adopting it.
1677
1678@item -Wselector
cd3bb277 1679@opindex Wselector
60de6385
SS
1680Warn if a selector has multiple methods of different types defined.
1681
1682@c not documented because only avail via -Wp
1683@c @item -print-objc-runtime-info
1684
1685@end table
1686
764dbbf2
GDR
1687@node Language Independent Options
1688@section Options to Control Diagnostic Messages Formatting
1689@cindex options to control diagnostics formatting
1690@cindex diagnostic messages
1691@cindex message formatting
1692
b192711e 1693Traditionally, diagnostic messages have been formatted irrespective of
e979f9e8 1694the output device's aspect (e.g.@: its width, @dots{}). The options described
764dbbf2 1695below can be used to control the diagnostic messages formatting
e979f9e8 1696algorithm, e.g.@: how many characters per line, how often source location
6c0a4eab 1697information should be reported. Right now, only the C++ front end can
764dbbf2 1698honor these options. However it is expected, in the near future, that
6c0a4eab 1699the remaining front ends would be able to digest them correctly.
764dbbf2 1700
2642624b 1701@table @gcctabopt
764dbbf2 1702@item -fmessage-length=@var{n}
cd3bb277 1703@opindex fmessage-length
764dbbf2 1704Try to format error messages so that they fit on lines of about @var{n}
aee96fe9 1705characters. The default is 72 characters for @command{g++} and 0 for the rest of
161d7b59 1706the front ends supported by GCC@. If @var{n} is zero, then no
02f52e19 1707line-wrapping will be done; each error message will appear on a single
764dbbf2
GDR
1708line.
1709
cd3bb277 1710@opindex fdiagnostics-show-location
764dbbf2 1711@item -fdiagnostics-show-location=once
b192711e 1712Only meaningful in line-wrapping mode. Instructs the diagnostic messages
764dbbf2
GDR
1713reporter to emit @emph{once} source location information; that is, in
1714case the message is too long to fit on a single physical line and has to
1715be wrapped, the source location won't be emitted (as prefix) again,
1716over and over, in subsequent continuation lines. This is the default
c21cd8b1 1717behavior.
764dbbf2
GDR
1718
1719@item -fdiagnostics-show-location=every-line
1720Only meaningful in line-wrapping mode. Instructs the diagnostic
1721messages reporter to emit the same source location information (as
4fe9b91c 1722prefix) for physical lines that result from the process of breaking
b192711e 1723a message which is too long to fit on a single line.
764dbbf2
GDR
1724
1725@end table
1726
74291a4b
MM
1727@node Warning Options
1728@section Options to Request or Suppress Warnings
1729@cindex options to control warnings
1730@cindex warning messages
1731@cindex messages, warning
1732@cindex suppressing warnings
1733
1734Warnings are diagnostic messages that report constructions which
1735are not inherently erroneous but which are risky or suggest there
1736may have been an error.
1737
1738You can request many specific warnings with options beginning @samp{-W},
630d3d5a 1739for example @option{-Wimplicit} to request warnings on implicit
74291a4b
MM
1740declarations. Each of these specific warning options also has a
1741negative form beginning @samp{-Wno-} to turn off warnings;
630d3d5a 1742for example, @option{-Wno-implicit}. This manual lists only one of the
74291a4b
MM
1743two forms, whichever is not the default.
1744
0c2d1a2a 1745These options control the amount and kinds of warnings produced by GCC:
74291a4b 1746
2642624b 1747@table @gcctabopt
74291a4b
MM
1748@cindex syntax checking
1749@item -fsyntax-only
cd3bb277 1750@opindex fsyntax-only
74291a4b
MM
1751Check the code for syntax errors, but don't do anything beyond that.
1752
1753@item -pedantic
cd3bb277 1754@opindex pedantic
074e95e3
JM
1755Issue all the warnings demanded by strict ISO C and ISO C++;
1756reject all programs that use forbidden extensions, and some other
1757programs that do not follow ISO C and ISO C++. For ISO C, follows the
630d3d5a 1758version of the ISO C standard specified by any @option{-std} option used.
74291a4b 1759
074e95e3 1760Valid ISO C and ISO C++ programs should compile properly with or without
5490d604 1761this option (though a rare few will require @option{-ansi} or a
161d7b59 1762@option{-std} option specifying the required version of ISO C)@. However,
b1d16193
JL
1763without this option, certain GNU extensions and traditional C and C++
1764features are supported as well. With this option, they are rejected.
74291a4b 1765
630d3d5a 1766@option{-pedantic} does not cause warning messages for use of the
74291a4b
MM
1767alternate keywords whose names begin and end with @samp{__}. Pedantic
1768warnings are also disabled in the expression that follows
1769@code{__extension__}. However, only system header files should use
1770these escape routes; application programs should avoid them.
1771@xref{Alternate Keywords}.
1772
630d3d5a 1773Some users try to use @option{-pedantic} to check programs for strict ISO
74291a4b 1774C conformance. They soon find that it does not do quite what they want:
c1030c7c 1775it finds some non-ISO practices, but not all---only those for which
074e95e3
JM
1776ISO C @emph{requires} a diagnostic, and some others for which
1777diagnostics have been added.
74291a4b 1778
074e95e3 1779A feature to report any failure to conform to ISO C might be useful in
74291a4b 1780some instances, but would require considerable additional work and would
630d3d5a 1781be quite different from @option{-pedantic}. We don't have plans to
892d0a6d 1782support such a feature in the near future.
74291a4b 1783
91ea548a
JM
1784Where the standard specified with @option{-std} represents a GNU
1785extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
1786corresponding @dfn{base standard}, the version of ISO C on which the GNU
1787extended dialect is based. Warnings from @option{-pedantic} are given
1788where they are required by the base standard. (It would not make sense
1789for such warnings to be given only for features not in the specified GNU
1790C dialect, since by definition the GNU dialects of C include all
1791features the compiler supports with the given option, and there would be
1792nothing to warn about.)
1793
74291a4b 1794@item -pedantic-errors
cd3bb277 1795@opindex pedantic-errors
630d3d5a 1796Like @option{-pedantic}, except that errors are produced rather than
74291a4b
MM
1797warnings.
1798
1799@item -w
cd3bb277 1800@opindex w
74291a4b
MM
1801Inhibit all warning messages.
1802
1803@item -Wno-import
cd3bb277 1804@opindex Wno-import
74291a4b
MM
1805Inhibit warning messages about the use of @samp{#import}.
1806
1807@item -Wchar-subscripts
cd3bb277 1808@opindex Wchar-subscripts
74291a4b
MM
1809Warn if an array subscript has type @code{char}. This is a common cause
1810of error, as programmers often forget that this type is signed on some
1811machines.
1812
1813@item -Wcomment
cd3bb277 1814@opindex Wcomment
74291a4b
MM
1815Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1816comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1817
1818@item -Wformat
cd3bb277 1819@opindex Wformat
74291a4b
MM
1820Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1821the arguments supplied have types appropriate to the format string
26f6672d
JM
1822specified, and that the conversions specified in the format string make
1823sense. This includes standard functions, and others specified by format
1824attributes (@pxref{Function Attributes}), in the @code{printf},
1825@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
1826not in the C standard) families.
74291a4b 1827
8308e0b7
JM
1828The formats are checked against the format features supported by GNU
1829libc version 2.2. These include all ISO C89 and C99 features, as well
1830as features from the Single Unix Specification and some BSD and GNU
1831extensions. Other library implementations may not support all these
1832features; GCC does not support warning about features that go beyond a
630d3d5a
JM
1833particular library's limitations. However, if @option{-pedantic} is used
1834with @option{-Wformat}, warnings will be given about format features not
26f6672d
JM
1835in the selected standard version (but not for @code{strfmon} formats,
1836since those are not in any version of the C standard). @xref{C Dialect
1837Options,,Options Controlling C Dialect}.
8308e0b7 1838
630d3d5a
JM
1839@option{-Wformat} is included in @option{-Wall}. For more control over some
1840aspects of format checking, the options @option{-Wno-format-y2k},
1841@option{-Wno-format-extra-args}, @option{-Wformat-nonliteral},
1842@option{-Wformat-security} and @option{-Wformat=2} are available, but are
1843not included in @option{-Wall}.
4d808927
JM
1844
1845@item -Wno-format-y2k
cd3bb277 1846@opindex Wno-format-y2k
630d3d5a 1847If @option{-Wformat} is specified, do not warn about @code{strftime}
4d808927
JM
1848formats which may yield only a two-digit year.
1849
1850@item -Wno-format-extra-args
cd3bb277 1851@opindex Wno-format-extra-args
630d3d5a 1852If @option{-Wformat} is specified, do not warn about excess arguments to a
4d808927
JM
1853@code{printf} or @code{scanf} format function. The C standard specifies
1854that such arguments are ignored.
1855
7e5fb12f
JM
1856Where the unused arguments lie between used arguments that are
1857specified with @samp{$} operand number specifications, normally
1858warnings are still given, since the implementation could not know what
1859type to pass to @code{va_arg} to skip the unused arguments. However,
1860in the case of @code{scanf} formats, this option will suppress the
1861warning if the unused arguments are all pointers, since the Single
1862Unix Specification says that such unused arguments are allowed.
1863
4d808927 1864@item -Wformat-nonliteral
cd3bb277 1865@opindex Wformat-nonliteral
630d3d5a 1866If @option{-Wformat} is specified, also warn if the format string is not a
4d808927
JM
1867string literal and so cannot be checked, unless the format function
1868takes its format arguments as a @code{va_list}.
1869
c907e684 1870@item -Wformat-security
cd3bb277 1871@opindex Wformat-security
630d3d5a 1872If @option{-Wformat} is specified, also warn about uses of format
c907e684
JM
1873functions that represent possible security problems. At present, this
1874warns about calls to @code{printf} and @code{scanf} functions where the
1875format string is not a string literal and there are no format arguments,
1876as in @code{printf (foo);}. This may be a security hole if the format
1877string came from untrusted input and contains @samp{%n}. (This is
630d3d5a
JM
1878currently a subset of what @option{-Wformat-nonliteral} warns about, but
1879in future warnings may be added to @option{-Wformat-security} that are not
1880included in @option{-Wformat-nonliteral}.)
c907e684 1881
4d808927 1882@item -Wformat=2
cd3bb277 1883@opindex Wformat=2
630d3d5a
JM
1884Enable @option{-Wformat} plus format checks not included in
1885@option{-Wformat}. Currently equivalent to @samp{-Wformat
c907e684 1886-Wformat-nonliteral -Wformat-security}.
4d808927 1887
e9a25f70 1888@item -Wimplicit-int
cd3bb277 1889@opindex Wimplicit-int
e9a25f70
JL
1890Warn when a declaration does not specify a type.
1891
f5963e61
JL
1892@item -Wimplicit-function-declaration
1893@itemx -Werror-implicit-function-declaration
cd3bb277
JM
1894@opindex Wimplicit-function-declaration
1895@opindex Werror-implicit-function-declaration
f5963e61
JL
1896Give a warning (or error) whenever a function is used before being
1897declared.
e9a25f70 1898
74291a4b 1899@item -Wimplicit
cd3bb277 1900@opindex Wimplicit
630d3d5a 1901Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
861bb6c1
JL
1902
1903@item -Wmain
cd3bb277 1904@opindex Wmain
861bb6c1
JL
1905Warn if the type of @samp{main} is suspicious. @samp{main} should be a
1906function with external linkage, returning int, taking either zero
1907arguments, two, or three arguments of appropriate types.
4a870dba 1908
1f0c3120 1909@item -Wmissing-braces
cd3bb277 1910@opindex Wmissing-braces
1f0c3120
JM
1911Warn if an aggregate or union initializer is not fully bracketed. In
1912the following example, the initializer for @samp{a} is not fully
1913bracketed, but that for @samp{b} is fully bracketed.
1914
1915@smallexample
1916int a[2][2] = @{ 0, 1, 2, 3 @};
1917int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
1918@end smallexample
1919
74291a4b 1920@item -Wparentheses
cd3bb277 1921@opindex Wparentheses
74291a4b
MM
1922Warn if parentheses are omitted in certain contexts, such
1923as when there is an assignment in a context where a truth value
1924is expected, or when operators are nested whose precedence people
1925often get confused about.
1926
e9a25f70
JL
1927Also warn about constructions where there may be confusion to which
1928@code{if} statement an @code{else} branch belongs. Here is an example of
1929such a case:
1930
1931@smallexample
aee96fe9 1932@group
e9a25f70
JL
1933@{
1934 if (a)
1935 if (b)
1936 foo ();
1937 else
1938 bar ();
1939@}
aee96fe9 1940@end group
e9a25f70
JL
1941@end smallexample
1942
1943In C, every @code{else} branch belongs to the innermost possible @code{if}
1944statement, which in this example is @code{if (b)}. This is often not
1945what the programmer expected, as illustrated in the above example by
1946indentation the programmer chose. When there is the potential for this
f0523f02 1947confusion, GCC will issue a warning when this flag is specified.
e9a25f70
JL
1948To eliminate the warning, add explicit braces around the innermost
1949@code{if} statement so there is no way the @code{else} could belong to
1950the enclosing @code{if}. The resulting code would look like this:
1951
1952@smallexample
aee96fe9 1953@group
e9a25f70
JL
1954@{
1955 if (a)
1956 @{
1957 if (b)
1958 foo ();
1959 else
1960 bar ();
1961 @}
1962@}
aee96fe9 1963@end group
e9a25f70
JL
1964@end smallexample
1965
bb58bec5 1966@item -Wsequence-point
cd3bb277 1967@opindex Wsequence-point
bb58bec5
JM
1968Warn about code that may have undefined semantics because of violations
1969of sequence point rules in the C standard.
1970
1971The C standard defines the order in which expressions in a C program are
1972evaluated in terms of @dfn{sequence points}, which represent a partial
1973ordering between the execution of parts of the program: those executed
1974before the sequence point, and those executed after it. These occur
1975after the evaluation of a full expression (one which is not part of a
1976larger expression), after the evaluation of the first operand of a
1977@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
1978function is called (but after the evaluation of its arguments and the
1979expression denoting the called function), and in certain other places.
1980Other than as expressed by the sequence point rules, the order of
1981evaluation of subexpressions of an expression is not specified. All
1982these rules describe only a partial order rather than a total order,
1983since, for example, if two functions are called within one expression
1984with no sequence point between them, the order in which the functions
1985are called is not specified. However, the standards committee have
1986ruled that function calls do not overlap.
1987
1988It is not specified when between sequence points modifications to the
1989values of objects take effect. Programs whose behavior depends on this
1990have undefined behavior; the C standard specifies that ``Between the
1991previous and next sequence point an object shall have its stored value
1992modified at most once by the evaluation of an expression. Furthermore,
1993the prior value shall be read only to determine the value to be
1994stored.''. If a program breaks these rules, the results on any
1995particular implementation are entirely unpredictable.
1996
1997Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
1998= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
1999diagnosed by this option, and it may give an occasional false positive
2000result, but in general it has been found fairly effective at detecting
2001this sort of problem in programs.
2002
2003The present implementation of this option only works for C programs. A
2004future implementation may also work for C++ programs.
2005
9c34dbbf
ZW
2006The C standard is worded confusingly, therefore there is some debate
2007over the precise meaning of the sequence point rules in subtle cases.
2008Links to discussions of the problem, including proposed formal
2009definitions, may be found on our readings page, at
c5122d75 2010@w{@uref{http://gcc.gnu.org/readings.html}}.
bb58bec5 2011
74291a4b 2012@item -Wreturn-type
cd3bb277 2013@opindex Wreturn-type
32c4c36c
ML
2014Warn whenever a function is defined with a return-type that defaults to
2015@code{int}. Also warn about any @code{return} statement with no
02f52e19 2016return-value in a function whose return-type is not @code{void}.
32c4c36c
ML
2017
2018For C++, a function without return type always produces a diagnostic
767094dd 2019message, even when @option{-Wno-return-type} is specified. The only
32c4c36c 2020exceptions are @samp{main} and functions defined in system headers.
74291a4b
MM
2021
2022@item -Wswitch
cd3bb277 2023@opindex Wswitch
74291a4b
MM
2024Warn whenever a @code{switch} statement has an index of enumeral type
2025and lacks a @code{case} for one or more of the named codes of that
2026enumeration. (The presence of a @code{default} label prevents this
2027warning.) @code{case} labels outside the enumeration range also
2028provoke warnings when this option is used.
2029
2030@item -Wtrigraphs
cd3bb277 2031@opindex Wtrigraphs
f2ecb02d
JM
2032Warn if any trigraphs are encountered that might change the meaning of
2033the program (trigraphs within comments are not warned about).
74291a4b 2034
078721e1 2035@item -Wunused-function
cd3bb277 2036@opindex Wunused-function
078721e1
AC
2037Warn whenever a static function is declared but not defined or a
2038non\-inline static function is unused.
74291a4b 2039
078721e1 2040@item -Wunused-label
cd3bb277 2041@opindex Wunused-label
078721e1
AC
2042Warn whenever a label is declared but not used.
2043
2044To suppress this warning use the @samp{unused} attribute
2045(@pxref{Variable Attributes}).
2046
2047@item -Wunused-parameter
cd3bb277 2048@opindex Wunused-parameter
078721e1
AC
2049Warn whenever a function parameter is unused aside from its declaration.
2050
2051To suppress this warning use the @samp{unused} attribute
2052(@pxref{Variable Attributes}).
956d6950 2053
078721e1 2054@item -Wunused-variable
cd3bb277 2055@opindex Wunused-variable
078721e1
AC
2056Warn whenever a local variable or non-constant static variable is unused
2057aside from its declaration
2058
2059To suppress this warning use the @samp{unused} attribute
74291a4b
MM
2060(@pxref{Variable Attributes}).
2061
078721e1 2062@item -Wunused-value
cd3bb277 2063@opindex Wunused-value
078721e1
AC
2064Warn whenever a statement computes a result that is explicitly not used.
2065
2066To suppress this warning cast the expression to @samp{void}.
2067
2068@item -Wunused
cd3bb277 2069@opindex Wunused
630d3d5a 2070All all the above @option{-Wunused} options combined.
078721e1
AC
2071
2072In order to get a warning about an unused function parameter, you must
b192711e 2073either specify @samp{-W -Wunused} or separately specify
630d3d5a 2074@option{-Wunused-parameter}.
078721e1 2075
74291a4b 2076@item -Wuninitialized
cd3bb277 2077@opindex Wuninitialized
c5c76735
JL
2078Warn if an automatic variable is used without first being initialized or
2079if a variable may be clobbered by a @code{setjmp} call.
74291a4b
MM
2080
2081These warnings are possible only in optimizing compilation,
2082because they require data flow information that is computed only
630d3d5a 2083when optimizing. If you don't specify @option{-O}, you simply won't
74291a4b
MM
2084get these warnings.
2085
2086These warnings occur only for variables that are candidates for
2087register allocation. Therefore, they do not occur for a variable that
2088is declared @code{volatile}, or whose address is taken, or whose size
2089is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
2090structures, unions or arrays, even when they are in registers.
2091
2092Note that there may be no warning about a variable that is used only
2093to compute a value that itself is never used, because such
2094computations may be deleted by data flow analysis before the warnings
2095are printed.
2096
0c2d1a2a 2097These warnings are made optional because GCC is not smart
74291a4b
MM
2098enough to see all the reasons why the code might be correct
2099despite appearing to have an error. Here is one example of how
2100this can happen:
2101
2102@smallexample
aee96fe9 2103@group
74291a4b
MM
2104@{
2105 int x;
2106 switch (y)
2107 @{
2108 case 1: x = 1;
2109 break;
2110 case 2: x = 4;
2111 break;
2112 case 3: x = 5;
2113 @}
2114 foo (x);
2115@}
aee96fe9 2116@end group
74291a4b
MM
2117@end smallexample
2118
2119@noindent
2120If the value of @code{y} is always 1, 2 or 3, then @code{x} is
0c2d1a2a 2121always initialized, but GCC doesn't know this. Here is
74291a4b
MM
2122another common case:
2123
2124@smallexample
2125@{
2126 int save_y;
2127 if (change_y) save_y = y, y = new_y;
2128 @dots{}
2129 if (change_y) y = save_y;
2130@}
2131@end smallexample
2132
2133@noindent
2134This has no bug because @code{save_y} is used only if it is set.
2135
20300b05 2136@cindex @code{longjmp} warnings
b192711e 2137This option also warns when a non-volatile automatic variable might be
c5c76735
JL
2138changed by a call to @code{longjmp}. These warnings as well are possible
2139only in optimizing compilation.
20300b05
GK
2140
2141The compiler sees only the calls to @code{setjmp}. It cannot know
2142where @code{longjmp} will be called; in fact, a signal handler could
2143call it at any point in the code. As a result, you may get a warning
2144even when there is in fact no problem because @code{longjmp} cannot
2145in fact be called at the place which would cause a problem.
2146
74291a4b
MM
2147Some spurious warnings can be avoided if you declare all the functions
2148you use that never return as @code{noreturn}. @xref{Function
2149Attributes}.
2150
aee96fe9 2151@item -Wreorder @r{(C++ only)}
cd3bb277 2152@opindex Wreorder
c5c76735
JL
2153@cindex reordering, warning
2154@cindex warning for reordering of member initializers
2155Warn when the order of member initializers given in the code does not
2156match the order in which they must be executed. For instance:
2157
d300e551 2158@item -Wunknown-pragmas
cd3bb277 2159@opindex Wunknown-pragmas
d300e551
NC
2160@cindex warning for unknown pragmas
2161@cindex unknown pragmas, warning
2162@cindex pragmas, warning of unknown
2163Warn when a #pragma directive is encountered which is not understood by
161d7b59 2164GCC@. If this command line option is used, warnings will even be issued
d300e551 2165for unknown pragmas in system header files. This is not the case if
630d3d5a 2166the warnings were only enabled by the @option{-Wall} command line option.
d300e551 2167
74291a4b 2168@item -Wall
cd3bb277 2169@opindex Wall
74291a4b
MM
2170All of the above @samp{-W} options combined. This enables all the
2171warnings about constructions that some users consider questionable, and
2172that are easy to avoid (or modify to prevent the warning), even in
2173conjunction with macros.
317639a8 2174
6c36d76b
NB
2175@item -Wdiv-by-zero
2176@opindex Wno-div-by-zero
2177@opindex Wdiv-by-zero
2178Warn about compile-time integer division by zero. This is default. To
2179inhibit the warning messages, use @option{-Wno-div-by-zero}. Floating
2180point division by zero is not warned about, as it can be a legitimate
2181way of obtaining infinities and NaNs.
2182
2183@item -Wmultichar
2184@opindex Wno-multichar
2185@opindex Wmultichar
2186Warn if a multicharacter constant (@samp{'FOOF'}) is used. This is
2187default. To inhibit the warning messages, use @option{-Wno-multichar}.
2188Usually they indicate a typo in the user's code, as they have
2189implementation-defined values, and should not be used in portable code.
2190
317639a8 2191@item -Wsystem-headers
cd3bb277 2192@opindex Wsystem-headers
317639a8
BC
2193@cindex warnings from system headers
2194@cindex system headers, warnings from
2195Print warning messages for constructs found in system header files.
2196Warnings from system headers are normally suppressed, on the assumption
2197that they usually do not indicate real problems and would only make the
2198compiler output harder to read. Using this command line option tells
2199GCC to emit warnings from system headers as if they occurred in user
630d3d5a 2200code. However, note that using @option{-Wall} in conjunction with this
317639a8 2201option will @emph{not} warn about unknown pragmas in system
630d3d5a 2202headers---for that, @option{-Wunknown-pragmas} must also be used.
74291a4b
MM
2203@end table
2204
630d3d5a 2205The following @option{-W@dots{}} options are not implied by @option{-Wall}.
74291a4b
MM
2206Some of them warn about constructions that users generally do not
2207consider questionable, but which occasionally you might wish to check
2208for; others warn about constructions that are necessary or hard to avoid
2209in some cases, and there is no simple way to modify the code to suppress
2210the warning.
2211
2642624b 2212@table @gcctabopt
74291a4b 2213@item -W
cd3bb277 2214@opindex W
74291a4b
MM
2215Print extra warning messages for these events:
2216
2217@itemize @bullet
74291a4b
MM
2218@item
2219A function can return either with or without a value. (Falling
2220off the end of the function body is considered returning without
2221a value.) For example, this function would evoke such a
2222warning:
2223
2224@smallexample
2225@group
2226foo (a)
2227@{
2228 if (a > 0)
2229 return a;
2230@}
2231@end group
2232@end smallexample
2233
2234@item
2235An expression-statement or the left-hand side of a comma expression
2236contains no side effects.
2237To suppress the warning, cast the unused expression to void.
2238For example, an expression such as @samp{x[i,j]} will cause a warning,
2239but @samp{x[(void)i,j]} will not.
2240
2241@item
2242An unsigned value is compared against zero with @samp{<} or @samp{<=}.
2243
2244@item
2245A comparison like @samp{x<=y<=z} appears; this is equivalent to
2246@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2247that of ordinary mathematical notation.
2248
2249@item
2250Storage-class specifiers like @code{static} are not the first things in
2251a declaration. According to the C Standard, this usage is obsolescent.
2252
e0c9fbb7
JM
2253@item
2254The return type of a function has a type qualifier such as @code{const}.
2255Such a type qualifier has no effect, since the value returned by a
2256function is not an lvalue. (But don't warn about the GNU extension of
2257@code{volatile void} return types. That extension will be warned about
630d3d5a 2258if @option{-pedantic} is specified.)
e0c9fbb7 2259
74291a4b 2260@item
630d3d5a 2261If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
74291a4b
MM
2262arguments.
2263
e9a25f70
JL
2264@item
2265A comparison between signed and unsigned values could produce an
2266incorrect result when the signed value is converted to unsigned.
630d3d5a 2267(But don't warn if @option{-Wno-sign-compare} is also specified.)
e9a25f70 2268
74291a4b
MM
2269@item
2270An aggregate has a partly bracketed initializer.
2271For example, the following code would evoke such a warning,
2272because braces are missing around the initializer for @code{x.h}:
2273
2274@smallexample
2275struct s @{ int f, g; @};
2276struct t @{ struct s h; int i; @};
2277struct t x = @{ 1, 2, 3 @};
2278@end smallexample
dbde0d5d
BH
2279
2280@item
2281An aggregate has an initializer which does not initialize all members.
2282For example, the following code would cause such a warning, because
2283@code{x.h} would be implicitly initialized to zero:
2284
2285@smallexample
2286struct s @{ int f, g, h; @};
2287struct s x = @{ 3, 4 @};
2288@end smallexample
74291a4b
MM
2289@end itemize
2290
f793a95e 2291@item -Wfloat-equal
cd3bb277 2292@opindex Wfloat-equal
f793a95e
JL
2293Warn if floating point values are used in equality comparisons.
2294
488d3985
GK
2295The idea behind this is that sometimes it is convenient (for the
2296programmer) to consider floating-point values as approximations to
2297infinitely precise real numbers. If you are doing this, then you need
2298to compute (by analysing the code, or in some other way) the maximum or
2299likely maximum error that the computation introduces, and allow for it
2300when performing comparisons (and when producing output, but that's a
2301different problem). In particular, instead of testing for equality, you
2302would check to see whether the two values have ranges that overlap; and
2303this is done with the relational operators, so equality comparisons are
2304probably mistaken.
2305
aee96fe9 2306@item -Wtraditional @r{(C only)}
cd3bb277 2307@opindex Wtraditional
74291a4b 2308Warn about certain constructs that behave differently in traditional and
161d7b59 2309ISO C@. Also warn about ISO C constructs that have no traditional C
c8abc684 2310equivalent, and/or problematic constructs which should be avoided.
74291a4b
MM
2311
2312@itemize @bullet
2313@item
da312b55
NB
2314Macro parameters that appear within string literals in the macro body.
2315In traditional C macro replacement takes place within string literals,
161d7b59 2316but does not in ISO C@.
da312b55
NB
2317
2318@item
2319In traditional C, some preprocessor directives did not exist.
2320Traditional preprocessors would only consider a line to be a directive
2321if the @samp{#} appeared in column 1 on the line. Therefore
630d3d5a 2322@option{-Wtraditional} warns about directives that traditional C
da312b55
NB
2323understands but would ignore because the @samp{#} does not appear as the
2324first character on the line. It also suggests you hide directives like
2325@samp{#pragma} not understood by traditional C by indenting them. Some
c21cd8b1 2326traditional implementations would not recognize @samp{#elif}, so it
da312b55
NB
2327suggests avoiding it altogether.
2328
2329@item
2330A function-like macro that appears without arguments.
2331
2332@item
2333The unary plus operator.
2334
2335@item
c771326b
JM
2336The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2337constant suffixes. (Traditional C does support the @samp{L} suffix on integer
da312b55 2338constants.) Note, these suffixes appear in macros defined in the system
e979f9e8 2339headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
c8abc684
KG
2340Use of these macros in user code might normally lead to spurious
2341warnings, however gcc's integrated preprocessor has enough context to
2342avoid warning in these cases.
74291a4b
MM
2343
2344@item
2345A function declared external in one block and then used after the end of
2346the block.
2347
2348@item
2349A @code{switch} statement has an operand of type @code{long}.
db838bb8
KG
2350
2351@item
2352A non-@code{static} function declaration follows a @code{static} one.
2353This construct is not accepted by some traditional C compilers.
48776cde
KG
2354
2355@item
c1030c7c 2356The ISO type of an integer constant has a different width or
48776cde 2357signedness from its traditional type. This warning is only issued if
e979f9e8 2358the base of the constant is ten. I.e.@: hexadecimal or octal values, which
48776cde 2359typically represent bit patterns, are not warned about.
bb66adca
KG
2360
2361@item
c1030c7c 2362Usage of ISO string concatenation is detected.
7f094a94 2363
895ea614
KG
2364@item
2365Initialization of automatic aggregates.
2366
2367@item
2368Identifier conflicts with labels. Traditional C lacks a separate
2369namespace for labels.
253b6b82
KG
2370
2371@item
2372Initialization of unions. If the initializer is zero, the warning is
2373omitted. This is done under the assumption that the zero initializer in
e979f9e8 2374user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
253b6b82
KG
2375initializer warnings and relies on default initialization to zero in the
2376traditional C case.
03829ad2
KG
2377
2378@item
3ed56f8a
KG
2379Conversions by prototypes between fixed/floating point values and vice
2380versa. The absence of these prototypes when compiling with traditional
2381C would cause serious problems. This is a subset of the possible
630d3d5a 2382conversion warnings, for the full set use @option{-Wconversion}.
74291a4b
MM
2383@end itemize
2384
861bb6c1 2385@item -Wundef
cd3bb277 2386@opindex Wundef
861bb6c1
JL
2387Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2388
74291a4b 2389@item -Wshadow
cd3bb277 2390@opindex Wshadow
d773df5a
DB
2391Warn whenever a local variable shadows another local variable, parameter or
2392global variable or whenever a built-in function is shadowed.
74291a4b 2393
74291a4b 2394@item -Wlarger-than-@var{len}
cd3bb277 2395@opindex Wlarger-than
74291a4b
MM
2396Warn whenever an object of larger than @var{len} bytes is defined.
2397
2398@item -Wpointer-arith
cd3bb277 2399@opindex Wpointer-arith
74291a4b
MM
2400Warn about anything that depends on the ``size of'' a function type or
2401of @code{void}. GNU C assigns these types a size of 1, for
2402convenience in calculations with @code{void *} pointers and pointers
2403to functions.
2404
aee96fe9 2405@item -Wbad-function-cast @r{(C only)}
cd3bb277 2406@opindex Wbad-function-cast
74291a4b
MM
2407Warn whenever a function call is cast to a non-matching type.
2408For example, warn if @code{int malloc()} is cast to @code{anything *}.
2409
2410@item -Wcast-qual
cd3bb277 2411@opindex Wcast-qual
74291a4b
MM
2412Warn whenever a pointer is cast so as to remove a type qualifier from
2413the target type. For example, warn if a @code{const char *} is cast
2414to an ordinary @code{char *}.
2415
2416@item -Wcast-align
cd3bb277 2417@opindex Wcast-align
74291a4b
MM
2418Warn whenever a pointer is cast such that the required alignment of the
2419target is increased. For example, warn if a @code{char *} is cast to
2420an @code{int *} on machines where integers can only be accessed at
2421two- or four-byte boundaries.
2422
2423@item -Wwrite-strings
cd3bb277 2424@opindex Wwrite-strings
aee96fe9
JM
2425When compiling C, give string constants the type @code{const
2426char[@var{length}]} so that
74291a4b 2427copying the address of one into a non-@code{const} @code{char *}
aee96fe9
JM
2428pointer will get a warning; when compiling C++, warn about the
2429deprecated conversion from string constants to @code{char *}.
2430These warnings will help you find at
74291a4b
MM
2431compile time code that can try to write into a string constant, but
2432only if you have been very careful about using @code{const} in
2433declarations and prototypes. Otherwise, it will just be a nuisance;
630d3d5a 2434this is why we did not make @option{-Wall} request these warnings.
74291a4b
MM
2435
2436@item -Wconversion
cd3bb277 2437@opindex Wconversion
74291a4b
MM
2438Warn if a prototype causes a type conversion that is different from what
2439would happen to the same argument in the absence of a prototype. This
2440includes conversions of fixed point to floating and vice versa, and
2441conversions changing the width or signedness of a fixed point argument
2442except when the same as the default promotion.
2443
2444Also, warn if a negative integer constant expression is implicitly
2445converted to an unsigned type. For example, warn about the assignment
2446@code{x = -1} if @code{x} is unsigned. But do not warn about explicit
2447casts like @code{(unsigned) -1}.
2448
e9a25f70 2449@item -Wsign-compare
cd3bb277 2450@opindex Wsign-compare
e9a25f70
JL
2451@cindex warning for comparison of signed and unsigned values
2452@cindex comparison of signed and unsigned values, warning
2453@cindex signed and unsigned values, comparison warning
2454Warn when a comparison between signed and unsigned values could produce
2455an incorrect result when the signed value is converted to unsigned.
630d3d5a
JM
2456This warning is also enabled by @option{-W}; to get the other warnings
2457of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}.
e9a25f70 2458
74291a4b 2459@item -Waggregate-return
cd3bb277 2460@opindex Waggregate-return
74291a4b
MM
2461Warn if any functions that return structures or unions are defined or
2462called. (In languages where you can return an array, this also elicits
2463a warning.)
2464
aee96fe9 2465@item -Wstrict-prototypes @r{(C only)}
cd3bb277 2466@opindex Wstrict-prototypes
74291a4b
MM
2467Warn if a function is declared or defined without specifying the
2468argument types. (An old-style function definition is permitted without
2469a warning if preceded by a declaration which specifies the argument
2470types.)
2471
aee96fe9 2472@item -Wmissing-prototypes @r{(C only)}
cd3bb277 2473@opindex Wmissing-prototypes
74291a4b
MM
2474Warn if a global function is defined without a previous prototype
2475declaration. This warning is issued even if the definition itself
2476provides a prototype. The aim is to detect global functions that fail
2477to be declared in header files.
2478
2479@item -Wmissing-declarations
cd3bb277 2480@opindex Wmissing-declarations
74291a4b
MM
2481Warn if a global function is defined without a previous declaration.
2482Do so even if the definition itself provides a prototype.
2483Use this option to detect global functions that are not declared in
2484header files.
2485
0ca3fb0a 2486@item -Wmissing-noreturn
cd3bb277 2487@opindex Wmissing-noreturn
0ca3fb0a
KG
2488Warn about functions which might be candidates for attribute @code{noreturn}.
2489Note these are only possible candidates, not absolute ones. Care should
2490be taken to manually verify functions actually do not ever return before
2491adding the @code{noreturn} attribute, otherwise subtle code generation
21c7361e
AJ
2492bugs could be introduced. You will not get a warning for @code{main} in
2493hosted C environments.
0ca3fb0a 2494
74ff4629 2495@item -Wmissing-format-attribute
cd3bb277
JM
2496@opindex Wmissing-format-attribute
2497@opindex Wformat
630d3d5a 2498If @option{-Wformat} is enabled, also warn about functions which might be
74ff4629
JM
2499candidates for @code{format} attributes. Note these are only possible
2500candidates, not absolute ones. GCC will guess that @code{format}
2501attributes might be appropriate for any function that calls a function
2502like @code{vprintf} or @code{vscanf}, but this might not always be the
2503case, and some functions for which @code{format} attributes are
2504appropriate may not be detected. This option has no effect unless
630d3d5a 2505@option{-Wformat} is enabled (possibly by @option{-Wall}).
74ff4629 2506
3c12fcc2 2507@item -Wpacked
cd3bb277 2508@opindex Wpacked
3c12fcc2 2509Warn if a structure is given the packed attribute, but the packed
02f52e19 2510attribute has no effect on the layout or size of the structure.
3c12fcc2
GM
2511Such structures may be mis-aligned for little benefit. For
2512instance, in this code, the variable @code{f.x} in @code{struct bar}
2513will be misaligned even though @code{struct bar} does not itself
2514have the packed attribute:
2515
2516@smallexample
2517@group
2518struct foo @{
2519 int x;
2520 char a, b, c, d;
2521@} __attribute__((packed));
2522struct bar @{
2523 char z;
2524 struct foo f;
2525@};
2526@end group
2527@end smallexample
2528
2529@item -Wpadded
cd3bb277 2530@opindex Wpadded
3c12fcc2
GM
2531Warn if padding is included in a structure, either to align an element
2532of the structure or to align the whole structure. Sometimes when this
2533happens it is possible to rearrange the fields of the structure to
2534reduce the padding and so make the structure smaller.
2535
74291a4b 2536@item -Wredundant-decls
cd3bb277 2537@opindex Wredundant-decls
74291a4b
MM
2538Warn if anything is declared more than once in the same scope, even in
2539cases where multiple declaration is valid and changes nothing.
2540
aee96fe9 2541@item -Wnested-externs @r{(C only)}
cd3bb277 2542@opindex Wnested-externs
252215a7 2543Warn if an @code{extern} declaration is encountered within a function.
74291a4b 2544
312f6255 2545@item -Wunreachable-code
cd3bb277 2546@opindex Wunreachable-code
312f6255
GK
2547Warn if the compiler detects that code will never be executed.
2548
2549This option is intended to warn when the compiler detects that at
2550least a whole line of source code will never be executed, because
2551some condition is never satisfied or because it is after a
2552procedure that never returns.
2553
2554It is possible for this option to produce a warning even though there
2555are circumstances under which part of the affected line can be executed,
2556so care should be taken when removing apparently-unreachable code.
2557
2558For instance, when a function is inlined, a warning may mean that the
02f52e19 2559line is unreachable in only one inlined copy of the function.
312f6255 2560
630d3d5a 2561This option is not made part of @option{-Wall} because in a debugging
312f6255
GK
2562version of a program there is often substantial code which checks
2563correct functioning of the program and is, hopefully, unreachable
2564because the program does work. Another common use of unreachable
c21cd8b1 2565code is to provide behavior which is selectable at compile-time.
312f6255 2566
74291a4b 2567@item -Winline
cd3bb277 2568@opindex Winline
c5c76735 2569Warn if a function can not be inlined and it was declared as inline.
74291a4b 2570
795add94 2571@item -Wlong-long
cd3bb277
JM
2572@opindex Wlong-long
2573@opindex Wno-long-long
795add94 2574Warn if @samp{long long} type is used. This is default. To inhibit
630d3d5a
JM
2575the warning messages, use @option{-Wno-long-long}. Flags
2576@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2577only when @option{-pedantic} flag is used.
795add94 2578
18424ae1 2579@item -Wdisabled-optimization
cd3bb277 2580@opindex Wdisabled-optimization
18424ae1
BL
2581Warn if a requested optimization pass is disabled. This warning does
2582not generally indicate that there is anything wrong with your code; it
2583merely indicates that GCC's optimizers were unable to handle the code
2584effectively. Often, the problem is that your code is too big or too
2585complex; GCC will refuse to optimize programs when the optimization
2586itself is likely to take inordinate amounts of time.
2587
74291a4b 2588@item -Werror
cd3bb277 2589@opindex Werror
74291a4b
MM
2590Make all warnings into errors.
2591@end table
2592
2593@node Debugging Options
0c2d1a2a 2594@section Options for Debugging Your Program or GCC
74291a4b
MM
2595@cindex options, debugging
2596@cindex debugging information options
2597
0c2d1a2a 2598GCC has various special options that are used for debugging
74291a4b
MM
2599either your program or GCC:
2600
2642624b 2601@table @gcctabopt
74291a4b 2602@item -g
cd3bb277 2603@opindex g
74291a4b 2604Produce debugging information in the operating system's native format
161d7b59 2605(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
74291a4b
MM
2606information.
2607
630d3d5a 2608On most systems that use stabs format, @option{-g} enables use of extra
74291a4b
MM
2609debugging information that only GDB can use; this extra information
2610makes debugging work better in GDB but will probably make other debuggers
2611crash or
2612refuse to read the program. If you want to control for certain whether
630d3d5a 2613to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5f98259a
RK
2614@option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1},
2615or @option{-gvms} (see below).
74291a4b 2616
630d3d5a
JM
2617Unlike most other C compilers, GCC allows you to use @option{-g} with
2618@option{-O}. The shortcuts taken by optimized code may occasionally
74291a4b
MM
2619produce surprising results: some variables you declared may not exist
2620at all; flow of control may briefly move where you did not expect it;
2621some statements may not be executed because they compute constant
2622results or their values were already at hand; some statements may
2623execute in different places because they were moved out of loops.
2624
2625Nevertheless it proves possible to debug optimized output. This makes
2626it reasonable to use the optimizer for programs that might have bugs.
2627
0c2d1a2a 2628The following options are useful when GCC is generated with the
74291a4b
MM
2629capability for more than one debugging format.
2630
2631@item -ggdb
cd3bb277 2632@opindex ggdb
161d7b59 2633Produce debugging information for use by GDB@. This means to use the
861bb6c1
JL
2634most expressive format available (DWARF 2, stabs, or the native format
2635if neither of those are supported), including GDB extensions if at all
2636possible.
74291a4b
MM
2637
2638@item -gstabs
cd3bb277 2639@opindex gstabs
74291a4b
MM
2640Produce debugging information in stabs format (if that is supported),
2641without GDB extensions. This is the format used by DBX on most BSD
2642systems. On MIPS, Alpha and System V Release 4 systems this option
161d7b59 2643produces stabs debugging output which is not understood by DBX or SDB@.
74291a4b
MM
2644On System V Release 4 systems this option requires the GNU assembler.
2645
2646@item -gstabs+
cd3bb277 2647@opindex gstabs+
74291a4b 2648Produce debugging information in stabs format (if that is supported),
161d7b59 2649using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
2650use of these extensions is likely to make other debuggers crash or
2651refuse to read the program.
2652
2653@item -gcoff
cd3bb277 2654@opindex gcoff
74291a4b
MM
2655Produce debugging information in COFF format (if that is supported).
2656This is the format used by SDB on most System V systems prior to
2657System V Release 4.
2658
2659@item -gxcoff
cd3bb277 2660@opindex gxcoff
74291a4b
MM
2661Produce debugging information in XCOFF format (if that is supported).
2662This is the format used by the DBX debugger on IBM RS/6000 systems.
2663
2664@item -gxcoff+
cd3bb277 2665@opindex gxcoff+
74291a4b 2666Produce debugging information in XCOFF format (if that is supported),
161d7b59 2667using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
2668use of these extensions is likely to make other debuggers crash or
2669refuse to read the program, and may cause assemblers other than the GNU
2670assembler (GAS) to fail with an error.
2671
2672@item -gdwarf
cd3bb277 2673@opindex gdwarf
861bb6c1
JL
2674Produce debugging information in DWARF version 1 format (if that is
2675supported). This is the format used by SDB on most System V Release 4
2676systems.
74291a4b
MM
2677
2678@item -gdwarf+
cd3bb277 2679@opindex gdwarf+
861bb6c1
JL
2680Produce debugging information in DWARF version 1 format (if that is
2681supported), using GNU extensions understood only by the GNU debugger
161d7b59 2682(GDB)@. The use of these extensions is likely to make other debuggers
861bb6c1
JL
2683crash or refuse to read the program.
2684
2685@item -gdwarf-2
cd3bb277 2686@opindex gdwarf-2
861bb6c1
JL
2687Produce debugging information in DWARF version 2 format (if that is
2688supported). This is the format used by DBX on IRIX 6.
74291a4b 2689
5f98259a
RK
2690@item -gvms
2691@opindex gvms
2692Produce debugging information in VMS debug format (if that is
2693supported). This is the format used by DEBUG on VMS systems.
2694
74291a4b
MM
2695@item -g@var{level}
2696@itemx -ggdb@var{level}
2697@itemx -gstabs@var{level}
2698@itemx -gcoff@var{level}
2699@itemx -gxcoff@var{level}
2700@itemx -gdwarf@var{level}
861bb6c1 2701@itemx -gdwarf-2@var{level}
5f98259a 2702@itemx -gvms@var{level}
74291a4b
MM
2703Request debugging information and also use @var{level} to specify how
2704much information. The default level is 2.
2705
2706Level 1 produces minimal information, enough for making backtraces in
2707parts of the program that you don't plan to debug. This includes
2708descriptions of functions and external variables, but no information
2709about local variables and no line numbers.
2710
2711Level 3 includes extra information, such as all the macro definitions
2712present in the program. Some debuggers support macro expansion when
630d3d5a 2713you use @option{-g3}.
74291a4b
MM
2714
2715@cindex @code{prof}
2716@item -p
cd3bb277 2717@opindex p
74291a4b
MM
2718Generate extra code to write profile information suitable for the
2719analysis program @code{prof}. You must use this option when compiling
2720the source files you want data about, and you must also use it when
2721linking.
2722
2723@cindex @code{gprof}
2724@item -pg
cd3bb277 2725@opindex pg
74291a4b
MM
2726Generate extra code to write profile information suitable for the
2727analysis program @code{gprof}. You must use this option when compiling
2728the source files you want data about, and you must also use it when
2729linking.
2730
2731@cindex @code{tcov}
2732@item -a
cd3bb277 2733@opindex a
74291a4b
MM
2734Generate extra code to write profile information for basic blocks, which will
2735record the number of times each basic block is executed, the basic block start
630d3d5a 2736address, and the function name containing the basic block. If @option{-g} is
74291a4b
MM
2737used, the line number and filename of the start of the basic block will also be
2738recorded. If not overridden by the machine description, the default action is
2739to append to the text file @file{bb.out}.
2740
2741This data could be analyzed by a program like @code{tcov}. Note,
2742however, that the format of the data is not what @code{tcov} expects.
2743Eventually GNU @code{gprof} should be extended to process this data.
2744
898f531b 2745@item -Q
cd3bb277 2746@opindex Q
898f531b
JL
2747Makes the compiler print out each function name as it is compiled, and
2748print some statistics about each pass when it finishes.
2749
1f0c3120 2750@item -ftime-report
cd3bb277 2751@opindex ftime-report
1f0c3120
JM
2752Makes the compiler print some statistics about the time consumed by each
2753pass when it finishes.
2754
2755@item -fmem-report
cd3bb277 2756@opindex fmem-report
1f0c3120
JM
2757Makes the compiler print some statistics about permanent memory
2758allocation when it finishes.
2759
861bb6c1 2760@item -fprofile-arcs
cd3bb277 2761@opindex fprofile-arcs
3de87bf2
JJ
2762Instrument @dfn{arcs} during compilation to generate coverage data
2763or for profile-directed block ordering. During execution the program
2764records how many times each branch is executed and how many times it is
2765taken. When the compiled program exits it saves this data to a file
2766called @file{@var{sourcename}.da} for each source file.
2767
2768For profile-directed block ordering, compile the program with
2769@option{-fprofile-arcs} plus optimization and code generation options,
2770generate the arc profile information by running the program on a
2771selected workload, and then compile the program again with the same
2772optimization and code generation options plus
630d3d5a 2773@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3de87bf2
JJ
2774Control Optimization}).
2775
2776The other use of @option{-fprofile-arcs} is for use with @code{gcov},
2777when it is used with the @option{-ftest-coverage} option. GCC
2778supports two methods of determining code coverage: the options that
2779support @code{gcov}, and options @option{-a} and @option{-ax}, which
2780write information to text files. The options that support @code{gcov}
2781do not need to instrument every arc in the program, so a program compiled
2782with them runs faster than a program compiled with @option{-a}, which
2783adds instrumentation code to every basic block in the program. The
2784tradeoff: since @code{gcov} does not have execution counts for all
2785branches, it must start with the execution counts for the instrumented
2786branches, and then iterate over the program flow graph until the entire
2787graph has been solved. Hence, @code{gcov} runs a little more slowly than
2788a program which uses information from @option{-a} and @option{-ax}.
2789
2790With @option{-fprofile-arcs}, for each function of your program GCC
2791creates a program flow graph, then finds a spanning tree for the graph.
2792Only arcs that are not on the spanning tree have to be instrumented: the
2793compiler adds code to count the number of times that these arcs are
2794executed. When an arc is the only exit or only entrance to a block, the
2795instrumentation code can be added to the block; otherwise, a new basic
2796block must be created to hold the instrumentation code.
2797
2798This option makes it possible to estimate branch probabilities and to
2799calculate basic block execution counts. In general, basic block
2800execution counts as provided by @option{-a} do not give enough
2801information to estimate all branch probabilities.
861bb6c1
JL
2802
2803@need 2000
2804@item -ftest-coverage
cd3bb277 2805@opindex ftest-coverage
861bb6c1 2806Create data files for the @code{gcov} code-coverage utility
0c2d1a2a 2807(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}).
861bb6c1
JL
2808The data file names begin with the name of your source file:
2809
2642624b 2810@table @gcctabopt
861bb6c1
JL
2811@item @var{sourcename}.bb
2812A mapping from basic blocks to line numbers, which @code{gcov} uses to
2813associate basic block execution counts with line numbers.
2814
2815@item @var{sourcename}.bbg
2816A list of all arcs in the program flow graph. This allows @code{gcov}
2817to reconstruct the program flow graph, so that it can compute all basic
2818block and arc execution counts from the information in the
3de87bf2 2819@code{@var{sourcename}.da} file.
861bb6c1
JL
2820@end table
2821
3de87bf2
JJ
2822Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter
2823option adds instrumentation to the program, which then writes
2824execution counts to another data file:
2825
2826@table @gcctabopt
2827@item @var{sourcename}.da
2828Runtime arc execution counts, used in conjunction with the arc
2829information in the file @code{@var{sourcename}.bbg}.
2830@end table
2831
2832Coverage data will map better to the source files if
2833@option{-ftest-coverage} is used without optimization.
2834
74291a4b 2835@item -d@var{letters}
cd3bb277 2836@opindex d
74291a4b
MM
2837Says to make debugging dumps during compilation at times specified by
2838@var{letters}. This is used for debugging the compiler. The file names
375e2d5c 2839for most of the dumps are made by appending a pass number and a word to
02f52e19 2840the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}).
375e2d5c 2841Here are the possible letters for use in @var{letters}, and their meanings:
74291a4b
MM
2842
2843@table @samp
375e2d5c 2844@item A
cd3bb277 2845@opindex dA
375e2d5c 2846Annotate the assembler output with miscellaneous debugging information.
956d6950 2847@item b
cd3bb277 2848@opindex db
0b47e4c1 2849Dump after computing branch probabilities, to @file{@var{file}.14.bp}.
48d9ade5 2850@item B
cd3bb277 2851@opindex dB
0b47e4c1 2852Dump after block reordering, to @file{@var{file}.28.bbro}.
032713aa 2853@item c
cd3bb277 2854@opindex dc
0b47e4c1 2855Dump after instruction combination, to the file @file{@var{file}.16.combine}.
470fc13d 2856@item C
cd3bb277 2857@opindex dC
0b47e4c1 2858Dump after the first if conversion, to the file @file{@var{file}.17.ce}.
032713aa 2859@item d
cd3bb277 2860@opindex dd
0b47e4c1 2861Dump after delayed branch scheduling, to @file{@var{file}.31.dbr}.
032713aa 2862@item D
cd3bb277 2863@opindex dD
f5963e61
JL
2864Dump all macro definitions, at the end of preprocessing, in addition to
2865normal output.
48d9ade5 2866@item e
cd3bb277 2867@opindex de
0826f1d8 2868Dump after SSA optimizations, to @file{@var{file}.04.ssa} and
0b47e4c1 2869@file{@var{file}.07.ussa}.
470fc13d 2870@item E
cd3bb277 2871@opindex dE
0b47e4c1 2872Dump after the second if conversion, to @file{@var{file}.26.ce2}.
74291a4b 2873@item f
cd3bb277 2874@opindex df
0b47e4c1 2875Dump after life analysis, to @file{@var{file}.15.life}.
48d9ade5 2876@item F
cd3bb277 2877@opindex dF
0b47e4c1 2878Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.09.addressof}.
74291a4b 2879@item g
cd3bb277 2880@opindex dg
0b47e4c1 2881Dump after global register allocation, to @file{@var{file}.21.greg}.
0826f1d8
JL
2882@item h
2883@opindex dh
2884Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
2885@item o
cd3bb277 2886@opindex do
9c34dbbf 2887Dump after post-reload optimizations, to @file{@var{file}.22.postreload}.
02f52e19 2888@item G
cd3bb277 2889@opindex dG
0b47e4c1 2890Dump after GCSE, to @file{@var{file}.10.gcse}.
48d9ade5 2891@item i
cd3bb277 2892@opindex di
48d9ade5 2893Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
032713aa 2894@item j
cd3bb277 2895@opindex dj
0826f1d8 2896Dump after the first jump optimization, to @file{@var{file}.03.jump}.
74291a4b 2897@item k
cd3bb277 2898@opindex dk
0b47e4c1 2899Dump after conversion from registers to stack, to @file{@var{file}.32.stack}.
032713aa 2900@item l
cd3bb277 2901@opindex dl
0b47e4c1 2902Dump after local register allocation, to @file{@var{file}.20.lreg}.
032713aa 2903@item L
cd3bb277 2904@opindex dL
0b47e4c1 2905Dump after loop optimization, to @file{@var{file}.11.loop}.
032713aa 2906@item M
cd3bb277 2907@opindex dM
032713aa 2908Dump after performing the machine dependent reorganisation pass, to
0b47e4c1 2909@file{@var{file}.30.mach}.
48d9ade5 2910@item n
cd3bb277 2911@opindex dn
0b47e4c1 2912Dump after register renumbering, to @file{@var{file}.25.rnreg}.
032713aa 2913@item N
cd3bb277 2914@opindex dN
0b47e4c1 2915Dump after the register move pass, to @file{@var{file}.18.regmove}.
032713aa 2916@item r
cd3bb277 2917@opindex dr
375e2d5c 2918Dump after RTL generation, to @file{@var{file}.00.rtl}.
032713aa 2919@item R
cd3bb277 2920@opindex dR
9c34dbbf 2921Dump after the second scheduling pass, to @file{@var{file}.27.sched2}.
032713aa 2922@item s
cd3bb277 2923@opindex ds
032713aa 2924Dump after CSE (including the jump optimization that sometimes follows
0b47e4c1 2925CSE), to @file{@var{file}.08.cse}.
032713aa 2926@item S
cd3bb277 2927@opindex dS
9c34dbbf 2928Dump after the first scheduling pass, to @file{@var{file}.19.sched}.
032713aa 2929@item t
cd3bb277 2930@opindex dt
032713aa 2931Dump after the second CSE pass (including the jump optimization that
0b47e4c1 2932sometimes follows CSE), to @file{@var{file}.12.cse2}.
48d9ade5 2933@item w
cd3bb277 2934@opindex dw
0b47e4c1 2935Dump after the second flow pass, to @file{@var{file}.23.flow2}.
470fc13d 2936@item X
cd3bb277 2937@opindex dX
9c34dbbf 2938Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}.
48d9ade5 2939@item z
cd3bb277 2940@opindex dz
0b47e4c1 2941Dump after the peephole pass, to @file{@var{file}.24.peephole2}.
74291a4b 2942@item a
cd3bb277 2943@opindex da
74291a4b
MM
2944Produce all the dumps listed above.
2945@item m
cd3bb277 2946@opindex dm
74291a4b
MM
2947Print statistics on memory usage, at the end of the run, to
2948standard error.
2949@item p
cd3bb277 2950@opindex dp
74291a4b 2951Annotate the assembler output with a comment indicating which
f20b5577
MM
2952pattern and alternative was used. The length of each instruction is
2953also printed.
2856c3e3 2954@item P
cd3bb277 2955@opindex dP
2856c3e3 2956Dump the RTL in the assembler output as a comment before each instruction.
630d3d5a 2957Also turns on @option{-dp} annotation.
375e2d5c 2958@item v
cd3bb277 2959@opindex dv
375e2d5c
RH
2960For each of the other indicated dump files (except for
2961@file{@var{file}.00.rtl}), dump a representation of the control flow graph
b192711e 2962suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
62a1403d 2963@item x
cd3bb277 2964@opindex dx
62a1403d
AS
2965Just generate RTL for a function instead of compiling it. Usually used
2966with @samp{r}.
032713aa 2967@item y
cd3bb277 2968@opindex dy
032713aa 2969Dump debugging information during parsing, to standard error.
74291a4b
MM
2970@end table
2971
b707b450 2972@item -fdump-unnumbered
cd3bb277 2973@opindex fdump-unnumbered
695ac33f 2974When doing debugging dumps (see @option{-d} option above), suppress instruction
b707b450 2975numbers and line number note output. This makes it more feasible to
b192711e 2976use diff on debugging dumps for compiler invocations with different
695ac33f 2977options, in particular with and without @option{-g}.
b707b450 2978
aee96fe9 2979@item -fdump-class-hierarchy @r{(C++ only)}
22367161 2980@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
cd3bb277 2981@opindex fdump-class-hierarchy
e76b4820 2982Dump a representation of each class's hierarchy and virtual function
767094dd 2983table layout to a file. The file name is made by appending @file{.class}
22367161
NS
2984to the source file name. If the @samp{-@var{options}} form is used,
2985@var{options} controls the details of the dump as described for the
2986@option{-fdump-tree} options.
2987
2988@item -fdump-tree-@var{switch} @r{(C++ only)}
2989@itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
2990@opindex fdump-tree
2991Control the dumping at various stages of processing the intermediate
2992language tree to a file. The file name is generated by appending a switch
2993specific suffix to the source file name. If the @samp{-@var{options}}
2994form is used, @var{options} is a list of @samp{-} separated options that
2995control the details of the dump. Not all options are applicable to all
2996dumps, those which are not meaningful will be ignored. The following
2997options are available
f71f87f9 2998
e76b4820 2999@table @samp
22367161 3000@item address
767094dd 3001Print the address of each node. Usually this is not meaningful as it
22367161
NS
3002changes according to the environment and source file. Its primary use
3003is for tying up a dump file with a debug environment.
3004@item slim
3005Inhibit dumping of members of a scope or body of a function merely
3006because that scope has been reached. Only dump such items when they
3007are directly reachable by some other path.
3008@item all
3009Turn on all options.
e76b4820
NS
3010@end table
3011
3012The following tree dumps are possible:
3013@table @samp
3014@item original
3015Dump before any tree based optimization, to @file{@var{file}.original}.
3016@item optimized
3017Dump after all tree based optimization, to @file{@var{file}.optimized}.
6be77748 3018@item inlined
9c34dbbf 3019Dump after function inlining, to @file{@var{file}.inlined}.
e76b4820 3020@end table
9965d119 3021
74291a4b 3022@item -fpretend-float
cd3bb277 3023@opindex fpretend-float
74291a4b
MM
3024When running a cross-compiler, pretend that the target machine uses the
3025same floating point format as the host machine. This causes incorrect
3026output of the actual floating constants, but the actual instruction
0c2d1a2a 3027sequence will probably be the same as GCC would make when running on
74291a4b
MM
3028the target machine.
3029
3030@item -save-temps
cd3bb277 3031@opindex save-temps
74291a4b
MM
3032Store the usual ``temporary'' intermediate files permanently; place them
3033in the current directory and name them based on the source file. Thus,
3034compiling @file{foo.c} with @samp{-c -save-temps} would produce files
f2ecb02d
JM
3035@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
3036preprocessed @file{foo.i} output file even though the compiler now
3037normally uses an integrated preprocessor.
74291a4b 3038
03c41c05 3039@item -time
cd3bb277 3040@opindex time
03c41c05 3041Report the CPU time taken by each subprocess in the compilation
f2ecb02d
JM
3042sequence. For C source files, this is the compiler proper and assembler
3043(plus the linker if linking is done). The output looks like this:
03c41c05
ZW
3044
3045@smallexample
03c41c05
ZW
3046# cc1 0.12 0.01
3047# as 0.00 0.01
3048@end smallexample
3049
3050The first number on each line is the ``user time,'' that is time spent
3051executing the program itself. The second number is ``system time,''
3052time spent executing operating system routines on behalf of the program.
3053Both numbers are in seconds.
3054
74291a4b 3055@item -print-file-name=@var{library}
cd3bb277 3056@opindex print-file-name
74291a4b
MM
3057Print the full absolute name of the library file @var{library} that
3058would be used when linking---and don't do anything else. With this
0c2d1a2a 3059option, GCC does not compile or link anything; it just prints the
74291a4b
MM
3060file name.
3061
b1018de6
AO
3062@item -print-multi-directory
3063@opindex print-multi-directory
3064Print the directory name corresponding to the multilib selected by any
3065other switches present in the command line. This directory is supposed
3066to exist in @env{GCC_EXEC_PREFIX}.
3067
3068@item -print-multi-lib
3069@opindex print-multi-lib
3070Print the mapping from multilib directory names to compiler switches
3071that enable them. The directory name is separated from the switches by
3072@samp{;}, and each switch starts with an @samp{@@} instead of the
3073@samp{-}, without spaces between multiple switches. This is supposed to
3074ease shell-processing.
3075
74291a4b 3076@item -print-prog-name=@var{program}
cd3bb277 3077@opindex print-prog-name
630d3d5a 3078Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
74291a4b
MM
3079
3080@item -print-libgcc-file-name
cd3bb277 3081@opindex print-libgcc-file-name
630d3d5a 3082Same as @option{-print-file-name=libgcc.a}.
74291a4b 3083
630d3d5a 3084This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
74291a4b
MM
3085but you do want to link with @file{libgcc.a}. You can do
3086
3087@example
3088gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3089@end example
3090
3091@item -print-search-dirs
cd3bb277 3092@opindex print-search-dirs
74291a4b
MM
3093Print the name of the configured installation directory and a list of
3094program and library directories gcc will search---and don't do anything else.
3095
3096This is useful when gcc prints the error message
3c0b7970
JM
3097@samp{installation problem, cannot exec cpp0: No such file or directory}.
3098To resolve this you either need to put @file{cpp0} and the other compiler
74291a4b 3099components where gcc expects to find them, or you can set the environment
bedc7537 3100variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
74291a4b
MM
3101Don't forget the trailing '/'.
3102@xref{Environment Variables}.
1f0c3120
JM
3103
3104@item -dumpmachine
cd3bb277 3105@opindex dumpmachine
1f0c3120
JM
3106Print the compiler's target machine (for example,
3107@samp{i686-pc-linux-gnu})---and don't do anything else.
3108
3109@item -dumpversion
cd3bb277 3110@opindex dumpversion
1f0c3120
JM
3111Print the compiler version (for example, @samp{3.0})---and don't do
3112anything else.
3113
3114@item -dumpspecs
cd3bb277 3115@opindex dumpspecs
1f0c3120
JM
3116Print the compiler's built-in specs---and don't do anything else. (This
3117is used when GCC itself is being built.) @xref{Spec Files}.
74291a4b
MM
3118@end table
3119
3120@node Optimize Options
3121@section Options That Control Optimization
3122@cindex optimize options
3123@cindex options, optimization
3124
3125These options control various sorts of optimizations:
3126
2642624b 3127@table @gcctabopt
74291a4b
MM
3128@item -O
3129@itemx -O1
cd3bb277
JM
3130@opindex O
3131@opindex O1
74291a4b
MM
3132Optimize. Optimizing compilation takes somewhat more time, and a lot
3133more memory for a large function.
3134
630d3d5a 3135Without @option{-O}, the compiler's goal is to reduce the cost of
74291a4b
MM
3136compilation and to make debugging produce the expected results.
3137Statements are independent: if you stop the program with a breakpoint
3138between statements, you can then assign a new value to any variable or
3139change the program counter to any other statement in the function and
3140get exactly the results you would expect from the source code.
3141
630d3d5a 3142With @option{-O}, the compiler tries to reduce code size and execution
9c34dbbf
ZW
3143time, without performing any optimizations that take a great deal of
3144compilation time.
74291a4b
MM
3145
3146@item -O2
cd3bb277 3147@opindex O2
0c2d1a2a 3148Optimize even more. GCC performs nearly all supported optimizations
74291a4b 3149that do not involve a space-speed tradeoff. The compiler does not
630d3d5a
JM
3150perform loop unrolling or function inlining when you specify @option{-O2}.
3151As compared to @option{-O}, this option increases both compilation time
74291a4b
MM
3152and the performance of the generated code.
3153
630d3d5a 3154@option{-O2} turns on all optional optimizations except for loop unrolling,
2b2a8f1f 3155function inlining, and register renaming. It also turns on the
630d3d5a 3156@option{-fforce-mem} option on all machines and frame pointer elimination
2b2a8f1f 3157on machines where doing so does not interfere with debugging.
74291a4b 3158
081ca317
BL
3159Please note the warning under @option{-fgcse} about
3160invoking @option{-O2} on programs that use computed gotos.
3161
74291a4b 3162@item -O3
cd3bb277 3163@opindex O3
630d3d5a
JM
3164Optimize yet more. @option{-O3} turns on all optimizations specified by
3165@option{-O2} and also turns on the @option{-finline-functions} and
3166@option{-frename-registers} options.
74291a4b
MM
3167
3168@item -O0
cd3bb277 3169@opindex O0
74291a4b
MM
3170Do not optimize.
3171
c6aded7c 3172@item -Os
cd3bb277 3173@opindex Os
630d3d5a 3174Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
c6aded7c
AG
3175do not typically increase code size. It also performs further
3176optimizations designed to reduce code size.
3177
630d3d5a 3178If you use multiple @option{-O} options, with or without level numbers,
74291a4b
MM
3179the last such option is the one that is effective.
3180@end table
3181
630d3d5a 3182Options of the form @option{-f@var{flag}} specify machine-independent
74291a4b 3183flags. Most flags have both positive and negative forms; the negative
630d3d5a 3184form of @option{-ffoo} would be @option{-fno-foo}. In the table below,
74291a4b
MM
3185only one of the forms is listed---the one which is not the default.
3186You can figure out the other form by either removing @samp{no-} or
3187adding it.
3188
2642624b 3189@table @gcctabopt
74291a4b 3190@item -ffloat-store
cd3bb277 3191@opindex ffloat-store
74291a4b
MM
3192Do not store floating point variables in registers, and inhibit other
3193options that might change whether a floating point value is taken from a
3194register or memory.
3195
3196@cindex floating point precision
3197This option prevents undesirable excess precision on machines such as
3198the 68000 where the floating registers (of the 68881) keep more
3199precision than a @code{double} is supposed to have. Similarly for the
3200x86 architecture. For most programs, the excess precision does only
3201good, but a few programs rely on the precise definition of IEEE floating
630d3d5a 3202point. Use @option{-ffloat-store} for such programs, after modifying
6fd74494 3203them to store all pertinent intermediate computations into variables.
74291a4b
MM
3204
3205@item -fno-default-inline
cd3bb277 3206@opindex fno-default-inline
74291a4b
MM
3207Do not make member functions inline by default merely because they are
3208defined inside the class scope (C++ only). Otherwise, when you specify
630d3d5a 3209@w{@option{-O}}, member functions defined inside class scope are compiled
74291a4b
MM
3210inline by default; i.e., you don't need to add @samp{inline} in front of
3211the member function name.
3212
3213@item -fno-defer-pop
cd3bb277 3214@opindex fno-defer-pop
74291a4b
MM
3215Always pop the arguments to each function call as soon as that function
3216returns. For machines which must pop arguments after a function call,
3217the compiler normally lets arguments accumulate on the stack for several
3218function calls and pops them all at once.
3219
3220@item -fforce-mem
cd3bb277 3221@opindex fforce-mem
74291a4b
MM
3222Force memory operands to be copied into registers before doing
3223arithmetic on them. This produces better code by making all memory
3224references potential common subexpressions. When they are not common
3225subexpressions, instruction combination should eliminate the separate
630d3d5a 3226register-load. The @option{-O2} option turns on this option.
74291a4b
MM
3227
3228@item -fforce-addr
cd3bb277 3229@opindex fforce-addr
74291a4b
MM
3230Force memory address constants to be copied into registers before
3231doing arithmetic on them. This may produce better code just as
630d3d5a 3232@option{-fforce-mem} may.
74291a4b
MM
3233
3234@item -fomit-frame-pointer
cd3bb277 3235@opindex fomit-frame-pointer
74291a4b
MM
3236Don't keep the frame pointer in a register for functions that
3237don't need one. This avoids the instructions to save, set up and
3238restore frame pointers; it also makes an extra register available
3239in many functions. @strong{It also makes debugging impossible on
3240some machines.}
3241
8aeea6e6 3242On some machines, such as the VAX, this flag has no effect, because
74291a4b
MM
3243the standard calling sequence automatically handles the frame pointer
3244and nothing is saved by pretending it doesn't exist. The
3245machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3246whether a target machine supports this flag. @xref{Registers,,Register
b11cc610 3247Usage, gccint, GNU Compiler Collection (GCC) Internals}.
74291a4b 3248
1aaef9c1 3249@item -foptimize-sibling-calls
cd3bb277 3250@opindex foptimize-sibling-calls
1aaef9c1
JH
3251Optimize sibling and tail recursive calls.
3252
91ce572a 3253@item -ftrapv
cd3bb277 3254@opindex ftrapv
91ce572a
CC
3255This option generates traps for signed overflow on addition, subtraction,
3256multiplication operations.
3257
74291a4b 3258@item -fno-inline
cd3bb277 3259@opindex fno-inline
74291a4b
MM
3260Don't pay attention to the @code{inline} keyword. Normally this option
3261is used to keep the compiler from expanding any functions inline.
3262Note that if you are not optimizing, no functions can be expanded inline.
3263
3264@item -finline-functions
cd3bb277 3265@opindex finline-functions
74291a4b
MM
3266Integrate all simple functions into their callers. The compiler
3267heuristically decides which functions are simple enough to be worth
3268integrating in this way.
3269
3270If all calls to a given function are integrated, and the function is
3271declared @code{static}, then the function is normally not output as
3272assembler code in its own right.
3273
efa3896a 3274@item -finline-limit=@var{n}
cd3bb277 3275@opindex finline-limit
f9e814f1
TP
3276By default, gcc limits the size of functions that can be inlined. This flag
3277allows the control of this limit for functions that are explicitly marked as
02f52e19
AJ
3278inline (ie marked with the inline keyword or defined within the class
3279definition in c++). @var{n} is the size of functions that can be inlined in
f9e814f1 3280number of pseudo instructions (not counting parameter handling). The default
93ee12c4
GP
3281value of @var{n} is 600.
3282Increasing this value can result in more inlined code at
f9e814f1 3283the cost of compilation time and memory consumption. Decreasing usually makes
02f52e19
AJ
3284the compilation faster and less code will be inlined (which presumably
3285means slower programs). This option is particularly useful for programs that
aee96fe9 3286use inlining heavily such as those based on recursive templates with C++.
f9e814f1
TP
3287
3288@emph{Note:} pseudo instruction represents, in this particular context, an
3289abstract measurement of function's size. In no way, it represents a count
3290of assembly instructions and as such its exact meaning might change from one
3291release to an another.
3292
74291a4b 3293@item -fkeep-inline-functions
cd3bb277 3294@opindex fkeep-inline-functions
74291a4b
MM
3295Even if all calls to a given function are integrated, and the function
3296is declared @code{static}, nevertheless output a separate run-time
3297callable version of the function. This switch does not affect
3298@code{extern inline} functions.
3299
3300@item -fkeep-static-consts
cd3bb277 3301@opindex fkeep-static-consts
74291a4b
MM
3302Emit variables declared @code{static const} when optimization isn't turned
3303on, even if the variables aren't referenced.
3304
0c2d1a2a 3305GCC enables this option by default. If you want to force the compiler to
74291a4b 3306check if the variable was referenced, regardless of whether or not
630d3d5a 3307optimization is turned on, use the @option{-fno-keep-static-consts} option.
74291a4b 3308
201556f0
JJ
3309@item -fmerge-constants
3310Attempt to merge identical constants (string constants and floating point
3311constants) accross compilation units.
3312
3313This option is default for optimized compilation if assembler and linker
c21cd8b1 3314support it. Use @option{-fno-merge-constants} to inhibit this behavior.
201556f0
JJ
3315
3316@item -fmerge-all-constants
3317Attempt to merge identical constants and identical variables.
3318
3319This option implies @option{-fmerge-constants}. In addition to
3320@option{-fmerge-constants} this considers e.g. even constant initialized
3321arrays or initialized constant variables with integral or floating point
3322types. Languages like C or C++ require each non-automatic variable to
3323have distinct location, so using this option will result in non-conforming
c21cd8b1 3324behavior.
201556f0 3325
74291a4b 3326@item -fno-function-cse
cd3bb277 3327@opindex fno-function-cse
74291a4b
MM
3328Do not put function addresses in registers; make each instruction that
3329calls a constant function contain the function's address explicitly.
3330
3331This option results in less efficient code, but some strange hacks
3332that alter the assembler output may be confused by the optimizations
3333performed when this option is not used.
3334
3335@item -ffast-math
cd3bb277 3336@opindex ffast-math
9c34dbbf
ZW
3337Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, and @*
3338@option{-fno-trapping-math}.
de6c5979 3339
630d3d5a 3340This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
74291a4b 3341
630d3d5a 3342This option should never be turned on by any @option{-O} option since
74291a4b 3343it can result in incorrect output for programs which depend on
c1030c7c 3344an exact implementation of IEEE or ISO rules/specifications for
74291a4b 3345math functions.
9605da8a
BL
3346
3347@item -fno-math-errno
cd3bb277 3348@opindex fno-math-errno
9605da8a
BL
3349Do not set ERRNO after calling math functions that are executed
3350with a single instruction, e.g., sqrt. A program that relies on
3351IEEE exceptions for math error handling may want to use this flag
3352for speed while maintaining IEEE arithmetic compatibility.
3353
630d3d5a 3354This option should never be turned on by any @option{-O} option since
de6c5979
BL
3355it can result in incorrect output for programs which depend on
3356an exact implementation of IEEE or ISO rules/specifications for
3357math functions.
3358
9c34dbbf 3359The default is @option{-fmath-errno}.
de6c5979
BL
3360
3361@item -funsafe-math-optimizations
cd3bb277 3362@opindex funsafe-math-optimizations
de6c5979
BL
3363Allow optimizations for floating-point arithmetic that (a) assume
3364that arguments and results are valid and (b) may violate IEEE or
237b14f7
RH
3365ANSI standards. When used at link-time, it may include libraries
3366or startup files that change the default FPU control word or other
3367similar optimizations.
de6c5979 3368
630d3d5a 3369This option should never be turned on by any @option{-O} option since
de6c5979
BL
3370it can result in incorrect output for programs which depend on
3371an exact implementation of IEEE or ISO rules/specifications for
3372math functions.
3373
9c34dbbf 3374The default is @option{-fno-unsafe-math-optimizations}.
de6c5979
BL
3375
3376@item -fno-trapping-math
cd3bb277 3377@opindex fno-trapping-math
de6c5979
BL
3378Compile code assuming that floating-point operations cannot generate
3379user-visible traps. Setting this option may allow faster code
3380if one relies on ``non-stop'' IEEE arithmetic, for example.
3381
630d3d5a 3382This option should never be turned on by any @option{-O} option since
de6c5979
BL
3383it can result in incorrect output for programs which depend on
3384an exact implementation of IEEE or ISO rules/specifications for
3385math functions.
3386
9c34dbbf 3387The default is @option{-ftrapping-math}.
74291a4b
MM
3388@end table
3389
630d3d5a
JM
3390The following options control specific optimizations. The @option{-O2}
3391option turns on all of these optimizations except @option{-funroll-loops}
3392and @option{-funroll-all-loops}. On most machines, the @option{-O} option
3393turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options,
74291a4b
MM
3394but specific machines may handle it differently.
3395
3396You can use the following flags in the rare cases when ``fine-tuning''
3397of optimizations to be performed is desired.
3398
9c34dbbf
ZW
3399Not all of the optimizations performed by GCC have @option{-f} options
3400to control them.
3401
ad919812 3402@table @gcctabopt
74291a4b 3403@item -fstrength-reduce
cd3bb277 3404@opindex fstrength-reduce
74291a4b
MM
3405Perform the optimizations of loop strength reduction and
3406elimination of iteration variables.
3407
3408@item -fthread-jumps
cd3bb277 3409@opindex fthread-jumps
74291a4b
MM
3410Perform optimizations where we check to see if a jump branches to a
3411location where another comparison subsumed by the first is found. If
3412so, the first branch is redirected to either the destination of the
3413second branch or a point immediately following it, depending on whether
3414the condition is known to be true or false.
3415
3416@item -fcse-follow-jumps
cd3bb277 3417@opindex fcse-follow-jumps
74291a4b
MM
3418In common subexpression elimination, scan through jump instructions
3419when the target of the jump is not reached by any other path. For
3420example, when CSE encounters an @code{if} statement with an
3421@code{else} clause, CSE will follow the jump when the condition
3422tested is false.
3423
3424@item -fcse-skip-blocks
cd3bb277 3425@opindex fcse-skip-blocks
630d3d5a 3426This is similar to @option{-fcse-follow-jumps}, but causes CSE to
74291a4b
MM
3427follow jumps which conditionally skip over blocks. When CSE
3428encounters a simple @code{if} statement with no else clause,
630d3d5a 3429@option{-fcse-skip-blocks} causes CSE to follow the jump around the
74291a4b
MM
3430body of the @code{if}.
3431
3432@item -frerun-cse-after-loop
cd3bb277 3433@opindex frerun-cse-after-loop
74291a4b
MM
3434Re-run common subexpression elimination after loop optimizations has been
3435performed.
3436
6d6d0fa0 3437@item -frerun-loop-opt
cd3bb277 3438@opindex frerun-loop-opt
6d6d0fa0
JL
3439Run the loop optimizer twice.
3440
7506f491 3441@item -fgcse
cd3bb277 3442@opindex fgcse
7506f491
DE
3443Perform a global common subexpression elimination pass.
3444This pass also performs global constant and copy propagation.
3445
081ca317
BL
3446@emph{Note:} When compiling a program using computed gotos, a GCC
3447extension, you may get better runtime performance if you disable
3448the global common subexpression elmination pass by adding
3449@option{-fno-gcse} to the command line.
3450
a13d4ebf 3451@item -fgcse-lm
cd3bb277 3452@opindex fgcse-lm
695ac33f 3453When @option{-fgcse-lm} is enabled, global common subexpression elimination will
767094dd 3454attempt to move loads which are only killed by stores into themselves. This
a13d4ebf 3455allows a loop containing a load/store sequence to be changed to a load outside
02f52e19 3456the loop, and a copy/store within the loop.
a13d4ebf
AM
3457
3458@item -fgcse-sm
cd3bb277 3459@opindex fgcse-sm
695ac33f 3460When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
767094dd 3461subexpression elimination. This pass will attempt to move stores out of loops.
695ac33f 3462When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
a13d4ebf
AM
3463can be changed to a load before the loop and a store after the loop.
3464
b6d24183 3465@item -fdelete-null-pointer-checks
cd3bb277 3466@opindex fdelete-null-pointer-checks
9c34dbbf
ZW
3467Use global dataflow analysis to identify and eliminate useless checks
3468for null pointers. The compiler assumes that dereferencing a null
3469pointer would have halted the program. If a pointer is checked after
3470it has already been dereferenced, it cannot be null.
3471
3472In some environments, this assumption is not true, and programs can
3473safely dereference null pointers. Use
3474@option{-fno-delete-null-pointer-checks} to disable this optimization
3475for programs which depend on that behavior.
b6d24183 3476
74291a4b 3477@item -fexpensive-optimizations
cd3bb277 3478@opindex fexpensive-optimizations
74291a4b
MM
3479Perform a number of minor optimizations that are relatively expensive.
3480
639726ba 3481@item -foptimize-register-move
59d40964 3482@itemx -fregmove
cd3bb277
JM
3483@opindex foptimize-register-move
3484@opindex fregmove
9ec36da5
JL
3485Attempt to reassign register numbers in move instructions and as
3486operands of other simple instructions in order to maximize the amount of
56159047 3487register tying. This is especially helpful on machines with two-operand
630d3d5a 3488instructions. GCC enables this optimization by default with @option{-O2}
9ec36da5
JL
3489or higher.
3490
bedc7537 3491Note @option{-fregmove} and @option{-foptimize-register-move} are the same
9ec36da5
JL
3492optimization.
3493
74291a4b 3494@item -fdelayed-branch
cd3bb277 3495@opindex fdelayed-branch
74291a4b
MM
3496If supported for the target machine, attempt to reorder instructions
3497to exploit instruction slots available after delayed branch
3498instructions.
3499
3500@item -fschedule-insns
cd3bb277 3501@opindex fschedule-insns
74291a4b
MM
3502If supported for the target machine, attempt to reorder instructions to
3503eliminate execution stalls due to required data being unavailable. This
3504helps machines that have slow floating point or memory load instructions
3505by allowing other instructions to be issued until the result of the load
3506or floating point instruction is required.
3507
3508@item -fschedule-insns2
cd3bb277 3509@opindex fschedule-insns2
630d3d5a 3510Similar to @option{-fschedule-insns}, but requests an additional pass of
74291a4b
MM
3511instruction scheduling after register allocation has been done. This is
3512especially useful on machines with a relatively small number of
3513registers and where memory load instructions take more than one cycle.
3514
3515@item -ffunction-sections
59d40964 3516@itemx -fdata-sections
cd3bb277
JM
3517@opindex ffunction-sections
3518@opindex fdata-sections
7d0756fb
CM
3519Place each function or data item into its own section in the output
3520file if the target supports arbitrary sections. The name of the
3521function or the name of the data item determines the section's name
3522in the output file.
74291a4b 3523
7d0756fb 3524Use these options on systems where the linker can perform optimizations
74291a4b
MM
3525to improve locality of reference in the instruction space. HPPA
3526processors running HP-UX and Sparc processors running Solaris 2 have
3527linkers with such optimizations. Other systems using the ELF object format
3528as well as AIX may have these optimizations in the future.
3529
7d0756fb
CM
3530Only use these options when there are significant benefits from doing
3531so. When you specify these options, the assembler and linker will
74291a4b
MM
3532create larger object and executable files and will also be slower.
3533You will not be able to use @code{gprof} on all systems if you
3534specify this option and you may have problems with debugging if
630d3d5a 3535you specify both this option and @option{-g}.
74291a4b
MM
3536
3537@item -fcaller-saves
cd3bb277 3538@opindex fcaller-saves
74291a4b
MM
3539Enable values to be allocated in registers that will be clobbered by
3540function calls, by emitting extra instructions to save and restore the
3541registers around such calls. Such allocation is done only when it
3542seems to result in better code than would otherwise be produced.
3543
81610a0d
HPN
3544This option is always enabled by default on certain machines, usually
3545those which have no call-preserved registers to use instead.
3546
3547For all machines, optimization level 2 and higher enables this flag by
3548default.
74291a4b
MM
3549
3550@item -funroll-loops
cd3bb277 3551@opindex funroll-loops
9c34dbbf
ZW
3552Unroll loops whose number of iterations can be determined at compile
3553time or upon entry to the loop. @option{-funroll-loops} implies both
3554@option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This
3555option makes code larger, and may or may not make it run faster.
74291a4b
MM
3556
3557@item -funroll-all-loops
cd3bb277 3558@opindex funroll-all-loops
9c34dbbf
ZW
3559Unroll all loops, even if their number of iterations is uncertain when
3560the loop is entered. This usually makes programs run more slowly.
3561@option{-funroll-all-loops} implies the same options as
3562@option{-funroll-loops},
3563
0dd0e980
JH
3564@item -fprefetch-loop-arrays
3565@opindex fprefetch-loop-arrays
3566If supported by the target machine, generate instructions to prefetch
3567memory to improve the performance of loops that access large arrays.
74291a4b 3568
e5eb27e5 3569@item -fmove-all-movables
cd3bb277 3570@opindex fmove-all-movables
e5eb27e5
JL
3571Forces all invariant computations in loops to be moved
3572outside the loop.
3573
3574@item -freduce-all-givs
cd3bb277 3575@opindex freduce-all-givs
e5eb27e5
JL
3576Forces all general-induction variables in loops to be
3577strength-reduced.
3578
3579@emph{Note:} When compiling programs written in Fortran,
630d3d5a 3580@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
e5eb27e5
JL
3581by default when you use the optimizer.
3582
3583These options may generate better or worse code; results are highly
3584dependent on the structure of loops within the source code.
3585
3586These two options are intended to be removed someday, once
3587they have helped determine the efficacy of various
3588approaches to improving loop optimizations.
3589
2642624b 3590Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
e5eb27e5
JL
3591know how use of these options affects
3592the performance of your production code.
3593We're very interested in code that runs @emph{slower}
3594when these options are @emph{enabled}.
3595
74291a4b 3596@item -fno-peephole
6cfc0341 3597@itemx -fno-peephole2
cd3bb277 3598@opindex fno-peephole
6cfc0341
RH
3599@opindex fno-peephole2
3600Disable any machine-specific peephole optimizations. The difference
630d3d5a 3601between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6cfc0341
RH
3602are implemented in the compiler; some targets use one, some use the
3603other, a few use both.
861bb6c1
JL
3604
3605@item -fbranch-probabilities
cd3bb277 3606@opindex fbranch-probabilities
630d3d5a 3607After running a program compiled with @option{-fprofile-arcs}
861bb6c1 3608(@pxref{Debugging Options,, Options for Debugging Your Program or
bedc7537 3609@command{gcc}}), you can compile it a second time using
630d3d5a 3610@option{-fbranch-probabilities}, to improve optimizations based on
3de87bf2
JJ
3611the number of times each branch was taken. When the program
3612compiled with @option{-fprofile-arcs} exits it saves arc execution
3613counts to a file called @file{@var{sourcename}.da} for each source
3614file The information in this data file is very dependent on the
3615structure of the generated code, so you must use the same source code
3616and the same optimization options for both compilations.
861bb6c1 3617
630d3d5a 3618With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
861bb6c1
JL
3619note on the first instruction of each basic block, and a
3620@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
3621These can be used to improve optimization. Currently, they are only
3622used in one place: in @file{reorg.c}, instead of guessing which path a
3623branch is mostly to take, the @samp{REG_BR_PROB} values are used to
3624exactly determine which path is taken more often.
8c660648 3625
454d0cc7 3626@item -fno-guess-branch-probability
cd3bb277 3627@opindex fno-guess-branch-probability
9c34dbbf
ZW
3628Do not guess branch probabilities using a randomized model.
3629
3630Sometimes gcc will opt to use a randomized model to guess branch
3631probabilities, when none are available from either profiling feedback
3632(@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that
3633different runs of the compiler on the same program may produce different
3634object code.
3635
3636In a hard real-time system, people don't want different runs of the
3637compiler to produce code that has different behavior; minimizing
3638non-determinism is of paramount import. This switch allows users to
3639reduce non-determinism, possibly at the expense of inferior
3640optimization.
454d0cc7 3641
41472af8 3642@item -fstrict-aliasing
cd3bb277 3643@opindex fstrict-aliasing
41472af8
MM
3644Allows the compiler to assume the strictest aliasing rules applicable to
3645the language being compiled. For C (and C++), this activates
3646optimizations based on the type of expressions. In particular, an
3647object of one type is assumed never to reside at the same address as an
3648object of a different type, unless the types are almost the same. For
3649example, an @code{unsigned int} can alias an @code{int}, but not a
3650@code{void*} or a @code{double}. A character type may alias any other
02f52e19 3651type.
41472af8
MM
3652
3653Pay special attention to code like this:
3654@example
02f52e19 3655union a_union @{
41472af8
MM
3656 int i;
3657 double d;
3658@};
3659
3660int f() @{
3661 a_union t;
3662 t.d = 3.0;
3663 return t.i;
3664@}
3665@end example
3666The practice of reading from a different union member than the one most
3667recently written to (called ``type-punning'') is common. Even with
630d3d5a 3668@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
41472af8
MM
3669is accessed through the union type. So, the code above will work as
3670expected. However, this code might not:
3671@example
02f52e19 3672int f() @{
41472af8
MM
3673 a_union t;
3674 int* ip;
3675 t.d = 3.0;
3676 ip = &t.i;
3677 return *ip;
3678@}
3679@end example
3680
41472af8
MM
3681Every language that wishes to perform language-specific alias analysis
3682should define a function that computes, given an @code{tree}
3683node, an alias set for the node. Nodes in different alias sets are not
3684allowed to alias. For an example, see the C front-end function
3685@code{c_get_alias_set}.
41472af8 3686
efa3896a
GK
3687@item -falign-functions
3688@itemx -falign-functions=@var{n}
cd3bb277 3689@opindex falign-functions
efa3896a
GK
3690Align the start of functions to the next power-of-two greater than
3691@var{n}, skipping up to @var{n} bytes. For instance,
630d3d5a
JM
3692@option{-falign-functions=32} aligns functions to the next 32-byte
3693boundary, but @option{-falign-functions=24} would align to the next
efa3896a
GK
369432-byte boundary only if this can be done by skipping 23 bytes or less.
3695
630d3d5a 3696@option{-fno-align-functions} and @option{-falign-functions=1} are
efa3896a
GK
3697equivalent and mean that functions will not be aligned.
3698
3699Some assemblers only support this flag when @var{n} is a power of two;
3700in that case, it is rounded up.
3701
3702If @var{n} is not specified, use a machine-dependent default.
3703
3704@item -falign-labels
3705@itemx -falign-labels=@var{n}
cd3bb277 3706@opindex falign-labels
efa3896a 3707Align all branch targets to a power-of-two boundary, skipping up to
630d3d5a 3708@var{n} bytes like @option{-falign-functions}. This option can easily
efa3896a
GK
3709make code slower, because it must insert dummy operations for when the
3710branch target is reached in the usual flow of the code.
3711
630d3d5a 3712If @option{-falign-loops} or @option{-falign-jumps} are applicable and
efa3896a
GK
3713are greater than this value, then their values are used instead.
3714
3715If @var{n} is not specified, use a machine-dependent default which is
3716very likely to be @samp{1}, meaning no alignment.
3717
3718@item -falign-loops
3719@itemx -falign-loops=@var{n}
cd3bb277 3720@opindex falign-loops
efa3896a 3721Align loops to a power-of-two boundary, skipping up to @var{n} bytes
630d3d5a 3722like @option{-falign-functions}. The hope is that the loop will be
efa3896a
GK
3723executed many times, which will make up for any execution of the dummy
3724operations.
3725
3726If @var{n} is not specified, use a machine-dependent default.
3727
3728@item -falign-jumps
3729@itemx -falign-jumps=@var{n}
cd3bb277 3730@opindex falign-jumps
efa3896a
GK
3731Align branch targets to a power-of-two boundary, for branch targets
3732where the targets can only be reached by jumping, skipping up to @var{n}
630d3d5a 3733bytes like @option{-falign-functions}. In this case, no dummy operations
efa3896a
GK
3734need be executed.
3735
3736If @var{n} is not specified, use a machine-dependent default.
3737
4bae0b47 3738@item -fssa
cd3bb277 3739@opindex fssa
4bae0b47
AS
3740Perform optimizations in static single assignment form. Each function's
3741flow graph is translated into SSA form, optimizations are performed, and
90ecce3e 3742the flow graph is translated back from SSA form. Users should not
b53978a3
JO
3743specify this option, since it is not yet ready for production use.
3744
0b47e4c1
JL
3745@item -fssa-ccp
3746@opindex fssa-ccp
3747Perform Sparse Conditional Constant Propagation in SSA form. Requires
3748@option{-fssa}. Like @option{-fssa}, this is an experimental feature.
3749
62d285ff
JL
3750@item -fssa-dce
3751@opindex fssa-dce
3752Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}.
3753Like @option{-fssa}, this is an experimental feature.
4bae0b47 3754
46d3a873 3755@item -fsingle-precision-constant
cd3bb277 3756@opindex fsingle-precision-constant
46d3a873
CC
3757Treat floating point constant as single precision constant instead of
3758implicitly converting it to double precision constant.
3759
2b2a8f1f 3760@item -frename-registers
cd3bb277 3761@opindex frename-registers
c771326b 3762Attempt to avoid false dependencies in scheduled code by making use
2b2a8f1f
RH
3763of registers left over after register allocation. This optimization
3764will most benefit processors with lots of registers. It can, however,
3765make debugging impossible, since variables will no longer stay in
3766a ``home register''.
3af64fd6 3767
8582c27b
RH
3768@item -fno-cprop-registers
3769@opindex fno-cprop-registers
3770After register allocation and post-register allocation instruction splitting,
3771we perform a copy-propagation pass to try to reduce scheduling dependencies
3772and occasionally eliminate the copy.
3773
3af64fd6 3774@item --param @var{name}=@var{value}
cd3bb277 3775@opindex param
3af64fd6
MM
3776In some places, GCC uses various constants to control the amount of
3777optimization that is done. For example, GCC will not inline functions
3778that contain more that a certain number of instructions. You can
3779control some of these constants on the command-line using the
630d3d5a 3780@option{--param} option.
3af64fd6 3781
4fe9b91c 3782In each case, the @var{value} is an integer. The allowable choices for
3af64fd6
MM
3783@var{name} are given in the following table:
3784
3785@table @gcctabopt
1c4c47db
JO
3786@item max-delay-slot-insn-search
3787The maximum number of instructions to consider when looking for an
3788instruction to fill a delay slot. If more than this arbitrary number of
3789instructions is searched, the time savings from filling the delay slot
3790will be minimal so stop searching. Increasing values mean more
3791aggressive optimization, making the compile time increase with probably
3792small improvement in executable run time.
3793
3794@item max-delay-slot-live-search
3795When trying to fill delay slots, the maximum number of instructions to
3796consider when searching for a block with valid live register
3797information. Increasing this arbitrarily chosen value means more
3798aggressive optimization, increasing the compile time. This parameter
3799should be removed when the delay slot code is rewritten to maintain the
3800control-flow graph.
33d3b05b
MM
3801
3802@item max-gcse-memory
3803The approximate maximum amount of memory that will be allocated in
3804order to perform the global common subexpression elimination
3805optimization. If more memory than specified is required, the
3806optimization will not be done.
3af64fd6 3807
740f35a0 3808@item max-gcse-passes
7dac2f89 3809The maximum number of passes of GCSE to run.
740f35a0 3810
4a121cc3 3811@item max-pending-list-length
0c688a7d 3812The maximum number of pending dependencies scheduling will allow
4a121cc3
AM
3813before flushing the current state and starting over. Large functions
3814with few branches or calls can create excessively large lists which
3815needlessly consume memory and resources.
3816
1c4c47db
JO
3817@item max-inline-insns
3818If an function contains more than this many instructions, it
3819will not be inlined. This option is precisely equivalent to
630d3d5a 3820@option{-finline-limit}.
1c4c47db
JO
3821
3822@end table
74291a4b
MM
3823@end table
3824
3825@node Preprocessor Options
3826@section Options Controlling the Preprocessor
3827@cindex preprocessor options
3828@cindex options, preprocessor
3829
3830These options control the C preprocessor, which is run on each C source
3831file before actual compilation.
3832
630d3d5a
JM
3833If you use the @option{-E} option, nothing is done except preprocessing.
3834Some of these options make sense only together with @option{-E} because
74291a4b
MM
3835they cause the preprocessor output to be unsuitable for actual
3836compilation.
3837
2642624b 3838@table @gcctabopt
74291a4b 3839@item -include @var{file}
cd3bb277 3840@opindex include
74291a4b 3841Process @var{file} as input before processing the regular input file.
630d3d5a
JM
3842In effect, the contents of @var{file} are compiled first. Any @option{-D}
3843and @option{-U} options on the command line are always processed before
3844@option{-include @var{file}}, regardless of the order in which they are
3845written. All the @option{-include} and @option{-imacros} options are
74291a4b
MM
3846processed in the order in which they are written.
3847
3848@item -imacros @var{file}
cd3bb277 3849@opindex imacros
74291a4b
MM
3850Process @var{file} as input, discarding the resulting output, before
3851processing the regular input file. Because the output generated from
630d3d5a 3852@var{file} is discarded, the only effect of @option{-imacros @var{file}}
74291a4b 3853is to make the macros defined in @var{file} available for use in the
630d3d5a 3854main input. All the @option{-include} and @option{-imacros} options are
e582248c 3855processed in the order in which they are written.
74291a4b
MM
3856
3857@item -idirafter @var{dir}
cd3bb277 3858@opindex idirafter
74291a4b
MM
3859@cindex second include path
3860Add the directory @var{dir} to the second include path. The directories
3861on the second include path are searched when a header file is not found
3862in any of the directories in the main include path (the one that
630d3d5a 3863@option{-I} adds to).
74291a4b
MM
3864
3865@item -iprefix @var{prefix}
cd3bb277 3866@opindex iprefix
630d3d5a 3867Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
74291a4b
MM
3868options.
3869
3870@item -iwithprefix @var{dir}
cd3bb277 3871@opindex iwithprefix
74291a4b
MM
3872Add a directory to the second include path. The directory's name is
3873made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
630d3d5a 3874specified previously with @option{-iprefix}. If you have not specified a
74291a4b
MM
3875prefix yet, the directory containing the installed passes of the
3876compiler is used as the default.
3877
3878@item -iwithprefixbefore @var{dir}
cd3bb277 3879@opindex iwithprefixbefore
74291a4b
MM
3880Add a directory to the main include path. The directory's name is made
3881by concatenating @var{prefix} and @var{dir}, as in the case of
630d3d5a 3882@option{-iwithprefix}.
74291a4b
MM
3883
3884@item -isystem @var{dir}
cd3bb277 3885@opindex isystem
74291a4b
MM
3886Add a directory to the beginning of the second include path, marking it
3887as a system directory, so that it gets the same special treatment as
3888is applied to the standard system directories.
3889
3890@item -nostdinc
cd3bb277 3891@opindex nostdinc
74291a4b 3892Do not search the standard system directories for header files. Only
630d3d5a 3893the directories you have specified with @option{-I} options (and the
74291a4b 3894current directory, if appropriate) are searched. @xref{Directory
630d3d5a 3895Options}, for information on @option{-I}.
74291a4b 3896
dfb5868d
NS
3897By using both @option{-nostdinc} and @option{-I-}, you can limit the include-file
3898search path to only those directories you specify explicitly.
74291a4b 3899
e582248c 3900@item -remap
cd3bb277 3901@opindex remap
e582248c
NB
3902When searching for a header file in a directory, remap file names if a
3903file named @file{header.gcc} exists in that directory. This can be used
3904to work around limitations of file systems with file name restrictions.
3905The @file{header.gcc} file should contain a series of lines with two
3906tokens on each line: the first token is the name to map, and the second
3907token is the actual name to use.
3908
74291a4b 3909@item -undef
cd3bb277 3910@opindex undef
74291a4b
MM
3911Do not predefine any nonstandard macros. (Including architecture flags).
3912
3913@item -E
cd3bb277 3914@opindex E
74291a4b
MM
3915Run only the C preprocessor. Preprocess all the C source files
3916specified and output the results to standard output or to the
3917specified output file.
3918
3919@item -C
cd3bb277 3920@opindex C
74291a4b 3921Tell the preprocessor not to discard comments. Used with the
630d3d5a 3922@option{-E} option.
74291a4b
MM
3923
3924@item -P
cd3bb277 3925@opindex P
74291a4b 3926Tell the preprocessor not to generate @samp{#line} directives.
630d3d5a 3927Used with the @option{-E} option.
74291a4b
MM
3928
3929@cindex make
3930@cindex dependencies, make
3931@item -M
cd3bb277 3932@opindex M
e582248c
NB
3933Instead of outputting the result of preprocessing, output a rule
3934suitable for @code{make} describing the dependencies of the main source
3935file. The preprocessor outputs one @code{make} rule containing the
3936object file name for that source file, a colon, and the names of all the
48ce6bbb
NS
3937included files. Unless overridden explicitly, the object file name
3938consists of the basename of the source file with any suffix replaced with
767094dd 3939object file suffix. If there are many included files then the
48ce6bbb 3940rule is split into several lines using @samp{\}-newline.
74291a4b 3941
630d3d5a 3942@option{-M} implies @option{-E}.
74291a4b 3943
e582248c 3944@item -MM
cd3bb277 3945@opindex MM
630d3d5a 3946Like @option{-M}, but mention only the files included with @samp{#include
e582248c
NB
3947"@var{file}"}. System header files included with @samp{#include
3948<@var{file}>} are omitted.
3949
7da723ef 3950@item -MD
cd3bb277 3951@opindex MD
630d3d5a 3952Like @option{-M} but the dependency information is written to a file
7da723ef 3953rather than stdout. @code{gcc} will use the same file name and
695ac33f 3954directory as the object file, but with the suffix @file{.d} instead.
7da723ef 3955
630d3d5a
JM
3956This is in addition to compiling the main file as specified---@option{-MD}
3957does not inhibit ordinary compilation the way @option{-M} does,
3958unless you also specify @option{-MG}.
7da723ef
NB
3959
3960With Mach, you can use the utility @code{md} to merge multiple
3961dependency files into a single dependency file suitable for using with
3962the @samp{make} command.
3963
d396403a 3964@item -MMD
cd3bb277 3965@opindex MMD
630d3d5a 3966Like @option{-MD} except mention only user header files, not system
7da723ef
NB
3967-header files.
3968
e582248c 3969@item -MF @var{file}
cd3bb277 3970@opindex MF
630d3d5a 3971When used with @option{-M} or @option{-MM}, specifies a file to write the
e582248c 3972dependencies to. This allows the preprocessor to write the preprocessed
630d3d5a 3973file to stdout normally. If no @option{-MF} switch is given, CPP sends
e582248c
NB
3974the rules to stdout and suppresses normal preprocessed output.
3975
74291a4b 3976Another way to specify output of a @code{make} rule is by setting
bedc7537 3977the environment variable @env{DEPENDENCIES_OUTPUT} (@pxref{Environment
74291a4b
MM
3978Variables}).
3979
74291a4b 3980@item -MG
cd3bb277 3981@opindex MG
630d3d5a 3982When used with @option{-M} or @option{-MM}, @option{-MG} says to treat missing
e582248c
NB
3983header files as generated files and assume they live in the same
3984directory as the source file. It suppresses preprocessed output, as a
3985missing header file is ordinarily an error.
3986
3987This feature is used in automatic updating of makefiles.
3988
3989@item -MP
cd3bb277 3990@opindex MP
e582248c
NB
3991This option instructs CPP to add a phony target for each dependency
3992other than the main file, causing each to depend on nothing. These
3993dummy rules work around errors @code{make} gives if you remove header
3994files without updating the @code{Makefile} to match.
3995
3996This is typical output:-
3997
3998@smallexample
3999/tmp/test.o: /tmp/test.c /tmp/test.h
4000
4001/tmp/test.h:
4002@end smallexample
4003
4004@item -MQ @var{target}
4005@item -MT @var{target}
cd3bb277
JM
4006@opindex MQ
4007@opindex MT
e582248c
NB
4008By default CPP uses the main file name, including any path, and appends
4009the object suffix, normally ``.o'', to it to obtain the name of the
630d3d5a 4010target for dependency generation. With @option{-MT} you can specify a
e582248c
NB
4011target yourself, overriding the default one.
4012
4013If you want multiple targets, you can specify them as a single argument
630d3d5a 4014to @option{-MT}, or use multiple @option{-MT} options.
e582248c
NB
4015
4016The targets you specify are output in the order they appear on the
630d3d5a
JM
4017command line. @option{-MQ} is identical to @option{-MT}, except that the
4018target name is quoted for Make, but with @option{-MT} it isn't. For
4019example, @option{-MT '$(objpfx)foo.o'} gives
e582248c
NB
4020
4021@smallexample
4022$(objpfx)foo.o: /tmp/foo.c
4023@end smallexample
4024
630d3d5a 4025but @option{-MQ '$(objpfx)foo.o'} gives
e582248c
NB
4026
4027@smallexample
4028$$(objpfx)foo.o: /tmp/foo.c
4029@end smallexample
4030
4031The default target is automatically quoted, as if it were given with
630d3d5a 4032@option{-MQ}.
74291a4b
MM
4033
4034@item -H
cd3bb277 4035@opindex H
74291a4b
MM
4036Print the name of each header file used, in addition to other normal
4037activities.
4038
4039@item -A@var{question}(@var{answer})
cd3bb277 4040@opindex A
74291a4b
MM
4041Assert the answer @var{answer} for @var{question}, in case it is tested
4042with a preprocessing conditional such as @samp{#if
630d3d5a 4043#@var{question}(@var{answer})}. @option{-A-} disables the standard
74291a4b
MM
4044assertions that normally describe the target machine.
4045
4046@item -D@var{macro}
cd3bb277 4047@opindex D
74291a4b
MM
4048Define macro @var{macro} with the string @samp{1} as its definition.
4049
4050@item -D@var{macro}=@var{defn}
630d3d5a
JM
4051Define macro @var{macro} as @var{defn}. All instances of @option{-D} on
4052the command line are processed before any @option{-U} options.
74291a4b 4053
630d3d5a
JM
4054Any @option{-D} and @option{-U} options on the command line are processed in
4055order, and always before @option{-imacros @var{file}}, regardless of the
e582248c
NB
4056order in which they are written.
4057
74291a4b 4058@item -U@var{macro}
cd3bb277 4059@opindex U
630d3d5a
JM
4060Undefine macro @var{macro}. @option{-U} options are evaluated after all
4061@option{-D} options, but before any @option{-include} and @option{-imacros}
74291a4b
MM
4062options.
4063
630d3d5a
JM
4064Any @option{-D} and @option{-U} options on the command line are processed in
4065order, and always before @option{-imacros @var{file}}, regardless of the
e582248c
NB
4066order in which they are written.
4067
74291a4b 4068@item -dM
cd3bb277 4069@opindex dM
74291a4b 4070Tell the preprocessor to output only a list of the macro definitions
630d3d5a 4071that are in effect at the end of preprocessing. Used with the @option{-E}
74291a4b
MM
4072option.
4073
4074@item -dD
cd3bb277 4075@opindex dD
74291a4b
MM
4076Tell the preprocessing to pass all macro definitions into the output, in
4077their proper sequence in the rest of the output.
4078
4079@item -dN
cd3bb277 4080@opindex dN
630d3d5a 4081Like @option{-dD} except that the macro arguments and contents are omitted.
74291a4b
MM
4082Only @samp{#define @var{name}} is included in the output.
4083
e582248c 4084@item -dI
cd3bb277 4085@opindex dI
e582248c
NB
4086Output @samp{#include} directives in addition to the result of
4087preprocessing.
4088
3bce8a01
NB
4089@item -fpreprocessed
4090@opindex fpreprocessed
4091Indicate to the preprocessor that the input file has already been
4092preprocessed. This suppresses things like macro expansion, trigraph
4093conversion, escaped newline splicing, and processing of most directives.
6d34c1c4
NB
4094The preprocessor still recognizes and removes comments, so that you can
4095pass a file preprocessed with @option{-C} to the compiler without
4096problems. In this mode the integrated preprocessor is little more than
4097a tokenizer for the front ends.
3bce8a01 4098
630d3d5a 4099@option{-fpreprocessed} is implicit if the input file has one of the
6d34c1c4
NB
4100extensions @samp{i}, @samp{ii} or @samp{mi}. These are the extensions
4101that GCC uses for preprocessed files created by @option{-save-temps}.
3bce8a01 4102
74291a4b 4103@item -trigraphs
cd3bb277 4104@opindex trigraphs
e582248c
NB
4105Process ISO standard trigraph sequences. These are three-character
4106sequences, all starting with @samp{??}, that are defined by ISO C to
4107stand for single characters. For example, @samp{??/} stands for
4108@samp{\}, so @samp{'??/n'} is a character constant for a newline. By
4109default, GCC ignores trigraphs, but in standard-conforming modes it
630d3d5a 4110converts them. See the @option{-std} and @option{-ansi} options.
e582248c
NB
4111
4112The nine trigraph sequences are
4113@table @samp
4114@item ??(
aee96fe9 4115@expansion{} @samp{[}
e582248c
NB
4116
4117@item ??)
aee96fe9 4118@expansion{} @samp{]}
e582248c
NB
4119
4120@item ??<
aee96fe9 4121@expansion{} @samp{@{}
e582248c
NB
4122
4123@item ??>
aee96fe9 4124@expansion{} @samp{@}}
e582248c
NB
4125
4126@item ??=
aee96fe9 4127@expansion{} @samp{#}
e582248c
NB
4128
4129@item ??/
aee96fe9 4130@expansion{} @samp{\}
e582248c
NB
4131
4132@item ??'
aee96fe9 4133@expansion{} @samp{^}
e582248c
NB
4134
4135@item ??!
aee96fe9 4136@expansion{} @samp{|}
e582248c
NB
4137
4138@item ??-
aee96fe9 4139@expansion{} @samp{~}
e582248c
NB
4140
4141@end table
4142
4143Trigraph support is not popular, so many compilers do not implement it
4144properly. Portable code should not rely on trigraphs being either
4145converted or ignored.
74291a4b 4146
aee96fe9 4147@item -Wp,@var{option}
cd3bb277 4148@opindex Wp
bedc7537 4149Pass @var{option} as an option to the preprocessor. If @var{option}
74291a4b
MM
4150contains commas, it is split into multiple options at the commas.
4151@end table
4152
4153@node Assembler Options
4154@section Passing Options to the Assembler
4155
4156@c prevent bad page break with this line
4157You can pass options to the assembler.
4158
2642624b 4159@table @gcctabopt
aee96fe9 4160@item -Wa,@var{option}
cd3bb277 4161@opindex Wa
74291a4b
MM
4162Pass @var{option} as an option to the assembler. If @var{option}
4163contains commas, it is split into multiple options at the commas.
4164@end table
4165
4166@node Link Options
4167@section Options for Linking
4168@cindex link options
4169@cindex options, linking
4170
4171These options come into play when the compiler links object files into
4172an executable output file. They are meaningless if the compiler is
4173not doing a link step.
4174
2642624b 4175@table @gcctabopt
74291a4b
MM
4176@cindex file names
4177@item @var{object-file-name}
4178A file name that does not end in a special recognized suffix is
4179considered to name an object file or library. (Object files are
4180distinguished from libraries by the linker according to the file
4181contents.) If linking is done, these object files are used as input
4182to the linker.
4183
4184@item -c
4185@itemx -S
4186@itemx -E
cd3bb277
JM
4187@opindex c
4188@opindex S
4189@opindex E
74291a4b
MM
4190If any of these options is used, then the linker is not run, and
4191object file names should not be used as arguments. @xref{Overall
4192Options}.
4193
4194@cindex Libraries
4195@item -l@var{library}
4275c4c4 4196@itemx -l @var{library}
cd3bb277 4197@opindex l
4275c4c4
JS
4198Search the library named @var{library} when linking. (The second
4199alternative with the library as a separate argument is only for
4200POSIX compliance and is not recommended.)
74291a4b
MM
4201
4202It makes a difference where in the command you write this option; the
4275c4c4 4203linker searches and processes libraries and object files in the order they
74291a4b
MM
4204are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4205after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
4206to functions in @samp{z}, those functions may not be loaded.
4207
4208The linker searches a standard list of directories for the library,
4209which is actually a file named @file{lib@var{library}.a}. The linker
4210then uses this file as if it had been specified precisely by name.
4211
4212The directories searched include several standard system directories
630d3d5a 4213plus any that you specify with @option{-L}.
74291a4b
MM
4214
4215Normally the files found this way are library files---archive files
4216whose members are object files. The linker handles an archive file by
4217scanning through it for members which define symbols that have so far
4218been referenced but not defined. But if the file that is found is an
4219ordinary object file, it is linked in the usual fashion. The only
630d3d5a
JM
4220difference between using an @option{-l} option and specifying a file name
4221is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
74291a4b
MM
4222and searches several directories.
4223
4224@item -lobjc
cd3bb277 4225@opindex lobjc
630d3d5a 4226You need this special case of the @option{-l} option in order to
2147b154 4227link an Objective-C program.
74291a4b
MM
4228
4229@item -nostartfiles
cd3bb277 4230@opindex nostartfiles
74291a4b 4231Do not use the standard system startup files when linking.
bedc7537
NC
4232The standard system libraries are used normally, unless @option{-nostdlib}
4233or @option{-nodefaultlibs} is used.
74291a4b
MM
4234
4235@item -nodefaultlibs
cd3bb277 4236@opindex nodefaultlibs
74291a4b
MM
4237Do not use the standard system libraries when linking.
4238Only the libraries you specify will be passed to the linker.
bedc7537 4239The standard startup files are used normally, unless @option{-nostartfiles}
4754172c 4240is used. The compiler may generate calls to memcmp, memset, and memcpy
c1030c7c 4241for System V (and ISO C) environments or to bcopy and bzero for
4754172c
CM
4242BSD environments. These entries are usually resolved by entries in
4243libc. These entry points should be supplied through some other
4244mechanism when this option is specified.
74291a4b
MM
4245
4246@item -nostdlib
cd3bb277 4247@opindex nostdlib
74291a4b
MM
4248Do not use the standard system startup files or libraries when linking.
4249No startup files and only the libraries you specify will be passed to
767094dd 4250the linker. The compiler may generate calls to memcmp, memset, and memcpy
c1030c7c 4251for System V (and ISO C) environments or to bcopy and bzero for
4754172c
CM
4252BSD environments. These entries are usually resolved by entries in
4253libc. These entry points should be supplied through some other
4254mechanism when this option is specified.
74291a4b 4255
630d3d5a
JM
4256@cindex @option{-lgcc}, use with @option{-nostdlib}
4257@cindex @option{-nostdlib} and unresolved references
4258@cindex unresolved references and @option{-nostdlib}
4259@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
4260@cindex @option{-nodefaultlibs} and unresolved references
4261@cindex unresolved references and @option{-nodefaultlibs}
4262One of the standard libraries bypassed by @option{-nostdlib} and
4263@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
0c2d1a2a 4264that GCC uses to overcome shortcomings of particular machines, or special
74291a4b 4265needs for some languages.
b11cc610
JM
4266(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
4267Collection (GCC) Internals},
74291a4b 4268for more discussion of @file{libgcc.a}.)
74291a4b 4269In most cases, you need @file{libgcc.a} even when you want to avoid
630d3d5a
JM
4270other standard libraries. In other words, when you specify @option{-nostdlib}
4271or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
0c2d1a2a 4272This ensures that you have no unresolved references to internal GCC
74291a4b 4273library subroutines. (For example, @samp{__main}, used to ensure C++
b11cc610
JM
4274constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
4275GNU Compiler Collection (GCC) Internals}.)
74291a4b
MM
4276
4277@item -s
cd3bb277 4278@opindex s
74291a4b
MM
4279Remove all symbol table and relocation information from the executable.
4280
4281@item -static
cd3bb277 4282@opindex static
74291a4b
MM
4283On systems that support dynamic linking, this prevents linking with the shared
4284libraries. On other systems, this option has no effect.
4285
4286@item -shared
cd3bb277 4287@opindex shared
74291a4b 4288Produce a shared object which can then be linked with other objects to
1d3b0e2c 4289form an executable. Not all systems support this option. For predictable
02f52e19 4290results, you must also specify the same set of options that were used to
630d3d5a 4291generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
2642624b 4292when you specify this option.@footnote{On some systems, @samp{gcc -shared}
767094dd 4293needs to build supplementary stub code for constructors to work. On
2642624b 4294multi-libbed systems, @samp{gcc -shared} must select the correct support
1d3b0e2c 4295libraries to link against. Failing to supply the correct flags may lead
767094dd 4296to subtle defects. Supplying them in cases where they are not necessary
1d3b0e2c 4297is innocuous.}
74291a4b 4298
9db0819e
RH
4299@item -shared-libgcc
4300@itemx -static-libgcc
cd3bb277
JM
4301@opindex shared-libgcc
4302@opindex static-libgcc
9db0819e
RH
4303On systems that provide @file{libgcc} as a shared library, these options
4304force the use of either the shared or static version respectively.
4305If no shared version of @file{libgcc} was built when the compiler was
4306configured, these options have no effect.
4307
4308There are several situations in which an application should use the
4309shared @file{libgcc} instead of the static version. The most common
4310of these is when the application wishes to throw and catch exceptions
4311across different shared libraries. In that case, each of the libraries
4312as well as the application itself should use the shared @file{libgcc}.
4313
630d3d5a
JM
4314Therefore, whenever you specify the @option{-shared} option, the GCC
4315driver automatically adds @option{-shared-libgcc}, unless you explicitly
4316specify @option{-static-libgcc}. The G++ driver automatically adds
4317@option{-shared-libgcc} when you build a main executable as well because
049f6ec9
MM
4318for C++ programs that is typically the right thing to do.
4319(Exception-handling will not work reliably otherwise.)
4320
4321However, when linking a main executable written in C, you must
630d3d5a 4322explicitly say @option{-shared-libgcc} if you want to use the shared
049f6ec9 4323@file{libgcc}.
9db0819e 4324
74291a4b 4325@item -symbolic
cd3bb277 4326@opindex symbolic
74291a4b
MM
4327Bind references to global symbols when building a shared object. Warn
4328about any unresolved references (unless overridden by the link editor
4329option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
4330this option.
4331
4332@item -Xlinker @var{option}
cd3bb277 4333@opindex Xlinker
74291a4b 4334Pass @var{option} as an option to the linker. You can use this to
0c2d1a2a 4335supply system-specific linker options which GCC does not know how to
74291a4b
MM
4336recognize.
4337
4338If you want to pass an option that takes an argument, you must use
630d3d5a
JM
4339@option{-Xlinker} twice, once for the option and once for the argument.
4340For example, to pass @option{-assert definitions}, you must write
74291a4b 4341@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
630d3d5a 4342@option{-Xlinker "-assert definitions"}, because this passes the entire
74291a4b
MM
4343string as a single argument, which is not what the linker expects.
4344
aee96fe9 4345@item -Wl,@var{option}
cd3bb277 4346@opindex Wl
74291a4b
MM
4347Pass @var{option} as an option to the linker. If @var{option} contains
4348commas, it is split into multiple options at the commas.
4349
4350@item -u @var{symbol}
cd3bb277 4351@opindex u
74291a4b 4352Pretend the symbol @var{symbol} is undefined, to force linking of
630d3d5a 4353library modules to define it. You can use @option{-u} multiple times with
74291a4b
MM
4354different symbols to force loading of additional library modules.
4355@end table
4356
4357@node Directory Options
4358@section Options for Directory Search
4359@cindex directory options
4360@cindex options, directory search
4361@cindex search path
4362
4363These options specify directories to search for header files, for
4364libraries and for parts of the compiler:
4365
2642624b 4366@table @gcctabopt
74291a4b 4367@item -I@var{dir}
cd3bb277 4368@opindex I
861bb6c1
JL
4369Add the directory @var{dir} to the head of the list of directories to be
4370searched for header files. This can be used to override a system header
4371file, substituting your own version, since these directories are
d0a5eb32
RK
4372searched before the system header file directories. However, you should
4373not use this option to add directories that contain vendor-supplied
767094dd 4374system header files (use @option{-isystem} for that). If you use more than
630d3d5a 4375one @option{-I} option, the directories are scanned in left-to-right
74291a4b
MM
4376order; the standard system directories come after.
4377
dbead49c
NS
4378If a standard system include directory, or a directory specified with
4379@option{-isystem}, is also specified with @option{-I}, it will be
4380searched only in the position requested by @option{-I}. Also, it will
4381not be considered a system include directory. If that directory really
4382does contain system headers, there is a good chance that they will
4383break. For instance, if GCC's installation procedure edited the headers
4384in @file{/usr/include} to fix bugs, @samp{-I/usr/include} will cause the
4385original, buggy headers to be found instead of the corrected ones. GCC
4386will issue a warning when a system include directory is hidden in this
4387way.
4388
74291a4b 4389@item -I-
cd3bb277 4390@opindex I-
630d3d5a 4391Any directories you specify with @option{-I} options before the @option{-I-}
74291a4b
MM
4392option are searched only for the case of @samp{#include "@var{file}"};
4393they are not searched for @samp{#include <@var{file}>}.
4394
630d3d5a
JM
4395If additional directories are specified with @option{-I} options after
4396the @option{-I-}, these directories are searched for all @samp{#include}
4397directives. (Ordinarily @emph{all} @option{-I} directories are used
74291a4b
MM
4398this way.)
4399
630d3d5a 4400In addition, the @option{-I-} option inhibits the use of the current
74291a4b
MM
4401directory (where the current input file came from) as the first search
4402directory for @samp{#include "@var{file}"}. There is no way to
630d3d5a 4403override this effect of @option{-I-}. With @option{-I.} you can specify
74291a4b
MM
4404searching the directory which was current when the compiler was
4405invoked. That is not exactly the same as what the preprocessor does
4406by default, but it is often satisfactory.
4407
630d3d5a
JM
4408@option{-I-} does not inhibit the use of the standard system directories
4409for header files. Thus, @option{-I-} and @option{-nostdinc} are
74291a4b
MM
4410independent.
4411
4412@item -L@var{dir}
cd3bb277 4413@opindex L
74291a4b 4414Add directory @var{dir} to the list of directories to be searched
630d3d5a 4415for @option{-l}.
74291a4b
MM
4416
4417@item -B@var{prefix}
cd3bb277 4418@opindex B
74291a4b
MM
4419This option specifies where to find the executables, libraries,
4420include files, and data files of the compiler itself.
4421
4422The compiler driver program runs one or more of the subprograms
4423@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
4424@var{prefix} as a prefix for each program it tries to run, both with and
4425without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
4426
4427For each subprogram to be run, the compiler driver first tries the
630d3d5a 4428@option{-B} prefix, if any. If that name is not found, or if @option{-B}
74291a4b
MM
4429was not specified, the driver tries two standard prefixes, which are
4430@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of
4431those results in a file name that is found, the unmodified program
4432name is searched for using the directories specified in your
bedc7537 4433@env{PATH} environment variable.
74291a4b 4434
07804c3b
NC
4435The compiler will check to see if the path provided by the @option{-B}
4436refers to a directory, and if necessary it will add a directory
4437separator character at the end of the path.
4438
630d3d5a 4439@option{-B} prefixes that effectively specify directory names also apply
74291a4b 4440to libraries in the linker, because the compiler translates these
630d3d5a 4441options into @option{-L} options for the linker. They also apply to
74291a4b 4442includes files in the preprocessor, because the compiler translates these
630d3d5a 4443options into @option{-isystem} options for the preprocessor. In this case,
74291a4b
MM
4444the compiler appends @samp{include} to the prefix.
4445
4446The run-time support file @file{libgcc.a} can also be searched for using
630d3d5a 4447the @option{-B} prefix, if needed. If it is not found there, the two
74291a4b
MM
4448standard prefixes above are tried, and that is all. The file is left
4449out of the link if it is not found by those means.
4450
630d3d5a 4451Another way to specify a prefix much like the @option{-B} prefix is to use
bedc7537 4452the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
74291a4b 4453Variables}.
861bb6c1 4454
07804c3b 4455As a special kludge, if the path provided by @option{-B} is
bf4eebe0
NC
4456@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
44579, then it will be replaced by @file{[dir/]include}. This is to help
7dac2f89 4458with boot-strapping the compiler.
07804c3b 4459
861bb6c1 4460@item -specs=@var{file}
cd3bb277 4461@opindex specs
861bb6c1
JL
4462Process @var{file} after the compiler reads in the standard @file{specs}
4463file, in order to override the defaults that the @file{gcc} driver
4464program uses when determining what switches to pass to @file{cc1},
4465@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
630d3d5a 4466@option{-specs=@var{file}} can be specified on the command line, and they
861bb6c1 4467are processed in order, from left to right.
74291a4b
MM
4468@end table
4469
ee457005
JM
4470@c man end
4471
a743d340
NC
4472@node Spec Files
4473@section Specifying subprocesses and the switches to pass to them
4474@cindex Spec Files
bedc7537 4475@command{gcc} is a driver program. It performs its job by invoking a
a743d340
NC
4476sequence of other programs to do the work of compiling, assembling and
4477linking. GCC interprets its command-line parameters and uses these to
4478deduce which programs it should invoke, and which command-line options
c21cd8b1 4479it ought to place on their command lines. This behavior is controlled
a743d340
NC
4480by @dfn{spec strings}. In most cases there is one spec string for each
4481program that GCC can invoke, but a few programs have multiple spec
c21cd8b1 4482strings to control their behavior. The spec strings built into GCC can
630d3d5a 4483be overridden by using the @option{-specs=} command-line switch to specify
a743d340
NC
4484a spec file.
4485
4486@dfn{Spec files} are plaintext files that are used to construct spec
4487strings. They consist of a sequence of directives separated by blank
4488lines. The type of directive is determined by the first non-whitespace
4489character on the line and it can be one of the following:
4490
4491@table @code
4492@item %@var{command}
4493Issues a @var{command} to the spec file processor. The commands that can
02f52e19 4494appear here are:
a743d340
NC
4495
4496@table @code
4497@item %include <@var{file}>
4498@cindex %include
4499Search for @var{file} and insert its text at the current point in the
4500specs file.
4501
4502@item %include_noerr <@var{file}>
4503@cindex %include_noerr
4504Just like @samp{%include}, but do not generate an error message if the include
4505file cannot be found.
4506
4507@item %rename @var{old_name} @var{new_name}
4508@cindex %rename
4509Rename the spec string @var{old_name} to @var{new_name}.
4510
4511@end table
4512
4513@item *[@var{spec_name}]:
4514This tells the compiler to create, override or delete the named spec
4515string. All lines after this directive up to the next directive or
4516blank line are considered to be the text for the spec string. If this
4517results in an empty string then the spec will be deleted. (Or, if the
4518spec did not exist, then nothing will happened.) Otherwise, if the spec
4519does not currently exist a new spec will be created. If the spec does
4520exist then its contents will be overridden by the text of this
4521directive, unless the first character of that text is the @samp{+}
4522character, in which case the text will be appended to the spec.
4523
4524@item [@var{suffix}]:
4525Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
4526and up to the next directive or blank line are considered to make up the
02f52e19 4527spec string for the indicated suffix. When the compiler encounters an
a743d340
NC
4528input file with the named suffix, it will processes the spec string in
4529order to work out how to compile that file. For example:
4530
4531@smallexample
4532.ZZ:
4533z-compile -input %i
4534@end smallexample
4535
4536This says that any input file whose name ends in @samp{.ZZ} should be
4537passed to the program @samp{z-compile}, which should be invoked with the
630d3d5a 4538command-line switch @option{-input} and with the result of performing the
a743d340
NC
4539@samp{%i} substitution. (See below.)
4540
4541As an alternative to providing a spec string, the text that follows a
4542suffix directive can be one of the following:
4543
4544@table @code
4545@item @@@var{language}
4546This says that the suffix is an alias for a known @var{language}. This is
bedc7537 4547similar to using the @option{-x} command-line switch to GCC to specify a
a743d340
NC
4548language explicitly. For example:
4549
4550@smallexample
4551.ZZ:
4552@@c++
4553@end smallexample
4554
4555Says that .ZZ files are, in fact, C++ source files.
4556
4557@item #@var{name}
4558This causes an error messages saying:
4559
4560@smallexample
4561@var{name} compiler not installed on this system.
4562@end smallexample
4563@end table
4564
4565GCC already has an extensive list of suffixes built into it.
4566This directive will add an entry to the end of the list of suffixes, but
4567since the list is searched from the end backwards, it is effectively
4568possible to override earlier entries using this technique.
4569
4570@end table
4571
4572GCC has the following spec strings built into it. Spec files can
4573override these strings or create their own. Note that individual
02f52e19 4574targets can also add their own spec strings to this list.
a743d340
NC
4575
4576@smallexample
4577asm Options to pass to the assembler
4578asm_final Options to pass to the assembler post-processor
4579cpp Options to pass to the C preprocessor
4580cc1 Options to pass to the C compiler
4581cc1plus Options to pass to the C++ compiler
4582endfile Object files to include at the end of the link
4583link Options to pass to the linker
4584lib Libraries to include on the command line to the linker
4585libgcc Decides which GCC support library to pass to the linker
4586linker Sets the name of the linker
4587predefines Defines to be passed to the C preprocessor
310668e8
JM
4588signed_char Defines to pass to CPP to say whether @code{char} is signed
4589 by default
a743d340
NC
4590startfile Object files to include at the start of the link
4591@end smallexample
4592
4593Here is a small example of a spec file:
4594
4595@smallexample
4596%rename lib old_lib
4597
4598*lib:
4599--start-group -lgcc -lc -leval1 --end-group %(old_lib)
4600@end smallexample
4601
4602This example renames the spec called @samp{lib} to @samp{old_lib} and
4603then overrides the previous definition of @samp{lib} with a new one.
4604The new definition adds in some extra command-line options before
4605including the text of the old definition.
4606
4607@dfn{Spec strings} are a list of command-line options to be passed to their
4608corresponding program. In addition, the spec strings can contain
4609@samp{%}-prefixed sequences to substitute variable text or to
4610conditionally insert text into the command line. Using these constructs
4611it is possible to generate quite complex command lines.
4612
4613Here is a table of all defined @samp{%}-sequences for spec
4614strings. Note that spaces are not generated automatically around the
4615results of expanding these sequences. Therefore you can concatenate them
02f52e19 4616together or combine them with constant text in a single argument.
a743d340
NC
4617
4618@table @code
4619@item %%
4620Substitute one @samp{%} into the program name or argument.
4621
4622@item %i
4623Substitute the name of the input file being processed.
4624
4625@item %b
4626Substitute the basename of the input file being processed.
4627This is the substring up to (and not including) the last period
4628and not including the directory.
4629
371e300b
NC
4630@item %B
4631This is the same as @samp{%b}, but include the file suffix (text after
4632the last period).
4633
a743d340
NC
4634@item %d
4635Marks the argument containing or following the @samp{%d} as a
4636temporary file name, so that that file will be deleted if GCC exits
4637successfully. Unlike @samp{%g}, this contributes no text to the
02f52e19 4638argument.
a743d340
NC
4639
4640@item %g@var{suffix}
4641Substitute a file name that has suffix @var{suffix} and is chosen
4642once per compilation, and mark the argument in the same way as
4643@samp{%d}. To reduce exposure to denial-of-service attacks, the file
02f52e19 4644name is now chosen in a way that is hard to predict even when previously
695ac33f 4645chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
a743d340
NC
4646might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
4647the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
4648treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
4649was simply substituted with a file name chosen once per compilation,
4650without regard to any appended suffix (which was therefore treated
4651just like ordinary text), making such attacks more likely to succeed.
4652
4653@item %u@var{suffix}
4654Like @samp{%g}, but generates a new temporary file name even if
4655@samp{%u@var{suffix}} was already seen.
4656
4657@item %U@var{suffix}
4658Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
4659new one if there is no such last file name. In the absence of any
4660@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
695ac33f 4661the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
a743d340
NC
4662would involve the generation of two distinct file names, one
4663for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
4664simply substituted with a file name chosen for the previous @samp{%u},
4665without regard to any appended suffix.
4666
371e300b 4667@item %j@var{SUFFIX}
aee96fe9 4668Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
371e300b
NC
4669writable, and if save-temps is off; otherwise, substitute the name
4670of a temporary file, just like @samp{%u}. This temporary file is not
4671meant for communication between processes, but rather as a junk
4672disposal mechanism.
4673
4674@item %.@var{SUFFIX}
4675Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
767094dd 4676when it is subsequently output with @samp{%*}. @var{SUFFIX} is
371e300b
NC
4677terminated by the next space or %.
4678
a743d340
NC
4679@item %w
4680Marks the argument containing or following the @samp{%w} as the
4681designated output file of this compilation. This puts the argument
4682into the sequence of arguments that @samp{%o} will substitute later.
4683
4684@item %o
4685Substitutes the names of all the output files, with spaces
4686automatically placed around them. You should write spaces
4687around the @samp{%o} as well or the results are undefined.
4688@samp{%o} is for use in the specs for running the linker.
4689Input files whose names have no recognized suffix are not compiled
4690at all, but they are included among the output files, so they will
4691be linked.
4692
4693@item %O
4694Substitutes the suffix for object files. Note that this is
4695handled specially when it immediately follows @samp{%g, %u, or %U},
4696because of the need for those to form complete file names. The
4697handling is such that @samp{%O} is treated exactly as if it had already
4698been substituted, except that @samp{%g, %u, and %U} do not currently
4699support additional @var{suffix} characters following @samp{%O} as they would
4700following, for example, @samp{.o}.
4701
4702@item %p
4703Substitutes the standard macro predefinitions for the
4704current target machine. Use this when running @code{cpp}.
4705
4706@item %P
4707Like @samp{%p}, but puts @samp{__} before and after the name of each
4708predefined macro, except for macros that start with @samp{__} or with
c1030c7c 4709@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
161d7b59 4710C@.
a743d340
NC
4711
4712@item %I
aee96fe9 4713Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}.
a743d340
NC
4714
4715@item %s
4716Current argument is the name of a library or startup file of some sort.
4717Search for that file in a standard list of directories and substitute
02f52e19 4718the full name found.
a743d340
NC
4719
4720@item %e@var{str}
4721Print @var{str} as an error message. @var{str} is terminated by a newline.
4722Use this when inconsistent options are detected.
4723
4724@item %|
4725Output @samp{-} if the input for the current command is coming from a pipe.
4726
4727@item %(@var{name})
4728Substitute the contents of spec string @var{name} at this point.
4729
4730@item %[@var{name}]
630d3d5a 4731Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
a743d340
NC
4732
4733@item %x@{@var{option}@}
4734Accumulate an option for @samp{%X}.
4735
4736@item %X
630d3d5a 4737Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
a743d340
NC
4738spec string.
4739
4740@item %Y
630d3d5a 4741Output the accumulated assembler options specified by @option{-Wa}.
a743d340
NC
4742
4743@item %Z
630d3d5a 4744Output the accumulated preprocessor options specified by @option{-Wp}.
a743d340
NC
4745
4746@item %v1
161d7b59 4747Substitute the major version number of GCC@.
a743d340
NC
4748(For version 2.9.5, this is 2.)
4749
4750@item %v2
161d7b59 4751Substitute the minor version number of GCC@.
a743d340
NC
4752(For version 2.9.5, this is 9.)
4753
371e300b 4754@item %v3
161d7b59 4755Substitute the patch level number of GCC@.
371e300b
NC
4756(For version 2.9.5, this is 5.)
4757
a743d340
NC
4758@item %a
4759Process the @code{asm} spec. This is used to compute the
4760switches to be passed to the assembler.
4761
4762@item %A
4763Process the @code{asm_final} spec. This is a spec string for
4764passing switches to an assembler post-processor, if such a program is
4765needed.
4766
4767@item %l
4768Process the @code{link} spec. This is the spec for computing the
4769command line passed to the linker. Typically it will make use of the
4770@samp{%L %G %S %D and %E} sequences.
4771
4772@item %D
630d3d5a 4773Dump out a @option{-L} option for each directory that GCC believes might
a743d340 4774contain startup files. If the target supports multilibs then the
02f52e19 4775current multilib directory will be prepended to each of these paths.
a743d340 4776
371e300b 4777@item %M
c771326b 4778Output the multilib directory with directory separators replaced with
695ac33f
JM
4779@samp{_}. If multilib directories are not set, or the multilib directory is
4780@file{.} then this option emits nothing.
371e300b 4781
a743d340
NC
4782@item %L
4783Process the @code{lib} spec. This is a spec string for deciding which
02f52e19 4784libraries should be included on the command line to the linker.
a743d340
NC
4785
4786@item %G
4787Process the @code{libgcc} spec. This is a spec string for deciding
02f52e19 4788which GCC support library should be included on the command line to the linker.
a743d340
NC
4789
4790@item %S
4791Process the @code{startfile} spec. This is a spec for deciding which
4792object files should be the first ones passed to the linker. Typically
02f52e19 4793this might be a file named @file{crt0.o}.
a743d340
NC
4794
4795@item %E
4796Process the @code{endfile} spec. This is a spec string that specifies
02f52e19 4797the last object files that will be passed to the linker.
a743d340
NC
4798
4799@item %C
4800Process the @code{cpp} spec. This is used to construct the arguments
4801to be passed to the C preprocessor.
4802
4803@item %c
4804Process the @code{signed_char} spec. This is intended to be used
02f52e19 4805to tell cpp whether a char is signed. It typically has the definition:
a743d340
NC
4806@smallexample
4807%@{funsigned-char:-D__CHAR_UNSIGNED__@}
4808@end smallexample
4809
4810@item %1
4811Process the @code{cc1} spec. This is used to construct the options to be
4812passed to the actual C compiler (@samp{cc1}).
4813
4814@item %2
4815Process the @code{cc1plus} spec. This is used to construct the options to be
4816passed to the actual C++ compiler (@samp{cc1plus}).
4817
4818@item %*
4819Substitute the variable part of a matched option. See below.
4820Note that each comma in the substituted string is replaced by
4821a single space.
4822
4823@item %@{@code{S}@}
161d7b59 4824Substitutes the @code{-S} switch, if that switch was given to GCC@.
a743d340
NC
4825If that switch was not specified, this substitutes nothing. Note that
4826the leading dash is omitted when specifying this option, and it is
4827automatically inserted if the substitution is performed. Thus the spec
630d3d5a
JM
4828string @samp{%@{foo@}} would match the command-line option @option{-foo}
4829and would output the command line option @option{-foo}.
a743d340
NC
4830
4831@item %W@{@code{S}@}
4832Like %@{@code{S}@} but mark last argument supplied within as a file to be
02f52e19 4833deleted on failure.
a743d340
NC
4834
4835@item %@{@code{S}*@}
4836Substitutes all the switches specified to GCC whose names start
4837with @code{-S}, but which also take an argument. This is used for
695ac33f 4838switches like @option{-o}, @option{-D}, @option{-I}, etc.
630d3d5a 4839GCC considers @option{-o foo} as being
a743d340 4840one switch whose names starts with @samp{o}. %@{o*@} would substitute this
02f52e19 4841text, including the space. Thus two arguments would be generated.
a743d340
NC
4842
4843@item %@{^@code{S}*@}
4844Like %@{@code{S}*@}, but don't put a blank between a switch and its
4845argument. Thus %@{^o*@} would only generate one argument, not two.
4846
371e300b
NC
4847@item %@{@code{S}*&@code{T}*@}
4848Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
4849(the order of @code{S} and @code{T} in the spec is not significant).
4850There can be any number of ampersand-separated variables; for each the
4851wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
4852
d630442f 4853@item %@{<@code{S}@}
695ac33f 4854Remove all occurrences of @code{-S} from the command line. Note---this
d630442f 4855command is position dependent. @samp{%} commands in the spec string
50c57e7b 4856before this option will see @code{-S}, @samp{%} commands in the spec
d630442f
NC
4857string after this option will not.
4858
a743d340
NC
4859@item %@{@code{S}*:@code{X}@}
4860Substitutes @code{X} if one or more switches whose names start with
161d7b59 4861@code{-S} are specified to GCC@. Note that the tail part of the
e979f9e8 4862@code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted
02f52e19 4863for each occurrence of @samp{%*} within @code{X}.
a743d340
NC
4864
4865@item %@{@code{S}:@code{X}@}
161d7b59 4866Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@.
a743d340
NC
4867
4868@item %@{!@code{S}:@code{X}@}
161d7b59 4869Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@.
a743d340
NC
4870
4871@item %@{|@code{S}:@code{X}@}
4872Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}.
4873
4874@item %@{|!@code{S}:@code{X}@}
4875Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}.
4876
4877@item %@{.@code{S}:@code{X}@}
4878Substitutes @code{X}, but only if processing a file with suffix @code{S}.
4879
4880@item %@{!.@code{S}:@code{X}@}
4881Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}.
4882
4883@item %@{@code{S}|@code{P}:@code{X}@}
161d7b59 4884Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be
a743d340
NC
4885combined with @samp{!} and @samp{.} sequences as well, although they
4886have a stronger binding than the @samp{|}. For example a spec string
4887like this:
4888
4889@smallexample
4890%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
4891@end smallexample
4892
4893will output the following command-line options from the following input
4894command-line options:
4895
4896@smallexample
4897fred.c -foo -baz
4898jim.d -bar -boggle
4899-d fred.c -foo -baz -boggle
4900-d jim.d -bar -baz -boggle
4901@end smallexample
4902
4903@end table
4904
4905The conditional text @code{X} in a %@{@code{S}:@code{X}@} or
4906%@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs
4907or spaces, or even newlines. They are processed as usual, as described
02f52e19 4908above.
a743d340 4909
695ac33f
JM
4910The @option{-O}, @option{-f}, @option{-m}, and @option{-W}
4911switches are handled specifically in these
630d3d5a
JM
4912constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or
4913@option{-W} switch is found later in the command line, the earlier switch
a743d340
NC
4914value is ignored, except with @{@code{S}*@} where @code{S} is just one
4915letter, which passes all matching options.
4916
4917The character @samp{|} at the beginning of the predicate text is used to indicate
630d3d5a 4918that a command should be piped to the following command, but only if @option{-pipe}
a743d340
NC
4919is specified.
4920
4921It is built into GCC which switches take arguments and which do not.
4922(You might think it would be useful to generalize this to allow each
4923compiler's spec to say which switches take arguments. But this cannot
4924be done in a consistent fashion. GCC cannot even decide which input
4925files have been specified without knowing which switches take arguments,
4926and it must know which input files to compile in order to tell which
02f52e19 4927compilers to run).
a743d340 4928
630d3d5a 4929GCC also knows implicitly that arguments starting in @option{-l} are to be
a743d340
NC
4930treated as compiler output files, and passed to the linker in their
4931proper position among the other output files.
4932
ee457005
JM
4933@c man begin OPTIONS
4934
74291a4b
MM
4935@node Target Options
4936@section Specifying Target Machine and Compiler Version
4937@cindex target options
4938@cindex cross compiling
4939@cindex specifying machine version
4940@cindex specifying compiler version and target machine
4941@cindex compiler version, specifying
4942@cindex target machine, specifying
4943
0c2d1a2a 4944By default, GCC compiles code for the same type of machine that you
74291a4b
MM
4945are using. However, it can also be installed as a cross-compiler, to
4946compile for some other type of machine. In fact, several different
0c2d1a2a 4947configurations of GCC, for different target machines, can be
74291a4b 4948installed side by side. Then you specify which one to use with the
630d3d5a 4949@option{-b} option.
74291a4b 4950
0c2d1a2a 4951In addition, older and newer versions of GCC can be installed side
74291a4b
MM
4952by side. One of them (probably the newest) will be the default, but
4953you may sometimes wish to use another.
4954
2642624b 4955@table @gcctabopt
74291a4b 4956@item -b @var{machine}
cd3bb277 4957@opindex b
74291a4b 4958The argument @var{machine} specifies the target machine for compilation.
0c2d1a2a 4959This is useful when you have installed GCC as a cross-compiler.
74291a4b
MM
4960
4961The value to use for @var{machine} is the same as was specified as the
0c2d1a2a 4962machine type when configuring GCC as a cross-compiler. For
74291a4b
MM
4963example, if a cross-compiler was configured with @samp{configure
4964i386v}, meaning to compile for an 80386 running System V, then you
630d3d5a 4965would specify @option{-b i386v} to run that cross compiler.
74291a4b 4966
630d3d5a 4967When you do not specify @option{-b}, it normally means to compile for
74291a4b
MM
4968the same type of machine that you are using.
4969
4970@item -V @var{version}
cd3bb277 4971@opindex V
0c2d1a2a 4972The argument @var{version} specifies which version of GCC to run.
74291a4b 4973This is useful when multiple versions are installed. For example,
0c2d1a2a 4974@var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
74291a4b 4975
630d3d5a 4976The default version, when you do not specify @option{-V}, is the last
0c2d1a2a 4977version of GCC that you installed.
74291a4b
MM
4978@end table
4979
630d3d5a 4980The @option{-b} and @option{-V} options actually work by controlling part of
74291a4b 4981the file name used for the executable files and libraries used for
0c2d1a2a 4982compilation. A given version of GCC, for a given target machine, is
bd819a4a 4983normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.
74291a4b 4984
630d3d5a 4985Thus, sites can customize the effect of @option{-b} or @option{-V} either by
74291a4b
MM
4986changing the names of these directories or adding alternate names (or
4987symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the
630d3d5a
JM
4988file @file{80386} is a link to the file @file{i386v}, then @option{-b
498980386} becomes an alias for @option{-b i386v}.
74291a4b 4990
630d3d5a 4991In one respect, the @option{-b} or @option{-V} do not completely change
bedc7537 4992to a different compiler: the top-level driver program @command{gcc}
74291a4b
MM
4993that you originally invoked continues to run and invoke the other
4994executables (preprocessor, compiler per se, assembler and linker)
4995that do the real work. However, since no real work is done in the
4996driver program, it usually does not matter that the driver program
8c7b74b9
JM
4997in use is not the one for the specified target. It is common for the
4998interface to the other executables to change incompatibly between
4999compiler versions, so unless the version specified is very close to that
630d3d5a
JM
5000of the driver (for example, @option{-V 3.0} with a driver program from GCC
5001version 3.0.1), use of @option{-V} may not work; for example, using
5002@option{-V 2.95.2} will not work with a driver program from GCC 3.0.
74291a4b
MM
5003
5004The only way that the driver program depends on the target machine is
5005in the parsing and handling of special machine-specific options.
5006However, this is controlled by a file which is found, along with the
5007other executables, in the directory for the specified version and
5008target machine. As a result, a single installed driver program adapts
8c7b74b9
JM
5009to any specified target machine, and sufficiently similar compiler
5010versions.
74291a4b
MM
5011
5012The driver program executable does control one significant thing,
5013however: the default version and target machine. Therefore, you can
5014install different instances of the driver program, compiled for
5015different targets or versions, under different names.
5016
bedc7537
NC
5017For example, if the driver for version 2.0 is installed as @command{ogcc}
5018and that for version 2.1 is installed as @command{gcc}, then the command
5019@command{gcc} will use version 2.1 by default, while @command{ogcc} will use
74291a4b 50202.0 by default. However, you can choose either version with either
630d3d5a 5021command with the @option{-V} option.
74291a4b
MM
5022
5023@node Submodel Options
5024@section Hardware Models and Configurations
5025@cindex submodel options
5026@cindex specifying hardware config
5027@cindex hardware models and configurations, specifying
5028@cindex machine dependent options
5029
630d3d5a 5030Earlier we discussed the standard option @option{-b} which chooses among
74291a4b 5031different installed compilers for completely different target
8aeea6e6 5032machines, such as VAX vs.@: 68000 vs.@: 80386.
74291a4b
MM
5033
5034In addition, each of these target machine types can have its own
5035special options, starting with @samp{-m}, to choose among various
5036hardware models or configurations---for example, 68010 vs 68020,
5037floating coprocessor or none. A single installed version of the
5038compiler can compile for any model or configuration, according to the
5039options specified.
5040
5041Some configurations of the compiler also support additional special
5042options, usually for compatibility with other compilers on the same
5043platform.
5044
74291a4b
MM
5045These options are defined by the macro @code{TARGET_SWITCHES} in the
5046machine description. The default for the options is also defined by
5047that macro, which enables you to change the defaults.
74291a4b
MM
5048
5049@menu
5050* M680x0 Options::
2856c3e3 5051* M68hc1x Options::
74291a4b
MM
5052* VAX Options::
5053* SPARC Options::
5054* Convex Options::
5055* AMD29K Options::
5056* ARM Options::
ecff22ab 5057* MN10200 Options::
6d6d0fa0 5058* MN10300 Options::
861bb6c1 5059* M32R/D Options::
74291a4b
MM
5060* M88K Options::
5061* RS/6000 and PowerPC Options::
5062* RT Options::
5063* MIPS Options::
14f73b5a 5064* i386 and x86-64 Options::
74291a4b
MM
5065* HPPA Options::
5066* Intel 960 Options::
5067* DEC Alpha Options::
d7c23cdc 5068* DEC Alpha/VMS Options::
74291a4b
MM
5069* Clipper Options::
5070* H8/300 Options::
5071* SH Options::
5072* System V Options::
282a61e6 5073* TMS320C3x/C4x Options::
f84271d9 5074* V850 Options::
56b2d7a7 5075* ARC Options::
83575957 5076* NS32K Options::
052a4b28
DC
5077* AVR Options::
5078* MCore Options::
df6194d4 5079* IA-64 Options::
e8ad90e5 5080* D30V Options::
91abf72d 5081* S/390 and zSeries Options::
0b85d816 5082* CRIS Options::
bcf684c7 5083* MMIX Options::
74291a4b
MM
5084@end menu
5085
5086@node M680x0 Options
5087@subsection M680x0 Options
5088@cindex M680x0 options
5089
5090These are the @samp{-m} options defined for the 68000 series. The default
5091values for these options depends on which style of 68000 was selected when
5092the compiler was configured; the defaults for the most common choices are
5093given below.
5094
2642624b 5095@table @gcctabopt
74291a4b
MM
5096@item -m68000
5097@itemx -mc68000
cd3bb277
JM
5098@opindex m68000
5099@opindex mc68000
74291a4b
MM
5100Generate output for a 68000. This is the default
5101when the compiler is configured for 68000-based systems.
5102
74cf1c6d
RK
5103Use this option for microcontrollers with a 68000 or EC000 core,
5104including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5105
74291a4b
MM
5106@item -m68020
5107@itemx -mc68020
cd3bb277
JM
5108@opindex m68020
5109@opindex mc68020
74291a4b
MM
5110Generate output for a 68020. This is the default
5111when the compiler is configured for 68020-based systems.
5112
5113@item -m68881
cd3bb277 5114@opindex m68881
74291a4b 5115Generate output containing 68881 instructions for floating point.
630d3d5a 5116This is the default for most 68020 systems unless @option{--nfp} was
74291a4b
MM
5117specified when the compiler was configured.
5118
5119@item -m68030
cd3bb277 5120@opindex m68030
74291a4b
MM
5121Generate output for a 68030. This is the default when the compiler is
5122configured for 68030-based systems.
5123
5124@item -m68040
cd3bb277 5125@opindex m68040
74291a4b
MM
5126Generate output for a 68040. This is the default when the compiler is
5127configured for 68040-based systems.
5128
5129This option inhibits the use of 68881/68882 instructions that have to be
74cf1c6d
RK
5130emulated by software on the 68040. Use this option if your 68040 does not
5131have code to emulate those instructions.
74291a4b
MM
5132
5133@item -m68060
cd3bb277 5134@opindex m68060
74291a4b
MM
5135Generate output for a 68060. This is the default when the compiler is
5136configured for 68060-based systems.
5137
5138This option inhibits the use of 68020 and 68881/68882 instructions that
74cf1c6d
RK
5139have to be emulated by software on the 68060. Use this option if your 68060
5140does not have code to emulate those instructions.
5141
5142@item -mcpu32
cd3bb277 5143@opindex mcpu32
767094dd 5144Generate output for a CPU32. This is the default
74cf1c6d
RK
5145when the compiler is configured for CPU32-based systems.
5146
5147Use this option for microcontrollers with a
5148CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
514968336, 68340, 68341, 68349 and 68360.
74291a4b
MM
5150
5151@item -m5200
cd3bb277 5152@opindex m5200
695ac33f 5153Generate output for a 520X ``coldfire'' family cpu. This is the default
74291a4b
MM
5154when the compiler is configured for 520X-based systems.
5155
02f52e19 5156Use this option for microcontroller with a 5200 core, including
74cf1c6d
RK
5157the MCF5202, MCF5203, MCF5204 and MCF5202.
5158
74291a4b
MM
5159
5160@item -m68020-40
cd3bb277 5161@opindex m68020-40
74291a4b
MM
5162Generate output for a 68040, without using any of the new instructions.
5163This results in code which can run relatively efficiently on either a
516468020/68881 or a 68030 or a 68040. The generated code does use the
516568881 instructions that are emulated on the 68040.
5166
861bb6c1 5167@item -m68020-60
cd3bb277 5168@opindex m68020-60
861bb6c1
JL
5169Generate output for a 68060, without using any of the new instructions.
5170This results in code which can run relatively efficiently on either a
517168020/68881 or a 68030 or a 68040. The generated code does use the
517268881 instructions that are emulated on the 68060.
5173
74291a4b 5174@item -mfpa
cd3bb277 5175@opindex mfpa
74291a4b
MM
5176Generate output containing Sun FPA instructions for floating point.
5177
5178@item -msoft-float
cd3bb277 5179@opindex msoft-float
74291a4b
MM
5180Generate output containing library calls for floating point.
5181@strong{Warning:} the requisite libraries are not available for all m68k
5182targets. Normally the facilities of the machine's usual C compiler are
5183used, but this can't be done directly in cross-compilation. You must
5184make your own arrangements to provide suitable library functions for
5185cross-compilation. The embedded targets @samp{m68k-*-aout} and
5186@samp{m68k-*-coff} do provide software floating point support.
5187
5188@item -mshort
cd3bb277 5189@opindex mshort
74291a4b
MM
5190Consider type @code{int} to be 16 bits wide, like @code{short int}.
5191
5192@item -mnobitfield
cd3bb277 5193@opindex mnobitfield
630d3d5a
JM
5194Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
5195and @option{-m5200} options imply @w{@option{-mnobitfield}}.
74291a4b
MM
5196
5197@item -mbitfield
cd3bb277 5198@opindex mbitfield
630d3d5a
JM
5199Do use the bit-field instructions. The @option{-m68020} option implies
5200@option{-mbitfield}. This is the default if you use a configuration
74291a4b
MM
5201designed for a 68020.
5202
5203@item -mrtd
cd3bb277 5204@opindex mrtd
74291a4b
MM
5205Use a different function-calling convention, in which functions
5206that take a fixed number of arguments return with the @code{rtd}
5207instruction, which pops their arguments while returning. This
5208saves one instruction in the caller since there is no need to pop
5209the arguments there.
5210
5211This calling convention is incompatible with the one normally
5212used on Unix, so you cannot use it if you need to call libraries
5213compiled with the Unix compiler.
5214
5215Also, you must provide function prototypes for all functions that
5216take variable numbers of arguments (including @code{printf});
5217otherwise incorrect code will be generated for calls to those
5218functions.
5219
5220In addition, seriously incorrect code will result if you call a
5221function with too many arguments. (Normally, extra arguments are
5222harmlessly ignored.)
5223
5224The @code{rtd} instruction is supported by the 68010, 68020, 68030,
74cf1c6d 522568040, 68060 and CPU32 processors, but not by the 68000 or 5200.
861bb6c1
JL
5226
5227@item -malign-int
5228@itemx -mno-align-int
cd3bb277
JM
5229@opindex malign-int
5230@opindex mno-align-int
02f52e19 5231Control whether GCC aligns @code{int}, @code{long}, @code{long long},
861bb6c1 5232@code{float}, @code{double}, and @code{long double} variables on a 32-bit
630d3d5a 5233boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
861bb6c1
JL
5234Aligning variables on 32-bit boundaries produces code that runs somewhat
5235faster on processors with 32-bit busses at the expense of more memory.
5236
630d3d5a 5237@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
861bb6c1
JL
5238align structures containing the above types differently than
5239most published application binary interface specifications for the m68k.
5240
fb868474 5241@item -mpcrel
cd3bb277 5242@opindex mpcrel
fb868474 5243Use the pc-relative addressing mode of the 68000 directly, instead of
695ac33f
JM
5244using a global offset table. At present, this option implies @option{-fpic},
5245allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
5246not presently supported with @option{-mpcrel}, though this could be supported for
fb868474
DL
524768020 and higher processors.
5248
b71733d5
GM
5249@item -mno-strict-align
5250@itemx -mstrict-align
cd3bb277
JM
5251@opindex mno-strict-align
5252@opindex mstrict-align
b71733d5
GM
5253Do not (do) assume that unaligned memory references will be handled by
5254the system.
5255
74291a4b
MM
5256@end table
5257
2856c3e3
SC
5258@node M68hc1x Options
5259@subsection M68hc1x Options
5260@cindex M68hc1x options
5261
5262These are the @samp{-m} options defined for the 68hc11 and 68hc12
02f52e19 5263microcontrollers. The default values for these options depends on
2856c3e3
SC
5264which style of microcontroller was selected when the compiler was configured;
5265the defaults for the most common choices are given below.
5266
2642624b 5267@table @gcctabopt
2856c3e3
SC
5268@item -m6811
5269@itemx -m68hc11
cd3bb277
JM
5270@opindex m6811
5271@opindex m68hc11
2856c3e3
SC
5272Generate output for a 68HC11. This is the default
5273when the compiler is configured for 68HC11-based systems.
5274
5275@item -m6812
5276@itemx -m68hc12
cd3bb277
JM
5277@opindex m6812
5278@opindex m68hc12
2856c3e3
SC
5279Generate output for a 68HC12. This is the default
5280when the compiler is configured for 68HC12-based systems.
5281
5282@item -mauto-incdec
cd3bb277 5283@opindex mauto-incdec
2856c3e3
SC
5284Enable the use of 68HC12 pre and post auto-increment and auto-decrement
5285addressing modes.
5286
5287@item -mshort
cd3bb277 5288@opindex mshort
2856c3e3
SC
5289Consider type @code{int} to be 16 bits wide, like @code{short int}.
5290
5291@item -msoft-reg-count=@var{count}
cd3bb277 5292@opindex msoft-reg-count
2856c3e3
SC
5293Specify the number of pseudo-soft registers which are used for the
5294code generation. The maximum number is 32. Using more pseudo-soft
5295register may or may not result in better code depending on the program.
5296The default is 4 for 68HC11 and 2 for 68HC12.
5297
5298@end table
5299
74291a4b
MM
5300@node VAX Options
5301@subsection VAX Options
5302@cindex VAX options
5303
8aeea6e6 5304These @samp{-m} options are defined for the VAX:
74291a4b 5305
2642624b 5306@table @gcctabopt
74291a4b 5307@item -munix
cd3bb277 5308@opindex munix
74291a4b 5309Do not output certain jump instructions (@code{aobleq} and so on)
8aeea6e6 5310that the Unix assembler for the VAX cannot handle across long
74291a4b
MM
5311ranges.
5312
5313@item -mgnu
cd3bb277 5314@opindex mgnu
74291a4b
MM
5315Do output those jump instructions, on the assumption that you
5316will assemble with the GNU assembler.
5317
5318@item -mg
cd3bb277 5319@opindex mg
74291a4b
MM
5320Output code for g-format floating point numbers instead of d-format.
5321@end table
5322
5323@node SPARC Options
5324@subsection SPARC Options
5325@cindex SPARC options
5326
5327These @samp{-m} switches are supported on the SPARC:
5328
2642624b 5329@table @gcctabopt
74291a4b
MM
5330@item -mno-app-regs
5331@itemx -mapp-regs
cd3bb277
JM
5332@opindex mno-app-regs
5333@opindex mapp-regs
630d3d5a 5334Specify @option{-mapp-regs} to generate output using the global registers
74291a4b
MM
53352 through 4, which the SPARC SVR4 ABI reserves for applications. This
5336is the default.
5337
5338To be fully SVR4 ABI compliant at the cost of some performance loss,
630d3d5a 5339specify @option{-mno-app-regs}. You should compile libraries and system
74291a4b
MM
5340software with this option.
5341
5342@item -mfpu
5343@itemx -mhard-float
cd3bb277
JM
5344@opindex mfpu
5345@opindex mhard-float
74291a4b
MM
5346Generate output containing floating point instructions. This is the
5347default.
5348
5349@item -mno-fpu
5350@itemx -msoft-float
cd3bb277
JM
5351@opindex mno-fpu
5352@opindex msoft-float
74291a4b
MM
5353Generate output containing library calls for floating point.
5354@strong{Warning:} the requisite libraries are not available for all SPARC
5355targets. Normally the facilities of the machine's usual C compiler are
5356used, but this cannot be done directly in cross-compilation. You must make
5357your own arrangements to provide suitable library functions for
5358cross-compilation. The embedded targets @samp{sparc-*-aout} and
5359@samp{sparclite-*-*} do provide software floating point support.
5360
630d3d5a 5361@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
5362therefore, it is only useful if you compile @emph{all} of a program with
5363this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 5364library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
5365this to work.
5366
5367@item -mhard-quad-float
cd3bb277 5368@opindex mhard-quad-float
74291a4b
MM
5369Generate output containing quad-word (long double) floating point
5370instructions.
5371
5372@item -msoft-quad-float
cd3bb277 5373@opindex msoft-quad-float
74291a4b
MM
5374Generate output containing library calls for quad-word (long double)
5375floating point instructions. The functions called are those specified
161d7b59 5376in the SPARC ABI@. This is the default.
74291a4b
MM
5377
5378As of this writing, there are no sparc implementations that have hardware
5379support for the quad-word floating point instructions. They all invoke
5380a trap handler for one of these instructions, and then the trap handler
5381emulates the effect of the instruction. Because of the trap handler overhead,
5382this is much slower than calling the ABI library routines. Thus the
630d3d5a 5383@option{-msoft-quad-float} option is the default.
74291a4b
MM
5384
5385@item -mno-epilogue
5386@itemx -mepilogue
cd3bb277
JM
5387@opindex mno-epilogue
5388@opindex mepilogue
630d3d5a 5389With @option{-mepilogue} (the default), the compiler always emits code for
74291a4b
MM
5390function exit at the end of each function. Any function exit in
5391the middle of the function (such as a return statement in C) will
5392generate a jump to the exit code at the end of the function.
5393
630d3d5a 5394With @option{-mno-epilogue}, the compiler tries to emit exit code inline
74291a4b
MM
5395at every function exit.
5396
5397@item -mno-flat
5398@itemx -mflat
cd3bb277
JM
5399@opindex mno-flat
5400@opindex mflat
630d3d5a 5401With @option{-mflat}, the compiler does not generate save/restore instructions
695ac33f 5402and will use a ``flat'' or single register window calling convention.
74291a4b
MM
5403This model uses %i7 as the frame pointer and is compatible with the normal
5404register window model. Code from either may be intermixed.
aee96fe9 5405The local registers and the input registers (0--5) are still treated as
695ac33f 5406``call saved'' registers and will be saved on the stack as necessary.
74291a4b 5407
630d3d5a 5408With @option{-mno-flat} (the default), the compiler emits save/restore
74291a4b
MM
5409instructions (except for leaf functions) and is the normal mode of operation.
5410
5411@item -mno-unaligned-doubles
5412@itemx -munaligned-doubles
cd3bb277
JM
5413@opindex mno-unaligned-doubles
5414@opindex munaligned-doubles
74291a4b
MM
5415Assume that doubles have 8 byte alignment. This is the default.
5416
630d3d5a 5417With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
74291a4b
MM
5418alignment only if they are contained in another type, or if they have an
5419absolute address. Otherwise, it assumes they have 4 byte alignment.
5420Specifying this option avoids some rare compatibility problems with code
5421generated by other compilers. It is not the default because it results
5422in a performance loss, especially for floating point code.
5423
c219ddf7
BK
5424@item -mno-faster-structs
5425@itemx -mfaster-structs
cd3bb277
JM
5426@opindex mno-faster-structs
5427@opindex mfaster-structs
630d3d5a 5428With @option{-mfaster-structs}, the compiler assumes that structures
c219ddf7
BK
5429should have 8 byte alignment. This enables the use of pairs of
5430@code{ldd} and @code{std} instructions for copies in structure
5431assignment, in place of twice as many @code{ld} and @code{st} pairs.
5432However, the use of this changed alignment directly violates the Sparc
161d7b59 5433ABI@. Thus, it's intended only for use on targets where the developer
c219ddf7 5434acknowledges that their resulting code will not be directly in line with
161d7b59 5435the rules of the ABI@.
c219ddf7 5436
74291a4b
MM
5437@item -mv8
5438@itemx -msparclite
cd3bb277
JM
5439@opindex mv8
5440@opindex msparclite
74291a4b
MM
5441These two options select variations on the SPARC architecture.
5442
5443By default (unless specifically configured for the Fujitsu SPARClite),
5444GCC generates code for the v7 variant of the SPARC architecture.
5445
630d3d5a 5446@option{-mv8} will give you SPARC v8 code. The only difference from v7
74291a4b
MM
5447code is that the compiler emits the integer multiply and integer
5448divide instructions which exist in SPARC v8 but not in SPARC v7.
5449
630d3d5a 5450@option{-msparclite} will give you SPARClite code. This adds the integer
74291a4b
MM
5451multiply, integer divide step and scan (@code{ffs}) instructions which
5452exist in SPARClite but not in SPARC v7.
5453
0c2d1a2a 5454These options are deprecated and will be deleted in a future GCC release.
630d3d5a 5455They have been replaced with @option{-mcpu=xxx}.
74291a4b
MM
5456
5457@item -mcypress
5458@itemx -msupersparc
cd3bb277
JM
5459@opindex mcypress
5460@opindex msupersparc
c21cd8b1 5461These two options select the processor for which the code is optimized.
74291a4b 5462
630d3d5a 5463With @option{-mcypress} (the default), the compiler optimizes code for the
74291a4b
MM
5464Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
5465This is also appropriate for the older SparcStation 1, 2, IPX etc.
5466
630d3d5a 5467With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
767094dd 5468used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
74291a4b
MM
5469of the full SPARC v8 instruction set.
5470
0c2d1a2a 5471These options are deprecated and will be deleted in a future GCC release.
630d3d5a 5472They have been replaced with @option{-mcpu=xxx}.
74291a4b
MM
5473
5474@item -mcpu=@var{cpu_type}
cd3bb277 5475@opindex mcpu
c0498f43
DE
5476Set the instruction set, register set, and instruction scheduling parameters
5477for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
5478@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
ad6843d7
RH
5479@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
5480@samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}.
c0498f43
DE
5481
5482Default instruction scheduling parameters are used for values that select
5483an architecture and not an implementation. These are @samp{v7}, @samp{v8},
5484@samp{sparclite}, @samp{sparclet}, @samp{v9}.
5485
5486Here is a list of each supported architecture and their supported
5487implementations.
5488
5489@smallexample
5490 v7: cypress
ad6843d7
RH
5491 v8: supersparc, hypersparc
5492 sparclite: f930, f934, sparclite86x
c0498f43
DE
5493 sparclet: tsc701
5494 v9: ultrasparc
5495@end smallexample
74291a4b
MM
5496
5497@item -mtune=@var{cpu_type}
cd3bb277 5498@opindex mtune
74291a4b 5499Set the instruction scheduling parameters for machine type
c0498f43 5500@var{cpu_type}, but do not set the instruction set or register set that the
630d3d5a 5501option @option{-mcpu=@var{cpu_type}} would.
c0498f43 5502
9c34dbbf
ZW
5503The same values for @option{-mcpu=@var{cpu_type}} can be used for
5504@option{-mtune=@var{cpu_type}}, but the only useful values are those
5505that select a particular cpu implementation. Those are @samp{cypress},
5506@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
5507@samp{sparclite86x}, @samp{tsc701}, and @samp{ultrasparc}.
74291a4b
MM
5508
5509@end table
5510
5511These @samp{-m} switches are supported in addition to the above
5512on the SPARCLET processor.
5513
2642624b 5514@table @gcctabopt
74291a4b 5515@item -mlittle-endian
cd3bb277 5516@opindex mlittle-endian
74291a4b
MM
5517Generate code for a processor running in little-endian mode.
5518
5519@item -mlive-g0
cd3bb277 5520@opindex mlive-g0
74291a4b
MM
5521Treat register @code{%g0} as a normal register.
5522GCC will continue to clobber it as necessary but will not assume
5523it always reads as 0.
5524
5525@item -mbroken-saverestore
cd3bb277 5526@opindex mbroken-saverestore
74291a4b
MM
5527Generate code that does not use non-trivial forms of the @code{save} and
5528@code{restore} instructions. Early versions of the SPARCLET processor do
5529not correctly handle @code{save} and @code{restore} instructions used with
5530arguments. They correctly handle them used without arguments. A @code{save}
5531instruction used without arguments increments the current window pointer
5532but does not allocate a new stack frame. It is assumed that the window
5533overflow trap handler will properly handle this case as will interrupt
5534handlers.
5535@end table
5536
5537These @samp{-m} switches are supported in addition to the above
02f52e19 5538on SPARC V9 processors in 64-bit environments.
74291a4b 5539
2642624b 5540@table @gcctabopt
74291a4b 5541@item -mlittle-endian
cd3bb277 5542@opindex mlittle-endian
74291a4b
MM
5543Generate code for a processor running in little-endian mode.
5544
ded17aad
DE
5545@item -m32
5546@itemx -m64
cd3bb277
JM
5547@opindex m32
5548@opindex m64
02f52e19
AJ
5549Generate code for a 32-bit or 64-bit environment.
5550The 32-bit environment sets int, long and pointer to 32 bits.
5551The 64-bit environment sets int to 32 bits and long and pointer
ded17aad
DE
5552to 64 bits.
5553
5554@item -mcmodel=medlow
cd3bb277 5555@opindex mcmodel=medlow
ded17aad
DE
5556Generate code for the Medium/Low code model: the program must be linked
5557in the low 32 bits of the address space. Pointers are 64 bits.
5558Programs can be statically or dynamically linked.
5559
5560@item -mcmodel=medmid
cd3bb277 5561@opindex mcmodel=medmid
ded17aad
DE
5562Generate code for the Medium/Middle code model: the program must be linked
5563in the low 44 bits of the address space, the text segment must be less than
55642G bytes, and data segment must be within 2G of the text segment.
5565Pointers are 64 bits.
5566
5567@item -mcmodel=medany
cd3bb277 5568@opindex mcmodel=medany
ded17aad
DE
5569Generate code for the Medium/Anywhere code model: the program may be linked
5570anywhere in the address space, the text segment must be less than
55712G bytes, and data segment must be within 2G of the text segment.
5572Pointers are 64 bits.
5573
5574@item -mcmodel=embmedany
cd3bb277 5575@opindex mcmodel=embmedany
ded17aad 5576Generate code for the Medium/Anywhere code model for embedded systems:
02f52e19 5577assume a 32-bit text and a 32-bit data segment, both starting anywhere
ded17aad 5578(determined at link time). Register %g4 points to the base of the
02f52e19 5579data segment. Pointers are still 64 bits.
ded17aad 5580Programs are statically linked, PIC is not supported.
74291a4b
MM
5581
5582@item -mstack-bias
5583@itemx -mno-stack-bias
cd3bb277
JM
5584@opindex mstack-bias
5585@opindex mno-stack-bias
630d3d5a
JM
5586With @option{-mstack-bias}, GCC assumes that the stack pointer, and
5587frame pointer if present, are offset by @minus{}2047 which must be added back
74291a4b
MM
5588when making stack frame references.
5589Otherwise, assume no such offset is present.
5590@end table
5591
5592@node Convex Options
5593@subsection Convex Options
5594@cindex Convex options
5595
5596These @samp{-m} options are defined for Convex:
5597
2642624b 5598@table @gcctabopt
74291a4b 5599@item -mc1
cd3bb277 5600@opindex mc1
74291a4b
MM
5601Generate output for C1. The code will run on any Convex machine.
5602The preprocessor symbol @code{__convex__c1__} is defined.
5603
5604@item -mc2
cd3bb277 5605@opindex mc2
74291a4b
MM
5606Generate output for C2. Uses instructions not available on C1.
5607Scheduling and other optimizations are chosen for max performance on C2.
5608The preprocessor symbol @code{__convex_c2__} is defined.
5609
5610@item -mc32
cd3bb277 5611@opindex mc32
74291a4b
MM
5612Generate output for C32xx. Uses instructions not available on C1.
5613Scheduling and other optimizations are chosen for max performance on C32.
5614The preprocessor symbol @code{__convex_c32__} is defined.
5615
5616@item -mc34
cd3bb277 5617@opindex mc34
74291a4b
MM
5618Generate output for C34xx. Uses instructions not available on C1.
5619Scheduling and other optimizations are chosen for max performance on C34.
5620The preprocessor symbol @code{__convex_c34__} is defined.
5621
5622@item -mc38
cd3bb277 5623@opindex mc38
74291a4b
MM
5624Generate output for C38xx. Uses instructions not available on C1.
5625Scheduling and other optimizations are chosen for max performance on C38.
5626The preprocessor symbol @code{__convex_c38__} is defined.
5627
5628@item -margcount
cd3bb277 5629@opindex margcount
74291a4b
MM
5630Generate code which puts an argument count in the word preceding each
5631argument list. This is compatible with regular CC, and a few programs
5632may need the argument count word. GDB and other source-level debuggers
5633do not need it; this info is in the symbol table.
5634
5635@item -mnoargcount
cd3bb277 5636@opindex mnoargcount
74291a4b
MM
5637Omit the argument count word. This is the default.
5638
5639@item -mvolatile-cache
cd3bb277 5640@opindex mvolatile-cache
74291a4b
MM
5641Allow volatile references to be cached. This is the default.
5642
5643@item -mvolatile-nocache
cd3bb277 5644@opindex mvolatile-nocache
74291a4b
MM
5645Volatile references bypass the data cache, going all the way to memory.
5646This is only needed for multi-processor code that does not use standard
5647synchronization instructions. Making non-volatile references to volatile
5648locations will not necessarily work.
5649
5650@item -mlong32
cd3bb277 5651@opindex mlong32
74291a4b
MM
5652Type long is 32 bits, the same as type int. This is the default.
5653
5654@item -mlong64
cd3bb277 5655@opindex mlong64
74291a4b
MM
5656Type long is 64 bits, the same as type long long. This option is useless,
5657because no library support exists for it.
5658@end table
5659
5660@node AMD29K Options
5661@subsection AMD29K Options
5662@cindex AMD29K options
5663
5664These @samp{-m} options are defined for the AMD Am29000:
5665
2642624b 5666@table @gcctabopt
74291a4b 5667@item -mdw
cd3bb277 5668@opindex mdw
74291a4b
MM
5669@cindex DW bit (29k)
5670Generate code that assumes the @code{DW} bit is set, i.e., that byte and
5671halfword operations are directly supported by the hardware. This is the
5672default.
5673
5674@item -mndw
cd3bb277 5675@opindex mndw
74291a4b
MM
5676Generate code that assumes the @code{DW} bit is not set.
5677
5678@item -mbw
cd3bb277 5679@opindex mbw
74291a4b
MM
5680@cindex byte writes (29k)
5681Generate code that assumes the system supports byte and halfword write
5682operations. This is the default.
5683
5684@item -mnbw
cd3bb277 5685@opindex mnbw
74291a4b 5686Generate code that assumes the systems does not support byte and
630d3d5a 5687halfword write operations. @option{-mnbw} implies @option{-mndw}.
74291a4b
MM
5688
5689@item -msmall
cd3bb277 5690@opindex msmall
74291a4b
MM
5691@cindex memory model (29k)
5692Use a small memory model that assumes that all function addresses are
5693either within a single 256 KB segment or at an absolute address of less
5694than 256k. This allows the @code{call} instruction to be used instead
5695of a @code{const}, @code{consth}, @code{calli} sequence.
5696
5697@item -mnormal
cd3bb277 5698@opindex mnormal
74291a4b
MM
5699Use the normal memory model: Generate @code{call} instructions only when
5700calling functions in the same file and @code{calli} instructions
5701otherwise. This works if each file occupies less than 256 KB but allows
161d7b59 5702the entire executable to be larger than 256 KB@. This is the default.
74291a4b
MM
5703
5704@item -mlarge
cd3bb277 5705@opindex mlarge
74291a4b
MM
5706Always use @code{calli} instructions. Specify this option if you expect
5707a single file to compile into more than 256 KB of code.
5708
5709@item -m29050
cd3bb277 5710@opindex m29050
74291a4b
MM
5711@cindex processor selection (29k)
5712Generate code for the Am29050.
5713
5714@item -m29000
cd3bb277 5715@opindex m29000
74291a4b
MM
5716Generate code for the Am29000. This is the default.
5717
5718@item -mkernel-registers
cd3bb277 5719@opindex mkernel-registers
74291a4b
MM
5720@cindex kernel and user registers (29k)
5721Generate references to registers @code{gr64-gr95} instead of to
5722registers @code{gr96-gr127}. This option can be used when compiling
5723kernel code that wants a set of global registers disjoint from that used
5724by user-mode code.
5725
5726Note that when this option is used, register names in @samp{-f} flags
5727must use the normal, user-mode, names.
5728
5729@item -muser-registers
cd3bb277 5730@opindex muser-registers
74291a4b
MM
5731Use the normal set of global registers, @code{gr96-gr127}. This is the
5732default.
5733
5734@item -mstack-check
5735@itemx -mno-stack-check
cd3bb277
JM
5736@opindex mstack-check
5737@opindex mno-stack-check
74291a4b
MM
5738@cindex stack checks (29k)
5739Insert (or do not insert) a call to @code{__msp_check} after each stack
5740adjustment. This is often used for kernel code.
5741
5742@item -mstorem-bug
5743@itemx -mno-storem-bug
cd3bb277
JM
5744@opindex mstorem-bug
5745@opindex mno-storem-bug
74291a4b 5746@cindex storem bug (29k)
630d3d5a 5747@option{-mstorem-bug} handles 29k processors which cannot handle the
74291a4b
MM
5748separation of a mtsrim insn and a storem instruction (most 29000 chips
5749to date, but not the 29050).
5750
5751@item -mno-reuse-arg-regs
5752@itemx -mreuse-arg-regs
cd3bb277
JM
5753@opindex mno-reuse-arg-regs
5754@opindex mreuse-arg-regs
630d3d5a 5755@option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
74291a4b
MM
5756registers for copying out arguments. This helps detect calling a function
5757with fewer arguments than it was declared with.
5758
861bb6c1
JL
5759@item -mno-impure-text
5760@itemx -mimpure-text
cd3bb277
JM
5761@opindex mno-impure-text
5762@opindex mimpure-text
630d3d5a
JM
5763@option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to
5764not pass @option{-assert pure-text} to the linker when linking a shared object.
861bb6c1 5765
74291a4b 5766@item -msoft-float
cd3bb277 5767@opindex msoft-float
74291a4b 5768Generate output containing library calls for floating point.
161d7b59 5769@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
5770Normally the facilities of the machine's usual C compiler are used, but
5771this can't be done directly in cross-compilation. You must make your
5772own arrangements to provide suitable library functions for
5773cross-compilation.
4e8d7ddc
JW
5774
5775@item -mno-multm
cd3bb277 5776@opindex mno-multm
4e8d7ddc
JW
5777Do not generate multm or multmu instructions. This is useful for some embedded
5778systems which do not have trap handlers for these instructions.
74291a4b
MM
5779@end table
5780
5781@node ARM Options
5782@subsection ARM Options
5783@cindex ARM options
5784
5785These @samp{-m} options are defined for Advanced RISC Machines (ARM)
5786architectures:
5787
2642624b 5788@table @gcctabopt
74291a4b 5789@item -mapcs-frame
cd3bb277 5790@opindex mapcs-frame
74291a4b
MM
5791Generate a stack frame that is compliant with the ARM Procedure Call
5792Standard for all functions, even if this is not strictly necessary for
630d3d5a 5793correct execution of the code. Specifying @option{-fomit-frame-pointer}
157a620e 5794with this option will cause the stack frames not to be generated for
630d3d5a 5795leaf functions. The default is @option{-mno-apcs-frame}.
157a620e
NC
5796
5797@item -mapcs
cd3bb277 5798@opindex mapcs
630d3d5a 5799This is a synonym for @option{-mapcs-frame}.
74291a4b
MM
5800
5801@item -mapcs-26
cd3bb277 5802@opindex mapcs-26
74291a4b
MM
5803Generate code for a processor running with a 26-bit program counter,
5804and conforming to the function calling standards for the APCS 26-bit
630d3d5a 5805option. This option replaces the @option{-m2} and @option{-m3} options
74291a4b
MM
5806of previous releases of the compiler.
5807
5808@item -mapcs-32
cd3bb277 5809@opindex mapcs-32
74291a4b
MM
5810Generate code for a processor running with a 32-bit program counter,
5811and conforming to the function calling standards for the APCS 32-bit
630d3d5a 5812option. This option replaces the @option{-m6} option of previous releases
74291a4b
MM
5813of the compiler.
5814
247f8561
PB
5815@ignore
5816@c not currently implemented
157a620e 5817@item -mapcs-stack-check
cd3bb277 5818@opindex mapcs-stack-check
157a620e
NC
5819Generate code to check the amount of stack space available upon entry to
5820every function (that actually uses some stack space). If there is
5821insufficient space available then either the function
5822@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
5823called, depending upon the amount of stack space required. The run time
5824system is required to provide these functions. The default is
630d3d5a 5825@option{-mno-apcs-stack-check}, since this produces smaller code.
157a620e 5826
247f8561 5827@c not currently implemented
157a620e 5828@item -mapcs-float
cd3bb277 5829@opindex mapcs-float
157a620e 5830Pass floating point arguments using the float point registers. This is
161d7b59 5831one of the variants of the APCS@. This option is recommended if the
157a620e
NC
5832target hardware has a floating point unit or if a lot of floating point
5833arithmetic is going to be performed by the code. The default is
630d3d5a
JM
5834@option{-mno-apcs-float}, since integer only code is slightly increased in
5835size if @option{-mapcs-float} is used.
157a620e 5836
247f8561 5837@c not currently implemented
157a620e 5838@item -mapcs-reentrant
cd3bb277 5839@opindex mapcs-reentrant
247f8561 5840Generate reentrant, position independent code. The default is
630d3d5a 5841@option{-mno-apcs-reentrant}.
247f8561 5842@end ignore
157a620e
NC
5843
5844@item -mthumb-interwork
cd3bb277 5845@opindex mthumb-interwork
247f8561 5846Generate code which supports calling between the ARM and Thumb
157a620e
NC
5847instruction sets. Without this option the two instruction sets cannot
5848be reliably used inside one program. The default is
630d3d5a
JM
5849@option{-mno-thumb-interwork}, since slightly larger code is generated
5850when @option{-mthumb-interwork} is specified.
157a620e
NC
5851
5852@item -mno-sched-prolog
cd3bb277 5853@opindex mno-sched-prolog
157a620e
NC
5854Prevent the reordering of instructions in the function prolog, or the
5855merging of those instruction with the instructions in the function's
ed0e6530
PB
5856body. This means that all functions will start with a recognizable set
5857of instructions (or in fact one of a choice from a small set of
157a620e
NC
5858different function prologues), and this information can be used to
5859locate the start if functions inside an executable piece of code. The
630d3d5a 5860default is @option{-msched-prolog}.
157a620e 5861
74291a4b 5862@item -mhard-float
cd3bb277 5863@opindex mhard-float
74291a4b
MM
5864Generate output containing floating point instructions. This is the
5865default.
5866
5867@item -msoft-float
cd3bb277 5868@opindex msoft-float
74291a4b
MM
5869Generate output containing library calls for floating point.
5870@strong{Warning:} the requisite libraries are not available for all ARM
5871targets. Normally the facilities of the machine's usual C compiler are
5872used, but this cannot be done directly in cross-compilation. You must make
5873your own arrangements to provide suitable library functions for
5874cross-compilation.
5875
630d3d5a 5876@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
5877therefore, it is only useful if you compile @emph{all} of a program with
5878this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 5879library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
5880this to work.
5881
5882@item -mlittle-endian
cd3bb277 5883@opindex mlittle-endian
74291a4b
MM
5884Generate code for a processor running in little-endian mode. This is
5885the default for all standard configurations.
5886
5887@item -mbig-endian
cd3bb277 5888@opindex mbig-endian
74291a4b
MM
5889Generate code for a processor running in big-endian mode; the default is
5890to compile code for a little-endian processor.
5891
5892@item -mwords-little-endian
cd3bb277 5893@opindex mwords-little-endian
74291a4b
MM
5894This option only applies when generating code for big-endian processors.
5895Generate code for a little-endian word order but a big-endian byte
5896order. That is, a byte order of the form @samp{32107654}. Note: this
5897option should only be used if you require compatibility with code for
5898big-endian ARM processors generated by versions of the compiler prior to
58992.8.
5900
5f1e6755 5901@item -malignment-traps
cd3bb277 5902@opindex malignment-traps
5f1e6755
NC
5903Generate code that will not trap if the MMU has alignment traps enabled.
5904On ARM architectures prior to ARMv4, there were no instructions to
5905access half-word objects stored in memory. However, when reading from
5906memory a feature of the ARM architecture allows a word load to be used,
5907even if the address is unaligned, and the processor core will rotate the
5908data as it is being loaded. This option tells the compiler that such
5909misaligned accesses will cause a MMU trap and that it should instead
5910synthesise the access as a series of byte accesses. The compiler can
5911still use word accesses to load half-word data if it knows that the
5912address is aligned to a word boundary.
5913
5914This option is ignored when compiling for ARM architecture 4 or later,
5915since these processors have instructions to directly access half-word
02f52e19
AJ
5916objects in memory.
5917
5f1e6755 5918@item -mno-alignment-traps
cd3bb277 5919@opindex mno-alignment-traps
5f1e6755
NC
5920Generate code that assumes that the MMU will not trap unaligned
5921accesses. This produces better code when the target instruction set
e979f9e8 5922does not have half-word memory operations (i.e.@: implementations prior to
02f52e19 5923ARMv4).
5f1e6755
NC
5924
5925Note that you cannot use this option to access unaligned word objects,
5926since the processor will only fetch one 32-bit aligned object from
02f52e19 5927memory.
5f1e6755 5928
695ac33f 5929The default setting for most targets is @option{-mno-alignment-traps}, since
5f1e6755 5930this produces better code when there are no half-word memory
02f52e19 5931instructions available.
5f1e6755 5932
74291a4b 5933@item -mshort-load-bytes
247f8561 5934@itemx -mno-short-load-words
cd3bb277
JM
5935@opindex mshort-load-bytes
5936@opindex mno-short-load-words
630d3d5a 5937These are deprecated aliases for @option{-malignment-traps}.
74291a4b
MM
5938
5939@item -mno-short-load-bytes
247f8561 5940@itemx -mshort-load-words
cd3bb277
JM
5941@opindex mno-short-load-bytes
5942@opindex mshort-load-words
630d3d5a 5943This are deprecated aliases for @option{-mno-alignment-traps}.
157a620e 5944
74291a4b 5945@item -mbsd
cd3bb277 5946@opindex mbsd
161d7b59 5947This option only applies to RISC iX@. Emulate the native BSD-mode
630d3d5a 5948compiler. This is the default if @option{-ansi} is not specified.
74291a4b
MM
5949
5950@item -mxopen
cd3bb277 5951@opindex mxopen
161d7b59 5952This option only applies to RISC iX@. Emulate the native X/Open-mode
74291a4b
MM
5953compiler.
5954
5955@item -mno-symrename
cd3bb277 5956@opindex mno-symrename
161d7b59 5957This option only applies to RISC iX@. Do not run the assembler
74291a4b
MM
5958post-processor, @samp{symrename}, after code has been assembled.
5959Normally it is necessary to modify some of the standard symbols in
5960preparation for linking with the RISC iX C library; this option
5961suppresses this pass. The post-processor is never run when the
5962compiler is built for cross-compilation.
157a620e 5963
cd3bb277
JM
5964@item -mcpu=@var{name}
5965@opindex mcpu
157a620e 5966This specifies the name of the target ARM processor. GCC uses this name
247f8561 5967to determine what kind of instructions it can emit when generating
aee96fe9
JM
5968assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
5969@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
5970@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
5971@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
5972@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
5973@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
5974@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
5975@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
5976@samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi},
5977@samp{arm1020t}, @samp{xscale}.
62b10bbc 5978
cd3bb277
JM
5979@itemx -mtune=@var{name}
5980@opindex mtune
630d3d5a 5981This option is very similar to the @option{-mcpu=} option, except that
62b10bbc
NC
5982instead of specifying the actual target processor type, and hence
5983restricting which instructions can be used, it specifies that GCC should
5984tune the performance of the code as if the target were of the type
5985specified in this option, but still choosing the instructions that it
630d3d5a 5986will generate based on the cpu specified by a @option{-mcpu=} option.
247f8561 5987For some ARM implementations better performance can be obtained by using
62b10bbc 5988this option.
157a620e 5989
cd3bb277
JM
5990@item -march=@var{name}
5991@opindex march
157a620e 5992This specifies the name of the target ARM architecture. GCC uses this
247f8561 5993name to determine what kind of instructions it can emit when generating
157a620e 5994assembly code. This option can be used in conjunction with or instead
aee96fe9
JM
5995of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
5996@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
5997@samp{armv5}, @samp{armv5t}, @samp{armv5te}.
157a620e 5998
cd3bb277
JM
5999@item -mfpe=@var{number}
6000@itemx -mfp=@var{number}
6001@opindex mfpe
6002@opindex mfp
b192711e 6003This specifies the version of the floating point emulation available on
630d3d5a 6004the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym
161d7b59 6005for @option{-mfpe=}, for compatibility with older versions of GCC@.
157a620e 6006
cd3bb277
JM
6007@item -mstructure-size-boundary=@var{n}
6008@opindex mstructure-size-boundary
157a620e 6009The size of all structures and unions will be rounded up to a multiple
ed0e6530 6010of the number of bits set by this option. Permissible values are 8 and
157a620e
NC
601132. The default value varies for different toolchains. For the COFF
6012targeted toolchain the default value is 8. Specifying the larger number
ed0e6530 6013can produce faster, more efficient code, but can also increase the size
157a620e
NC
6014of the program. The two values are potentially incompatible. Code
6015compiled with one value cannot necessarily expect to work with code or
6016libraries compiled with the other value, if they exchange information
247f8561 6017using structures or unions.
157a620e 6018
f5a1b0d2 6019@item -mabort-on-noreturn
cd3bb277 6020@opindex mabort-on-noreturn
247f8561
PB
6021Generate a call to the function @code{abort} at the end of a
6022@code{noreturn} function. It will be executed if the function tries to
6023return.
f5a1b0d2 6024
c27ba912
DM
6025@item -mlong-calls
6026@itemx -mno-long-calls
cd3bb277
JM
6027@opindex mlong-calls
6028@opindex mno-long-calls
c27ba912
DM
6029Tells the compiler to perform function calls by first loading the
6030address of the function into a register and then performing a subroutine
6031call on this register. This switch is needed if the target function
6032will lie outside of the 64 megabyte addressing range of the offset based
02f52e19 6033version of subroutine call instruction.
c27ba912
DM
6034
6035Even if this switch is enabled, not all function calls will be turned
6036into long calls. The heuristic is that static functions, functions
6037which have the @samp{short-call} attribute, functions that are inside
6038the scope of a @samp{#pragma no_long_calls} directive and functions whose
6039definitions have already been compiled within the current compilation
6040unit, will not be turned into long calls. The exception to this rule is
b192711e 6041that weak function definitions, functions with the @samp{long-call}
c27ba912
DM
6042attribute or the @samp{section} attribute, and functions that are within
6043the scope of a @samp{#pragma long_calls} directive, will always be
6044turned into long calls.
6045
6046This feature is not enabled by default. Specifying
c21cd8b1 6047@option{-mno-long-calls} will restore the default behavior, as will
c27ba912
DM
6048placing the function calls within the scope of a @samp{#pragma
6049long_calls_off} directive. Note these switches have no effect on how
6050the compiler generates code to handle function calls via function
02f52e19 6051pointers.
c27ba912 6052
62b10bbc 6053@item -mnop-fun-dllimport
cd3bb277 6054@opindex mnop-fun-dllimport
aee96fe9 6055Disable support for the @code{dllimport} attribute.
62b10bbc 6056
ed0e6530 6057@item -msingle-pic-base
cd3bb277 6058@opindex msingle-pic-base
ed0e6530
PB
6059Treat the register used for PIC addressing as read-only, rather than
6060loading it in the prologue for each function. The run-time system is
c21cd8b1 6061responsible for initializing this register with an appropriate value
ed0e6530
PB
6062before execution begins.
6063
cd3bb277
JM
6064@item -mpic-register=@var{reg}
6065@opindex mpic-register
ed0e6530
PB
6066Specify the register to be used for PIC addressing. The default is R10
6067unless stack-checking is enabled, when R9 is used.
6068
247f8561 6069@item -mpoke-function-name
cd3bb277 6070@opindex mpoke-function-name
247f8561
PB
6071Write the name of each function into the text section, directly
6072preceding the function prologue. The generated code is similar to this:
74291a4b 6073
247f8561
PB
6074@smallexample
6075 t0
6076 .ascii "arm_poke_function_name", 0
6077 .align
6078 t1
6079 .word 0xff000000 + (t1 - t0)
6080 arm_poke_function_name
6081 mov ip, sp
6082 stmfd sp!, @{fp, ip, lr, pc@}
6083 sub fp, ip, #4
6084@end smallexample
157a620e 6085
247f8561
PB
6086When performing a stack backtrace, code can inspect the value of
6087@code{pc} stored at @code{fp + 0}. If the trace function then looks at
6088location @code{pc - 12} and the top 8 bits are set, then we know that
6089there is a function name embedded immediately preceding this location
6090and has length @code{((pc[-3]) & 0xff000000)}.
157a620e 6091
247f8561 6092@item -mthumb
cd3bb277 6093@opindex mthumb
247f8561
PB
6094Generate code for the 16-bit Thumb instruction set. The default is to
6095use the 32-bit ARM instruction set.
157a620e
NC
6096
6097@item -mtpcs-frame
cd3bb277 6098@opindex mtpcs-frame
157a620e
NC
6099Generate a stack frame that is compliant with the Thumb Procedure Call
6100Standard for all non-leaf functions. (A leaf function is one that does
630d3d5a 6101not call any other functions.) The default is @option{-mno-tpcs-frame}.
157a620e
NC
6102
6103@item -mtpcs-leaf-frame
cd3bb277 6104@opindex mtpcs-leaf-frame
157a620e
NC
6105Generate a stack frame that is compliant with the Thumb Procedure Call
6106Standard for all leaf functions. (A leaf function is one that does
630d3d5a 6107not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
62b10bbc
NC
6108
6109@item -mcallee-super-interworking
cd3bb277 6110@opindex mcallee-super-interworking
62b10bbc
NC
6111Gives all externally visible functions in the file being compiled an ARM
6112instruction set header which switches to Thumb mode before executing the
6113rest of the function. This allows these functions to be called from
6114non-interworking code.
6115
6116@item -mcaller-super-interworking
cd3bb277 6117@opindex mcaller-super-interworking
62b10bbc
NC
6118Allows calls via function pointers (including virtual functions) to
6119execute correctly regardless of whether the target code has been
6120compiled for interworking or not. There is a small overhead in the cost
4bdc1ac7
PB
6121of executing a function pointer if this option is enabled.
6122
157a620e
NC
6123@end table
6124
ecff22ab
JL
6125@node MN10200 Options
6126@subsection MN10200 Options
6127@cindex MN10200 options
630d3d5a 6128These @option{-m} options are defined for Matsushita MN10200 architectures:
2642624b 6129@table @gcctabopt
ecff22ab
JL
6130
6131@item -mrelax
cd3bb277 6132@opindex mrelax
ecff22ab
JL
6133Indicate to the linker that it should perform a relaxation optimization pass
6134to shorten branches, calls and absolute memory addresses. This option only
6135has an effect when used on the command line for the final link step.
6136
02f52e19 6137This option makes symbolic debugging impossible.
ecff22ab 6138@end table
157a620e 6139
6d6d0fa0
JL
6140@node MN10300 Options
6141@subsection MN10300 Options
6142@cindex MN10300 options
630d3d5a 6143These @option{-m} options are defined for Matsushita MN10300 architectures:
6d6d0fa0 6144
2642624b 6145@table @gcctabopt
6d6d0fa0 6146@item -mmult-bug
cd3bb277 6147@opindex mmult-bug
6d6d0fa0
JL
6148Generate code to avoid bugs in the multiply instructions for the MN10300
6149processors. This is the default.
6150
6151@item -mno-mult-bug
cd3bb277 6152@opindex mno-mult-bug
6d6d0fa0
JL
6153Do not generate code to avoid bugs in the multiply instructions for the
6154MN10300 processors.
ecff22ab 6155
705ac34f 6156@item -mam33
cd3bb277 6157@opindex mam33
705ac34f
JL
6158Generate code which uses features specific to the AM33 processor.
6159
6160@item -mno-am33
cd3bb277 6161@opindex mno-am33
705ac34f
JL
6162Do not generate code which uses features specific to the AM33 processor. This
6163is the default.
6164
c474f76b
AO
6165@item -mno-crt0
6166@opindex mno-crt0
6167Do not link in the C run-time initialization object file.
6168
ecff22ab 6169@item -mrelax
cd3bb277 6170@opindex mrelax
ecff22ab
JL
6171Indicate to the linker that it should perform a relaxation optimization pass
6172to shorten branches, calls and absolute memory addresses. This option only
6173has an effect when used on the command line for the final link step.
6174
02f52e19 6175This option makes symbolic debugging impossible.
6d6d0fa0
JL
6176@end table
6177
ecff22ab 6178
861bb6c1
JL
6179@node M32R/D Options
6180@subsection M32R/D Options
6181@cindex M32R/D options
6182
630d3d5a 6183These @option{-m} options are defined for Mitsubishi M32R/D architectures:
861bb6c1 6184
2642624b 6185@table @gcctabopt
98180123
NC
6186@item -m32rx
6187@opindex m32rx
0bf93a51 6188Generate code for the M32R/X@.
98180123
NC
6189
6190@item -m32r
6191@opindex m32r
0bf93a51 6192Generate code for the M32R@. This is the default.
de41e41c 6193
861bb6c1 6194@item -mcode-model=small
cd3bb277 6195@opindex mcode-model=small
861bb6c1
JL
6196Assume all objects live in the lower 16MB of memory (so that their addresses
6197can be loaded with the @code{ld24} instruction), and assume all subroutines
6198are reachable with the @code{bl} instruction.
6199This is the default.
6200
6201The addressability of a particular object can be set with the
6202@code{model} attribute.
6203
6204@item -mcode-model=medium
cd3bb277 6205@opindex mcode-model=medium
02f52e19 6206Assume objects may be anywhere in the 32-bit address space (the compiler
861bb6c1
JL
6207will generate @code{seth/add3} instructions to load their addresses), and
6208assume all subroutines are reachable with the @code{bl} instruction.
6209
6210@item -mcode-model=large
cd3bb277 6211@opindex mcode-model=large
02f52e19 6212Assume objects may be anywhere in the 32-bit address space (the compiler
861bb6c1
JL
6213will generate @code{seth/add3} instructions to load their addresses), and
6214assume subroutines may not be reachable with the @code{bl} instruction
6215(the compiler will generate the much slower @code{seth/add3/jl}
6216instruction sequence).
6217
6218@item -msdata=none
cd3bb277 6219@opindex msdata=none
861bb6c1
JL
6220Disable use of the small data area. Variables will be put into
6221one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6222@code{section} attribute has been specified).
6223This is the default.
6224
6225The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6226Objects may be explicitly put in the small data area with the
6227@code{section} attribute using one of these sections.
6228
6229@item -msdata=sdata
cd3bb277 6230@opindex msdata=sdata
861bb6c1
JL
6231Put small global and static data in the small data area, but do not
6232generate special code to reference them.
6233
6234@item -msdata=use
cd3bb277 6235@opindex msdata=use
861bb6c1
JL
6236Put small global and static data in the small data area, and generate
6237special instructions to reference them.
6238
6239@item -G @var{num}
cd3bb277 6240@opindex G
861bb6c1
JL
6241@cindex smaller data references
6242Put global and static objects less than or equal to @var{num} bytes
6243into the small data or bss sections instead of the normal data or bss
6244sections. The default value of @var{num} is 8.
630d3d5a 6245The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
861bb6c1
JL
6246for this option to have any effect.
6247
630d3d5a 6248All modules should be compiled with the same @option{-G @var{num}} value.
861bb6c1 6249Compiling with different values of @var{num} may or may not work; if it
695ac33f 6250doesn't the linker will give an error message---incorrect code will not be
861bb6c1
JL
6251generated.
6252
6253@end table
6254
74291a4b
MM
6255@node M88K Options
6256@subsection M88K Options
6257@cindex M88k options
6258
6259These @samp{-m} options are defined for Motorola 88k architectures:
6260
2642624b 6261@table @gcctabopt
74291a4b 6262@item -m88000
cd3bb277 6263@opindex m88000
74291a4b
MM
6264Generate code that works well on both the m88100 and the
6265m88110.
6266
6267@item -m88100
cd3bb277 6268@opindex m88100
74291a4b
MM
6269Generate code that works best for the m88100, but that also
6270runs on the m88110.
6271
6272@item -m88110
cd3bb277 6273@opindex m88110
74291a4b
MM
6274Generate code that works best for the m88110, and may not run
6275on the m88100.
6276
6277@item -mbig-pic
cd3bb277 6278@opindex mbig-pic
74291a4b 6279Obsolete option to be removed from the next revision.
630d3d5a 6280Use @option{-fPIC}.
74291a4b
MM
6281
6282@item -midentify-revision
cd3bb277 6283@opindex midentify-revision
74291a4b
MM
6284@cindex identifying source, compiler (88k)
6285Include an @code{ident} directive in the assembler output recording the
6286source file name, compiler name and version, timestamp, and compilation
6287flags used.
6288
6289@item -mno-underscores
cd3bb277 6290@opindex mno-underscores
74291a4b
MM
6291@cindex underscores, avoiding (88k)
6292In assembler output, emit symbol names without adding an underscore
6293character at the beginning of each name. The default is to use an
6294underscore as prefix on each name.
6295
6296@item -mocs-debug-info
6297@itemx -mno-ocs-debug-info
cd3bb277
JM
6298@opindex mocs-debug-info
6299@opindex mno-ocs-debug-info
74291a4b
MM
6300@cindex OCS (88k)
6301@cindex debugging, 88k OCS
6302Include (or omit) additional debugging information (about registers used
6303in each stack frame) as specified in the 88open Object Compatibility
161d7b59 6304Standard, ``OCS''@. This extra information allows debugging of code that
74291a4b
MM
6305has had the frame pointer eliminated. The default for DG/UX, SVr4, and
6306Delta 88 SVr3.2 is to include this information; other 88k configurations
6307omit this information by default.
6308
6309@item -mocs-frame-position
cd3bb277 6310@opindex mocs-frame-position
74291a4b
MM
6311@cindex register positions in frame (88k)
6312When emitting COFF debugging information for automatic variables and
6313parameters stored on the stack, use the offset from the canonical frame
6314address, which is the stack pointer (register 31) on entry to the
6315function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
630d3d5a
JM
6316@option{-mocs-frame-position}; other 88k configurations have the default
6317@option{-mno-ocs-frame-position}.
74291a4b
MM
6318
6319@item -mno-ocs-frame-position
cd3bb277 6320@opindex mno-ocs-frame-position
74291a4b
MM
6321@cindex register positions in frame (88k)
6322When emitting COFF debugging information for automatic variables and
6323parameters stored on the stack, use the offset from the frame pointer
6324register (register 30). When this option is in effect, the frame
6325pointer is not eliminated when debugging information is selected by the
6326-g switch.
6327
6328@item -moptimize-arg-area
cd3bb277 6329@opindex moptimize-arg-area
74291a4b 6330@cindex arguments in frame (88k)
9c34dbbf
ZW
6331Save space by reorganizing the stack frame. This option generates code
6332that does not agree with the 88open specifications, but uses less
6333memory.
6334
6335@itemx -mno-optimize-arg-area
6336@opindex mno-optimize-arg-area
6337Do not reorganize the stack frame to save space. This is the default.
6338The generated conforms to the specification, but uses more memory.
74291a4b
MM
6339
6340@item -mshort-data-@var{num}
cd3bb277 6341@opindex mshort-data
74291a4b
MM
6342@cindex smaller data references (88k)
6343@cindex r0-relative references (88k)
6344Generate smaller data references by making them relative to @code{r0},
6345which allows loading a value using a single instruction (rather than the
6346usual two). You control which data references are affected by
6347specifying @var{num} with this option. For example, if you specify
630d3d5a 6348@option{-mshort-data-512}, then the data references affected are those
74291a4b 6349involving displacements of less than 512 bytes.
630d3d5a 6350@option{-mshort-data-@var{num}} is not effective for @var{num} greater
74291a4b
MM
6351than 64k.
6352
6353@item -mserialize-volatile
cd3bb277 6354@opindex mserialize-volatile
74291a4b 6355@itemx -mno-serialize-volatile
cd3bb277 6356@opindex mno-serialize-volatile
74291a4b
MM
6357@cindex sequential consistency on 88k
6358Do, or don't, generate code to guarantee sequential consistency
6359of volatile memory references. By default, consistency is
6360guaranteed.
6361
6362The order of memory references made by the MC88110 processor does
6363not always match the order of the instructions requesting those
6364references. In particular, a load instruction may execute before
6365a preceding store instruction. Such reordering violates
6366sequential consistency of volatile memory references, when there
6367are multiple processors. When consistency must be guaranteed,
f0523f02 6368GCC generates special instructions, as needed, to force
74291a4b
MM
6369execution in the proper order.
6370
6371The MC88100 processor does not reorder memory references and so
f0523f02
JM
6372always provides sequential consistency. However, by default, GCC
6373generates the special instructions to guarantee consistency
630d3d5a 6374even when you use @option{-m88100}, so that the code may be run on an
74291a4b 6375MC88110 processor. If you intend to run your code only on the
630d3d5a 6376MC88100 processor, you may use @option{-mno-serialize-volatile}.
74291a4b
MM
6377
6378The extra code generated to guarantee consistency may affect the
6379performance of your application. If you know that you can safely
630d3d5a 6380forgo this guarantee, you may use @option{-mno-serialize-volatile}.
74291a4b
MM
6381
6382@item -msvr4
6383@itemx -msvr3
cd3bb277
JM
6384@opindex msvr4
6385@opindex msvr3
74291a4b
MM
6386@cindex assembler syntax, 88k
6387@cindex SVr4
630d3d5a 6388Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions
74291a4b
MM
6389related to System V release 4 (SVr4). This controls the following:
6390
6391@enumerate
6392@item
6393Which variant of the assembler syntax to emit.
6394@item
630d3d5a 6395@option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
74291a4b
MM
6396that is used on System V release 4.
6397@item
630d3d5a 6398@option{-msvr4} makes GCC issue additional declaration directives used in
74291a4b
MM
6399SVr4.
6400@end enumerate
6401
630d3d5a 6402@option{-msvr4} is the default for the m88k-motorola-sysv4 and
767094dd 6403m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all
74291a4b
MM
6404other m88k configurations.
6405
6406@item -mversion-03.00
cd3bb277 6407@opindex mversion-03.00
74291a4b
MM
6408This option is obsolete, and is ignored.
6409@c ??? which asm syntax better for GAS? option there too?
6410
6411@item -mno-check-zero-division
6412@itemx -mcheck-zero-division
cd3bb277
JM
6413@opindex mno-check-zero-division
6414@opindex mcheck-zero-division
74291a4b
MM
6415@cindex zero division on 88k
6416Do, or don't, generate code to guarantee that integer division by
6417zero will be detected. By default, detection is guaranteed.
6418
6419Some models of the MC88100 processor fail to trap upon integer
6420division by zero under certain conditions. By default, when
f0523f02 6421compiling code that might be run on such a processor, GCC
74291a4b
MM
6422generates code that explicitly checks for zero-valued divisors
6423and traps with exception number 503 when one is detected. Use of
9c34dbbf 6424@option{-mno-check-zero-division} suppresses such checking for code
74291a4b
MM
6425generated to run on an MC88100 processor.
6426
9c34dbbf
ZW
6427GCC assumes that the MC88110 processor correctly detects all instances
6428of integer division by zero. When @option{-m88110} is specified, no
6429explicit checks for zero-valued divisors are generated, and both
6430@option{-mcheck-zero-division} and @option{-mno-check-zero-division} are
6431ignored.
74291a4b
MM
6432
6433@item -muse-div-instruction
cd3bb277 6434@opindex muse-div-instruction
74291a4b
MM
6435@cindex divide instruction, 88k
6436Use the div instruction for signed integer division on the
6437MC88100 processor. By default, the div instruction is not used.
6438
6439On the MC88100 processor the signed integer division instruction
6440div) traps to the operating system on a negative operand. The
6441operating system transparently completes the operation, but at a
6442large cost in execution time. By default, when compiling code
f0523f02 6443that might be run on an MC88100 processor, GCC emulates signed
74291a4b
MM
6444integer division using the unsigned integer division instruction
6445divu), thereby avoiding the large penalty of a trap to the
6446operating system. Such emulation has its own, smaller, execution
6447cost in both time and space. To the extent that your code's
6448important signed integer division operations are performed on two
6449nonnegative operands, it may be desirable to use the div
6450instruction directly.
6451
6452On the MC88110 processor the div instruction (also known as the
6453divs instruction) processes negative operands without trapping to
630d3d5a
JM
6454the operating system. When @option{-m88110} is specified,
6455@option{-muse-div-instruction} is ignored, and the div instruction is used
74291a4b
MM
6456for signed integer division.
6457
630d3d5a 6458Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In
74291a4b 6459particular, the behavior of such a division with and without
630d3d5a 6460@option{-muse-div-instruction} may differ.
74291a4b
MM
6461
6462@item -mtrap-large-shift
6463@itemx -mhandle-large-shift
cd3bb277
JM
6464@opindex mtrap-large-shift
6465@opindex mhandle-large-shift
74291a4b
MM
6466@cindex bit shift overflow (88k)
6467@cindex large bit shifts (88k)
6468Include code to detect bit-shifts of more than 31 bits; respectively,
0c2d1a2a 6469trap such shifts or emit code to handle them properly. By default GCC
74291a4b
MM
6470makes no special provision for large bit shifts.
6471
6472@item -mwarn-passed-structs
cd3bb277 6473@opindex mwarn-passed-structs
74291a4b
MM
6474@cindex structure passing (88k)
6475Warn when a function passes a struct as an argument or result.
6476Structure-passing conventions have changed during the evolution of the C
6477language, and are often the source of portability problems. By default,
0c2d1a2a 6478GCC issues no such warning.
74291a4b
MM
6479@end table
6480
9c34dbbf
ZW
6481@c break page here to avoid unsightly interparagraph stretch.
6482@c -zw, 2001-8-17
6483@page
6484
74291a4b
MM
6485@node RS/6000 and PowerPC Options
6486@subsection IBM RS/6000 and PowerPC Options
6487@cindex RS/6000 and PowerPC Options
6488@cindex IBM RS/6000 and PowerPC Options
6489
6490These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
2642624b 6491@table @gcctabopt
74291a4b
MM
6492@item -mpower
6493@itemx -mno-power
6494@itemx -mpower2
6495@itemx -mno-power2
6496@itemx -mpowerpc
6497@itemx -mno-powerpc
6498@itemx -mpowerpc-gpopt
6499@itemx -mno-powerpc-gpopt
6500@itemx -mpowerpc-gfxopt
6501@itemx -mno-powerpc-gfxopt
7fe90e7b
DE
6502@itemx -mpowerpc64
6503@itemx -mno-powerpc64
cd3bb277
JM
6504@opindex mpower
6505@opindex mno-power
6506@opindex mpower2
6507@opindex mno-power2
6508@opindex mpowerpc
6509@opindex mno-powerpc
6510@opindex mpowerpc-gpopt
6511@opindex mno-powerpc-gpopt
6512@opindex mpowerpc-gfxopt
6513@opindex mno-powerpc-gfxopt
6514@opindex mpowerpc64
6515@opindex mno-powerpc64
0c2d1a2a 6516GCC supports two related instruction set architectures for the
161d7b59 6517RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
74291a4b
MM
6518instructions supported by the @samp{rios} chip set used in the original
6519RS/6000 systems and the @dfn{PowerPC} instruction set is the
6520architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
861bb6c1 6521the IBM 4xx microprocessors.
74291a4b
MM
6522
6523Neither architecture is a subset of the other. However there is a
6524large common subset of instructions supported by both. An MQ
6525register is included in processors supporting the POWER architecture.
6526
6527You use these options to specify which instructions are available on the
6528processor you are using. The default value of these options is
161d7b59 6529determined when configuring GCC@. Specifying the
630d3d5a
JM
6530@option{-mcpu=@var{cpu_type}} overrides the specification of these
6531options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
74291a4b
MM
6532rather than the options listed above.
6533
630d3d5a 6534The @option{-mpower} option allows GCC to generate instructions that
74291a4b 6535are found only in the POWER architecture and to use the MQ register.
630d3d5a 6536Specifying @option{-mpower2} implies @option{-power} and also allows GCC
74291a4b
MM
6537to generate instructions that are present in the POWER2 architecture but
6538not the original POWER architecture.
6539
630d3d5a 6540The @option{-mpowerpc} option allows GCC to generate instructions that
74291a4b 6541are found only in the 32-bit subset of the PowerPC architecture.
630d3d5a 6542Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
0c2d1a2a 6543GCC to use the optional PowerPC architecture instructions in the
74291a4b 6544General Purpose group, including floating-point square root. Specifying
630d3d5a 6545@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
74291a4b
MM
6546use the optional PowerPC architecture instructions in the Graphics
6547group, including floating-point select.
6548
630d3d5a 6549The @option{-mpowerpc64} option allows GCC to generate the additional
7fe90e7b 655064-bit instructions that are found in the full PowerPC64 architecture
0c2d1a2a 6551and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
630d3d5a 6552@option{-mno-powerpc64}.
7fe90e7b 6553
630d3d5a 6554If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
74291a4b
MM
6555will use only the instructions in the common subset of both
6556architectures plus some special AIX common-mode calls, and will not use
630d3d5a 6557the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
0c2d1a2a 6558permits GCC to use any instruction from either architecture and to
74291a4b
MM
6559allow use of the MQ register; specify this for the Motorola MPC601.
6560
6561@item -mnew-mnemonics
6562@itemx -mold-mnemonics
cd3bb277
JM
6563@opindex mnew-mnemonics
6564@opindex mold-mnemonics
9c34dbbf
ZW
6565Select which mnemonics to use in the generated assembler code. With
6566@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
6567the PowerPC architecture. With @option{-mold-mnemonics} it uses the
6568assembler mnemonics defined for the POWER architecture. Instructions
6569defined in only one architecture have only one mnemonic; GCC uses that
6570mnemonic irrespective of which of these options is specified.
74291a4b 6571
0c2d1a2a 6572GCC defaults to the mnemonics appropriate for the architecture in
630d3d5a 6573use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
7fe90e7b 6574value of these option. Unless you are building a cross-compiler, you
630d3d5a
JM
6575should normally not specify either @option{-mnew-mnemonics} or
6576@option{-mold-mnemonics}, but should instead accept the default.
74291a4b
MM
6577
6578@item -mcpu=@var{cpu_type}
cd3bb277 6579@opindex mcpu
74291a4b
MM
6580Set architecture type, register usage, choice of mnemonics, and
6581instruction scheduling parameters for machine type @var{cpu_type}.
5f59ecb7
DE
6582Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
6583@samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
6584@samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
ed947a96
DJ
6585@samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750},
6586@samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505},
6587@samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
9c34dbbf
ZW
6588
6589@option{-mcpu=common} selects a completely generic processor. Code
6590generated under this option will run on any POWER or PowerPC processor.
6591GCC will use only the instructions in the common subset of both
6592architectures, and will not use the MQ register. GCC assumes a generic
74291a4b
MM
6593processor model for scheduling purposes.
6594
9c34dbbf
ZW
6595@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
6596@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
6597PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
6598types, with an appropriate, generic processor model assumed for
6599scheduling purposes.
74291a4b 6600
9c34dbbf
ZW
6601The other options specify a specific processor. Code generated under
6602those options will run best on that processor, and may not run at all on
6603others.
6604
6605The @option{-mcpu} options automatically enable or disable other
6606@option{-m} options as follows:
6607
6608@table @samp
6609@item common
6610@option{-mno-power}, @option{-mno-powerc}
6611
6612@item power
6613@itemx power2
6614@itemx rios1
6615@itemx rios2
6616@itemx rsc
6617@option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics}
6618
6619@item powerpc
6620@itemx rs64a
6621@itemx 602
6622@itemx 603
6623@itemx 603e
6624@itemx 604
6625@itemx 620
6626@itemx 630
6627@itemx 740
ed947a96
DJ
6628@itemx 7400
6629@itemx 7450
9c34dbbf
ZW
6630@itemx 750
6631@itemx 505
6632@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6633
6634@item 601
6635@option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6636
6637@item 403
6638@itemx 821
6639@itemx 860
6640@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float}
6641@end table
74291a4b
MM
6642
6643@item -mtune=@var{cpu_type}
cd3bb277 6644@opindex mtune
74291a4b 6645Set the instruction scheduling parameters for machine type
9c34dbbf
ZW
6646@var{cpu_type}, but do not set the architecture type, register usage, or
6647choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
6648values for @var{cpu_type} are used for @option{-mtune} as for
6649@option{-mcpu}. If both are specified, the code generated will use the
6650architecture, registers, and mnemonics set by @option{-mcpu}, but the
6651scheduling parameters set by @option{-mtune}.
74291a4b 6652
0ac081f6
AH
6653@item -maltivec
6654@itemx -mno-altivec
6655@opindex maltivec
6656@opindex mno-altivec
6657These switches enable or disable the use of built-in functions that
6658allow access to the AltiVec instruction set. You may also need to set
6659@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
6660enhancements.
6661
74291a4b
MM
6662@item -mfull-toc
6663@itemx -mno-fp-in-toc
6664@itemx -mno-sum-in-toc
6665@itemx -mminimal-toc
cd3bb277
JM
6666@opindex mfull-toc
6667@opindex mno-fp-in-toc
6668@opindex mno-sum-in-toc
6669@opindex mminimal-toc
74291a4b 6670Modify generation of the TOC (Table Of Contents), which is created for
630d3d5a 6671every executable file. The @option{-mfull-toc} option is selected by
0c2d1a2a
JB
6672default. In that case, GCC will allocate at least one TOC entry for
6673each unique non-automatic variable reference in your program. GCC
161d7b59
JM
6674will also place floating-point constants in the TOC@. However, only
667516,384 entries are available in the TOC@.
74291a4b
MM
6676
6677If you receive a linker error message that saying you have overflowed
6678the available TOC space, you can reduce the amount of TOC space used
630d3d5a
JM
6679with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
6680@option{-mno-fp-in-toc} prevents GCC from putting floating-point
6681constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
74291a4b 6682generate code to calculate the sum of an address and a constant at
161d7b59 6683run-time instead of putting that sum into the TOC@. You may specify one
0c2d1a2a 6684or both of these options. Each causes GCC to produce very slightly
74291a4b
MM
6685slower and larger code at the expense of conserving TOC space.
6686
6687If you still run out of space in the TOC even when you specify both of
630d3d5a 6688these options, specify @option{-mminimal-toc} instead. This option causes
0c2d1a2a
JB
6689GCC to make only one TOC entry for every file. When you specify this
6690option, GCC will produce code that is slower and larger but which
74291a4b 6691uses extremely little TOC space. You may wish to use this option
bd819a4a 6692only on files that contain less frequently executed code.
74291a4b 6693
fa06229f
GK
6694@item -maix64
6695@itemx -maix32
cd3bb277
JM
6696@opindex maix64
6697@opindex maix32
fa06229f 6698Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7fe90e7b 6699@code{long} type, and the infrastructure needed to support them.
630d3d5a
JM
6700Specifying @option{-maix64} implies @option{-mpowerpc64} and
6701@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
6702implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
7fe90e7b 6703
74291a4b
MM
6704@item -mxl-call
6705@itemx -mno-xl-call
cd3bb277
JM
6706@opindex mxl-call
6707@opindex mno-xl-call
74291a4b
MM
6708On AIX, pass floating-point arguments to prototyped functions beyond the
6709register save area (RSA) on the stack in addition to argument FPRs. The
6710AIX calling convention was extended but not initially documented to
6711handle an obscure K&R C case of calling a function that takes the
6712address of its arguments with fewer arguments than declared. AIX XL
7fe90e7b
DE
6713compilers access floating point arguments which do not fit in the
6714RSA from the stack when a subroutine is compiled without
74291a4b
MM
6715optimization. Because always storing floating-point arguments on the
6716stack is inefficient and rarely needed, this option is not enabled by
6717default and only is necessary when calling subroutines compiled by AIX
6718XL compilers without optimization.
6719
861bb6c1 6720@item -mpe
cd3bb277 6721@opindex mpe
161d7b59 6722Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
861bb6c1
JL
6723application written to use message passing with special startup code to
6724enable the application to run. The system must have PE installed in the
6725standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
630d3d5a 6726must be overridden with the @option{-specs=} option to specify the
861bb6c1 6727appropriate directory location. The Parallel Environment does not
0a379b7a 6728support threads, so the @option{-mpe} option and the @option{-pthread}
861bb6c1
JL
6729option are incompatible.
6730
74291a4b
MM
6731@item -msoft-float
6732@itemx -mhard-float
cd3bb277
JM
6733@opindex msoft-float
6734@opindex mhard-float
74291a4b
MM
6735Generate code that does not use (uses) the floating-point register set.
6736Software floating point emulation is provided if you use the
630d3d5a 6737@option{-msoft-float} option, and pass the option to GCC when linking.
74291a4b
MM
6738
6739@item -mmultiple
6740@itemx -mno-multiple
cd3bb277
JM
6741@opindex mmultiple
6742@opindex mno-multiple
74291a4b
MM
6743Generate code that uses (does not use) the load multiple word
6744instructions and the store multiple word instructions. These
6745instructions are generated by default on POWER systems, and not
630d3d5a 6746generated on PowerPC systems. Do not use @option{-mmultiple} on little
74291a4b 6747endian PowerPC systems, since those instructions do not work when the
bef84347
VM
6748processor is in little endian mode. The exceptions are PPC740 and
6749PPC750 which permit the instructions usage in little endian mode.
74291a4b
MM
6750
6751@item -mstring
6752@itemx -mno-string
cd3bb277
JM
6753@opindex mstring
6754@opindex mno-string
bef84347
VM
6755Generate code that uses (does not use) the load string instructions
6756and the store string word instructions to save multiple registers and
6757do small block moves. These instructions are generated by default on
6758POWER systems, and not generated on PowerPC systems. Do not use
630d3d5a 6759@option{-mstring} on little endian PowerPC systems, since those
bef84347
VM
6760instructions do not work when the processor is in little endian mode.
6761The exceptions are PPC740 and PPC750 which permit the instructions
6762usage in little endian mode.
74291a4b 6763
861bb6c1
JL
6764@item -mupdate
6765@itemx -mno-update
cd3bb277
JM
6766@opindex mupdate
6767@opindex mno-update
861bb6c1
JL
6768Generate code that uses (does not use) the load or store instructions
6769that update the base register to the address of the calculated memory
6770location. These instructions are generated by default. If you use
630d3d5a 6771@option{-mno-update}, there is a small window between the time that the
861bb6c1
JL
6772stack pointer is updated and the address of the previous frame is
6773stored, which means code that walks the stack frame across interrupts or
6774signals may get corrupted data.
6775
6776@item -mfused-madd
6777@itemx -mno-fused-madd
cd3bb277
JM
6778@opindex mfused-madd
6779@opindex mno-fused-madd
861bb6c1
JL
6780Generate code that uses (does not use) the floating point multiply and
6781accumulate instructions. These instructions are generated by default if
6782hardware floating is used.
6783
74291a4b
MM
6784@item -mno-bit-align
6785@itemx -mbit-align
cd3bb277
JM
6786@opindex mno-bit-align
6787@opindex mbit-align
74291a4b 6788On System V.4 and embedded PowerPC systems do not (do) force structures
c771326b
JM
6789and unions that contain bit-fields to be aligned to the base type of the
6790bit-field.
74291a4b
MM
6791
6792For example, by default a structure containing nothing but 8
c771326b 6793@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
630d3d5a 6794boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
74291a4b
MM
6795the structure would be aligned to a 1 byte boundary and be one byte in
6796size.
6797
6798@item -mno-strict-align
6799@itemx -mstrict-align
cd3bb277
JM
6800@opindex mno-strict-align
6801@opindex mstrict-align
74291a4b
MM
6802On System V.4 and embedded PowerPC systems do not (do) assume that
6803unaligned memory references will be handled by the system.
6804
6805@item -mrelocatable
6806@itemx -mno-relocatable
cd3bb277
JM
6807@opindex mrelocatable
6808@opindex mno-relocatable
74291a4b
MM
6809On embedded PowerPC systems generate code that allows (does not allow)
6810the program to be relocated to a different address at runtime. If you
630d3d5a
JM
6811use @option{-mrelocatable} on any module, all objects linked together must
6812be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
74291a4b
MM
6813
6814@item -mrelocatable-lib
6815@itemx -mno-relocatable-lib
cd3bb277
JM
6816@opindex mrelocatable-lib
6817@opindex mno-relocatable-lib
74291a4b
MM
6818On embedded PowerPC systems generate code that allows (does not allow)
6819the program to be relocated to a different address at runtime. Modules
630d3d5a
JM
6820compiled with @option{-mrelocatable-lib} can be linked with either modules
6821compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
6822with modules compiled with the @option{-mrelocatable} options.
74291a4b
MM
6823
6824@item -mno-toc
6825@itemx -mtoc
cd3bb277
JM
6826@opindex mno-toc
6827@opindex mtoc
74291a4b
MM
6828On System V.4 and embedded PowerPC systems do not (do) assume that
6829register 2 contains a pointer to a global area pointing to the addresses
6830used in the program.
6831
74291a4b
MM
6832@item -mlittle
6833@itemx -mlittle-endian
cd3bb277
JM
6834@opindex mlittle
6835@opindex mlittle-endian
74291a4b 6836On System V.4 and embedded PowerPC systems compile code for the
630d3d5a
JM
6837processor in little endian mode. The @option{-mlittle-endian} option is
6838the same as @option{-mlittle}.
74291a4b
MM
6839
6840@item -mbig
6841@itemx -mbig-endian
cd3bb277
JM
6842@opindex mbig
6843@opindex mbig-endian
74291a4b 6844On System V.4 and embedded PowerPC systems compile code for the
630d3d5a
JM
6845processor in big endian mode. The @option{-mbig-endian} option is
6846the same as @option{-mbig}.
74291a4b
MM
6847
6848@item -mcall-sysv
cd3bb277 6849@opindex mcall-sysv
74291a4b
MM
6850On System V.4 and embedded PowerPC systems compile code using calling
6851conventions that adheres to the March 1995 draft of the System V
6852Application Binary Interface, PowerPC processor supplement. This is the
6853default unless you configured GCC using @samp{powerpc-*-eabiaix}.
6854
6855@item -mcall-sysv-eabi
cd3bb277 6856@opindex mcall-sysv-eabi
630d3d5a 6857Specify both @option{-mcall-sysv} and @option{-meabi} options.
74291a4b
MM
6858
6859@item -mcall-sysv-noeabi
cd3bb277 6860@opindex mcall-sysv-noeabi
630d3d5a 6861Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
74291a4b
MM
6862
6863@item -mcall-aix
cd3bb277 6864@opindex mcall-aix
74291a4b 6865On System V.4 and embedded PowerPC systems compile code using calling
161d7b59 6866conventions that are similar to those used on AIX@. This is the
74291a4b
MM
6867default if you configured GCC using @samp{powerpc-*-eabiaix}.
6868
6869@item -mcall-solaris
cd3bb277 6870@opindex mcall-solaris
74291a4b
MM
6871On System V.4 and embedded PowerPC systems compile code for the Solaris
6872operating system.
6873
6874@item -mcall-linux
cd3bb277 6875@opindex mcall-linux
861bb6c1
JL
6876On System V.4 and embedded PowerPC systems compile code for the
6877Linux-based GNU system.
74291a4b 6878
48180d68
RM
6879@item -mcall-gnu
6880@opindex mcall-gnu
6881On System V.4 and embedded PowerPC systems compile code for the
6882Hurd-based GNU system.
6883
edf1b3f3
AC
6884@item -mcall-netbsd
6885@opindex mcall-netbsd
6886On System V.4 and embedded PowerPC systems compile code for the
6887NetBSD operating system.
6888
9904592e
ZW
6889@item -maix-struct-return
6890@opindex maix-struct-return
6891Return all structures in memory (as specified by the AIX ABI)@.
6892
6893@item -msvr4-struct-return
6894@opindex msvr4-struct-return
6895Return structures smaller than 8 bytes in registers (as specified by the
6896SVR4 ABI)@.
6897
0ac081f6
AH
6898@item -mabi=altivec
6899@opindex mabi=altivec
6900Extend the current ABI with AltiVec ABI extensions. This does not
6901change the default ABI, instead it adds the AltiVec ABI extensions to
6902the current ABI@.
6903
74291a4b 6904@item -mprototype
e9a25f70 6905@itemx -mno-prototype
cd3bb277
JM
6906@opindex mprototype
6907@opindex mno-prototype
74291a4b
MM
6908On System V.4 and embedded PowerPC systems assume that all calls to
6909variable argument functions are properly prototyped. Otherwise, the
6910compiler must insert an instruction before every non prototyped call to
6911set or clear bit 6 of the condition code register (@var{CR}) to
6912indicate whether floating point values were passed in the floating point
6913registers in case the function takes a variable arguments. With
630d3d5a 6914@option{-mprototype}, only calls to prototyped variable argument functions
74291a4b
MM
6915will set or clear the bit.
6916
6917@item -msim
cd3bb277 6918@opindex msim
74291a4b
MM
6919On embedded PowerPC systems, assume that the startup module is called
6920@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
6921@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
6922configurations.
6923
6924@item -mmvme
cd3bb277 6925@opindex mmvme
74291a4b 6926On embedded PowerPC systems, assume that the startup module is called
e9a25f70
JL
6927@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
6928@file{libc.a}.
6929
6930@item -mads
cd3bb277 6931@opindex mads
e9a25f70
JL
6932On embedded PowerPC systems, assume that the startup module is called
6933@file{crt0.o} and the standard C libraries are @file{libads.a} and
6934@file{libc.a}.
6935
6936@item -myellowknife
cd3bb277 6937@opindex myellowknife
e9a25f70
JL
6938On embedded PowerPC systems, assume that the startup module is called
6939@file{crt0.o} and the standard C libraries are @file{libyk.a} and
74291a4b
MM
6940@file{libc.a}.
6941
bff46771 6942@item -mvxworks
cd3bb277 6943@opindex mvxworks
bff46771
GK
6944On System V.4 and embedded PowerPC systems, specify that you are
6945compiling for a VxWorks system.
6946
74291a4b 6947@item -memb
cd3bb277 6948@opindex memb
74291a4b
MM
6949On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
6950header to indicate that @samp{eabi} extended relocations are used.
6951
6952@item -meabi
6953@itemx -mno-eabi
cd3bb277
JM
6954@opindex meabi
6955@opindex mno-eabi
74291a4b
MM
6956On System V.4 and embedded PowerPC systems do (do not) adhere to the
6957Embedded Applications Binary Interface (eabi) which is a set of
bedc7537 6958modifications to the System V.4 specifications. Selecting @option{-meabi}
74291a4b
MM
6959means that the stack is aligned to an 8 byte boundary, a function
6960@code{__eabi} is called to from @code{main} to set up the eabi
630d3d5a 6961environment, and the @option{-msdata} option can use both @code{r2} and
74291a4b 6962@code{r13} to point to two separate small data areas. Selecting
bedc7537 6963@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
74291a4b 6964do not call an initialization function from @code{main}, and the
630d3d5a
JM
6965@option{-msdata} option will only use @code{r13} to point to a single
6966small data area. The @option{-meabi} option is on by default if you
74291a4b
MM
6967configured GCC using one of the @samp{powerpc*-*-eabi*} options.
6968
6969@item -msdata=eabi
cd3bb277 6970@opindex msdata=eabi
74291a4b
MM
6971On System V.4 and embedded PowerPC systems, put small initialized
6972@code{const} global and static data in the @samp{.sdata2} section, which
6973is pointed to by register @code{r2}. Put small initialized
6974non-@code{const} global and static data in the @samp{.sdata} section,
6975which is pointed to by register @code{r13}. Put small uninitialized
6976global and static data in the @samp{.sbss} section, which is adjacent to
630d3d5a
JM
6977the @samp{.sdata} section. The @option{-msdata=eabi} option is
6978incompatible with the @option{-mrelocatable} option. The
6979@option{-msdata=eabi} option also sets the @option{-memb} option.
74291a4b
MM
6980
6981@item -msdata=sysv
cd3bb277 6982@opindex msdata=sysv
74291a4b
MM
6983On System V.4 and embedded PowerPC systems, put small global and static
6984data in the @samp{.sdata} section, which is pointed to by register
6985@code{r13}. Put small uninitialized global and static data in the
6986@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
630d3d5a
JM
6987The @option{-msdata=sysv} option is incompatible with the
6988@option{-mrelocatable} option.
74291a4b
MM
6989
6990@item -msdata=default
6991@itemx -msdata
cd3bb277
JM
6992@opindex msdata=default
6993@opindex msdata
630d3d5a
JM
6994On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
6995compile code the same as @option{-msdata=eabi}, otherwise compile code the
6996same as @option{-msdata=sysv}.
74291a4b
MM
6997
6998@item -msdata-data
cd3bb277 6999@opindex msdata-data
74291a4b
MM
7000On System V.4 and embedded PowerPC systems, put small global and static
7001data in the @samp{.sdata} section. Put small uninitialized global and
7002static data in the @samp{.sbss} section. Do not use register @code{r13}
7003to address small data however. This is the default behavior unless
630d3d5a 7004other @option{-msdata} options are used.
74291a4b
MM
7005
7006@item -msdata=none
7007@itemx -mno-sdata
cd3bb277
JM
7008@opindex msdata=none
7009@opindex mno-sdata
74291a4b
MM
7010On embedded PowerPC systems, put all initialized global and static data
7011in the @samp{.data} section, and all uninitialized data in the
7012@samp{.bss} section.
7013
7014@item -G @var{num}
cd3bb277 7015@opindex G
74291a4b
MM
7016@cindex smaller data references (PowerPC)
7017@cindex .sdata/.sdata2 references (PowerPC)
956d6950 7018On embedded PowerPC systems, put global and static items less than or
74291a4b
MM
7019equal to @var{num} bytes into the small data or bss sections instead of
7020the normal data or bss section. By default, @var{num} is 8. The
630d3d5a
JM
7021@option{-G @var{num}} switch is also passed to the linker.
7022All modules should be compiled with the same @option{-G @var{num}} value.
74291a4b
MM
7023
7024@item -mregnames
7025@itemx -mno-regnames
cd3bb277
JM
7026@opindex mregnames
7027@opindex mno-regnames
74291a4b
MM
7028On System V.4 and embedded PowerPC systems do (do not) emit register
7029names in the assembly language output using symbolic forms.
f5a1b0d2 7030
0a379b7a
CR
7031@item -pthread
7032@opindex pthread
7033Adds support for multithreading with the @dfn{pthreads} library.
7034This option sets flags for both the preprocessor and linker.
7035
74291a4b 7036@end table
f5a1b0d2 7037
74291a4b
MM
7038@node RT Options
7039@subsection IBM RT Options
7040@cindex RT options
7041@cindex IBM RT options
7042
7043These @samp{-m} options are defined for the IBM RT PC:
7044
2642624b 7045@table @gcctabopt
74291a4b 7046@item -min-line-mul
cd3bb277 7047@opindex min-line-mul
74291a4b
MM
7048Use an in-line code sequence for integer multiplies. This is the
7049default.
7050
7051@item -mcall-lib-mul
cd3bb277 7052@opindex mcall-lib-mul
74291a4b
MM
7053Call @code{lmul$$} for integer multiples.
7054
7055@item -mfull-fp-blocks
cd3bb277 7056@opindex mfull-fp-blocks
74291a4b 7057Generate full-size floating point data blocks, including the minimum
161d7b59 7058amount of scratch space recommended by IBM@. This is the default.
74291a4b
MM
7059
7060@item -mminimum-fp-blocks
cd3bb277 7061@opindex mminimum-fp-blocks
74291a4b
MM
7062Do not include extra scratch space in floating point data blocks. This
7063results in smaller code, but slower execution, since scratch space must
7064be allocated dynamically.
7065
7066@cindex @file{varargs.h} and RT PC
7067@cindex @file{stdarg.h} and RT PC
7068@item -mfp-arg-in-fpregs
cd3bb277 7069@opindex mfp-arg-in-fpregs
74291a4b
MM
7070Use a calling sequence incompatible with the IBM calling convention in
7071which floating point arguments are passed in floating point registers.
c771326b 7072Note that @code{varargs.h} and @code{stdarg.h} will not work with
74291a4b
MM
7073floating point operands if this option is specified.
7074
7075@item -mfp-arg-in-gregs
cd3bb277 7076@opindex mfp-arg-in-gregs
74291a4b
MM
7077Use the normal calling convention for floating point arguments. This is
7078the default.
7079
7080@item -mhc-struct-return
cd3bb277 7081@opindex mhc-struct-return
74291a4b
MM
7082Return structures of more than one word in memory, rather than in a
7083register. This provides compatibility with the MetaWare HighC (hc)
630d3d5a 7084compiler. Use the option @option{-fpcc-struct-return} for compatibility
74291a4b
MM
7085with the Portable C Compiler (pcc).
7086
7087@item -mnohc-struct-return
cd3bb277 7088@opindex mnohc-struct-return
74291a4b
MM
7089Return some structures of more than one word in registers, when
7090convenient. This is the default. For compatibility with the
630d3d5a
JM
7091IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
7092option @option{-mhc-struct-return}.
74291a4b
MM
7093@end table
7094
7095@node MIPS Options
7096@subsection MIPS Options
7097@cindex MIPS options
7098
7099These @samp{-m} options are defined for the MIPS family of computers:
7100
2642624b 7101@table @gcctabopt
7dac2f89
EC
7102
7103@item -march=@var{cpu-type}
7104@opindex march
7105Assume the defaults for the machine type @var{cpu-type} when generating
7106instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000},
7107@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
7108@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
7109and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000},
7110@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
7111@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc.
7112
7113@item -mtune=@var{cpu-type}
7114@opindex mtune
630d3d5a
JM
7115Assume the defaults for the machine type @var{cpu-type} when scheduling
7116instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000},
8b9243df
JJ
7117@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
7118@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
7119and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000},
7120@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
7121@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific
630d3d5a 7122@var{cpu-type} will schedule things appropriately for that particular
8b9243df 7123chip, the compiler will not generate any code that does not meet level 1
630d3d5a
JM
7124of the MIPS ISA (instruction set architecture) without a @option{-mipsX}
7125or @option{-mabi} switch being used.
74291a4b 7126
7dac2f89
EC
7127@item -mcpu=@var{cpu-type}
7128@opindex mcpu
7129This is identical to specifying both @option{-march} and @option{-mtune}.
7130
74291a4b 7131@item -mips1
cd3bb277 7132@opindex mips1
161d7b59 7133Issue instructions from level 1 of the MIPS ISA@. This is the default.
630d3d5a 7134@samp{r3000} is the default @var{cpu-type} at this ISA level.
74291a4b
MM
7135
7136@item -mips2
cd3bb277 7137@opindex mips2
74291a4b 7138Issue instructions from level 2 of the MIPS ISA (branch likely, square
630d3d5a 7139root instructions). @samp{r6000} is the default @var{cpu-type} at this
74291a4b
MM
7140ISA level.
7141
7142@item -mips3
cd3bb277 7143@opindex mips3
02f52e19 7144Issue instructions from level 3 of the MIPS ISA (64-bit instructions).
630d3d5a 7145@samp{r4000} is the default @var{cpu-type} at this ISA level.
74291a4b 7146
3398f47f 7147@item -mips4
cd3bb277 7148@opindex mips4
8b9243df
JJ
7149Issue instructions from level 4 of the MIPS ISA (conditional move,
7150prefetch, enhanced FPU instructions). @samp{r8000} is the default
630d3d5a 7151@var{cpu-type} at this ISA level.
3398f47f 7152
74291a4b 7153@item -mfp32
cd3bb277 7154@opindex mfp32
74291a4b
MM
7155Assume that 32 32-bit floating point registers are available. This is
7156the default.
7157
7158@item -mfp64
cd3bb277 7159@opindex mfp64
74291a4b 7160Assume that 32 64-bit floating point registers are available. This is
630d3d5a 7161the default when the @option{-mips3} option is used.
74291a4b 7162
13fac94a
GK
7163@item -mfused-madd
7164@itemx -mno-fused-madd
7165@opindex mfused-madd
7166@opindex mno-fused-madd
7167Generate code that uses (does not use) the floating point multiply and
7168accumulate instructions, when they are available. These instructions
7169are generated by default if they are available, but this may be
7170undesirable if the extra precision causes problems or on certain chips
7171in the mode where denormals are rounded to zero where denormals
7172generated by multiply and accumulate instructions cause exceptions
7173anyway.
7174
74291a4b 7175@item -mgp32
cd3bb277 7176@opindex mgp32
74291a4b
MM
7177Assume that 32 32-bit general purpose registers are available. This is
7178the default.
7179
7180@item -mgp64
cd3bb277 7181@opindex mgp64
74291a4b 7182Assume that 32 64-bit general purpose registers are available. This is
630d3d5a 7183the default when the @option{-mips3} option is used.
74291a4b
MM
7184
7185@item -mint64
cd3bb277 7186@opindex mint64
630d3d5a 7187Force int and long types to be 64 bits wide. See @option{-mlong32} for an
3ce1ba83 7188explanation of the default, and the width of pointers.
74291a4b
MM
7189
7190@item -mlong64
cd3bb277 7191@opindex mlong64
630d3d5a 7192Force long types to be 64 bits wide. See @option{-mlong32} for an
3ce1ba83 7193explanation of the default, and the width of pointers.
fb1bf66d 7194
3ce1ba83 7195@item -mlong32
cd3bb277 7196@opindex mlong32
3ce1ba83
GRK
7197Force long, int, and pointer types to be 32 bits wide.
7198
630d3d5a 7199If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set,
b192711e 7200the size of ints, longs, and pointers depends on the ABI and ISA chosen.
630d3d5a
JM
7201For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits
7202wide. For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide.
7203For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints
7204and longs are 32 bits wide. For @option{-mabi=eabi} and higher ISAs, ints
3ce1ba83
GRK
7205are 32 bits, and longs are 64 bits wide. The width of pointer types is
7206the smaller of the width of longs or the width of general purpose
161d7b59 7207registers (which in turn depends on the ISA)@.
74291a4b 7208
62a1403d 7209@item -mabi=32
8b9243df 7210@itemx -mabi=o64
3398f47f
MM
7211@itemx -mabi=n32
7212@itemx -mabi=64
7213@itemx -mabi=eabi
cd3bb277
JM
7214@opindex mabi=32
7215@opindex mabi=o64
7216@opindex mabi=n32
7217@opindex mabi=64
7218@opindex mabi=eabi
161d7b59 7219Generate code for the indicated ABI@. The default instruction level is
630d3d5a
JM
7220@option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and
7221@option{-mips4} otherwise. Conversely, with @option{-mips1} or
7222@option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI
8b9243df 7223is @samp{64}.
3398f47f 7224
74291a4b 7225@item -mmips-as
cd3bb277 7226@opindex mmips-as
74291a4b
MM
7227Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
7228add normal debug information. This is the default for all
7229platforms except for the OSF/1 reference platform, using the OSF/rose
630d3d5a 7230object format. If the either of the @option{-gstabs} or @option{-gstabs+}
74291a4b 7231switches are used, the @file{mips-tfile} program will encapsulate the
161d7b59 7232stabs within MIPS ECOFF@.
74291a4b
MM
7233
7234@item -mgas
cd3bb277 7235@opindex mgas
74291a4b 7236Generate code for the GNU assembler. This is the default on the OSF/1
861bb6c1 7237reference platform, using the OSF/rose object format. Also, this is
630d3d5a 7238the default if the configure option @option{--with-gnu-as} is used.
861bb6c1
JL
7239
7240@item -msplit-addresses
7241@itemx -mno-split-addresses
cd3bb277
JM
7242@opindex msplit-addresses
7243@opindex mno-split-addresses
861bb6c1 7244Generate code to load the high and low parts of address constants separately.
aee96fe9 7245This allows GCC to optimize away redundant loads of the high order
861bb6c1
JL
7246bits of addresses. This optimization requires GNU as and GNU ld.
7247This optimization is enabled by default for some embedded targets where
7248GNU as and GNU ld are standard.
74291a4b
MM
7249
7250@item -mrnames
7251@itemx -mno-rnames
cd3bb277
JM
7252@opindex mrnames
7253@opindex mno-rnames
630d3d5a 7254The @option{-mrnames} switch says to output code using the MIPS software
74291a4b
MM
7255names for the registers, instead of the hardware names (ie, @var{a0}
7256instead of @var{$4}). The only known assembler that supports this option
7257is the Algorithmics assembler.
7258
7259@item -mgpopt
7260@itemx -mno-gpopt
cd3bb277
JM
7261@opindex mgpopt
7262@opindex mno-gpopt
630d3d5a 7263The @option{-mgpopt} switch says to write all of the data declarations
74291a4b
MM
7264before the instructions in the text section, this allows the MIPS
7265assembler to generate one word memory references instead of using two
7266words for short global or static data items. This is on by default if
7267optimization is selected.
7268
7269@item -mstats
7270@itemx -mno-stats
cd3bb277
JM
7271@opindex mstats
7272@opindex mno-stats
630d3d5a 7273For each non-inline function processed, the @option{-mstats} switch
74291a4b
MM
7274causes the compiler to emit one line to the standard error file to
7275print statistics about the program (number of registers saved, stack
7276size, etc.).
7277
7278@item -mmemcpy
7279@itemx -mno-memcpy
cd3bb277
JM
7280@opindex mmemcpy
7281@opindex mno-memcpy
630d3d5a 7282The @option{-mmemcpy} switch makes all block moves call the appropriate
74291a4b
MM
7283string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
7284generating inline code.
7285
7286@item -mmips-tfile
7287@itemx -mno-mips-tfile
cd3bb277
JM
7288@opindex mmips-tfile
7289@opindex mno-mips-tfile
630d3d5a 7290The @option{-mno-mips-tfile} switch causes the compiler not
74291a4b
MM
7291postprocess the object file with the @file{mips-tfile} program,
7292after the MIPS assembler has generated it to add debug support. If
7293@file{mips-tfile} is not run, then no local variables will be
7294available to the debugger. In addition, @file{stage2} and
7295@file{stage3} objects will have the temporary file names passed to the
7296assembler embedded in the object file, which means the objects will
630d3d5a 7297not compare the same. The @option{-mno-mips-tfile} switch should only
74291a4b
MM
7298be used when there are bugs in the @file{mips-tfile} program that
7299prevents compilation.
7300
7301@item -msoft-float
cd3bb277 7302@opindex msoft-float
74291a4b 7303Generate output containing library calls for floating point.
161d7b59 7304@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
7305Normally the facilities of the machine's usual C compiler are used, but
7306this can't be done directly in cross-compilation. You must make your
7307own arrangements to provide suitable library functions for
7308cross-compilation.
7309
7310@item -mhard-float
cd3bb277 7311@opindex mhard-float
74291a4b
MM
7312Generate output containing floating point instructions. This is the
7313default if you use the unmodified sources.
7314
7315@item -mabicalls
7316@itemx -mno-abicalls
cd3bb277
JM
7317@opindex mabicalls
7318@opindex mno-abicalls
74291a4b
MM
7319Emit (or do not emit) the pseudo operations @samp{.abicalls},
7320@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
7321position independent code.
7322
7323@item -mlong-calls
7324@itemx -mno-long-calls
cd3bb277
JM
7325@opindex mlong-calls
7326@opindex mno-long-calls
74291a4b
MM
7327Do all calls with the @samp{JALR} instruction, which requires
7328loading up a function's address into a register before the call.
7329You need to use this switch, if you call outside of the current
7330512 megabyte segment to functions that are not through pointers.
7331
7332@item -mhalf-pic
7333@itemx -mno-half-pic
cd3bb277
JM
7334@opindex mhalf-pic
7335@opindex mno-half-pic
74291a4b
MM
7336Put pointers to extern references into the data section and load them
7337up, rather than put the references in the text section.
7338
7339@item -membedded-pic
7340@itemx -mno-embedded-pic
cd3bb277
JM
7341@opindex membedded-pic
7342@opindex mno-embedded-pic
69fa83cf
JW
7343Generate PIC code suitable for some embedded systems. All calls are
7344made using PC relative address, and all data is addressed using the $gp
7345register. No more than 65536 bytes of global data may be used. This
7346requires GNU as and GNU ld which do most of the work. This currently
161d7b59 7347only works on targets which use ECOFF; it does not work with ELF@.
74291a4b
MM
7348
7349@item -membedded-data
7350@itemx -mno-embedded-data
cd3bb277
JM
7351@opindex membedded-data
7352@opindex mno-embedded-data
74291a4b
MM
7353Allocate variables to the read-only data section first if possible, then
7354next in the small data section if possible, otherwise in data. This gives
7355slightly slower code than the default, but reduces the amount of RAM required
7356when executing, and thus may be preferred for some embedded systems.
7357
919509ce
DN
7358@item -muninit-const-in-rodata
7359@itemx -mno-uninit-const-in-rodata
cd3bb277
JM
7360@opindex muninit-const-in-rodata
7361@opindex mno-uninit-const-in-rodata
695ac33f 7362When used together with @option{-membedded-data}, it will always store uninitialized
919509ce 7363const variables in the read-only data section.
02f52e19 7364
74291a4b
MM
7365@item -msingle-float
7366@itemx -mdouble-float
cd3bb277
JM
7367@opindex msingle-float
7368@opindex mdouble-float
630d3d5a 7369The @option{-msingle-float} switch tells gcc to assume that the floating
74291a4b 7370point coprocessor only supports single precision operations, as on the
630d3d5a 7371@samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use
74291a4b
MM
7372double precision operations. This is the default.
7373
7374@item -mmad
7375@itemx -mno-mad
cd3bb277
JM
7376@opindex mmad
7377@opindex mno-mad
74291a4b
MM
7378Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
7379as on the @samp{r4650} chip.
7380
7381@item -m4650
cd3bb277 7382@opindex m4650
630d3d5a
JM
7383Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
7384@option{-mcpu=r4650}.
74291a4b 7385
8b9243df
JJ
7386@item -mips16
7387@itemx -mno-mips16
cd3bb277
JM
7388@opindex mips16
7389@opindex mno-mips16
8b9243df
JJ
7390Enable 16-bit instructions.
7391
7392@item -mentry
cd3bb277 7393@opindex mentry
8b9243df 7394Use the entry and exit pseudo ops. This option can only be used with
630d3d5a 7395@option{-mips16}.
8b9243df 7396
74291a4b 7397@item -EL
cd3bb277 7398@opindex EL
74291a4b
MM
7399Compile code for the processor in little endian mode.
7400The requisite libraries are assumed to exist.
7401
7402@item -EB
cd3bb277 7403@opindex EB
74291a4b
MM
7404Compile code for the processor in big endian mode.
7405The requisite libraries are assumed to exist.
7406
7407@item -G @var{num}
cd3bb277 7408@opindex G
74291a4b
MM
7409@cindex smaller data references (MIPS)
7410@cindex gp-relative references (MIPS)
7411Put global and static items less than or equal to @var{num} bytes into
7412the small data or bss sections instead of the normal data or bss
7413section. This allows the assembler to emit one word memory reference
7414instructions based on the global pointer (@var{gp} or @var{$28}),
7415instead of the normal two words used. By default, @var{num} is 8 when
7416the MIPS assembler is used, and 0 when the GNU assembler is used. The
630d3d5a
JM
7417@option{-G @var{num}} switch is also passed to the assembler and linker.
7418All modules should be compiled with the same @option{-G @var{num}}
74291a4b
MM
7419value.
7420
7421@item -nocpp
cd3bb277 7422@opindex nocpp
9ec36da5 7423Tell the MIPS assembler to not run its preprocessor over user
74291a4b 7424assembler files (with a @samp{.s} suffix) when assembling them.
63357d93 7425
1e387156 7426@item -mfix7000
cd3bb277 7427@opindex mfix7000
1e387156
CM
7428Pass an option to gas which will cause nops to be inserted if
7429the read of the destination register of an mfhi or mflo instruction
7430occurs in the following two instructions.
7431
63357d93 7432@item -no-crt0
cd3bb277 7433@opindex no-crt0
63357d93 7434Do not include the default crt0.
d490e8ad
DD
7435
7436@item -mflush-func=@var{func}
7437@itemx -mno-flush-func
7438@opindex mflush-func
7439Specifies the function to call to flush the I and D caches, or to not
7440call any such function. If called, the function must take the same
7441arguments as the common @code{_flush_func()}, that is, the address of the
7442memory range for which the cache is being flushed, the size of the
7443memory range, and the number 3 (to flush both caches). The default
7444depends on the target gcc was configured for, but commonly is either
7445@samp{_flush_func} or @samp{__cpu_flush}.
74291a4b
MM
7446@end table
7447
74291a4b
MM
7448These options are defined by the macro
7449@code{TARGET_SWITCHES} in the machine description. The default for the
7450options is also defined by that macro, which enables you to change the
7451defaults.
74291a4b 7452
14f73b5a
JH
7453@node i386 and x86-64 Options
7454@subsection Intel 386 and AMD x86-64 Options
74291a4b 7455@cindex i386 Options
14f73b5a 7456@cindex x86-64 Options
74291a4b 7457@cindex Intel 386 Options
14f73b5a 7458@cindex AMD x86-64 Options
74291a4b 7459
14f73b5a
JH
7460These @samp{-m} options are defined for the i386 and x86-64 family of
7461computers:
74291a4b 7462
2642624b 7463@table @gcctabopt
630d3d5a 7464@item -mcpu=@var{cpu-type}
cd3bb277 7465@opindex mcpu
0dd0e980
JH
7466Tune to @var{cpu-type} everything applicable about the generated code, except
7467for the ABI and the set of available instructions. The choices for
7468@var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686},
7469@samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2},
7470@samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3},
7471@samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp}
7472and @samp{athlon-mp}.
6f670fde 7473
630d3d5a 7474While picking a specific @var{cpu-type} will schedule things appropriately
6f670fde 7475for that particular chip, the compiler will not generate any code that
630d3d5a 7476does not run on the i386 without the @option{-march=@var{cpu-type}} option
7001ee2d 7477being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
6ca3ad1b 7478is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the
b4e89e2d 7479AMD chips as opposed to the Intel ones.
a9f3e1a4 7480
630d3d5a 7481@item -march=@var{cpu-type}
cd3bb277 7482@opindex march
630d3d5a
JM
7483Generate instructions for the machine type @var{cpu-type}. The choices
7484for @var{cpu-type} are the same as for @option{-mcpu}. Moreover,
7485specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}.
a9f3e1a4
JL
7486
7487@item -m386
7488@itemx -m486
7489@itemx -mpentium
7490@itemx -mpentiumpro
cd3bb277
JM
7491@opindex m386
7492@opindex m486
7493@opindex mpentium
7494@opindex mpentiumpro
9c34dbbf
ZW
7495These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486},
7496@option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively.
7497These synonyms are deprecated.
74291a4b 7498
965f5423
JH
7499@item -mfpmath=@var{unit}
7500@opindex march
7501generate floating point arithmetics for selected unit @var{unit}. the choices
7502for @var{unit} are:
7503
7504@table @samp
7505@item 387
7506Use the standard 387 floating point coprocessor present majority of chips and
7507emulated otherwise. Code compiled with this option will run almost everywhere.
7508The temporary results are computed in 80bit precesion instead of precision
7509specified by the type resulting in slightly different results compared to most
7510of other chips. See @option{-ffloat-store} for more detailed description.
7511
7512This is the default choice for i386 compiler.
7513
7514@item sse
7515Use scalar floating point instructions present in the SSE instruction set.
7516This instruction set is supported by Pentium3 and newer chips, in the AMD line
7517by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
7518instruction set supports only single precision arithmetics, thus the double and
7519extended precision arithmetics is still done using 387. Later version, present
7520only in Pentium4 and the future AMD x86-64 chips supports double precision
7521arithmetics too.
7522
7523For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
7524@option{-msse2} switches to enable SSE extensions and make this option
7525effective. For x86-64 compiler, these extensions are enabled by default.
7526
7527The resulting code should be considerably faster in majority of cases and avoid
7528the numerical instability problems of 387 code, but may break some existing
7529code that expects temporaries to be 80bit.
7530
7531This is the default choice for x86-64 compiler.
7532
7533@item sse,387
7534Attempt to utilize both instruction sets at once. This effectivly double the
7535amount of available registers and on chips with separate execution units for
7536387 and SSE the execution resources too. Use this option with care, as it is
7537still experimental, because gcc register allocator does not model separate
7538functional units well resulting in instable performance.
7539@end table
7540
c93e80a5
JH
7541@item -masm=@var{dialect}
7542@opindex masm=@var{dialect}
7543Output asm instructions using selected @var{dialect}. Supported choices are
7544@samp{intel} or @samp{att} (the default one).
04e149ab 7545
74291a4b
MM
7546@item -mieee-fp
7547@itemx -mno-ieee-fp
cd3bb277
JM
7548@opindex mieee-fp
7549@opindex mno-ieee-fp
74291a4b
MM
7550Control whether or not the compiler uses IEEE floating point
7551comparisons. These handle correctly the case where the result of a
7552comparison is unordered.
7553
7554@item -msoft-float
cd3bb277 7555@opindex msoft-float
74291a4b 7556Generate output containing library calls for floating point.
161d7b59 7557@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
7558Normally the facilities of the machine's usual C compiler are used, but
7559this can't be done directly in cross-compilation. You must make your
7560own arrangements to provide suitable library functions for
7561cross-compilation.
7562
7563On machines where a function returns floating point results in the 80387
7564register stack, some floating point opcodes may be emitted even if
630d3d5a 7565@option{-msoft-float} is used.
74291a4b
MM
7566
7567@item -mno-fp-ret-in-387
cd3bb277 7568@opindex mno-fp-ret-in-387
74291a4b
MM
7569Do not use the FPU registers for return values of functions.
7570
7571The usual calling convention has functions return values of types
7572@code{float} and @code{double} in an FPU register, even if there
161d7b59
JM
7573is no FPU@. The idea is that the operating system should emulate
7574an FPU@.
74291a4b 7575
630d3d5a 7576The option @option{-mno-fp-ret-in-387} causes such values to be returned
74291a4b
MM
7577in ordinary CPU registers instead.
7578
7579@item -mno-fancy-math-387
cd3bb277 7580@opindex mno-fancy-math-387
74291a4b
MM
7581Some 387 emulators do not support the @code{sin}, @code{cos} and
7582@code{sqrt} instructions for the 387. Specify this option to avoid
161d7b59 7583generating those instructions. This option is the default on FreeBSD@.
74291a4b 7584As of revision 2.6.1, these instructions are not generated unless you
630d3d5a 7585also use the @option{-funsafe-math-optimizations} switch.
74291a4b
MM
7586
7587@item -malign-double
7588@itemx -mno-align-double
cd3bb277
JM
7589@opindex malign-double
7590@opindex mno-align-double
0c2d1a2a 7591Control whether GCC aligns @code{double}, @code{long double}, and
74291a4b
MM
7592@code{long long} variables on a two word boundary or a one word
7593boundary. Aligning @code{double} variables on a two word boundary will
7594produce code that runs somewhat faster on a @samp{Pentium} at the
7595expense of more memory.
7596
2b589241 7597@item -m128bit-long-double
cd3bb277 7598@opindex m128bit-long-double
2b589241
JH
7599Control the size of @code{long double} type. i386 application binary interface
7600specify the size to be 12 bytes, while modern architectures (Pentium and newer)
c771326b 7601prefer @code{long double} aligned to 8 or 16 byte boundary. This is
2b589241
JH
7602impossible to reach with 12 byte long doubles in the array accesses.
7603
630d3d5a 7604@strong{Warning:} if you use the @option{-m128bit-long-double} switch, the
2b589241
JH
7605structures and arrays containing @code{long double} will change their size as
7606well as function calling convention for function taking @code{long double}
02f52e19 7607will be modified.
2b589241
JH
7608
7609@item -m96bit-long-double
cd3bb277 7610@opindex m96bit-long-double
0a75e5c3 7611Set the size of @code{long double} to 96 bits as required by the i386
2b589241 7612application binary interface. This is the default.
74291a4b
MM
7613
7614@item -msvr3-shlib
7615@itemx -mno-svr3-shlib
cd3bb277
JM
7616@opindex msvr3-shlib
7617@opindex mno-svr3-shlib
9c34dbbf
ZW
7618Control whether GCC places uninitialized local variables into the
7619@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them
7620into @code{bss}. These options are meaningful only on System V Release 3.
74291a4b 7621
74291a4b 7622@item -mrtd
cd3bb277 7623@opindex mrtd
74291a4b
MM
7624Use a different function-calling convention, in which functions that
7625take a fixed number of arguments return with the @code{ret} @var{num}
7626instruction, which pops their arguments while returning. This saves one
7627instruction in the caller since there is no need to pop the arguments
7628there.
7629
7630You can specify that an individual function is called with this calling
7631sequence with the function attribute @samp{stdcall}. You can also
630d3d5a 7632override the @option{-mrtd} option by using the function attribute
0b433de6 7633@samp{cdecl}. @xref{Function Attributes}.
74291a4b
MM
7634
7635@strong{Warning:} this calling convention is incompatible with the one
7636normally used on Unix, so you cannot use it if you need to call
7637libraries compiled with the Unix compiler.
7638
7639Also, you must provide function prototypes for all functions that
7640take variable numbers of arguments (including @code{printf});
7641otherwise incorrect code will be generated for calls to those
7642functions.
7643
7644In addition, seriously incorrect code will result if you call a
7645function with too many arguments. (Normally, extra arguments are
7646harmlessly ignored.)
7647
74291a4b 7648@item -mregparm=@var{num}
cd3bb277 7649@opindex mregparm
74291a4b
MM
7650Control how many registers are used to pass integer arguments. By
7651default, no registers are used to pass arguments, and at most 3
7652registers can be used. You can control this behavior for a specific
0b433de6
JL
7653function by using the function attribute @samp{regparm}.
7654@xref{Function Attributes}.
74291a4b
MM
7655
7656@strong{Warning:} if you use this switch, and
7657@var{num} is nonzero, then you must build all modules with the same
7658value, including any libraries. This includes the system libraries and
7659startup modules.
7660
3af4bd89 7661@item -mpreferred-stack-boundary=@var{num}
cd3bb277 7662@opindex mpreferred-stack-boundary
3af4bd89 7663Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
630d3d5a 7664byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
fbb83b43
AO
7665the default is 4 (16 bytes or 128 bits), except when optimizing for code
7666size (@option{-Os}), in which case the default is the minimum correct
7667alignment (4 bytes for x86, and 8 bytes for x86-64).
3af4bd89 7668
fbb83b43
AO
7669On Pentium and PentiumPro, @code{double} and @code{long double} values
7670should be aligned to an 8 byte boundary (see @option{-malign-double}) or
7671suffer significant run time performance penalties. On Pentium III, the
b192711e 7672Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
3af4bd89
JH
7673penalties if it is not 16 byte aligned.
7674
7675To ensure proper alignment of this values on the stack, the stack boundary
02f52e19 7676must be as aligned as that required by any value stored on the stack.
3af4bd89
JH
7677Further, every function must be generated such that it keeps the stack
7678aligned. Thus calling a function compiled with a higher preferred
7679stack boundary from a function compiled with a lower preferred stack
7680boundary will most likely misalign the stack. It is recommended that
7681libraries that use callbacks always use the default setting.
7682
fbb83b43
AO
7683This extra alignment does consume extra stack space, and generally
7684increases code size. Code that is sensitive to stack space usage, such
7685as embedded systems and operating system kernels, may want to reduce the
7686preferred alignment to @option{-mpreferred-stack-boundary=2}.
f22a97d2 7687
1255c85c
BS
7688@item -mmmx
7689@itemx -mno-mmx
7690@item -msse
7691@itemx -mno-sse
965f5423
JH
7692@item -msse2
7693@itemx -mno-sse2
1255c85c
BS
7694@item -m3dnow
7695@itemx -mno-3dnow
7696@opindex mmmx
7697@opindex mno-mmx
7698@opindex msse
7699@opindex mno-sse
7700@opindex m3dnow
7701@opindex mno-3dnow
7702These switches enable or disable the use of built-in functions that allow
7703direct access to the MMX, SSE and 3Dnow extensions of the instruction set.
7704
80ebf43e 7705The following machine modes are available for use with MMX built-in functions
1255c85c
BS
7706(@pxref{Vector Extensions}): @code{V2SI} for a vector of two 32 bit integers,
7707@code{V4HI} for a vector of four 16 bit integers, and @code{V8QI} for a
80ebf43e
BS
7708vector of eight 8 bit integers. Some of the built-in functions operate on
7709MMX registers as a whole 64 bit entity, these use @code{DI} as their mode.
1255c85c
BS
7710
7711If 3Dnow extensions are enabled, @code{V2SF} is used as a mode for a vector
7712of two 32 bit floating point values.
7713
7714If SSE extensions are enabled, @code{V4SF} is used for a vector of four 32 bit
7715floating point values. Some instructions use a vector of four 32 bit
7716integers, these use @code{V4SI}. Finally, some instructions operate on an
7717entire vector register, interpreting it as a 128 bit integer, these use mode
7718@code{TI}.
7719
80ebf43e 7720The following built-in functions are made available by @option{-mmmx}:
1255c85c
BS
7721@table @code
7722@item v8qi __builtin_ia32_paddb (v8qi, v8qi)
7723Generates the @code{paddb} machine instruction.
7724@item v4hi __builtin_ia32_paddw (v4hi, v4hi)
7725Generates the @code{paddw} machine instruction.
7726@item v2si __builtin_ia32_paddd (v2si, v2si)
7727Generates the @code{paddd} machine instruction.
7728@item v8qi __builtin_ia32_psubb (v8qi, v8qi)
7729Generates the @code{psubb} machine instruction.
7730@item v4hi __builtin_ia32_psubw (v4hi, v4hi)
7731Generates the @code{psubw} machine instruction.
7732@item v2si __builtin_ia32_psubd (v2si, v2si)
7733Generates the @code{psubd} machine instruction.
7734
7735@item v8qi __builtin_ia32_paddsb (v8qi, v8qi)
7736Generates the @code{paddsb} machine instruction.
7737@item v4hi __builtin_ia32_paddsw (v4hi, v4hi)
7738Generates the @code{paddsw} machine instruction.
7739@item v8qi __builtin_ia32_psubsb (v8qi, v8qi)
7740Generates the @code{psubsb} machine instruction.
7741@item v4hi __builtin_ia32_psubsw (v4hi, v4hi)
7742Generates the @code{psubsw} machine instruction.
7743
7744@item v8qi __builtin_ia32_paddusb (v8qi, v8qi)
7745Generates the @code{paddusb} machine instruction.
7746@item v4hi __builtin_ia32_paddusw (v4hi, v4hi)
7747Generates the @code{paddusw} machine instruction.
7748@item v8qi __builtin_ia32_psubusb (v8qi, v8qi)
7749Generates the @code{psubusb} machine instruction.
7750@item v4hi __builtin_ia32_psubusw (v4hi, v4hi)
7751Generates the @code{psubusw} machine instruction.
7752
7753@item v4hi __builtin_ia32_pmullw (v4hi, v4hi)
7754Generates the @code{pmullw} machine instruction.
7755@item v4hi __builtin_ia32_pmulhw (v4hi, v4hi)
7756Generates the @code{pmulhw} machine instruction.
7757
7758@item di __builtin_ia32_pand (di, di)
7759Generates the @code{pand} machine instruction.
7760@item di __builtin_ia32_pandn (di,di)
7761Generates the @code{pandn} machine instruction.
7762@item di __builtin_ia32_por (di, di)
7763Generates the @code{por} machine instruction.
7764@item di __builtin_ia32_pxor (di, di)
7765Generates the @code{pxor} machine instruction.
7766
7767@item v8qi __builtin_ia32_pcmpeqb (v8qi, v8qi)
7768Generates the @code{pcmpeqb} machine instruction.
7769@item v4hi __builtin_ia32_pcmpeqw (v4hi, v4hi)
7770Generates the @code{pcmpeqw} machine instruction.
7771@item v2si __builtin_ia32_pcmpeqd (v2si, v2si)
7772Generates the @code{pcmpeqd} machine instruction.
7773@item v8qi __builtin_ia32_pcmpgtb (v8qi, v8qi)
7774Generates the @code{pcmpgtb} machine instruction.
7775@item v4hi __builtin_ia32_pcmpgtw (v4hi, v4hi)
7776Generates the @code{pcmpgtw} machine instruction.
7777@item v2si __builtin_ia32_pcmpgtd (v2si, v2si)
7778Generates the @code{pcmpgtd} machine instruction.
7779
7780@item v8qi __builtin_ia32_punpckhbw (v8qi, v8qi)
7781Generates the @code{punpckhbw} machine instruction.
7782@item v4hi __builtin_ia32_punpckhwd (v4hi, v4hi)
7783Generates the @code{punpckhwd} machine instruction.
7784@item v2si __builtin_ia32_punpckhdq (v2si, v2si)
7785Generates the @code{punpckhdq} machine instruction.
7786@item v8qi __builtin_ia32_punpcklbw (v8qi, v8qi)
7787Generates the @code{punpcklbw} machine instruction.
7788@item v4hi __builtin_ia32_punpcklwd (v4hi, v4hi)
7789Generates the @code{punpcklwd} machine instruction.
7790@item v2si __builtin_ia32_punpckldq (v2si, v2si)
7791Generates the @code{punpckldq} machine instruction.
7792
7793@item v8qi __builtin_ia32_packsswb (v4hi, v4hi)
7794Generates the @code{packsswb} machine instruction.
7795@item v4hi __builtin_ia32_packssdw (v2si, v2si)
7796Generates the @code{packssdw} machine instruction.
7797@item v8qi __builtin_ia32_packuswb (v4hi, v4hi)
7798Generates the @code{packuswb} machine instruction.
7799
7800@end table
7801
80ebf43e 7802The following built-in functions are made available either with @option{-msse}, or
1255c85c
BS
7803with a combination of @option{-m3dnow} and @option{-march=athlon}.
7804@table @code
7805
7806@item v4hi __builtin_ia32_pmulhuw (v4hi, v4hi)
7807Generates the @code{pmulhuw} machine instruction.
7808
7809@item v8qi __builtin_ia32_pavgb (v8qi, v8qi)
7810Generates the @code{pavgb} machine instruction.
7811@item v4hi __builtin_ia32_pavgw (v4hi, v4hi)
7812Generates the @code{pavgw} machine instruction.
7813@item v4hi __builtin_ia32_psadbw (v8qi, v8qi)
7814Generates the @code{psadbw} machine instruction.
7815
7816@item v8qi __builtin_ia32_pmaxub (v8qi, v8qi)
7817Generates the @code{pmaxub} machine instruction.
7818@item v4hi __builtin_ia32_pmaxsw (v4hi, v4hi)
7819Generates the @code{pmaxsw} machine instruction.
7820@item v8qi __builtin_ia32_pminub (v8qi, v8qi)
7821Generates the @code{pminub} machine instruction.
7822@item v4hi __builtin_ia32_pminsw (v4hi, v4hi)
7823Generates the @code{pminsw} machine instruction.
7824
7825@item int __builtin_ia32_pextrw (v4hi, int)
7826Generates the @code{pextrw} machine instruction.
7827@item v4hi __builtin_ia32_pinsrw (v4hi, int, int)
7828Generates the @code{pinsrw} machine instruction.
7829
7830@item int __builtin_ia32_pmovmskb (v8qi)
7831Generates the @code{pmovmskb} machine instruction.
7832@item void __builtin_ia32_maskmovq (v8qi, v8qi, char *)
7833Generates the @code{maskmovq} machine instruction.
acb0aa65 7834@item void __builtin_ia32_movntq (di *, di)
1255c85c 7835Generates the @code{movntq} machine instruction.
acb0aa65 7836@item void __builtin_ia32_sfence (void)
1255c85c
BS
7837Generates the @code{sfence} machine instruction.
7838@item void __builtin_ia32_prefetch (char *, int selector)
7839Generates a prefetch machine instruction, depending on the value of
7840selector. If @code{selector} is 0, it generates @code{prefetchnta}; for
7841a value of 1, it generates @code{prefetcht0}; for a value of 2, it generates
7842@code{prefetcht1}; and for a value of 3 it generates @code{prefetcht2}.
7843
7844@end table
7845
80ebf43e 7846The following built-in functions are available when @option{-msse} is used.
1255c85c
BS
7847
7848@table @code
acb0aa65 7849@item int __builtin_ia32_comieq (v4sf, v4sf)
1255c85c
BS
7850Generates the @code{comiss} machine instruction and performs an equality
7851comparison. The return value is the truth value of that comparison.
acb0aa65 7852@item int __builtin_ia32_comineq (v4sf, v4sf)
1255c85c
BS
7853Generates the @code{comiss} machine instruction and performs an inequality
7854comparison. The return value is the truth value of that comparison.
acb0aa65 7855@item int __builtin_ia32_comilt (v4sf, v4sf)
1255c85c
BS
7856Generates the @code{comiss} machine instruction and performs a ``less than''
7857comparison. The return value is the truth value of that comparison.
acb0aa65 7858@item int __builtin_ia32_comile (v4sf, v4sf)
1255c85c
BS
7859Generates the @code{comiss} machine instruction and performs a ``less or
7860equal'' comparison. The return value is the truth value of that comparison.
acb0aa65 7861@item int __builtin_ia32_comigt (v4sf, v4sf)
1255c85c
BS
7862Generates the @code{comiss} machine instruction and performs a ``greater than''
7863comparison. The return value is the truth value of that comparison.
acb0aa65 7864@item int __builtin_ia32_comige (v4sf, v4sf)
1255c85c
BS
7865Generates the @code{comiss} machine instruction and performs a ``greater or
7866equal'' comparison. The return value is the truth value of that comparison.
7867
acb0aa65 7868@item int __builtin_ia32_ucomieq (v4sf, v4sf)
1255c85c
BS
7869Generates the @code{ucomiss} machine instruction and performs an equality
7870comparison. The return value is the truth value of that comparison.
acb0aa65 7871@item int __builtin_ia32_ucomineq (v4sf, v4sf)
1255c85c
BS
7872Generates the @code{ucomiss} machine instruction and performs an inequality
7873comparison. The return value is the truth value of that comparison.
acb0aa65 7874@item int __builtin_ia32_ucomilt (v4sf, v4sf)
1255c85c
BS
7875Generates the @code{ucomiss} machine instruction and performs a ``less than''
7876comparison. The return value is the truth value of that comparison.
acb0aa65 7877@item int __builtin_ia32_ucomile (v4sf, v4sf)
1255c85c
BS
7878Generates the @code{ucomiss} machine instruction and performs a ``less or
7879equal'' comparison. The return value is the truth value of that comparison.
acb0aa65 7880@item int __builtin_ia32_ucomigt (v4sf, v4sf)
1255c85c
BS
7881Generates the @code{ucomiss} machine instruction and performs a ``greater than''
7882comparison. The return value is the truth value of that comparison.
acb0aa65 7883@item int __builtin_ia32_ucomige (v4sf, v4sf)
1255c85c
BS
7884Generates the @code{ucomiss} machine instruction and performs a ``greater or
7885equal'' comparison. The return value is the truth value of that comparison.
7886
acb0aa65 7887@item v4sf __builtin_ia32_addps (v4sf, v4sf)
1255c85c 7888Generates the @code{addps} machine instruction.
acb0aa65 7889@item v4sf __builtin_ia32_addss (v4sf, v4sf)
1255c85c 7890Generates the @code{addss} machine instruction.
acb0aa65 7891@item v4sf __builtin_ia32_subps (v4sf, v4sf)
1255c85c 7892Generates the @code{subps} machine instruction.
acb0aa65 7893@item v4sf __builtin_ia32_subss (v4sf, v4sf)
1255c85c 7894Generates the @code{subss} machine instruction.
acb0aa65 7895@item v4sf __builtin_ia32_mulps (v4sf, v4sf)
1255c85c 7896Generates the @code{mulps} machine instruction.
acb0aa65 7897@item v4sf __builtin_ia32_mulss (v4sf, v4sf)
1255c85c 7898Generates the @code{mulss} machine instruction.
acb0aa65 7899@item v4sf __builtin_ia32_divps (v4sf, v4sf)
1255c85c 7900Generates the @code{divps} machine instruction.
acb0aa65 7901@item v4sf __builtin_ia32_divss (v4sf, v4sf)
1255c85c
BS
7902Generates the @code{divss} machine instruction.
7903
acb0aa65 7904@item v4si __builtin_ia32_cmpeqps (v4sf, v4sf)
1255c85c 7905Generates the @code{cmpeqps} machine instruction.
acb0aa65 7906@item v4si __builtin_ia32_cmplts (v4sf, v4sf)
1255c85c 7907Generates the @code{cmpltps} machine instruction.
acb0aa65 7908@item v4si __builtin_ia32_cmpleps (v4sf, v4sf)
1255c85c 7909Generates the @code{cmpleps} machine instruction.
acb0aa65 7910@item v4si __builtin_ia32_cmpgtps (v4sf, v4sf)
1255c85c 7911Generates the @code{cmpgtps} machine instruction.
acb0aa65 7912@item v4si __builtin_ia32_cmpgeps (v4sf, v4sf)
1255c85c 7913Generates the @code{cmpgeps} machine instruction.
acb0aa65 7914@item v4si __builtin_ia32_cmpunordps (v4sf, v4sf)
1255c85c 7915Generates the @code{cmpunodps} machine instruction.
acb0aa65 7916@item v4si __builtin_ia32_cmpneqps (v4sf, v4sf)
1255c85c 7917Generates the @code{cmpeqps} machine instruction.
acb0aa65 7918@item v4si __builtin_ia32_cmpnltps (v4sf, v4sf)
1255c85c 7919Generates the @code{cmpltps} machine instruction.
acb0aa65 7920@item v4si __builtin_ia32_cmpnleps (v4sf, v4sf)
1255c85c 7921Generates the @code{cmpleps} machine instruction.
acb0aa65 7922@item v4si __builtin_ia32_cmpngtps (v4sf, v4sf)
1255c85c 7923Generates the @code{cmpgtps} machine instruction.
acb0aa65 7924@item v4si __builtin_ia32_cmpngeps (v4sf, v4sf)
1255c85c 7925Generates the @code{cmpgeps} machine instruction.
acb0aa65 7926@item v4si __builtin_ia32_cmpordps (v4sf, v4sf)
1255c85c
BS
7927Generates the @code{cmpunodps} machine instruction.
7928
acb0aa65 7929@item v4si __builtin_ia32_cmpeqss (v4sf, v4sf)
1255c85c 7930Generates the @code{cmpeqss} machine instruction.
acb0aa65 7931@item v4si __builtin_ia32_cmpltss (v4sf, v4sf)
1255c85c 7932Generates the @code{cmpltss} machine instruction.
acb0aa65 7933@item v4si __builtin_ia32_cmpless (v4sf, v4sf)
1255c85c 7934Generates the @code{cmpless} machine instruction.
acb0aa65 7935@item v4si __builtin_ia32_cmpgtss (v4sf, v4sf)
1255c85c 7936Generates the @code{cmpgtss} machine instruction.
acb0aa65 7937@item v4si __builtin_ia32_cmpgess (v4sf, v4sf)
1255c85c 7938Generates the @code{cmpgess} machine instruction.
acb0aa65 7939@item v4si __builtin_ia32_cmpunordss (v4sf, v4sf)
1255c85c 7940Generates the @code{cmpunodss} machine instruction.
acb0aa65 7941@item v4si __builtin_ia32_cmpneqss (v4sf, v4sf)
1255c85c 7942Generates the @code{cmpeqss} machine instruction.
acb0aa65 7943@item v4si __builtin_ia32_cmpnlts (v4sf, v4sf)
1255c85c 7944Generates the @code{cmpltss} machine instruction.
acb0aa65 7945@item v4si __builtin_ia32_cmpnless (v4sf, v4sf)
1255c85c 7946Generates the @code{cmpless} machine instruction.
acb0aa65 7947@item v4si __builtin_ia32_cmpngtss (v4sf, v4sf)
1255c85c 7948Generates the @code{cmpgtss} machine instruction.
acb0aa65 7949@item v4si __builtin_ia32_cmpngess (v4sf, v4sf)
1255c85c 7950Generates the @code{cmpgess} machine instruction.
acb0aa65 7951@item v4si __builtin_ia32_cmpordss (v4sf, v4sf)
1255c85c
BS
7952Generates the @code{cmpunodss} machine instruction.
7953
acb0aa65 7954@item v4sf __builtin_ia32_maxps (v4sf, v4sf)
1255c85c 7955Generates the @code{maxps} machine instruction.
acb0aa65 7956@item v4sf __builtin_ia32_maxsss (v4sf, v4sf)
1255c85c 7957Generates the @code{maxss} machine instruction.
acb0aa65 7958@item v4sf __builtin_ia32_minps (v4sf, v4sf)
1255c85c 7959Generates the @code{minps} machine instruction.
acb0aa65 7960@item v4sf __builtin_ia32_minsss (v4sf, v4sf)
1255c85c
BS
7961Generates the @code{minss} machine instruction.
7962
acb0aa65 7963@item ti __builtin_ia32_andps (ti, ti)
1255c85c 7964Generates the @code{andps} machine instruction.
acb0aa65 7965@item ti __builtin_ia32_andnps (ti, ti)
1255c85c 7966Generates the @code{andnps} machine instruction.
acb0aa65 7967@item ti __builtin_ia32_orps (ti, ti)
1255c85c 7968Generates the @code{orps} machine instruction.
acb0aa65 7969@item ti __builtin_ia32_xorps (ti, ti)
1255c85c
BS
7970Generates the @code{xorps} machine instruction.
7971
acb0aa65 7972@item v4sf __builtin_ia32_movps (v4sf, v4sf)
1255c85c 7973Generates the @code{movps} machine instruction.
acb0aa65 7974@item v4sf __builtin_ia32_movhlps (v4sf, v4sf)
1255c85c 7975Generates the @code{movhlps} machine instruction.
acb0aa65 7976@item v4sf __builtin_ia32_movlhps (v4sf, v4sf)
1255c85c 7977Generates the @code{movlhps} machine instruction.
acb0aa65 7978@item v4sf __builtin_ia32_unpckhps (v4sf, v4sf)
1255c85c 7979Generates the @code{unpckhps} machine instruction.
acb0aa65 7980@item v4sf __builtin_ia32_unpcklps (v4sf, v4sf)
1255c85c
BS
7981Generates the @code{unpcklps} machine instruction.
7982
acb0aa65 7983@item v4sf __builtin_ia32_cvtpi2ps (v4sf, v2si)
1255c85c 7984Generates the @code{cvtpi2ps} machine instruction.
acb0aa65 7985@item v2si __builtin_ia32_cvtps2pi (v4sf)
1255c85c 7986Generates the @code{cvtps2pi} machine instruction.
acb0aa65 7987@item v4sf __builtin_ia32_cvtsi2ss (v4sf, int)
1255c85c 7988Generates the @code{cvtsi2ss} machine instruction.
acb0aa65 7989@item int __builtin_ia32_cvtss2si (v4sf)
1255c85c 7990Generates the @code{cvtsi2ss} machine instruction.
acb0aa65 7991@item v2si __builtin_ia32_cvttps2pi (v4sf)
1255c85c 7992Generates the @code{cvttps2pi} machine instruction.
acb0aa65 7993@item int __builtin_ia32_cvttss2si (v4sf)
1255c85c
BS
7994Generates the @code{cvttsi2ss} machine instruction.
7995
acb0aa65 7996@item v4sf __builtin_ia32_rcpps (v4sf)
1255c85c 7997Generates the @code{rcpps} machine instruction.
acb0aa65 7998@item v4sf __builtin_ia32_rsqrtps (v4sf)
1255c85c 7999Generates the @code{rsqrtps} machine instruction.
acb0aa65 8000@item v4sf __builtin_ia32_sqrtps (v4sf)
1255c85c 8001Generates the @code{sqrtps} machine instruction.
acb0aa65 8002@item v4sf __builtin_ia32_rcpss (v4sf)
1255c85c 8003Generates the @code{rcpss} machine instruction.
acb0aa65 8004@item v4sf __builtin_ia32_rsqrtss (v4sf)
1255c85c 8005Generates the @code{rsqrtss} machine instruction.
acb0aa65 8006@item v4sf __builtin_ia32_sqrtss (v4sf)
1255c85c
BS
8007Generates the @code{sqrtss} machine instruction.
8008
acb0aa65 8009@item v4sf __builtin_ia32_shufps (v4sf, v4sf, int)
1255c85c
BS
8010Generates the @code{shufps} machine instruction.
8011
acb0aa65 8012@item v4sf __builtin_ia32_loadaps (float *)
1255c85c 8013Generates the @code{movaps} machine instruction as a load from memory.
acb0aa65 8014@item void __builtin_ia32_storeaps (float *, v4sf)
1255c85c 8015Generates the @code{movaps} machine instruction as a store to memory.
acb0aa65 8016@item v4sf __builtin_ia32_loadups (float *)
1255c85c 8017Generates the @code{movups} machine instruction as a load from memory.
acb0aa65 8018@item void __builtin_ia32_storeups (float *, v4sf)
1255c85c 8019Generates the @code{movups} machine instruction as a store to memory.
acb0aa65 8020@item v4sf __builtin_ia32_loadsss (float *)
1255c85c 8021Generates the @code{movss} machine instruction as a load from memory.
acb0aa65 8022@item void __builtin_ia32_storess (float *, v4sf)
1255c85c
BS
8023Generates the @code{movss} machine instruction as a store to memory.
8024
acb0aa65 8025@item v4sf __builtin_ia32_loadhps (v4sf, v2si *)
1255c85c 8026Generates the @code{movhps} machine instruction as a load from memory.
acb0aa65 8027@item v4sf __builtin_ia32_loadlps (v4sf, v2si *)
1255c85c 8028Generates the @code{movlps} machine instruction as a load from memory
acb0aa65 8029@item void __builtin_ia32_storehps (v4sf, v2si *)
1255c85c 8030Generates the @code{movhps} machine instruction as a store to memory.
acb0aa65 8031@item void __builtin_ia32_storelps (v4sf, v2si *)
1255c85c
BS
8032Generates the @code{movlps} machine instruction as a store to memory.
8033
acb0aa65 8034@item void __builtin_ia32_movntps (float *, v4sf)
1255c85c 8035Generates the @code{movntps} machine instruction.
acb0aa65 8036@item int __builtin_ia32_movmskps (v4sf)
1255c85c
BS
8037Generates the @code{movntps} machine instruction.
8038
acb0aa65 8039@item void __builtin_ia32_storeps1 (float *, v4sf)
1255c85c
BS
8040Generates the @code{movaps} machine instruction as a store to memory.
8041Before storing, the value is modified with a @code{shufps} instruction
8042so that the lowest of the four floating point elements is replicated
8043across the entire vector that is stored.
acb0aa65 8044@item void __builtin_ia32_storerps (float *, v4sf)
1255c85c
BS
8045Generates the @code{movaps} machine instruction as a store to memory.
8046Before storing, the value is modified with a @code{shufps} instruction
8047so that the order of the four floating point elements in the vector is
8048reversed.
acb0aa65 8049@item v4sf __builtin_ia32_loadps1 (float *)
1255c85c
BS
8050Generates a @code{movss} machine instruction to load a floating point
8051value from memory, and a @code{shufps} instruction to replicate the
8052loaded value across all four elements of the result vector.
acb0aa65 8053@item v4sf __builtin_ia32_loadrps (float *)
1255c85c
BS
8054Generates a @code{movaps} machine instruction to load a vector from
8055memory, and a @code{shufps} instruction to reverse the order of the
8056four floating point elements in the result vector.
8057@item v4sf __builtin_ia32_setps (float, float, float, float)
8058Constructs a vector from four single floating point values. The return
8059value is equal to the value that would result from storing the four
8060arguments into consecutive memory locations and then executing a
8061@code{movaps} to load the vector from memory.
8062@item v4sf __builtin_ia32_setps1 (float)
8063Constructs a vector from a single floating point value by replicating
8064it across all four elements of the result vector.
8065@end table
8066
f73ad30e 8067@item -mpush-args
a7939b1d 8068@itemx -mno-push-args
cd3bb277 8069@opindex mpush-args
a7939b1d 8070@opindex mno-push-args
767094dd 8071Use PUSH operations to store outgoing parameters. This method is shorter
f73ad30e 8072and usually equally fast as method using SUB/MOV operations and is enabled
767094dd 8073by default. In some cases disabling it may improve performance because of
f73ad30e
JH
8074improved scheduling and reduced dependencies.
8075
8076@item -maccumulate-outgoing-args
cd3bb277 8077@opindex maccumulate-outgoing-args
f73ad30e 8078If enabled, the maximum amount of space required for outgoing arguments will be
a7939b1d 8079computed in the function prologue. This is faster on most modern CPUs
b192711e 8080because of reduced dependencies, improved scheduling and reduced stack usage
f73ad30e 8081when preferred stack boundary is not equal to 2. The drawback is a notable
767094dd 8082increase in code size. This switch implies @option{-mno-push-args}.
f73ad30e 8083
f22a97d2 8084@item -mthreads
cd3bb277 8085@opindex mthreads
767094dd 8086Support thread-safe exception handling on @samp{Mingw32}. Code that relies
02f52e19 8087on thread-safe exception handling must compile and link all code with the
767094dd 8088@option{-mthreads} option. When compiling, @option{-mthreads} defines
630d3d5a
JM
8089@option{-D_MT}; when linking, it links in a special thread helper library
8090@option{-lmingwthrd} which cleans up per thread exception handling data.
79f05c19
JH
8091
8092@item -mno-align-stringops
cd3bb277 8093@opindex mno-align-stringops
767094dd 8094Do not align destination of inlined string operations. This switch reduces
79f05c19
JH
8095code size and improves performance in case the destination is already aligned,
8096but gcc don't know about it.
8097
8098@item -minline-all-stringops
cd3bb277 8099@opindex minline-all-stringops
79f05c19 8100By default GCC inlines string operations only when destination is known to be
767094dd 8101aligned at least to 4 byte boundary. This enables more inlining, increase code
79f05c19
JH
8102size, but may improve performance of code that depends on fast memcpy, strlen
8103and memset for short lengths.
762e166b
AJ
8104
8105@item -momit-leaf-frame-pointer
cd3bb277 8106@opindex momit-leaf-frame-pointer
762e166b
AJ
8107Don't keep the frame pointer in a register for leaf functions. This
8108avoids the instructions to save, set up and restore frame pointers and
8109makes an extra register available in leaf functions. The option
630d3d5a 8110@option{-fomit-frame-pointer} removes the frame pointer for all functions
762e166b 8111which might make debugging harder.
3af4bd89
JH
8112@end table
8113
14f73b5a
JH
8114These @samp{-m} switches are supported in addition to the above
8115on AMD x86-64 processors in 64-bit environments.
8116
8117@table @gcctabopt
8118@item -m32
8119@itemx -m64
8120@opindex m32
8121@opindex m64
8122Generate code for a 32-bit or 64-bit environment.
8123The 32-bit environment sets int, long and pointer to 32 bits and
8124generates code that runs on any i386 system.
8125The 64-bit environment sets int to 32 bits and long and pointer
8126to 64 bits and generates code for AMD's x86-64 architecture.
8127
8128@item -mno-red-zone
8129@opindex no-red-zone
8130Do not use a so called red zone for x86-64 code. The red zone is mandated
8131by the x86-64 ABI, it is a 128-byte area beyond the location of the
8132stack pointer that will not be modified by signal or interrupt handlers
8133and therefore can be used for temporary data without adjusting the stack
8134pointer. The flag @option{-mno-red-zone} disables this red zone.
8135@end table
8136
74291a4b
MM
8137@node HPPA Options
8138@subsection HPPA Options
8139@cindex HPPA Options
8140
8141These @samp{-m} options are defined for the HPPA family of computers:
8142
2642624b 8143@table @gcctabopt
630d3d5a 8144@item -march=@var{architecture-type}
cd3bb277 8145@opindex march
ea3bfbfe 8146Generate code for the specified architecture. The choices for
630d3d5a 8147@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
ea3bfbfe
JQ
81481.1, and @samp{2.0} for PA 2.0 processors. Refer to
8149@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
8150architecture option for your machine. Code compiled for lower numbered
8151architectures will run on higher numbered architectures, but not the
8152other way around.
8153
8154PA 2.0 support currently requires gas snapshot 19990413 or later. The
8155next release of binutils (current is 2.9.1) will probably contain PA 2.0
02f52e19 8156support.
74291a4b 8157
ea3bfbfe 8158@item -mpa-risc-1-0
62a1403d
AS
8159@itemx -mpa-risc-1-1
8160@itemx -mpa-risc-2-0
cd3bb277
JM
8161@opindex mpa-risc-1-0
8162@opindex mpa-risc-1-1
8163@opindex mpa-risc-2-0
695ac33f 8164Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
74291a4b 8165
861bb6c1 8166@item -mbig-switch
cd3bb277 8167@opindex mbig-switch
861bb6c1
JL
8168Generate code suitable for big switch tables. Use this option only if
8169the assembler/linker complain about out of range branches within a switch
8170table.
8171
74291a4b 8172@item -mjump-in-delay
cd3bb277 8173@opindex mjump-in-delay
74291a4b
MM
8174Fill delay slots of function calls with unconditional jump instructions
8175by modifying the return pointer for the function call to be the target
8176of the conditional jump.
8177
8178@item -mdisable-fpregs
cd3bb277 8179@opindex mdisable-fpregs
74291a4b
MM
8180Prevent floating point registers from being used in any manner. This is
8181necessary for compiling kernels which perform lazy context switching of
8182floating point registers. If you use this option and attempt to perform
8183floating point operations, the compiler will abort.
8184
8185@item -mdisable-indexing
cd3bb277 8186@opindex mdisable-indexing
74291a4b 8187Prevent the compiler from using indexing address modes. This avoids some
161d7b59 8188rather obscure problems when compiling MIG generated code under MACH@.
74291a4b
MM
8189
8190@item -mno-space-regs
cd3bb277 8191@opindex mno-space-regs
74291a4b
MM
8192Generate code that assumes the target has no space registers. This allows
8193GCC to generate faster indirect calls and use unscaled index address modes.
8194
8195Such code is suitable for level 0 PA systems and kernels.
8196
8197@item -mfast-indirect-calls
cd3bb277 8198@opindex mfast-indirect-calls
74291a4b
MM
8199Generate code that assumes calls never cross space boundaries. This
8200allows GCC to emit code which performs faster indirect calls.
8201
b192711e 8202This option will not work in the presence of shared libraries or nested
74291a4b
MM
8203functions.
8204
74291a4b 8205@item -mlong-load-store
cd3bb277 8206@opindex mlong-load-store
74291a4b
MM
8207Generate 3-instruction load and store sequences as sometimes required by
8208the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
8209the HP compilers.
8210
8211@item -mportable-runtime
cd3bb277 8212@opindex mportable-runtime
74291a4b
MM
8213Use the portable calling conventions proposed by HP for ELF systems.
8214
8215@item -mgas
cd3bb277 8216@opindex mgas
74291a4b
MM
8217Enable the use of assembler directives only GAS understands.
8218
630d3d5a 8219@item -mschedule=@var{cpu-type}
cd3bb277 8220@opindex mschedule
74291a4b 8221Schedule code according to the constraints for the machine type
630d3d5a 8222@var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
02f52e19 8223@samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to
732135bf
JL
8224@file{/usr/lib/sched.models} on an HP-UX system to determine the
8225proper scheduling option for your machine.
74291a4b
MM
8226
8227@item -mlinker-opt
cd3bb277 8228@opindex mlinker-opt
74291a4b
MM
8229Enable the optimization pass in the HPUX linker. Note this makes symbolic
8230debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers
8231in which they give bogus error messages when linking some programs.
8232
8233@item -msoft-float
cd3bb277 8234@opindex msoft-float
74291a4b
MM
8235Generate output containing library calls for floating point.
8236@strong{Warning:} the requisite libraries are not available for all HPPA
8237targets. Normally the facilities of the machine's usual C compiler are
8238used, but this cannot be done directly in cross-compilation. You must make
8239your own arrangements to provide suitable library functions for
8240cross-compilation. The embedded target @samp{hppa1.1-*-pro}
8241does provide software floating point support.
8242
630d3d5a 8243@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
8244therefore, it is only useful if you compile @emph{all} of a program with
8245this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 8246library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
8247this to work.
8248@end table
8249
8250@node Intel 960 Options
8251@subsection Intel 960 Options
8252
8253These @samp{-m} options are defined for the Intel 960 implementations:
8254
2642624b 8255@table @gcctabopt
cd3bb277
JM
8256@item -m@var{cpu-type}
8257@opindex mka
8258@opindex mkb
8259@opindex mmc
8260@opindex mca
8261@opindex mcf
8262@opindex msa
8263@opindex msb
8264Assume the defaults for the machine type @var{cpu-type} for some of
74291a4b 8265the other options, including instruction scheduling, floating point
cd3bb277 8266support, and addressing modes. The choices for @var{cpu-type} are
74291a4b
MM
8267@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
8268@samp{sa}, and @samp{sb}.
8269The default is
8270@samp{kb}.
8271
8272@item -mnumerics
8273@itemx -msoft-float
cd3bb277
JM
8274@opindex mnumerics
8275@opindex msoft-float
630d3d5a
JM
8276The @option{-mnumerics} option indicates that the processor does support
8277floating-point instructions. The @option{-msoft-float} option indicates
74291a4b
MM
8278that floating-point support should not be assumed.
8279
8280@item -mleaf-procedures
8281@itemx -mno-leaf-procedures
cd3bb277
JM
8282@opindex mleaf-procedures
8283@opindex mno-leaf-procedures
74291a4b
MM
8284Do (or do not) attempt to alter leaf procedures to be callable with the
8285@code{bal} instruction as well as @code{call}. This will result in more
8286efficient code for explicit calls when the @code{bal} instruction can be
8287substituted by the assembler or linker, but less efficient code in other
8288cases, such as calls via function pointers, or using a linker that doesn't
8289support this optimization.
8290
8291@item -mtail-call
8292@itemx -mno-tail-call
cd3bb277
JM
8293@opindex mtail-call
8294@opindex mno-tail-call
74291a4b
MM
8295Do (or do not) make additional attempts (beyond those of the
8296machine-independent portions of the compiler) to optimize tail-recursive
8297calls into branches. You may not want to do this because the detection of
8298cases where this is not valid is not totally complete. The default is
630d3d5a 8299@option{-mno-tail-call}.
74291a4b
MM
8300
8301@item -mcomplex-addr
8302@itemx -mno-complex-addr
cd3bb277
JM
8303@opindex mcomplex-addr
8304@opindex mno-complex-addr
74291a4b
MM
8305Assume (or do not assume) that the use of a complex addressing mode is a
8306win on this implementation of the i960. Complex addressing modes may not
8307be worthwhile on the K-series, but they definitely are on the C-series.
630d3d5a 8308The default is currently @option{-mcomplex-addr} for all processors except
161d7b59 8309the CB and CC@.
74291a4b
MM
8310
8311@item -mcode-align
8312@itemx -mno-code-align
cd3bb277
JM
8313@opindex mcode-align
8314@opindex mno-code-align
74291a4b
MM
8315Align code to 8-byte boundaries for faster fetching (or don't bother).
8316Currently turned on by default for C-series implementations only.
8317
8318@ignore
8319@item -mclean-linkage
8320@itemx -mno-clean-linkage
cd3bb277
JM
8321@opindex mclean-linkage
8322@opindex mno-clean-linkage
74291a4b
MM
8323These options are not fully implemented.
8324@end ignore
8325
8326@item -mic-compat
8327@itemx -mic2.0-compat
8328@itemx -mic3.0-compat
cd3bb277
JM
8329@opindex mic-compat
8330@opindex mic2.0-compat
8331@opindex mic3.0-compat
74291a4b
MM
8332Enable compatibility with iC960 v2.0 or v3.0.
8333
8334@item -masm-compat
8335@itemx -mintel-asm
cd3bb277
JM
8336@opindex masm-compat
8337@opindex mintel-asm
74291a4b
MM
8338Enable compatibility with the iC960 assembler.
8339
8340@item -mstrict-align
8341@itemx -mno-strict-align
cd3bb277
JM
8342@opindex mstrict-align
8343@opindex mno-strict-align
74291a4b
MM
8344Do not permit (do permit) unaligned accesses.
8345
8346@item -mold-align
cd3bb277 8347@opindex mold-align
74291a4b 8348Enable structure-alignment compatibility with Intel's gcc release version
630d3d5a 83491.3 (based on gcc 1.37). This option implies @option{-mstrict-align}.
eaa4b44c
VM
8350
8351@item -mlong-double-64
cd3bb277 8352@opindex mlong-double-64
eaa4b44c
VM
8353Implement type @samp{long double} as 64-bit floating point numbers.
8354Without the option @samp{long double} is implemented by 80-bit
8355floating point numbers. The only reason we have it because there is
8356no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it
8357is only useful for people using soft-float targets. Otherwise, we
8358should recommend against use of it.
8359
74291a4b
MM
8360@end table
8361
8362@node DEC Alpha Options
8363@subsection DEC Alpha Options
8364
8365These @samp{-m} options are defined for the DEC Alpha implementations:
8366
2642624b 8367@table @gcctabopt
74291a4b
MM
8368@item -mno-soft-float
8369@itemx -msoft-float
cd3bb277
JM
8370@opindex mno-soft-float
8371@opindex msoft-float
74291a4b 8372Use (do not use) the hardware floating-point instructions for
bedc7537 8373floating-point operations. When @option{-msoft-float} is specified,
7857f134 8374functions in @file{libgcc.a} will be used to perform floating-point
74291a4b
MM
8375operations. Unless they are replaced by routines that emulate the
8376floating-point operations, or compiled in such a way as to call such
8377emulations routines, these routines will issue floating-point
8378operations. If you are compiling for an Alpha without floating-point
8379operations, you must ensure that the library is built so as not to call
8380them.
8381
8382Note that Alpha implementations without floating-point operations are
8383required to have floating-point registers.
8384
8385@item -mfp-reg
8386@itemx -mno-fp-regs
cd3bb277
JM
8387@opindex mfp-reg
8388@opindex mno-fp-regs
74291a4b 8389Generate code that uses (does not use) the floating-point register set.
bedc7537 8390@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
74291a4b
MM
8391register set is not used, floating point operands are passed in integer
8392registers as if they were integers and floating-point results are passed
8393in $0 instead of $f0. This is a non-standard calling sequence, so any
8394function with a floating-point argument or return value called by code
bedc7537 8395compiled with @option{-mno-fp-regs} must also be compiled with that
74291a4b
MM
8396option.
8397
8398A typical use of this option is building a kernel that does not use,
8399and hence need not save and restore, any floating-point registers.
8400
8401@item -mieee
cd3bb277 8402@opindex mieee
74291a4b
MM
8403The Alpha architecture implements floating-point hardware optimized for
8404maximum performance. It is mostly compliant with the IEEE floating
8405point standard. However, for full compliance, software assistance is
8406required. This option generates code fully IEEE compliant code
630d3d5a 8407@emph{except} that the @var{inexact-flag} is not maintained (see below).
9c34dbbf
ZW
8408If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8409defined during compilation. The resulting code is less efficient but is
8410able to correctly support denormalized numbers and exceptional IEEE
8411values such as not-a-number and plus/minus infinity. Other Alpha
8412compilers call this option @option{-ieee_with_no_inexact}.
74291a4b
MM
8413
8414@item -mieee-with-inexact
cd3bb277 8415@opindex mieee-with-inexact
9c34dbbf
ZW
8416This is like @option{-mieee} except the generated code also maintains
8417the IEEE @var{inexact-flag}. Turning on this option causes the
8418generated code to implement fully-compliant IEEE math. In addition to
8419@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8420macro. On some Alpha implementations the resulting code may execute
8421significantly slower than the code generated by default. Since there is
8422very little code that depends on the @var{inexact-flag}, you should
74291a4b 8423normally not specify this option. Other Alpha compilers call this
630d3d5a 8424option @option{-ieee_with_inexact}.
74291a4b 8425
630d3d5a 8426@item -mfp-trap-mode=@var{trap-mode}
cd3bb277 8427@opindex mfp-trap-mode
74291a4b 8428This option controls what floating-point related traps are enabled.
630d3d5a 8429Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
74291a4b
MM
8430The trap mode can be set to one of four values:
8431
8432@table @samp
8433@item n
8434This is the default (normal) setting. The only traps that are enabled
8435are the ones that cannot be disabled in software (e.g., division by zero
8436trap).
8437
8438@item u
8439In addition to the traps enabled by @samp{n}, underflow traps are enabled
8440as well.
8441
8442@item su
8443Like @samp{su}, but the instructions are marked to be safe for software
8444completion (see Alpha architecture manual for details).
8445
8446@item sui
8447Like @samp{su}, but inexact traps are enabled as well.
8448@end table
8449
630d3d5a 8450@item -mfp-rounding-mode=@var{rounding-mode}
cd3bb277 8451@opindex mfp-rounding-mode
74291a4b 8452Selects the IEEE rounding mode. Other Alpha compilers call this option
630d3d5a 8453@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
74291a4b
MM
8454of:
8455
8456@table @samp
8457@item n
8458Normal IEEE rounding mode. Floating point numbers are rounded towards
8459the nearest machine number or towards the even machine number in case
8460of a tie.
8461
8462@item m
8463Round towards minus infinity.
8464
8465@item c
8466Chopped rounding mode. Floating point numbers are rounded towards zero.
8467
8468@item d
8469Dynamic rounding mode. A field in the floating point control register
8470(@var{fpcr}, see Alpha architecture reference manual) controls the
8471rounding mode in effect. The C library initializes this register for
8472rounding towards plus infinity. Thus, unless your program modifies the
ec4b2ecb
CB
8473@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8474@end table
74291a4b 8475
630d3d5a 8476@item -mtrap-precision=@var{trap-precision}
cd3bb277 8477@opindex mtrap-precision
74291a4b
MM
8478In the Alpha architecture, floating point traps are imprecise. This
8479means without software assistance it is impossible to recover from a
8480floating trap and program execution normally needs to be terminated.
0c2d1a2a 8481GCC can generate code that can assist operating system trap handlers
74291a4b
MM
8482in determining the exact location that caused a floating point trap.
8483Depending on the requirements of an application, different levels of
8484precisions can be selected:
8485
8486@table @samp
8487@item p
8488Program precision. This option is the default and means a trap handler
8489can only identify which program caused a floating point exception.
8490
8491@item f
8492Function precision. The trap handler can determine the function that
8493caused a floating point exception.
8494
8495@item i
8496Instruction precision. The trap handler can determine the exact
8497instruction that caused a floating point exception.
8498@end table
8499
8500Other Alpha compilers provide the equivalent options called
630d3d5a 8501@option{-scope_safe} and @option{-resumption_safe}.
74291a4b
MM
8502
8503@item -mieee-conformant
cd3bb277 8504@opindex mieee-conformant
74291a4b 8505This option marks the generated code as IEEE conformant. You must not
630d3d5a
JM
8506use this option unless you also specify @option{-mtrap-precision=i} and either
8507@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
74291a4b
MM
8508is to emit the line @samp{.eflag 48} in the function prologue of the
8509generated assembly file. Under DEC Unix, this has the effect that
8510IEEE-conformant math library routines will be linked in.
8511
8512@item -mbuild-constants
cd3bb277 8513@opindex mbuild-constants
0c2d1a2a 8514Normally GCC examines a 32- or 64-bit integer constant to
74291a4b
MM
8515see if it can construct it from smaller constants in two or three
8516instructions. If it cannot, it will output the constant as a literal and
956d6950 8517generate code to load it from the data segment at runtime.
74291a4b 8518
0c2d1a2a 8519Use this option to require GCC to construct @emph{all} integer constants
74291a4b
MM
8520using code, even if it takes more instructions (the maximum is six).
8521
8522You would typically use this option to build a shared library dynamic
8523loader. Itself a shared library, it must relocate itself in memory
8524before it can find the variables and constants in its own data segment.
956d6950
JL
8525
8526@item -malpha-as
8527@itemx -mgas
cd3bb277
JM
8528@opindex malpha-as
8529@opindex mgas
956d6950 8530Select whether to generate code to be assembled by the vendor-supplied
630d3d5a 8531assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
956d6950
JL
8532
8533@item -mbwx
8534@itemx -mno-bwx
8535@itemx -mcix
8536@itemx -mno-cix
8537@itemx -mmax
8538@itemx -mno-max
cd3bb277
JM
8539@opindex mbwx
8540@opindex mno-bwx
8541@opindex mcix
8542@opindex mno-cix
8543@opindex mmax
8544@opindex mno-max
0c2d1a2a 8545Indicate whether GCC should generate code to use the optional BWX,
956d6950 8546CIX, and MAX instruction sets. The default is to use the instruction sets
630d3d5a 8547supported by the CPU type specified via @option{-mcpu=} option or that
0c2d1a2a 8548of the CPU on which GCC was built if none was specified.
956d6950 8549
956d6950 8550@item -mcpu=@var{cpu_type}
cd3bb277 8551@opindex mcpu
956d6950
JL
8552Set the instruction set, register set, and instruction scheduling
8553parameters for machine type @var{cpu_type}. You can specify either the
0c2d1a2a 8554@samp{EV} style name or the corresponding chip number. GCC
956d6950
JL
8555supports scheduling parameters for the EV4 and EV5 family of processors
8556and will choose the default values for the instruction set from
8557the processor you specify. If you do not specify a processor type,
0c2d1a2a 8558GCC will default to the processor on which the compiler was built.
956d6950
JL
8559
8560Supported values for @var{cpu_type} are
8561
8562@table @samp
8563@item ev4
8564@itemx 21064
8565Schedules as an EV4 and has no instruction set extensions.
8566
8567@item ev5
8568@itemx 21164
8569Schedules as an EV5 and has no instruction set extensions.
8570
8571@item ev56
8572@itemx 21164a
8573Schedules as an EV5 and supports the BWX extension.
8574
8575@item pca56
4f69985c 8576@itemx 21164pc
956d6950
JL
8577@itemx 21164PC
8578Schedules as an EV5 and supports the BWX and MAX extensions.
8579
8580@item ev6
8581@itemx 21264
8582Schedules as an EV5 (until Digital releases the scheduling parameters
8583for the EV6) and supports the BWX, CIX, and MAX extensions.
4f69985c
RH
8584@end table
8585
8586@item -mmemory-latency=@var{time}
cd3bb277 8587@opindex mmemory-latency
4f69985c
RH
8588Sets the latency the scheduler should assume for typical memory
8589references as seen by the application. This number is highly
b192711e 8590dependent on the memory access patterns used by the application
4f69985c
RH
8591and the size of the external cache on the machine.
8592
8593Valid options for @var{time} are
8594
8595@table @samp
8596@item @var{number}
8597A decimal number representing clock cycles.
8598
8599@item L1
8600@itemx L2
8601@itemx L3
8602@itemx main
8603The compiler contains estimates of the number of clock cycles for
8604``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8605(also called Dcache, Scache, and Bcache), as well as to main memory.
8606Note that L3 is only valid for EV5.
8607
956d6950 8608@end table
74291a4b
MM
8609@end table
8610
d7c23cdc
DR
8611@node DEC Alpha/VMS Options
8612@subsection DEC Alpha/VMS Options
8613
8614These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8615
8616@table @gcctabopt
8617@item -mvms-return-codes
8618@opindex mvms-return-codes
bf6cfc5e
RK
8619Return VMS condition codes from main. The default is to return POSIX
8620style condition (e.g.@ error) codes.
d7c23cdc
DR
8621@end table
8622
74291a4b
MM
8623@node Clipper Options
8624@subsection Clipper Options
8625
8626These @samp{-m} options are defined for the Clipper implementations:
8627
2642624b 8628@table @gcctabopt
74291a4b 8629@item -mc300
cd3bb277 8630@opindex mc300
767094dd 8631Produce code for a C300 Clipper processor. This is the default.
74291a4b 8632
62a1403d 8633@item -mc400
cd3bb277 8634@opindex mc400
9c34dbbf
ZW
8635Produce code for a C400 Clipper processor, i.e.@: use floating point
8636registers f8--f15.
74291a4b
MM
8637@end table
8638
8639@node H8/300 Options
8640@subsection H8/300 Options
8641
8642These @samp{-m} options are defined for the H8/300 implementations:
8643
2642624b 8644@table @gcctabopt
74291a4b 8645@item -mrelax
cd3bb277 8646@opindex mrelax
74291a4b 8647Shorten some address references at link time, when possible; uses the
630d3d5a 8648linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
74291a4b
MM
8649ld.info, Using ld}, for a fuller description.
8650
8651@item -mh
cd3bb277 8652@opindex mh
161d7b59 8653Generate code for the H8/300H@.
74291a4b 8654
dcb9d1f0 8655@item -ms
cd3bb277 8656@opindex ms
161d7b59 8657Generate code for the H8/S@.
dcb9d1f0 8658
17f0f8fa 8659@item -ms2600
cd3bb277 8660@opindex ms2600
695ac33f 8661Generate code for the H8/S2600. This switch must be used with @option{-ms}.
17f0f8fa 8662
74291a4b 8663@item -mint32
cd3bb277 8664@opindex mint32
74291a4b
MM
8665Make @code{int} data 32 bits by default.
8666
8667@item -malign-300
cd3bb277 8668@opindex malign-300
2c54abce
KH
8669On the H8/300H and H8/S, use the same alignment rules as for the H8/300.
8670The default for the H8/300H and H8/S is to align longs and floats on 4
8671byte boundaries.
630d3d5a 8672@option{-malign-300} causes them to be aligned on 2 byte boundaries.
2c54abce 8673This option has no effect on the H8/300.
74291a4b
MM
8674@end table
8675
8676@node SH Options
8677@subsection SH Options
8678
8679These @samp{-m} options are defined for the SH implementations:
8680
2642624b 8681@table @gcctabopt
74291a4b 8682@item -m1
cd3bb277 8683@opindex m1
74291a4b
MM
8684Generate code for the SH1.
8685
8686@item -m2
cd3bb277 8687@opindex m2
74291a4b
MM
8688Generate code for the SH2.
8689
8690@item -m3
cd3bb277 8691@opindex m3
74291a4b
MM
8692Generate code for the SH3.
8693
8694@item -m3e
cd3bb277 8695@opindex m3e
74291a4b
MM
8696Generate code for the SH3e.
8697
3cadd778 8698@item -m4-nofpu
cd3bb277 8699@opindex m4-nofpu
3cadd778
AO
8700Generate code for the SH4 without a floating-point unit.
8701
8702@item -m4-single-only
cd3bb277 8703@opindex m4-single-only
3cadd778 8704Generate code for the SH4 with a floating-point unit that only
c771326b 8705supports single-precision arithmetic.
3cadd778
AO
8706
8707@item -m4-single
cd3bb277 8708@opindex m4-single
3cadd778
AO
8709Generate code for the SH4 assuming the floating-point unit is in
8710single-precision mode by default.
8711
8712@item -m4
cd3bb277 8713@opindex m4
3cadd778
AO
8714Generate code for the SH4.
8715
74291a4b 8716@item -mb
cd3bb277 8717@opindex mb
74291a4b
MM
8718Compile code for the processor in big endian mode.
8719
8720@item -ml
cd3bb277 8721@opindex ml
74291a4b
MM
8722Compile code for the processor in little endian mode.
8723
3d5a0820 8724@item -mdalign
cd3bb277 8725@opindex mdalign
02f52e19 8726Align doubles at 64-bit boundaries. Note that this changes the calling
3d5a0820 8727conventions, and thus some functions from the standard C library will
695ac33f 8728not work unless you recompile it first with @option{-mdalign}.
3d5a0820 8729
74291a4b 8730@item -mrelax
cd3bb277 8731@opindex mrelax
74291a4b 8732Shorten some address references at link time, when possible; uses the
630d3d5a 8733linker option @option{-relax}.
3cadd778
AO
8734
8735@item -mbigtable
cd3bb277 8736@opindex mbigtable
3cadd778
AO
8737Use 32-bit offsets in @code{switch} tables. The default is to use
873816-bit offsets.
8739
8740@item -mfmovd
cd3bb277 8741@opindex mfmovd
3cadd778
AO
8742Enable the use of the instruction @code{fmovd}.
8743
8744@item -mhitachi
cd3bb277 8745@opindex mhitachi
3cadd778
AO
8746Comply with the calling conventions defined by Hitachi.
8747
8748@item -mnomacsave
cd3bb277 8749@opindex mnomacsave
3cadd778 8750Mark the @code{MAC} register as call-clobbered, even if
bedc7537 8751@option{-mhitachi} is given.
3cadd778 8752
c474f76b
AO
8753@item -mieee
8754@opindex mieee
8755Increase IEEE-compliance of floating-point code.
8756
3cadd778 8757@item -misize
cd3bb277 8758@opindex misize
3cadd778
AO
8759Dump instruction size and location in the assembly code.
8760
8761@item -mpadstruct
cd3bb277 8762@opindex mpadstruct
3cadd778 8763This option is deprecated. It pads structures to multiple of 4 bytes,
161d7b59 8764which is incompatible with the SH ABI@.
3cadd778
AO
8765
8766@item -mspace
cd3bb277 8767@opindex mspace
bedc7537 8768Optimize for space instead of speed. Implied by @option{-Os}.
1a66cd67
AO
8769
8770@item -mprefergot
cd3bb277 8771@opindex mprefergot
1a66cd67
AO
8772When generating position-independent code, emit function calls using
8773the Global Offset Table instead of the Procedure Linkage Table.
93ca1662
NY
8774
8775@item -musermode
cd3bb277 8776@opindex musermode
93ca1662
NY
8777Generate a library function call to invalidate instruction cache
8778entries, after fixing up a trampoline. This library function call
8779doesn't assume it can write to the whole memory address space. This
8780is the default when the target is @code{sh-*-linux*}.
74291a4b
MM
8781@end table
8782
8783@node System V Options
8784@subsection Options for System V
8785
8786These additional options are available on System V Release 4 for
8787compatibility with other compilers on those systems:
8788
2642624b 8789@table @gcctabopt
74291a4b 8790@item -G
cd3bb277 8791@opindex G
74291a4b 8792Create a shared object.
630d3d5a 8793It is recommended that @option{-symbolic} or @option{-shared} be used instead.
74291a4b
MM
8794
8795@item -Qy
cd3bb277 8796@opindex Qy
74291a4b
MM
8797Identify the versions of each tool used by the compiler, in a
8798@code{.ident} assembler directive in the output.
8799
8800@item -Qn
cd3bb277 8801@opindex Qn
74291a4b
MM
8802Refrain from adding @code{.ident} directives to the output file (this is
8803the default).
8804
aee96fe9 8805@item -YP,@var{dirs}
cd3bb277 8806@opindex YP
74291a4b 8807Search the directories @var{dirs}, and no others, for libraries
630d3d5a 8808specified with @option{-l}.
74291a4b 8809
aee96fe9 8810@item -Ym,@var{dir}
cd3bb277 8811@opindex Ym
bedc7537 8812Look in the directory @var{dir} to find the M4 preprocessor.
74291a4b
MM
8813The assembler uses this option.
8814@c This is supposed to go with a -Yd for predefined M4 macro files, but
8815@c the generic assembler that comes with Solaris takes just -Ym.
8816@end table
8817
282a61e6
MH
8818@node TMS320C3x/C4x Options
8819@subsection TMS320C3x/C4x Options
8820@cindex TMS320C3x/C4x Options
8821
8822These @samp{-m} options are defined for TMS320C3x/C4x implementations:
8823
2642624b 8824@table @gcctabopt
282a61e6
MH
8825
8826@item -mcpu=@var{cpu_type}
cd3bb277 8827@opindex mcpu
282a61e6
MH
8828Set the instruction set, register set, and instruction scheduling
8829parameters for machine type @var{cpu_type}. Supported values for
8830@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
8831@samp{c44}. The default is @samp{c40} to generate code for the
8832TMS320C40.
8833
8834@item -mbig-memory
8835@item -mbig
8836@itemx -msmall-memory
8837@itemx -msmall
cd3bb277
JM
8838@opindex mbig-memory
8839@opindex mbig
8840@opindex msmall-memory
8841@opindex msmall
282a61e6
MH
8842Generates code for the big or small memory model. The small memory
8843model assumed that all data fits into one 64K word page. At run-time
8844the data page (DP) register must be set to point to the 64K page
8845containing the .bss and .data program sections. The big memory model is
8846the default and requires reloading of the DP register for every direct
8847memory access.
8848
8849@item -mbk
8850@itemx -mno-bk
cd3bb277
JM
8851@opindex mbk
8852@opindex mno-bk
282a61e6 8853Allow (disallow) allocation of general integer operands into the block
161d7b59 8854count register BK@.
282a61e6
MH
8855
8856@item -mdb
8857@itemx -mno-db
cd3bb277
JM
8858@opindex mdb
8859@opindex mno-db
282a61e6
MH
8860Enable (disable) generation of code using decrement and branch,
8861DBcond(D), instructions. This is enabled by default for the C4x. To be
8862on the safe side, this is disabled for the C3x, since the maximum
aee96fe9
JM
8863iteration count on the C3x is @math{2^23 + 1} (but who iterates loops more than
8864@math{2^23} times on the C3x?). Note that GCC will try to reverse a loop so
282a61e6
MH
8865that it can utilise the decrement and branch instruction, but will give
8866up if there is more than one memory reference in the loop. Thus a loop
8867where the loop counter is decremented can generate slightly more
8868efficient code, in cases where the RPTB instruction cannot be utilised.
8869
8870@item -mdp-isr-reload
8871@itemx -mparanoid
cd3bb277
JM
8872@opindex mdp-isr-reload
8873@opindex mparanoid
282a61e6
MH
8874Force the DP register to be saved on entry to an interrupt service
8875routine (ISR), reloaded to point to the data section, and restored on
161d7b59 8876exit from the ISR@. This should not be required unless someone has
282a61e6
MH
8877violated the small memory model by modifying the DP register, say within
8878an object library.
8879
8880@item -mmpyi
8881@itemx -mno-mpyi
cd3bb277
JM
8882@opindex mmpyi
8883@opindex mno-mpyi
282a61e6
MH
8884For the C3x use the 24-bit MPYI instruction for integer multiplies
8885instead of a library call to guarantee 32-bit results. Note that if one
8886of the operands is a constant, then the multiplication will be performed
695ac33f 8887using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x,
282a61e6
MH
8888then squaring operations are performed inline instead of a library call.
8889
8890@item -mfast-fix
8891@itemx -mno-fast-fix
cd3bb277
JM
8892@opindex mfast-fix
8893@opindex mno-fast-fix
282a61e6
MH
8894The C3x/C4x FIX instruction to convert a floating point value to an
8895integer value chooses the nearest integer less than or equal to the
8896floating point value rather than to the nearest integer. Thus if the
8897floating point number is negative, the result will be incorrectly
8898truncated an additional code is necessary to detect and correct this
8899case. This option can be used to disable generation of the additional
8900code required to correct the result.
8901
8902@item -mrptb
8903@itemx -mno-rptb
cd3bb277
JM
8904@opindex mrptb
8905@opindex mno-rptb
282a61e6
MH
8906Enable (disable) generation of repeat block sequences using the RPTB
8907instruction for zero overhead looping. The RPTB construct is only used
8908for innermost loops that do not call functions or jump across the loop
8909boundaries. There is no advantage having nested RPTB loops due to the
8910overhead required to save and restore the RC, RS, and RE registers.
695ac33f 8911This is enabled by default with @option{-O2}.
282a61e6
MH
8912
8913@item -mrpts=@var{count}
8914@itemx -mno-rpts
cd3bb277
JM
8915@opindex mrpts
8916@opindex mno-rpts
282a61e6 8917Enable (disable) the use of the single instruction repeat instruction
161d7b59 8918RPTS@. If a repeat block contains a single instruction, and the loop
282a61e6 8919count can be guaranteed to be less than the value @var{count}, GCC will
161d7b59 8920emit a RPTS instruction instead of a RPTB@. If no value is specified,
282a61e6
MH
8921then a RPTS will be emitted even if the loop count cannot be determined
8922at compile time. Note that the repeated instruction following RPTS does
8923not have to be reloaded from memory each iteration, thus freeing up the
b192711e 8924CPU buses for operands. However, since interrupts are blocked by this
282a61e6
MH
8925instruction, it is disabled by default.
8926
8927@item -mloop-unsigned
8928@itemx -mno-loop-unsigned
cd3bb277
JM
8929@opindex mloop-unsigned
8930@opindex mno-loop-unsigned
282a61e6 8931The maximum iteration count when using RPTS and RPTB (and DB on the C40)
aee96fe9 8932is @math{2^31 + 1} since these instructions test if the iteration count is
282a61e6 8933negative to terminate the loop. If the iteration count is unsigned
aee96fe9 8934there is a possibility than the @math{2^31 + 1} maximum iteration count may be
282a61e6
MH
8935exceeded. This switch allows an unsigned iteration count.
8936
8937@item -mti
cd3bb277 8938@opindex mti
282a61e6
MH
8939Try to emit an assembler syntax that the TI assembler (asm30) is happy
8940with. This also enforces compatibility with the API employed by the TI
8941C3x C compiler. For example, long doubles are passed as structures
8942rather than in floating point registers.
8943
8944@item -mregparm
8945@itemx -mmemparm
cd3bb277
JM
8946@opindex mregparm
8947@opindex mmemparm
282a61e6
MH
8948Generate code that uses registers (stack) for passing arguments to functions.
8949By default, arguments are passed in registers where possible rather
8950than by pushing arguments on to the stack.
8951
8952@item -mparallel-insns
8953@itemx -mno-parallel-insns
cd3bb277
JM
8954@opindex mparallel-insns
8955@opindex mno-parallel-insns
282a61e6 8956Allow the generation of parallel instructions. This is enabled by
695ac33f 8957default with @option{-O2}.
282a61e6
MH
8958
8959@item -mparallel-mpy
8960@itemx -mno-parallel-mpy
cd3bb277
JM
8961@opindex mparallel-mpy
8962@opindex mno-parallel-mpy
282a61e6 8963Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
695ac33f 8964provided @option{-mparallel-insns} is also specified. These instructions have
282a61e6
MH
8965tight register constraints which can pessimize the code generation
8966of large functions.
8967
8968@end table
8969
f84271d9
JL
8970@node V850 Options
8971@subsection V850 Options
8972@cindex V850 Options
8973
8974These @samp{-m} options are defined for V850 implementations:
8975
2642624b 8976@table @gcctabopt
f84271d9
JL
8977@item -mlong-calls
8978@itemx -mno-long-calls
cd3bb277
JM
8979@opindex mlong-calls
8980@opindex mno-long-calls
f84271d9
JL
8981Treat all calls as being far away (near). If calls are assumed to be
8982far away, the compiler will always load the functions address up into a
8983register, and call indirect through the pointer.
8984
8985@item -mno-ep
bd762873 8986@itemx -mep
cd3bb277
JM
8987@opindex mno-ep
8988@opindex mep
f84271d9
JL
8989Do not optimize (do optimize) basic blocks that use the same index
8990pointer 4 or more times to copy pointer into the @code{ep} register, and
630d3d5a 8991use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
f84271d9
JL
8992option is on by default if you optimize.
8993
8994@item -mno-prolog-function
8995@itemx -mprolog-function
cd3bb277
JM
8996@opindex mno-prolog-function
8997@opindex mprolog-function
f84271d9
JL
8998Do not use (do use) external functions to save and restore registers at
8999the prolog and epilog of a function. The external functions are slower,
9000but use less code space if more than one function saves the same number
630d3d5a 9001of registers. The @option{-mprolog-function} option is on by default if
f84271d9
JL
9002you optimize.
9003
9004@item -mspace
cd3bb277 9005@opindex mspace
f84271d9 9006Try to make the code as small as possible. At present, this just turns
630d3d5a 9007on the @option{-mep} and @option{-mprolog-function} options.
f84271d9
JL
9008
9009@item -mtda=@var{n}
cd3bb277 9010@opindex mtda
f84271d9
JL
9011Put static or global variables whose size is @var{n} bytes or less into
9012the tiny data area that register @code{ep} points to. The tiny data
9013area can hold up to 256 bytes in total (128 bytes for byte references).
9014
9015@item -msda=@var{n}
cd3bb277 9016@opindex msda
f84271d9
JL
9017Put static or global variables whose size is @var{n} bytes or less into
9018the small data area that register @code{gp} points to. The small data
9019area can hold up to 64 kilobytes.
9020
9021@item -mzda=@var{n}
cd3bb277 9022@opindex mzda
f84271d9
JL
9023Put static or global variables whose size is @var{n} bytes or less into
9024the first 32 kilobytes of memory.
02f52e19 9025
48f0be1b 9026@item -mv850
cd3bb277 9027@opindex mv850
48f0be1b
SC
9028Specify that the target processor is the V850.
9029
e9a25f70 9030@item -mbig-switch
cd3bb277 9031@opindex mbig-switch
e9a25f70
JL
9032Generate code suitable for big switch tables. Use this option only if
9033the assembler/linker complain about out of range branches within a switch
9034table.
f84271d9
JL
9035@end table
9036
56b2d7a7
JL
9037@node ARC Options
9038@subsection ARC Options
9039@cindex ARC Options
9040
9041These options are defined for ARC implementations:
9042
2642624b 9043@table @gcctabopt
56b2d7a7 9044@item -EL
cd3bb277 9045@opindex EL
56b2d7a7
JL
9046Compile code for little endian mode. This is the default.
9047
9048@item -EB
cd3bb277 9049@opindex EB
56b2d7a7
JL
9050Compile code for big endian mode.
9051
9052@item -mmangle-cpu
cd3bb277 9053@opindex mmangle-cpu
56b2d7a7
JL
9054Prepend the name of the cpu to all public symbol names.
9055In multiple-processor systems, there are many ARC variants with different
9056instruction and register set characteristics. This flag prevents code
9057compiled for one cpu to be linked with code compiled for another.
695ac33f 9058No facility exists for handling variants that are ``almost identical''.
56b2d7a7
JL
9059This is an all or nothing option.
9060
9061@item -mcpu=@var{cpu}
cd3bb277 9062@opindex mcpu
56b2d7a7
JL
9063Compile code for ARC variant @var{cpu}.
9064Which variants are supported depend on the configuration.
630d3d5a 9065All variants support @option{-mcpu=base}, this is the default.
56b2d7a7 9066
630d3d5a
JM
9067@item -mtext=@var{text-section}
9068@itemx -mdata=@var{data-section}
9069@itemx -mrodata=@var{readonly-data-section}
cd3bb277
JM
9070@opindex mtext
9071@opindex mdata
9072@opindex mrodata
630d3d5a
JM
9073Put functions, data, and readonly data in @var{text-section},
9074@var{data-section}, and @var{readonly-data-section} respectively
56b2d7a7 9075by default. This can be overridden with the @code{section} attribute.
0b433de6 9076@xref{Variable Attributes}.
56b2d7a7
JL
9077
9078@end table
9079
83575957
ID
9080@node NS32K Options
9081@subsection NS32K Options
9082@cindex NS32K options
9083
9084These are the @samp{-m} options defined for the 32000 series. The default
9085values for these options depends on which style of 32000 was selected when
9086the compiler was configured; the defaults for the most common choices are
9087given below.
9088
2642624b 9089@table @gcctabopt
83575957
ID
9090@item -m32032
9091@itemx -m32032
cd3bb277
JM
9092@opindex m32032
9093@opindex m32032
83575957
ID
9094Generate output for a 32032. This is the default
9095when the compiler is configured for 32032 and 32016 based systems.
9096
9097@item -m32332
9098@itemx -m32332
cd3bb277
JM
9099@opindex m32332
9100@opindex m32332
83575957
ID
9101Generate output for a 32332. This is the default
9102when the compiler is configured for 32332-based systems.
9103
9104@item -m32532
9105@itemx -m32532
cd3bb277
JM
9106@opindex m32532
9107@opindex m32532
83575957
ID
9108Generate output for a 32532. This is the default
9109when the compiler is configured for 32532-based systems.
9110
9111@item -m32081
cd3bb277 9112@opindex m32081
83575957
ID
9113Generate output containing 32081 instructions for floating point.
9114This is the default for all systems.
9115
9116@item -m32381
cd3bb277 9117@opindex m32381
83575957 9118Generate output containing 32381 instructions for floating point. This
767094dd
JM
9119also implies @option{-m32081}. The 32381 is only compatible with the 32332
9120and 32532 cpus. This is the default for the pc532-netbsd configuration.
83575957
ID
9121
9122@item -mmulti-add
cd3bb277 9123@opindex mmulti-add
83575957 9124Try and generate multiply-add floating point instructions @code{polyF}
767094dd 9125and @code{dotF}. This option is only available if the @option{-m32381}
14976c58 9126option is in effect. Using these instructions requires changes to
83575957
ID
9127register allocation which generally has a negative impact on
9128performance. This option should only be enabled when compiling code
9129particularly likely to make heavy use of multiply-add instructions.
9130
9131@item -mnomulti-add
cd3bb277 9132@opindex mnomulti-add
83575957 9133Do not try and generate multiply-add floating point instructions
767094dd 9134@code{polyF} and @code{dotF}. This is the default on all platforms.
83575957
ID
9135
9136@item -msoft-float
cd3bb277 9137@opindex msoft-float
83575957
ID
9138Generate output containing library calls for floating point.
9139@strong{Warning:} the requisite libraries may not be available.
9140
9141@item -mnobitfield
cd3bb277 9142@opindex mnobitfield
767094dd
JM
9143Do not use the bit-field instructions. On some machines it is faster to
9144use shifting and masking operations. This is the default for the pc532.
83575957
ID
9145
9146@item -mbitfield
cd3bb277 9147@opindex mbitfield
767094dd 9148Do use the bit-field instructions. This is the default for all platforms
83575957
ID
9149except the pc532.
9150
9151@item -mrtd
cd3bb277 9152@opindex mrtd
83575957
ID
9153Use a different function-calling convention, in which functions
9154that take a fixed number of arguments return pop their
9155arguments on return with the @code{ret} instruction.
9156
9157This calling convention is incompatible with the one normally
9158used on Unix, so you cannot use it if you need to call libraries
9159compiled with the Unix compiler.
9160
9161Also, you must provide function prototypes for all functions that
9162take variable numbers of arguments (including @code{printf});
9163otherwise incorrect code will be generated for calls to those
9164functions.
9165
9166In addition, seriously incorrect code will result if you call a
9167function with too many arguments. (Normally, extra arguments are
9168harmlessly ignored.)
9169
9170This option takes its name from the 680x0 @code{rtd} instruction.
9171
9172
9173@item -mregparam
cd3bb277 9174@opindex mregparam
83575957
ID
9175Use a different function-calling convention where the first two arguments
9176are passed in registers.
9177
9178This calling convention is incompatible with the one normally
9179used on Unix, so you cannot use it if you need to call libraries
9180compiled with the Unix compiler.
9181
9182@item -mnoregparam
cd3bb277 9183@opindex mnoregparam
767094dd 9184Do not pass any arguments in registers. This is the default for all
83575957
ID
9185targets.
9186
9187@item -msb
cd3bb277 9188@opindex msb
83575957 9189It is OK to use the sb as an index register which is always loaded with
767094dd 9190zero. This is the default for the pc532-netbsd target.
83575957
ID
9191
9192@item -mnosb
cd3bb277 9193@opindex mnosb
83575957 9194The sb register is not available for use or has not been initialized to
767094dd
JM
9195zero by the run time system. This is the default for all targets except
9196the pc532-netbsd. It is also implied whenever @option{-mhimem} or
630d3d5a 9197@option{-fpic} is set.
83575957
ID
9198
9199@item -mhimem
cd3bb277 9200@opindex mhimem
161d7b59 9201Many ns32000 series addressing modes use displacements of up to 512MB@.
83575957 9202If an address is above 512MB then displacements from zero can not be used.
161d7b59 9203This option causes code to be generated which can be loaded above 512MB@.
83575957
ID
9204This may be useful for operating systems or ROM code.
9205
9206@item -mnohimem
cd3bb277 9207@opindex mnohimem
83575957
ID
9208Assume code will be loaded in the first 512MB of virtual address space.
9209This is the default for all platforms.
9210
9211
9212@end table
9213
052a4b28
DC
9214@node AVR Options
9215@subsection AVR Options
9216@cindex AVR Options
9217
9218These options are defined for AVR implementations:
9219
2642624b 9220@table @gcctabopt
052a4b28 9221@item -mmcu=@var{mcu}
cd3bb277 9222@opindex mmcu
3a69a7d5
MM
9223Specify ATMEL AVR instruction set or MCU type.
9224
9225Instruction set avr1 is for the minimal AVR core, not supported by the C
9226compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9227attiny11, attiny12, attiny15, attiny28).
9228
9229Instruction set avr2 (default) is for the classic AVR core with up to
92308K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9231at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9232at90c8534, at90s8535).
9233
9234Instruction set avr3 is for the classic AVR core with up to 128K program
9235memory space (MCU types: atmega103, atmega603).
9236
9237Instruction set avr4 is for the enhanced AVR core with up to 8K program
9238memory space (MCU types: atmega83, atmega85).
9239
9240Instruction set avr5 is for the enhanced AVR core with up to 128K program
9241memory space (MCU types: atmega161, atmega163, atmega32, at94k).
052a4b28
DC
9242
9243@item -msize
cd3bb277 9244@opindex msize
3a69a7d5 9245Output instruction sizes to the asm file.
052a4b28
DC
9246
9247@item -minit-stack=@var{N}
cd3bb277 9248@opindex minit-stack
3a69a7d5 9249Specify the initial stack address, which may be a symbol or numeric value,
aee96fe9 9250@samp{__stack} is the default.
052a4b28
DC
9251
9252@item -mno-interrupts
cd3bb277 9253@opindex mno-interrupts
052a4b28
DC
9254Generated code is not compatible with hardware interrupts.
9255Code size will be smaller.
9256
9257@item -mcall-prologues
cd3bb277 9258@opindex mcall-prologues
052a4b28 9259Functions prologues/epilogues expanded as call to appropriate
767094dd 9260subroutines. Code size will be smaller.
3a69a7d5
MM
9261
9262@item -mno-tablejump
cd3bb277 9263@opindex mno-tablejump
3a69a7d5
MM
9264Do not generate tablejump insns which sometimes increase code size.
9265
9266@item -mtiny-stack
cd3bb277 9267@opindex mtiny-stack
3a69a7d5 9268Change only the low 8 bits of the stack pointer.
052a4b28
DC
9269@end table
9270
789a3090
NC
9271@node MCore Options
9272@subsection MCore Options
9273@cindex MCore options
9274
9275These are the @samp{-m} options defined for the Motorola M*Core
02f52e19 9276processors.
789a3090 9277
2642624b 9278@table @gcctabopt
789a3090
NC
9279
9280@item -mhardlit
9281@itemx -mhardlit
9282@itemx -mno-hardlit
cd3bb277
JM
9283@opindex mhardlit
9284@opindex mhardlit
9285@opindex mno-hardlit
789a3090
NC
9286Inline constants into the code stream if it can be done in two
9287instructions or less.
9288
9289@item -mdiv
9290@itemx -mdiv
9291@itemx -mno-div
cd3bb277
JM
9292@opindex mdiv
9293@opindex mdiv
9294@opindex mno-div
789a3090
NC
9295Use the divide instruction. (Enabled by default).
9296
9297@item -mrelax-immediate
9298@itemx -mrelax-immediate
9299@itemx -mno-relax-immediate
cd3bb277
JM
9300@opindex mrelax-immediate
9301@opindex mrelax-immediate
9302@opindex mno-relax-immediate
b192711e 9303Allow arbitrary sized immediates in bit operations.
789a3090
NC
9304
9305@item -mwide-bitfields
9306@itemx -mwide-bitfields
9307@itemx -mno-wide-bitfields
cd3bb277
JM
9308@opindex mwide-bitfields
9309@opindex mwide-bitfields
9310@opindex mno-wide-bitfields
c771326b 9311Always treat bit-fields as int-sized.
789a3090
NC
9312
9313@item -m4byte-functions
9314@itemx -m4byte-functions
9315@itemx -mno-4byte-functions
cd3bb277
JM
9316@opindex m4byte-functions
9317@opindex m4byte-functions
9318@opindex mno-4byte-functions
b192711e 9319Force all functions to be aligned to a four byte boundary.
789a3090
NC
9320
9321@item -mcallgraph-data
9322@itemx -mcallgraph-data
9323@itemx -mno-callgraph-data
cd3bb277
JM
9324@opindex mcallgraph-data
9325@opindex mcallgraph-data
9326@opindex mno-callgraph-data
789a3090
NC
9327Emit callgraph information.
9328
9329@item -mslow-bytes
9330@itemx -mslow-bytes
9331@itemx -mno-slow-bytes
cd3bb277
JM
9332@opindex mslow-bytes
9333@opindex mslow-bytes
9334@opindex mno-slow-bytes
789a3090
NC
9335Prefer word access when reading byte quantities.
9336
9337@item -mlittle-endian
9338@itemx -mlittle-endian
9339@itemx -mbig-endian
cd3bb277
JM
9340@opindex mlittle-endian
9341@opindex mlittle-endian
9342@opindex mbig-endian
b192711e 9343Generate code for a little endian target.
789a3090
NC
9344
9345@item -m210
9346@itemx -m210
9347@itemx -m340
cd3bb277
JM
9348@opindex m210
9349@opindex m210
9350@opindex m340
789a3090 9351Generate code for the 210 processor.
789a3090 9352@end table
83575957 9353
df6194d4
JW
9354@node IA-64 Options
9355@subsection IA-64 Options
9356@cindex IA-64 Options
9357
9358These are the @samp{-m} options defined for the Intel IA-64 architecture.
9359
9360@table @gcctabopt
9361@item -mbig-endian
cd3bb277 9362@opindex mbig-endian
161d7b59 9363Generate code for a big endian target. This is the default for HPUX@.
df6194d4
JW
9364
9365@item -mlittle-endian
cd3bb277 9366@opindex mlittle-endian
df6194d4
JW
9367Generate code for a little endian target. This is the default for AIX5
9368and Linux.
9369
9370@item -mgnu-as
9371@itemx -mno-gnu-as
cd3bb277
JM
9372@opindex mgnu-as
9373@opindex mno-gnu-as
15d3a111 9374Generate (or don't) code for the GNU assembler. This is the default.
630d3d5a 9375@c Also, this is the default if the configure option @option{--with-gnu-as}
15d3a111 9376@c is used.
df6194d4
JW
9377
9378@item -mgnu-ld
9379@itemx -mno-gnu-ld
cd3bb277
JM
9380@opindex mgnu-ld
9381@opindex mno-gnu-ld
15d3a111 9382Generate (or don't) code for the GNU linker. This is the default.
630d3d5a 9383@c Also, this is the default if the configure option @option{--with-gnu-ld}
15d3a111 9384@c is used.
df6194d4
JW
9385
9386@item -mno-pic
cd3bb277 9387@opindex mno-pic
15d3a111 9388Generate code that does not use a global pointer register. The result
161d7b59 9389is not position independent code, and violates the IA-64 ABI@.
df6194d4
JW
9390
9391@item -mvolatile-asm-stop
9392@itemx -mno-volatile-asm-stop
cd3bb277
JM
9393@opindex mvolatile-asm-stop
9394@opindex mno-volatile-asm-stop
15d3a111
JW
9395Generate (or don't) a stop bit immediately before and after volatile asm
9396statements.
df6194d4
JW
9397
9398@item -mb-step
cd3bb277 9399@opindex mb-step
df6194d4
JW
9400Generate code that works around Itanium B step errata.
9401
9402@item -mregister-names
9403@itemx -mno-register-names
cd3bb277
JM
9404@opindex mregister-names
9405@opindex mno-register-names
15d3a111
JW
9406Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9407the stacked registers. This may make assembler output more readable.
df6194d4
JW
9408
9409@item -mno-sdata
9410@itemx -msdata
cd3bb277
JM
9411@opindex mno-sdata
9412@opindex msdata
15d3a111
JW
9413Disable (or enable) optimizations that use the small data section. This may
9414be useful for working around optimizer bugs.
df6194d4
JW
9415
9416@item -mconstant-gp
cd3bb277 9417@opindex mconstant-gp
df6194d4
JW
9418Generate code that uses a single constant global pointer value. This is
9419useful when compiling kernel code.
9420
9421@item -mauto-pic
cd3bb277 9422@opindex mauto-pic
630d3d5a 9423Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
df6194d4
JW
9424This is useful when compiling firmware code.
9425
9426@item -minline-divide-min-latency
cd3bb277 9427@opindex minline-divide-min-latency
df6194d4
JW
9428Generate code for inline divides using the minimum latency algorithm.
9429
9430@item -minline-divide-max-throughput
cd3bb277 9431@opindex minline-divide-max-throughput
df6194d4
JW
9432Generate code for inline divides using the maximum throughput algorithm.
9433
9434@item -mno-dwarf2-asm
9435@itemx -mdwarf2-asm
cd3bb277
JM
9436@opindex mno-dwarf2-asm
9437@opindex mdwarf2-asm
15d3a111
JW
9438Don't (or do) generate assembler code for the DWARF2 line number debugging
9439info. This may be useful when not using the GNU assembler.
df6194d4 9440
630d3d5a 9441@item -mfixed-range=@var{register-range}
cd3bb277 9442@opindex mfixed-range
df6194d4
JW
9443Generate code treating the given register range as fixed registers.
9444A fixed register is one that the register allocator can not use. This is
9445useful when compiling kernel code. A register range is specified as
9446two registers separated by a dash. Multiple register ranges can be
9447specified separated by a comma.
9448@end table
9449
e8ad90e5
MM
9450@node D30V Options
9451@subsection D30V Options
9452@cindex D30V Options
9453
9454These @samp{-m} options are defined for D30V implementations:
9455
2642624b 9456@table @gcctabopt
e8ad90e5 9457@item -mextmem
cd3bb277 9458@opindex mextmem
e8ad90e5
MM
9459Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
9460@samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
9461memory, which starts at location @code{0x80000000}.
9462
9463@item -mextmemory
cd3bb277 9464@opindex mextmemory
630d3d5a 9465Same as the @option{-mextmem} switch.
e8ad90e5
MM
9466
9467@item -monchip
cd3bb277 9468@opindex monchip
e8ad90e5
MM
9469Link the @samp{.text} section into onchip text memory, which starts at
9470location @code{0x0}. Also link @samp{.data}, @samp{.bss},
9471@samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
9472into onchip data memory, which starts at location @code{0x20000000}.
9473
9474@item -mno-asm-optimize
9475@itemx -masm-optimize
cd3bb277
JM
9476@opindex mno-asm-optimize
9477@opindex masm-optimize
630d3d5a
JM
9478Disable (enable) passing @option{-O} to the assembler when optimizing.
9479The assembler uses the @option{-O} option to automatically parallelize
e8ad90e5
MM
9480adjacent short instructions where possible.
9481
9482@item -mbranch-cost=@var{n}
cd3bb277 9483@opindex mbranch-cost
e8ad90e5
MM
9484Increase the internal costs of branches to @var{n}. Higher costs means
9485that the compiler will issue more instructions to avoid doing a branch.
9486The default is 2.
9487
9488@item -mcond-exec=@var{n}
cd3bb277 9489@opindex mcond-exec
e8ad90e5
MM
9490Specify the maximum number of conditionally executed instructions that
9491replace a branch. The default is 4.
9492@end table
56b2d7a7 9493
91abf72d
HP
9494@node S/390 and zSeries Options
9495@subsection S/390 and zSeries Options
9496@cindex S/390 and zSeries Options
9497
9498These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9499
9500@table @gcctabopt
9501@item -mhard-float
9502@itemx -msoft-float
9503@opindex mhard-float
9504@opindex msoft-float
9505Use (do not use) the hardware floating-point instructions and registers
9506for floating-point operations. When @option{-msoft-float} is specified,
9507functions in @file{libgcc.a} will be used to perform floating-point
9508operations. When @option{-mhard-float} is specified, the compiler
9509generates IEEE floating-point instructions. This is the default.
9510
9511@item -mbackchain
9512@itemx -mno-backchain
9513@opindex mbackchain
9514@opindex mno-backchain
9515Generate (or do not generate) code which maintains an explicit
9516backchain within the stack frame that points to the caller's frame.
9517This is currently needed to allow debugging. The default is to
9518generate the backchain.
9519
9520@item -msmall-exec
9521@itemx -mno-small-exec
9522@opindex msmall-exec
9523@opindex mno-small-exec
9524Generate (or do not generate) code using the @code{bras} instruction
9525to do subroutine calls.
9526This only works reliably if the total executable size does not
9527exceed 64k. The default is to use the @code{basr} instruction instead,
9528which does not have this limitation.
9529
9530@item -m64
9531@itemx -m31
9532@opindex m64
9533@opindex m31
9534When @option{-m31} is specified, generate code compliant to the
9535Linux for S/390 ABI@. When @option{-m64} is specified, generate
9536code compliant to the Linux for zSeries ABI@. This allows GCC in
9537particular to generate 64-bit instructions. For the @samp{s390}
9538targets, the default is @option{-m31}, while the @samp{s390x}
9539targets default to @option{-m64}.
9540
9541@item -mmvcle
9542@itemx -mno-mvcle
9543@opindex mmvcle
9544@opindex mno-mvcle
9545Generate (or do not generate) code using the @code{mvcle} instruction
9546to perform block moves. When @option{-mno-mvcle} is specifed,
9547use a @code{mvc} loop instead. This is the default.
9548
9549@item -mdebug
9550@itemx -mno-debug
9551@opindex mdebug
9552@opindex mno-debug
9553Print (or do not print) additional debug information when compiling.
9554The default is to not print debug information.
9555
9556@end table
9557
0b85d816
HPN
9558@node CRIS Options
9559@subsection CRIS Options
9560@cindex CRIS Options
9561
9562These options are defined specifically for the CRIS ports.
9563
9564@table @gcctabopt
9565@item -march=@var{architecture-type}
9566@itemx -mcpu=@var{architecture-type}
9567@opindex march
9568@opindex mcpu
9569Generate code for the specified architecture. The choices for
9570@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
9571respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
9572Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
9573@samp{v10}.
9574
9575@item -mtune=@var{architecture-type}
9576@opindex mtune
9577Tune to @var{architecture-type} everything applicable about the generated
9578code, except for the ABI and the set of available instructions. The
9579choices for @var{architecture-type} are the same as for
9580@option{-march=@var{architecture-type}}.
9581
9582@item -mmax-stack-frame=@var{n}
9583@opindex mmax-stack-frame
9584Warn when the stack frame of a function exceeds @var{n} bytes.
9585
9586@item -melinux-stacksize=@var{n}
9587@opindex melinux-stacksize
9588Only available with the @samp{cris-axis-aout} target. Arranges for
9589indications in the program to the kernel loader that the stack of the
9590program should be set to @var{n} bytes.
9591
9592@item -metrax4
9593@itemx -metrax100
9594@opindex metrax4
9595@opindex metrax100
9596The options @option{-metrax4} and @option{-metrax100} are synonyms for
9597@option{-march=v3} and @option{-march=v8} respectively.
9598
9599@item -mpdebug
9600@opindex mpdebug
9601Enable CRIS-specific verbose debug-related information in the assembly
9602code. This option also has the effect to turn off the @samp{#NO_APP}
9603formatted-code indicator to the assembler at the beginning of the
9604assembly file.
9605
9606@item -mcc-init
9607@opindex mcc-init
9608Do not use condition-code results from previous instruction; always emit
9609compare and test instructions before use of condition codes.
9610
9611@item -mno-side-effects
9612@opindex mno-side-effects
9613Do not emit instructions with side-effects in addressing modes other than
9614post-increment.
9615
9616@item -mstack-align
9617@itemx -mno-stack-align
9618@itemx -mdata-align
9619@itemx -mno-data-align
9620@itemx -mconst-align
9621@itemx -mno-const-align
9622@opindex mstack-align
9623@opindex mno-stack-align
9624@opindex mdata-align
9625@opindex mno-data-align
9626@opindex mconst-align
9627@opindex mno-const-align
9628These options (no-options) arranges (eliminate arrangements) for the
9629stack-frame, individual data and constants to be aligned for the maximum
9630single data access size for the chosen CPU model. The default is to
9631arrange for 32-bit alignment. ABI details such as structure layout are
9632not affected by these options.
9633
9634@item -m32-bit
9635@itemx -m16-bit
9636@itemx -m8-bit
9637@opindex m32-bit
9638@opindex m16-bit
9639@opindex m8-bit
9640Similar to the stack- data- and const-align options above, these options
9641arrange for stack-frame, writable data and constants to all be 32-bit,
964216-bit or 8-bit aligned. The default is 32-bit alignment.
9643
9644@item -mno-prologue-epilogue
9645@itemx -mprologue-epilogue
9646@opindex mno-prologue-epilogue
9647@opindex mprologue-epilogue
9648With @option{-mno-prologue-epilogue}, the normal function prologue and
9649epilogue that sets up the stack-frame are omitted and no return
9650instructions or return sequences are generated in the code. Use this
9651option only together with visual inspection of the compiled code: no
9652warnings or errors are generated when call-saved registers must be saved,
9653or storage for local variable needs to be allocated.
9654
9655@item -mno-gotplt
9656@itemx -mgotplt
9657@opindex mno-gotplt
9658@opindex mgotplt
9659With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
9660instruction sequences that load addresses for functions from the PLT part
9661of the GOT rather than (traditional on other architectures) calls to the
9662PLT. The default is @option{-mgotplt}.
9663
9664@item -maout
9665@opindex maout
9666Legacy no-op option only recognized with the cris-axis-aout target.
9667
9668@item -melf
9669@opindex melf
9670Legacy no-op option only recognized with the cris-axis-elf and
9671cris-axis-linux-gnu targets.
9672
9673@item -melinux
9674@opindex melinux
9675Only recognized with the cris-axis-aout target, where it selects a
9676GNU/linux-like multilib, include files and instruction set for
9677@option{-march=v8}.
9678
9679@item -mlinux
9680@opindex mlinux
9681Legacy no-op option only recognized with the cris-axis-linux-gnu target.
9682
9683@item -sim
9684@opindex sim
9685This option, recognized for the cris-axis-aout and cris-axis-elf arranges
9686to link with input-output functions from a simulator library. Code,
9687initialized data and zero-initialized data are allocated consecutively.
9688
9689@item -sim2
9690@opindex sim2
9691Like @option{-sim}, but pass linker options to locate initialized data at
96920x40000000 and zero-initialized data at 0x80000000.
9693@end table
9694
bcf684c7
HPN
9695@node MMIX Options
9696@subsection MMIX Options
9697@cindex MMIX Options
9698
9699These options are defined for the MMIX:
9700
9701@table @code
9702@item -mlibfuncs
9703@itemx -mno-libfuncs
9704Specify that intrinsic library functions are being compiled, passing all
9705values in registers, no matter the size.
9706
9707@item -mepsilon
9708@itemx -mno-epsilon
9709Generate floating-point comparison instructions that compare with respect
9710to the @code{rE} epsilon register.
9711
9712@item -mabi=mmixware
9713@itemx -mabi=gnu
9714Generate code that passes function parameters and return values that (in
9715the called function) are seen as registers @code{$0} and up, as opposed to
9716the GNU ABI which uses global registers @code{$231} and up.
9717
9718@item -mzero-extend
9719@item -mno-zero-extend
9720When reading data from memory in sizes shorter than 64 bits, use (do not
9721use) zero-extending load instructions by default, rather than
9722sign-extending ones.
9723
9724@item -mknuthdiv
9725@itemx -mno-knuthdiv
9726Make the result of a division yielding a remainder have the same sign as
9727the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
7fba3293
HPN
9728remainder follows the sign of the dividend. Both methods are
9729arithmetically valid, the latter being almost exclusively used.
bcf684c7
HPN
9730
9731@item -mtoplevel-symbols
9732@itemx -mno-toplevel-symbols
7fba3293 9733Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
bcf684c7
HPN
9734code can be used with the @code{PREFIX} assembly directive.
9735
9736@item -melf
7fba3293 9737Generate an executable in the ELF format, rather than the default
bcf684c7
HPN
9738@samp{mmo} format used by the @command{mmix} simulator.
9739@end table
9740
74291a4b
MM
9741@node Code Gen Options
9742@section Options for Code Generation Conventions
9743@cindex code generation conventions
9744@cindex options, code generation
9745@cindex run-time options
9746
9747These machine-independent options control the interface conventions
9748used in code generation.
9749
9750Most of them have both positive and negative forms; the negative form
630d3d5a 9751of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
74291a4b
MM
9752one of the forms is listed---the one which is not the default. You
9753can figure out the other form by either removing @samp{no-} or adding
9754it.
9755
2642624b 9756@table @gcctabopt
956d6950 9757@item -fexceptions
cd3bb277 9758@opindex fexceptions
767094dd 9759Enable exception handling. Generates extra code needed to propagate
f0523f02 9760exceptions. For some targets, this implies GCC will generate frame
c5c76735
JL
9761unwind information for all functions, which can produce significant data
9762size overhead, although it does not affect execution. If you do not
f0523f02 9763specify this option, GCC will enable it by default for languages like
90ecce3e 9764C++ which normally require exception handling, and disable it for
c5c76735
JL
9765languages like C that do not normally require it. However, you may need
9766to enable this option when compiling C code that needs to interoperate
9767properly with exception handlers written in C++. You may also wish to
9768disable this option if you are compiling older C++ programs that don't
9769use exception handling.
956d6950 9770
6cfc0341
RH
9771@item -fnon-call-exceptions
9772@opindex fnon-call-exceptions
9773Generate code that allows trapping instructions to throw exceptions.
9774Note that this requires platform-specific runtime support that does
9775not exist everywhere. Moreover, it only allows @emph{trapping}
e979f9e8 9776instructions to throw exceptions, i.e.@: memory references or floating
6cfc0341
RH
9777point instructions. It does not allow exceptions to be thrown from
9778arbitrary signal handlers such as @code{SIGALRM}.
9779
14a774a9 9780@item -funwind-tables
cd3bb277 9781@opindex funwind-tables
bedc7537 9782Similar to @option{-fexceptions}, except that it will just generate any needed
14a774a9
RK
9783static data, but will not affect the generated code in any other way.
9784You will normally not enable this option; instead, a language processor
9785that needs this handling would enable it on your behalf.
9786
b932f770
JH
9787@item -fasynchronous-unwind-tables
9788@opindex funwind-tables
9789Generate unwind table in dwarf2 format, if supported by target machine. The
9790table is exact at each instruction boundary, so it can be used for stack
9791unwinding from asynchronous events (such as debugger or garbage collector).
9792
74291a4b 9793@item -fpcc-struct-return
cd3bb277 9794@opindex fpcc-struct-return
74291a4b
MM
9795Return ``short'' @code{struct} and @code{union} values in memory like
9796longer ones, rather than in registers. This convention is less
9797efficient, but it has the advantage of allowing intercallability between
0c2d1a2a 9798GCC-compiled files and files compiled with other compilers.
74291a4b
MM
9799
9800The precise convention for returning structures in memory depends
9801on the target configuration macros.
9802
9803Short structures and unions are those whose size and alignment match
9804that of some integer type.
9805
9806@item -freg-struct-return
cd3bb277 9807@opindex freg-struct-return
9c34dbbf
ZW
9808Return @code{struct} and @code{union} values in registers when possible.
9809This is more efficient for small structures than
9810@option{-fpcc-struct-return}.
74291a4b 9811
9c34dbbf 9812If you specify neither @option{-fpcc-struct-return} nor
630d3d5a 9813@option{-freg-struct-return}, GCC defaults to whichever convention is
0c2d1a2a 9814standard for the target. If there is no standard convention, GCC
9c34dbbf
ZW
9815defaults to @option{-fpcc-struct-return}, except on targets where GCC is
9816the principal compiler. In those cases, we can choose the standard, and
9817we chose the more efficient register return alternative.
74291a4b
MM
9818
9819@item -fshort-enums
cd3bb277 9820@opindex fshort-enums
74291a4b
MM
9821Allocate to an @code{enum} type only as many bytes as it needs for the
9822declared range of possible values. Specifically, the @code{enum} type
9823will be equivalent to the smallest integer type which has enough room.
9824
9825@item -fshort-double
cd3bb277 9826@opindex fshort-double
74291a4b
MM
9827Use the same size for @code{double} as for @code{float}.
9828
9829@item -fshared-data
cd3bb277 9830@opindex fshared-data
74291a4b
MM
9831Requests that the data and non-@code{const} variables of this
9832compilation be shared data rather than private data. The distinction
9833makes sense only on certain operating systems, where shared data is
9834shared between processes running the same program, while private data
9835exists in one copy per process.
9836
9837@item -fno-common
cd3bb277 9838@opindex fno-common
90ecce3e 9839In C, allocate even uninitialized global variables in the data section of the
74291a4b
MM
9840object file, rather than generating them as common blocks. This has the
9841effect that if the same variable is declared (without @code{extern}) in
9842two different compilations, you will get an error when you link them.
9843The only reason this might be useful is if you wish to verify that the
9844program will work on other systems which always work this way.
9845
9846@item -fno-ident
cd3bb277 9847@opindex fno-ident
74291a4b
MM
9848Ignore the @samp{#ident} directive.
9849
9850@item -fno-gnu-linker
cd3bb277 9851@opindex fno-gnu-linker
74291a4b
MM
9852Do not output global initializations (such as C++ constructors and
9853destructors) in the form used by the GNU linker (on systems where the GNU
9854linker is the standard method of handling them). Use this option when
9855you want to use a non-GNU linker, which also requires using the
bedc7537
NC
9856@command{collect2} program to make sure the system linker includes
9857constructors and destructors. (@command{collect2} is included in the GCC
9858distribution.) For systems which @emph{must} use @command{collect2}, the
9859compiler driver @command{gcc} is configured to do this automatically.
74291a4b
MM
9860
9861@item -finhibit-size-directive
cd3bb277 9862@opindex finhibit-size-directive
74291a4b
MM
9863Don't output a @code{.size} assembler directive, or anything else that
9864would cause trouble if the function is split in the middle, and the
9865two halves are placed at locations far apart in memory. This option is
9866used when compiling @file{crtstuff.c}; you should not need to use it
9867for anything else.
9868
9869@item -fverbose-asm
cd3bb277 9870@opindex fverbose-asm
74291a4b
MM
9871Put extra commentary information in the generated assembly code to
9872make it more readable. This option is generally only of use to those
9873who actually need to read the generated assembly code (perhaps while
9874debugging the compiler itself).
9875
630d3d5a 9876@option{-fno-verbose-asm}, the default, causes the
74291a4b
MM
9877extra information to be omitted and is useful when comparing two assembler
9878files.
9879
9880@item -fvolatile
cd3bb277 9881@opindex fvolatile
74291a4b
MM
9882Consider all memory references through pointers to be volatile.
9883
9884@item -fvolatile-global
cd3bb277 9885@opindex fvolatile-global
74291a4b 9886Consider all memory references to extern and global data items to
0c2d1a2a 9887be volatile. GCC does not consider static data items to be volatile
ab87f8c8
JL
9888because of this switch.
9889
9890@item -fvolatile-static
cd3bb277 9891@opindex fvolatile-static
ab87f8c8 9892Consider all memory references to static data to be volatile.
74291a4b
MM
9893
9894@item -fpic
cd3bb277 9895@opindex fpic
74291a4b
MM
9896@cindex global offset table
9897@cindex PIC
9898Generate position-independent code (PIC) suitable for use in a shared
9899library, if supported for the target machine. Such code accesses all
161d7b59 9900constant addresses through a global offset table (GOT)@. The dynamic
861bb6c1 9901loader resolves the GOT entries when the program starts (the dynamic
0c2d1a2a 9902loader is not part of GCC; it is part of the operating system). If
861bb6c1
JL
9903the GOT size for the linked executable exceeds a machine-specific
9904maximum size, you get an error message from the linker indicating that
630d3d5a 9905@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
861bb6c1
JL
9906instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
9907on the m68k and RS/6000. The 386 has no such limit.)
74291a4b
MM
9908
9909Position-independent code requires special support, and therefore works
0c2d1a2a 9910only on certain machines. For the 386, GCC supports PIC for System V
74291a4b
MM
9911but not for the Sun 386i. Code generated for the IBM RS/6000 is always
9912position-independent.
9913
74291a4b 9914@item -fPIC
cd3bb277 9915@opindex fPIC
74291a4b
MM
9916If supported for the target machine, emit position-independent code,
9917suitable for dynamic linking and avoiding any limit on the size of the
9918global offset table. This option makes a difference on the m68k, m88k,
9919and the Sparc.
9920
9921Position-independent code requires special support, and therefore works
9922only on certain machines.
9923
9924@item -ffixed-@var{reg}
cd3bb277 9925@opindex ffixed
74291a4b
MM
9926Treat the register named @var{reg} as a fixed register; generated code
9927should never refer to it (except perhaps as a stack pointer, frame
9928pointer or in some other fixed role).
9929
9930@var{reg} must be the name of a register. The register names accepted
9931are machine-specific and are defined in the @code{REGISTER_NAMES}
9932macro in the machine description macro file.
9933
9934This flag does not have a negative form, because it specifies a
9935three-way choice.
9936
9937@item -fcall-used-@var{reg}
cd3bb277 9938@opindex fcall-used
956d6950 9939Treat the register named @var{reg} as an allocable register that is
74291a4b
MM
9940clobbered by function calls. It may be allocated for temporaries or
9941variables that do not live across a call. Functions compiled this way
9942will not save and restore the register @var{reg}.
9943
cb2fdc84
GRK
9944It is an error to used this flag with the frame pointer or stack pointer.
9945Use of this flag for other registers that have fixed pervasive roles in
9946the machine's execution model will produce disastrous results.
74291a4b
MM
9947
9948This flag does not have a negative form, because it specifies a
9949three-way choice.
9950
9951@item -fcall-saved-@var{reg}
cd3bb277 9952@opindex fcall-saved
956d6950 9953Treat the register named @var{reg} as an allocable register saved by
74291a4b
MM
9954functions. It may be allocated even for temporaries or variables that
9955live across a call. Functions compiled this way will save and restore
9956the register @var{reg} if they use it.
9957
cb2fdc84
GRK
9958It is an error to used this flag with the frame pointer or stack pointer.
9959Use of this flag for other registers that have fixed pervasive roles in
9960the machine's execution model will produce disastrous results.
74291a4b
MM
9961
9962A different sort of disaster will result from the use of this flag for
9963a register in which function values may be returned.
9964
9965This flag does not have a negative form, because it specifies a
9966three-way choice.
9967
9968@item -fpack-struct
cd3bb277 9969@opindex fpack-struct
74291a4b
MM
9970Pack all structure members together without holes. Usually you would
9971not want to use this option, since it makes the code suboptimal, and
9972the offsets of structure members won't agree with system libraries.
9973
07417085 9974@item -finstrument-functions
cd3bb277 9975@opindex finstrument-functions
07417085
KR
9976Generate instrumentation calls for entry and exit to functions. Just
9977after function entry and just before function exit, the following
9978profiling functions will be called with the address of the current
9979function and its call site. (On some platforms,
9980@code{__builtin_return_address} does not work beyond the current
9981function, so the call site information may not be available to the
9982profiling functions otherwise.)
9983
9984@example
310668e8
JM
9985void __cyg_profile_func_enter (void *this_fn,
9986 void *call_site);
9987void __cyg_profile_func_exit (void *this_fn,
9988 void *call_site);
07417085
KR
9989@end example
9990
9991The first argument is the address of the start of the current function,
9992which may be looked up exactly in the symbol table.
9993
9994This instrumentation is also done for functions expanded inline in other
9995functions. The profiling calls will indicate where, conceptually, the
9996inline function is entered and exited. This means that addressable
9997versions of such functions must be available. If all your uses of a
9998function are expanded inline, this may mean an additional expansion of
9999code size. If you use @samp{extern inline} in your C code, an
10000addressable version of such functions must be provided. (This is
10001normally the case anyways, but if you get lucky and the optimizer always
10002expands the functions inline, you might have gotten away without
10003providing static copies.)
10004
10005A function may be given the attribute @code{no_instrument_function}, in
10006which case this instrumentation will not be done. This can be used, for
10007example, for the profiling functions listed above, high-priority
10008interrupt routines, and any functions from which the profiling functions
10009cannot safely be called (perhaps signal handlers, if the profiling
10010routines generate output or allocate memory).
10011
861bb6c1 10012@item -fstack-check
cd3bb277 10013@opindex fstack-check
861bb6c1
JL
10014Generate code to verify that you do not go beyond the boundary of the
10015stack. You should specify this flag if you are running in an
10016environment with multiple threads, but only rarely need to specify it in
10017a single-threaded environment since stack overflow is automatically
10018detected on nearly all systems if there is only one stack.
10019
a157febd
GK
10020Note that this switch does not actually cause checking to be done; the
10021operating system must do that. The switch causes generation of code
10022to ensure that the operating system sees the stack being extended.
10023
10024@item -fstack-limit-register=@var{reg}
10025@itemx -fstack-limit-symbol=@var{sym}
10026@itemx -fno-stack-limit
cd3bb277
JM
10027@opindex fstack-limit-register
10028@opindex fstack-limit-symbol
10029@opindex fno-stack-limit
a157febd
GK
10030Generate code to ensure that the stack does not grow beyond a certain value,
10031either the value of a register or the address of a symbol. If the stack
10032would grow beyond the value, a signal is raised. For most targets,
10033the signal is raised before the stack overruns the boundary, so
10034it is possible to catch the signal without taking special precautions.
10035
9c34dbbf
ZW
10036For instance, if the stack starts at absolute address @samp{0x80000000}
10037and grows downwards, you can use the flags
10038@option{-fstack-limit-symbol=__stack_limit} and
10039@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10040of 128KB@. Note that this may only work with the GNU linker.
a157febd 10041
e5eb27e5
JL
10042@cindex aliasing of parameters
10043@cindex parameters, aliased
10044@item -fargument-alias
04afd9d6
JL
10045@itemx -fargument-noalias
10046@itemx -fargument-noalias-global
cd3bb277
JM
10047@opindex fargument-alias
10048@opindex fargument-noalias
10049@opindex fargument-noalias-global
e5eb27e5
JL
10050Specify the possible relationships among parameters and between
10051parameters and global data.
10052
630d3d5a 10053@option{-fargument-alias} specifies that arguments (parameters) may
9c34dbbf 10054alias each other and may alias global storage.@*
630d3d5a 10055@option{-fargument-noalias} specifies that arguments do not alias
9c34dbbf 10056each other, but may alias global storage.@*
630d3d5a 10057@option{-fargument-noalias-global} specifies that arguments do not
e5eb27e5
JL
10058alias each other and do not alias global storage.
10059
10060Each language will automatically use whatever option is required by
10061the language standard. You should not need to use these options yourself.
19283265
RH
10062
10063@item -fleading-underscore
cd3bb277 10064@opindex fleading-underscore
695ac33f 10065This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19283265
RH
10066change the way C symbols are represented in the object file. One use
10067is to help link with legacy assembly code.
10068
10069Be warned that you should know what you are doing when invoking this
10070option, and that not all targets provide complete support for it.
74291a4b
MM
10071@end table
10072
ee457005
JM
10073@c man end
10074
74291a4b 10075@node Environment Variables
0c2d1a2a 10076@section Environment Variables Affecting GCC
74291a4b
MM
10077@cindex environment variables
10078
ee457005
JM
10079@c man begin ENVIRONMENT
10080
0c2d1a2a
JB
10081This section describes several environment variables that affect how GCC
10082operates. Some of them work by specifying directories or prefixes to use
767094dd 10083when searching for various kinds of files. Some are used to specify other
46103ab4 10084aspects of the compilation environment.
74291a4b 10085
74291a4b 10086Note that you can also specify places to search using options such as
630d3d5a 10087@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
74291a4b 10088take precedence over places specified using environment variables, which
161d7b59 10089in turn take precedence over those specified by the configuration of GCC@.
b11cc610
JM
10090@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
10091GNU Compiler Collection (GCC) Internals}.
74291a4b 10092
bedc7537 10093@table @env
ab87f8c8
JL
10094@item LANG
10095@itemx LC_CTYPE
10096@c @itemx LC_COLLATE
10097@itemx LC_MESSAGES
10098@c @itemx LC_MONETARY
10099@c @itemx LC_NUMERIC
10100@c @itemx LC_TIME
10101@itemx LC_ALL
10102@findex LANG
10103@findex LC_CTYPE
10104@c @findex LC_COLLATE
10105@findex LC_MESSAGES
10106@c @findex LC_MONETARY
10107@c @findex LC_NUMERIC
10108@c @findex LC_TIME
10109@findex LC_ALL
10110@cindex locale
0c2d1a2a
JB
10111These environment variables control the way that GCC uses
10112localization information that allow GCC to work with different
10113national conventions. GCC inspects the locale categories
bedc7537 10114@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
ab87f8c8
JL
10115so. These locale categories can be set to any value supported by your
10116installation. A typical value is @samp{en_UK} for English in the United
10117Kingdom.
10118
bedc7537 10119The @env{LC_CTYPE} environment variable specifies character
0c2d1a2a 10120classification. GCC uses it to determine the character boundaries in
ab87f8c8
JL
10121a string; this is needed for some multibyte encodings that contain quote
10122and escape characters that would otherwise be interpreted as a string
10123end or escape.
10124
bedc7537 10125The @env{LC_MESSAGES} environment variable specifies the language to
ab87f8c8
JL
10126use in diagnostic messages.
10127
bedc7537
NC
10128If the @env{LC_ALL} environment variable is set, it overrides the value
10129of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
10130and @env{LC_MESSAGES} default to the value of the @env{LANG}
0c2d1a2a 10131environment variable. If none of these variables are set, GCC
ab87f8c8
JL
10132defaults to traditional C English behavior.
10133
74291a4b
MM
10134@item TMPDIR
10135@findex TMPDIR
bedc7537 10136If @env{TMPDIR} is set, it specifies the directory to use for temporary
0c2d1a2a 10137files. GCC uses temporary files to hold the output of one stage of
74291a4b
MM
10138compilation which is to be used as input to the next stage: for example,
10139the output of the preprocessor, which is the input to the compiler
10140proper.
10141
10142@item GCC_EXEC_PREFIX
10143@findex GCC_EXEC_PREFIX
bedc7537 10144If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
74291a4b
MM
10145names of the subprograms executed by the compiler. No slash is added
10146when this prefix is combined with the name of a subprogram, but you can
10147specify a prefix that ends with a slash if you wish.
10148
f0523f02 10149If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
0deb20df
TT
10150an appropriate prefix to use based on the pathname it was invoked with.
10151
0c2d1a2a 10152If GCC cannot find the subprogram using the specified prefix, it
74291a4b
MM
10153tries looking in the usual places for the subprogram.
10154
bedc7537 10155The default value of @env{GCC_EXEC_PREFIX} is
74291a4b
MM
10156@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
10157of @code{prefix} when you ran the @file{configure} script.
10158
630d3d5a 10159Other prefixes specified with @option{-B} take precedence over this prefix.
74291a4b
MM
10160
10161This prefix is also used for finding files such as @file{crt0.o} that are
10162used for linking.
10163
10164In addition, the prefix is used in an unusual way in finding the
10165directories to search for header files. For each of the standard
10166directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
bedc7537 10167(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
74291a4b 10168replacing that beginning with the specified prefix to produce an
630d3d5a 10169alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
74291a4b
MM
10170@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
10171These alternate directories are searched first; the standard directories
10172come next.
10173
10174@item COMPILER_PATH
10175@findex COMPILER_PATH
bedc7537
NC
10176The value of @env{COMPILER_PATH} is a colon-separated list of
10177directories, much like @env{PATH}. GCC tries the directories thus
74291a4b 10178specified when searching for subprograms, if it can't find the
bedc7537 10179subprograms using @env{GCC_EXEC_PREFIX}.
74291a4b
MM
10180
10181@item LIBRARY_PATH
10182@findex LIBRARY_PATH
bedc7537
NC
10183The value of @env{LIBRARY_PATH} is a colon-separated list of
10184directories, much like @env{PATH}. When configured as a native compiler,
0c2d1a2a 10185GCC tries the directories thus specified when searching for special
bedc7537 10186linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
0c2d1a2a 10187using GCC also uses these directories when searching for ordinary
630d3d5a
JM
10188libraries for the @option{-l} option (but directories specified with
10189@option{-L} come first).
74291a4b
MM
10190
10191@item C_INCLUDE_PATH
10192@itemx CPLUS_INCLUDE_PATH
10193@itemx OBJC_INCLUDE_PATH
10194@findex C_INCLUDE_PATH
10195@findex CPLUS_INCLUDE_PATH
10196@findex OBJC_INCLUDE_PATH
10197@c @itemx OBJCPLUS_INCLUDE_PATH
10198These environment variables pertain to particular languages. Each
10199variable's value is a colon-separated list of directories, much like
bedc7537 10200@env{PATH}. When GCC searches for header files, it tries the
74291a4b 10201directories listed in the variable for the language you are using, after
630d3d5a 10202the directories specified with @option{-I} but before the standard header
74291a4b
MM
10203file directories.
10204
10205@item DEPENDENCIES_OUTPUT
10206@findex DEPENDENCIES_OUTPUT
10207@cindex dependencies for make as output
10208If this variable is set, its value specifies how to output dependencies
10209for Make based on the header files processed by the compiler. This
630d3d5a 10210output looks much like the output from the @option{-M} option
74291a4b
MM
10211(@pxref{Preprocessor Options}), but it goes to a separate file, and is
10212in addition to the usual results of compilation.
10213
bedc7537 10214The value of @env{DEPENDENCIES_OUTPUT} can be just a file name, in
74291a4b
MM
10215which case the Make rules are written to that file, guessing the target
10216name from the source file name. Or the value can have the form
10217@samp{@var{file} @var{target}}, in which case the rules are written to
10218file @var{file} using @var{target} as the target name.
56f48ce9
DB
10219
10220@item LANG
10221@findex LANG
10222@cindex locale definition
767094dd 10223This variable is used to pass locale information to the compiler. One way in
56f48ce9
DB
10224which this information is used is to determine the character set to be used
10225when character literals, string literals and comments are parsed in C and C++.
10226When the compiler is configured to allow multibyte characters,
bedc7537 10227the following values for @env{LANG} are recognized:
56f48ce9 10228
2642624b 10229@table @samp
56f48ce9
DB
10230@item C-JIS
10231Recognize JIS characters.
10232@item C-SJIS
10233Recognize SJIS characters.
10234@item C-EUCJP
10235Recognize EUCJP characters.
10236@end table
10237
bedc7537 10238If @env{LANG} is not defined, or if it has some other value, then the
56f48ce9
DB
10239compiler will use mblen and mbtowc as defined by the default locale to
10240recognize and translate multibyte characters.
74291a4b
MM
10241@end table
10242
9d86bffc
JM
10243@c man end
10244
74291a4b
MM
10245@node Running Protoize
10246@section Running Protoize
10247
161d7b59 10248The program @code{protoize} is an optional part of GCC@. You can use
c1030c7c 10249it to add prototypes to a program, thus converting the program to ISO
74291a4b
MM
10250C in one respect. The companion program @code{unprotoize} does the
10251reverse: it removes argument types from any prototypes that are found.
10252
10253When you run these programs, you must specify a set of source files as
10254command line arguments. The conversion programs start out by compiling
10255these files to see what functions they define. The information gathered
10256about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
10257
10258After scanning comes actual conversion. The specified files are all
10259eligible to be converted; any files they include (whether sources or
10260just headers) are eligible as well.
10261
10262But not all the eligible files are converted. By default,
10263@code{protoize} and @code{unprotoize} convert only source and header
10264files in the current directory. You can specify additional directories
630d3d5a 10265whose files should be converted with the @option{-d @var{directory}}
74291a4b 10266option. You can also specify particular files to exclude with the
630d3d5a 10267@option{-x @var{file}} option. A file is converted if it is eligible, its
74291a4b
MM
10268directory name matches one of the specified directory names, and its
10269name within the directory has not been excluded.
10270
10271Basic conversion with @code{protoize} consists of rewriting most
10272function definitions and function declarations to specify the types of
10273the arguments. The only ones not rewritten are those for varargs
10274functions.
10275
10276@code{protoize} optionally inserts prototype declarations at the
10277beginning of the source file, to make them available for any calls that
10278precede the function's definition. Or it can insert prototype
10279declarations with block scope in the blocks where undeclared functions
10280are called.
10281
10282Basic conversion with @code{unprotoize} consists of rewriting most
10283function declarations to remove any argument types, and rewriting
c1030c7c 10284function definitions to the old-style pre-ISO form.
74291a4b
MM
10285
10286Both conversion programs print a warning for any function declaration or
10287definition that they can't convert. You can suppress these warnings
630d3d5a 10288with @option{-q}.
74291a4b
MM
10289
10290The output from @code{protoize} or @code{unprotoize} replaces the
10291original source file. The original file is renamed to a name ending
02f52e19 10292with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
a7db8bbb
MK
10293without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav}
10294for DOS) file already exists, then the source file is simply discarded.
74291a4b 10295
0c2d1a2a 10296@code{protoize} and @code{unprotoize} both depend on GCC itself to
74291a4b 10297scan the program and collect information about the functions it uses.
0c2d1a2a 10298So neither of these programs will work until GCC is installed.
74291a4b
MM
10299
10300Here is a table of the options you can use with @code{protoize} and
10301@code{unprotoize}. Each option works with both programs unless
10302otherwise stated.
10303
10304@table @code
10305@item -B @var{directory}
10306Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
10307usual directory (normally @file{/usr/local/lib}). This file contains
10308prototype information about standard system functions. This option
10309applies only to @code{protoize}.
10310
10311@item -c @var{compilation-options}
10312Use @var{compilation-options} as the options when running @code{gcc} to
630d3d5a 10313produce the @samp{.X} files. The special option @option{-aux-info} is
74291a4b
MM
10314always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
10315
10316Note that the compilation options must be given as a single argument to
10317@code{protoize} or @code{unprotoize}. If you want to specify several
10318@code{gcc} options, you must quote the entire set of compilation options
10319to make them a single word in the shell.
10320
10321There are certain @code{gcc} arguments that you cannot use, because they
630d3d5a
JM
10322would produce the wrong kind of output. These include @option{-g},
10323@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
74291a4b
MM
10324the @var{compilation-options}, they are ignored.
10325
10326@item -C
a7db8bbb 10327Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
02f52e19 10328systems) instead of @samp{.c}. This is convenient if you are converting
ee77eda5 10329a C program to C++. This option applies only to @code{protoize}.
74291a4b
MM
10330
10331@item -g
10332Add explicit global declarations. This means inserting explicit
10333declarations at the beginning of each source file for each function
10334that is called in the file and was not declared. These declarations
10335precede the first function definition that contains a call to an
10336undeclared function. This option applies only to @code{protoize}.
10337
10338@item -i @var{string}
10339Indent old-style parameter declarations with the string @var{string}.
10340This option applies only to @code{protoize}.
10341
10342@code{unprotoize} converts prototyped function definitions to old-style
10343function definitions, where the arguments are declared between the
10344argument list and the initial @samp{@{}. By default, @code{unprotoize}
10345uses five spaces as the indentation. If you want to indent with just
630d3d5a 10346one space instead, use @option{-i " "}.
74291a4b
MM
10347
10348@item -k
10349Keep the @samp{.X} files. Normally, they are deleted after conversion
10350is finished.
10351
10352@item -l
630d3d5a 10353Add explicit local declarations. @code{protoize} with @option{-l} inserts
74291a4b
MM
10354a prototype declaration for each function in each block which calls the
10355function without any declaration. This option applies only to
10356@code{protoize}.
10357
10358@item -n
10359Make no real changes. This mode just prints information about the conversions
630d3d5a 10360that would have been done without @option{-n}.
74291a4b
MM
10361
10362@item -N
10363Make no @samp{.save} files. The original files are simply deleted.
10364Use this option with caution.
10365
10366@item -p @var{program}
10367Use the program @var{program} as the compiler. Normally, the name
10368@file{gcc} is used.
10369
10370@item -q
10371Work quietly. Most warnings are suppressed.
10372
10373@item -v
630d3d5a 10374Print the version number, just like @option{-v} for @code{gcc}.
74291a4b
MM
10375@end table
10376
10377If you need special compiler options to compile one of your program's
10378source files, then you should generate that file's @samp{.X} file
10379specially, by running @code{gcc} on that source file with the
630d3d5a 10380appropriate options and the option @option{-aux-info}. Then run
74291a4b
MM
10381@code{protoize} on the entire set of files. @code{protoize} will use
10382the existing @samp{.X} file because it is newer than the source file.
10383For example:
10384
10385@example
b1018de6 10386gcc -Dfoo=bar file1.c -aux-info file1.X
74291a4b
MM
10387protoize *.c
10388@end example
10389
10390@noindent
10391You need to include the special files along with the rest in the
10392@code{protoize} command, even though their @samp{.X} files already
10393exist, because otherwise they won't get converted.
10394
10395@xref{Protoize Caveats}, for more information on how to use
10396@code{protoize} successfully.
This page took 2.965832 seconds and 5 git commands to generate.