]> gcc.gnu.org Git - gcc.git/blame - gcc/doc/invoke.texi
* i386.md (minsf splitter): Fix pasto.
[gcc.git] / gcc / doc / invoke.texi
CommitLineData
d0a5eb32 1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4dd57c18 2@c 2000, 2001, 2002 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,
4dd57c18 91998, 1999, 2000, 2001, 2002 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
24dbb440
GP
56See the Info entry for @command{gcc}, or
57@w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
58for contributors to GCC@.
2642624b 59@c man end
9d86bffc
JM
60@end ignore
61
74291a4b 62@node Invoking GCC
0c2d1a2a
JB
63@chapter GCC Command Options
64@cindex GCC command options
74291a4b 65@cindex command options
0c2d1a2a 66@cindex options, GCC command
74291a4b 67
9d86bffc
JM
68@c man begin DESCRIPTION
69
0c2d1a2a 70When you invoke GCC, it normally does preprocessing, compilation,
74291a4b 71assembly and linking. The ``overall options'' allow you to stop this
630d3d5a 72process at an intermediate stage. For example, the @option{-c} option
74291a4b
MM
73says not to run the linker. Then the output consists of object files
74output by the assembler.
75
76Other options are passed on to one stage of processing. Some options
77control the preprocessor and others the compiler itself. Yet other
78options control the assembler and linker; most of these are not
79documented here, since you rarely need to use any of them.
80
81@cindex C compilation options
0c2d1a2a 82Most of the command line options that you can use with GCC are useful
74291a4b
MM
83for C programs; when an option is only useful with another language
84(usually C++), the explanation says so explicitly. If the description
85for a particular option does not mention a source language, you can use
86that option with all supported languages.
87
88@cindex C++ compilation options
89@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
90options for compiling C++ programs.
91
92@cindex grouping options
93@cindex options, grouping
bedc7537 94The @command{gcc} program accepts options and file names as operands. Many
b192711e 95options have multi-letter names; therefore multiple single-letter options
630d3d5a 96may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
74291a4b
MM
97-r}}.
98
99@cindex order of options
100@cindex options, order
101You can mix options and other arguments. For the most part, the order
102you use doesn't matter. Order does matter when you use several options
630d3d5a 103of the same kind; for example, if you specify @option{-L} more than once,
74291a4b
MM
104the directories are searched in the order specified.
105
106Many options have long names starting with @samp{-f} or with
630d3d5a
JM
107@samp{-W}---for example, @option{-fforce-mem},
108@option{-fstrength-reduce}, @option{-Wformat} and so on. Most of
74291a4b 109these have both positive and negative forms; the negative form of
630d3d5a 110@option{-ffoo} would be @option{-fno-foo}. This manual documents
74291a4b
MM
111only one of these two forms, whichever one is not the default.
112
9d86bffc
JM
113@c man end
114
cd3bb277
JM
115@xref{Option Index}, for an index to GCC's options.
116
74291a4b
MM
117@menu
118* Option Summary:: Brief list of all options, without explanations.
119* Overall Options:: Controlling the kind of output:
120 an executable, object files, assembler files,
121 or preprocessed source.
122* Invoking G++:: Compiling C++ programs.
123* C Dialect Options:: Controlling the variant of C language compiled.
124* C++ Dialect Options:: Variations on C++.
60de6385 125* Objective-C Dialect Options:: Variations on Objective-C.
764dbbf2 126* Language Independent Options:: Controlling how diagnostics should be
02f52e19 127 formatted.
74291a4b
MM
128* Warning Options:: How picky should the compiler be?
129* Debugging Options:: Symbol tables, measurements, and debugging dumps.
130* Optimize Options:: How much optimization?
131* Preprocessor Options:: Controlling header files and macro definitions.
132 Also, getting dependency information for Make.
133* Assembler Options:: Passing options to the assembler.
134* Link Options:: Specifying libraries and so on.
135* Directory Options:: Where to find header files and libraries.
136 Where to find the compiler executable files.
a743d340 137* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 138* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
139* Submodel Options:: Specifying minor hardware or convention variations,
140 such as 68010 vs 68020.
141* Code Gen Options:: Specifying conventions for function calls, data layout
142 and register usage.
0c2d1a2a 143* Environment Variables:: Env vars that affect GCC.
74291a4b
MM
144* Running Protoize:: Automatically adding or removing function prototypes.
145@end menu
146
4bc1997b
JM
147@c man begin OPTIONS
148
74291a4b
MM
149@node Option Summary
150@section Option Summary
151
152Here is a summary of all the options, grouped by type. Explanations are
153in the following sections.
154
155@table @emph
156@item Overall Options
157@xref{Overall Options,,Options Controlling the Kind of Output}.
4bc1997b
JM
158@gccoptlist{
159-c -S -E -o @var{file} -pipe -pass-exit-codes -x @var{language} @gol
160-v --target-help --help}
74291a4b
MM
161
162@item C Language Options
163@xref{C Dialect Options,,Options Controlling C Dialect}.
4bc1997b 164@gccoptlist{
b1018de6 165-ansi -std=@var{standard} -aux-info @var{filename} @gol
7d14c755 166-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
4bc1997b
JM
167-fhosted -ffreestanding @gol
168-trigraphs -traditional -traditional-cpp @gol
169-fallow-single-precision -fcond-mismatch @gol
170-fsigned-bitfields -fsigned-char @gol
171-funsigned-bitfields -funsigned-char @gol
172-fwritable-strings -fshort-wchar}
74291a4b
MM
173
174@item C++ Language Options
175@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
4bc1997b
JM
176@gccoptlist{
177-fno-access-control -fcheck-new -fconserve-space @gol
aa0cc562
JM
178-fno-const-strings -fdollars-in-identifiers @gol
179-fno-elide-constructors @gol
4bc1997b
JM
180-fno-enforce-eh-specs -fexternal-templates @gol
181-falt-external-templates @gol
1dbb6023 182-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
90ecce3e 183-fno-implicit-templates @gol
4bc1997b
JM
184-fno-implicit-inline-templates @gol
185-fno-implement-inlines -fms-extensions @gol
aa0cc562 186-fno-nonansi-builtins -fno-operator-names @gol
4bc1997b 187-fno-optional-diags -fpermissive @gol
aa0cc562 188-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
90ecce3e 189-fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol
4bc1997b
JM
190-fno-default-inline -Wctor-dtor-privacy @gol
191-Wnon-virtual-dtor -Wreorder @gol
192-Weffc++ -Wno-deprecated @gol
193-Wno-non-template-friend -Wold-style-cast @gol
194-Woverloaded-virtual -Wno-pmf-conversions @gol
195-Wsign-promo -Wsynth}
74291a4b 196
60de6385
SS
197@item Objective-C Language Options
198@xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
199@gccoptlist{
630d3d5a 200-fconstant-string-class=@var{class-name} @gol
310668e8 201-fgnu-runtime -fnext-runtime -gen-decls @gol
60de6385
SS
202-Wno-protocol -Wselector}
203
764dbbf2
GDR
204@item Language Independent Options
205@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
4bc1997b
JM
206@gccoptlist{
207-fmessage-length=@var{n} @gol
208-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
764dbbf2 209
74291a4b
MM
210@item Warning Options
211@xref{Warning Options,,Options to Request or Suppress Warnings}.
4bc1997b
JM
212@gccoptlist{
213-fsyntax-only -pedantic -pedantic-errors @gol
214-w -W -Wall -Waggregate-return @gol
215-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol
e23bd218
IR
216-Wconversion -Wno-deprecated-declarations @gol
217-Wdisabled-optimization -Wdiv-by-zero -Werror @gol
4bc1997b 218-Wfloat-equal -Wformat -Wformat=2 @gol
feb48bde
JM
219-Wformat-nonliteral -Wformat-security @gol
220-Wimplicit -Wimplicit-int @gol
4bc1997b
JM
221-Wimplicit-function-declaration @gol
222-Werror-implicit-function-declaration @gol
223-Wimport -Winline @gol
224-Wlarger-than-@var{len} -Wlong-long @gol
1f0c3120 225-Wmain -Wmissing-braces -Wmissing-declarations @gol
4bc1997b 226-Wmissing-format-attribute -Wmissing-noreturn @gol
feb48bde 227-Wmultichar -Wno-format-extra-args -Wno-format-y2k @gol
4bc1997b 228-Wno-import -Wpacked -Wpadded @gol
310668e8 229-Wparentheses -Wpointer-arith -Wredundant-decls @gol
4bc1997b
JM
230-Wreturn-type -Wsequence-point -Wshadow @gol
231-Wsign-compare -Wswitch -Wsystem-headers @gol
232-Wtrigraphs -Wundef -Wuninitialized @gol
233-Wunknown-pragmas -Wunreachable-code @gol
234-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
235-Wunused-value -Wunused-variable -Wwrite-strings}
74291a4b 236
fe50c0eb 237@item C-only Warning Options
4bc1997b 238@gccoptlist{
310668e8
JM
239-Wbad-function-cast -Wmissing-prototypes -Wnested-externs @gol
240-Wstrict-prototypes -Wtraditional}
fe50c0eb 241
74291a4b
MM
242@item Debugging Options
243@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
4bc1997b 244@gccoptlist{
8456b95a 245-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
92989aed 246-fdump-unnumbered
aee96fe9 247-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
22367161
NS
248-fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
249-fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
e76b4820 250-fmem-report -fpretend-float @gol
1f0c3120 251-fprofile-arcs -ftest-coverage -ftime-report @gol
4bc1997b 252-g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol
5f98259a 253-ggdb -gstabs -gstabs+ -gvms -gxcoff -gxcoff+ @gol
4bc1997b 254-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
b1018de6 255-print-multi-directory -print-multi-lib @gol
4bc1997b
JM
256-print-prog-name=@var{program} -print-search-dirs -Q @gol
257-save-temps -time}
74291a4b
MM
258
259@item Optimization Options
260@xref{Optimize Options,,Options that Control Optimization}.
4bc1997b
JM
261@gccoptlist{
262-falign-functions=@var{n} -falign-jumps=@var{n} @gol
263-falign-labels=@var{n} -falign-loops=@var{n} @gol
8582c27b 264-fbranch-probabilities -fcaller-saves -fcprop-registers @gol
62d285ff 265-fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol
4bc1997b
JM
266-fdelayed-branch -fdelete-null-pointer-checks @gol
267-fexpensive-optimizations -ffast-math -ffloat-store @gol
feb48bde
JM
268-fforce-addr -fforce-mem -ffunction-sections @gol
269-fgcse -fgcse-lm -fgcse-sm @gol
4bc1997b 270-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol
201556f0
JJ
271-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
272-fmove-all-movables -fno-default-inline -fno-defer-pop @gol
feb48bde 273-fno-function-cse -fno-guess-branch-probability @gol
6cfc0341 274-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
de6c5979 275-funsafe-math-optimizations -fno-trapping-math @gol
4bc1997b 276-fomit-frame-pointer -foptimize-register-move @gol
5d22c1a5
JM
277-foptimize-sibling-calls -fprefetch-loop-arrays @gol
278-freduce-all-givs -fregmove -frename-registers @gol
4bc1997b
JM
279-frerun-cse-after-loop -frerun-loop-opt @gol
280-fschedule-insns -fschedule-insns2 @gol
0b47e4c1 281-fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol
4bc1997b 282-fstrength-reduce -fstrict-aliasing -fthread-jumps -ftrapv @gol
86be733d 283-funroll-all-loops -funroll-loops @gol
3af64fd6 284--param @var{name}=@var{value}
4bc1997b 285-O -O0 -O1 -O2 -O3 -Os}
74291a4b
MM
286
287@item Preprocessor Options
288@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
4bc1997b
JM
289@gccoptlist{
290-$ -A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol
291-C -dD -dI -dM -dN @gol
292-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
293-idirafter @var{dir} @gol
294-include @var{file} -imacros @var{file} @gol
295-iprefix @var{file} -iwithprefix @var{dir} @gol
bdd42dd9 296-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
4bc1997b 297-M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol
aee96fe9 298-trigraphs -undef -U@var{macro} -Wp,@var{option}}
74291a4b
MM
299
300@item Assembler Option
301@xref{Assembler Options,,Passing Options to the Assembler}.
4bc1997b 302@gccoptlist{
aee96fe9 303-Wa,@var{option}}
74291a4b
MM
304
305@item Linker Options
306@xref{Link Options,,Options for Linking}.
4bc1997b
JM
307@gccoptlist{
308@var{object-file-name} -l@var{library} @gol
309-nostartfiles -nodefaultlibs -nostdlib @gol
310-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
aee96fe9 311-Wl,@var{option} -Xlinker @var{option} @gol
4bc1997b 312-u @var{symbol}}
74291a4b
MM
313
314@item Directory Options
315@xref{Directory Options,,Options for Directory Search}.
4bc1997b
JM
316@gccoptlist{
317-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}}
74291a4b
MM
318
319@item Target Options
320@c I wrote this xref this way to avoid overfull hbox. -- rms
321@xref{Target Options}.
4bc1997b
JM
322@gccoptlist{
323-b @var{machine} -V @var{version}}
74291a4b
MM
324
325@item Machine Dependent Options
326@xref{Submodel Options,,Hardware Models and Configurations}.
5d22c1a5 327
74291a4b 328@emph{M680x0 Options}
4bc1997b
JM
329@gccoptlist{
330-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
feb48bde 331-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol
310668e8
JM
332-mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol
333-malign-int -mstrict-align}
74291a4b 334
2856c3e3 335@emph{M68hc1x Options}
4bc1997b
JM
336@gccoptlist{
337-m6811 -m6812 -m68hc11 -m68hc12 @gol
338-mauto-incdec -mshort -msoft-reg-count=@var{count}}
2856c3e3 339
74291a4b 340@emph{VAX Options}
4bc1997b
JM
341@gccoptlist{
342-mg -mgnu -munix}
74291a4b
MM
343
344@emph{SPARC Options}
4bc1997b 345@gccoptlist{
630d3d5a
JM
346-mcpu=@var{cpu-type} @gol
347-mtune=@var{cpu-type} @gol
348-mcmodel=@var{code-model} @gol
4bc1997b
JM
349-m32 -m64 @gol
350-mapp-regs -mbroken-saverestore -mcypress @gol
feb48bde 351-mepilogue -mfaster-structs -mflat @gol
4bc1997b
JM
352-mfpu -mhard-float -mhard-quad-float @gol
353-mimpure-text -mlive-g0 -mno-app-regs @gol
310668e8
JM
354-mno-epilogue -mno-faster-structs -mno-flat -mno-fpu @gol
355-mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol
4bc1997b
JM
356-msoft-float -msoft-quad-float -msparclite -mstack-bias @gol
357-msupersparc -munaligned-doubles -mv8}
74291a4b
MM
358
359@emph{Convex Options}
4bc1997b
JM
360@gccoptlist{
361-mc1 -mc2 -mc32 -mc34 -mc38 @gol
362-margcount -mnoargcount @gol
363-mlong32 -mlong64 @gol
364-mvolatile-cache -mvolatile-nocache}
74291a4b
MM
365
366@emph{AMD29K Options}
4bc1997b
JM
367@gccoptlist{
368-m29000 -m29050 -mbw -mnbw -mdw -mndw @gol
369-mlarge -mnormal -msmall @gol
370-mkernel-registers -mno-reuse-arg-regs @gol
371-mno-stack-check -mno-storem-bug @gol
372-mreuse-arg-regs -msoft-float -mstack-check @gol
373-mstorem-bug -muser-registers}
74291a4b
MM
374
375@emph{ARM Options}
4bc1997b 376@gccoptlist{
310668e8
JM
377-mapcs-frame -mno-apcs-frame @gol
378-mapcs-26 -mapcs-32 @gol
379-mapcs-stack-check -mno-apcs-stack-check @gol
380-mapcs-float -mno-apcs-float @gol
381-mapcs-reentrant -mno-apcs-reentrant @gol
382-msched-prolog -mno-sched-prolog @gol
383-mlittle-endian -mbig-endian -mwords-little-endian @gol
384-malignment-traps -mno-alignment-traps @gol
385-msoft-float -mhard-float -mfpe @gol
386-mthumb-interwork -mno-thumb-interwork @gol
387-mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol
247f8561 388-mstructure-size-boundary=@var{n} @gol
310668e8 389-mbsd -mxopen -mno-symrename @gol
4bc1997b 390-mabort-on-noreturn @gol
310668e8
JM
391-mlong-calls -mno-long-calls @gol
392-msingle-pic-base -mno-single-pic-base @gol
247f8561
PB
393-mpic-register=@var{reg} @gol
394-mnop-fun-dllimport @gol
395-mpoke-function-name @gol
310668e8
JM
396-mthumb -marm @gol
397-mtpcs-frame -mtpcs-leaf-frame @gol
398-mcaller-super-interworking -mcallee-super-interworking }
74291a4b 399
ecff22ab 400@emph{MN10200 Options}
4bc1997b
JM
401@gccoptlist{
402-mrelax}
ecff22ab 403
6d6d0fa0 404@emph{MN10300 Options}
4bc1997b 405@gccoptlist{
c474f76b
AO
406-mmult-bug -mno-mult-bug @gol
407-mam33 -mno-am33 @gol
408-mno-crt0 -mrelax}
6d6d0fa0 409
861bb6c1 410@emph{M32R/D Options}
4bc1997b 411@gccoptlist{
98180123 412-m32rx -m32r -mcode-model=@var{model-type} -msdata=@var{sdata-type} @gol
4bc1997b 413-G @var{num}}
861bb6c1 414
74291a4b 415@emph{M88K Options}
4bc1997b
JM
416@gccoptlist{
417-m88000 -m88100 -m88110 -mbig-pic @gol
418-mcheck-zero-division -mhandle-large-shift @gol
419-midentify-revision -mno-check-zero-division @gol
420-mno-ocs-debug-info -mno-ocs-frame-position @gol
421-mno-optimize-arg-area -mno-serialize-volatile @gol
422-mno-underscores -mocs-debug-info @gol
423-mocs-frame-position -moptimize-arg-area @gol
424-mserialize-volatile -mshort-data-@var{num} -msvr3 @gol
425-msvr4 -mtrap-large-shift -muse-div-instruction @gol
426-mversion-03.00 -mwarn-passed-structs}
74291a4b
MM
427
428@emph{RS/6000 and PowerPC Options}
4bc1997b 429@gccoptlist{
630d3d5a
JM
430-mcpu=@var{cpu-type} @gol
431-mtune=@var{cpu-type} @gol
4bc1997b
JM
432-mpower -mno-power -mpower2 -mno-power2 @gol
433-mpowerpc -mpowerpc64 -mno-powerpc @gol
0ac081f6 434-maltivec -mno-altivec @gol
4bc1997b
JM
435-mpowerpc-gpopt -mno-powerpc-gpopt @gol
436-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
437-mnew-mnemonics -mold-mnemonics @gol
438-mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc @gol
0a379b7a 439-m64 -m32 -mxl-call -mno-xl-call -mpe @gol
4bc1997b
JM
440-msoft-float -mhard-float -mmultiple -mno-multiple @gol
441-mstring -mno-string -mupdate -mno-update @gol
442-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
443-mstrict-align -mno-strict-align -mrelocatable @gol
444-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
445-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
9c34dbbf 446-mcall-aix -mcall-sysv -mcall-netbsd @gol
9904592e 447-maix-struct-return -msvr4-struct-return
0ac081f6 448-mabi=altivec @gol
9c34dbbf 449-mprototype -mno-prototype @gol
4bc1997b 450-msim -mmvme -mads -myellowknife -memb -msdata @gol
0a379b7a 451-msdata=@var{opt} -mvxworks -G @var{num} -pthread}
74291a4b
MM
452
453@emph{RT Options}
4bc1997b
JM
454@gccoptlist{
455-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol
456-mfull-fp-blocks -mhc-struct-return -min-line-mul @gol
457-mminimum-fp-blocks -mnohc-struct-return}
74291a4b
MM
458
459@emph{MIPS Options}
4bc1997b 460@gccoptlist{
7dac2f89
EC
461-mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol
462-mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol
13fac94a
GK
463-membedded-pic -mfp32 -mfp64 -mfused-madd -mno-fused-madd @gol
464-mgas -mgp32 -mgp64 @gol
4bc1997b 465-mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol
feb48bde 466-mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol
4bc1997b 467-mmips-as -mmips-tfile -mno-abicalls @gol
feb48bde
JM
468-mno-embedded-data -mno-uninit-const-in-rodata @gol
469-mno-embedded-pic -mno-gpopt -mno-long-calls @gol
4bc1997b
JM
470-mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol
471-mrnames -msoft-float @gol
472-m4650 -msingle-float -mmad @gol
473-mstats -EL -EB -G @var{num} -nocpp @gol
feb48bde 474-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol
d490e8ad 475-mfix7000 -mno-crt0 -mflush-func=@var{func} -mno-flush-func}
74291a4b 476
14f73b5a 477@emph{i386 and x86-64 Options}
4bc1997b 478@gccoptlist{
965f5423 479-mcpu=@var{cpu-type} -march=@var{cpu-type} -mfpmath=@var{unit} @gol
c93e80a5 480-masm=@var{dialect} -mno-fancy-math-387 @gol
4bc1997b
JM
481-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol
482-mno-wide-multiply -mrtd -malign-double @gol
3e18fdf6 483-mpreferred-stack-boundary=@var{num} @gol
965f5423 484-mmmx -msse -msse2 -msse-math -m3dnow @gol
feb48bde
JM
485-mthreads -mno-align-stringops -minline-all-stringops @gol
486-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
14f73b5a
JH
487-m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer @gol
488-mno-red-zone@gol
489-m32 -m64}
74291a4b
MM
490
491@emph{HPPA Options}
4bc1997b 492@gccoptlist{
630d3d5a 493-march=@var{architecture-type} @gol
feb48bde
JM
494-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
495-mfast-indirect-calls -mgas -mjump-in-delay @gol
4bc1997b
JM
496-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
497-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
feb48bde 498-mno-jump-in-delay -mno-long-load-store @gol
4bc1997b 499-mno-portable-runtime -mno-soft-float @gol
feb48bde
JM
500-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
501-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
630d3d5a 502-mschedule=@var{cpu-type} -mspace-regs}
74291a4b
MM
503
504@emph{Intel 960 Options}
4bc1997b 505@gccoptlist{
630d3d5a 506-m@var{cpu-type} -masm-compat -mclean-linkage @gol
4bc1997b
JM
507-mcode-align -mcomplex-addr -mleaf-procedures @gol
508-mic-compat -mic2.0-compat -mic3.0-compat @gol
509-mintel-asm -mno-clean-linkage -mno-code-align @gol
510-mno-complex-addr -mno-leaf-procedures @gol
511-mno-old-align -mno-strict-align -mno-tail-call @gol
512-mnumerics -mold-align -msoft-float -mstrict-align @gol
513-mtail-call}
74291a4b
MM
514
515@emph{DEC Alpha Options}
4bc1997b 516@gccoptlist{
58605ba0 517-mno-fp-regs -msoft-float -malpha-as -mgas @gol
4bc1997b
JM
518-mieee -mieee-with-inexact -mieee-conformant @gol
519-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
520-mtrap-precision=@var{mode} -mbuild-constants @gol
58605ba0
RH
521-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
522-mbwx -mmax -mfix -mcix @gol
523-mfloat-vax -mfloat-ieee @gol
524-mexplicit-relocs -msmall-data -mlarge-data @gol
4bc1997b 525-mmemory-latency=@var{time}}
74291a4b 526
d7c23cdc
DR
527@emph{DEC Alpha/VMS Options}
528@gccoptlist{
529-mvms-return-codes}
530
74291a4b 531@emph{Clipper Options}
4bc1997b
JM
532@gccoptlist{
533-mc300 -mc400}
74291a4b
MM
534
535@emph{H8/300 Options}
4bc1997b 536@gccoptlist{
310668e8 537-mrelax -mh -ms -mint32 -malign-300}
74291a4b
MM
538
539@emph{SH Options}
4bc1997b
JM
540@gccoptlist{
541-m1 -m2 -m3 -m3e @gol
542-m4-nofpu -m4-single-only -m4-single -m4 @gol
543-mb -ml -mdalign -mrelax @gol
544-mbigtable -mfmovd -mhitachi -mnomacsave @gol
c474f76b
AO
545-mieee -misize -mpadstruct -mspace @gol
546-mprefergot -musermode}
74291a4b
MM
547
548@emph{System V Options}
4bc1997b 549@gccoptlist{
aee96fe9 550-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
74291a4b 551
56b2d7a7 552@emph{ARC Options}
4bc1997b
JM
553@gccoptlist{
554-EB -EL @gol
630d3d5a
JM
555-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
556-mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
56b2d7a7 557
282a61e6 558@emph{TMS320C3x/C4x Options}
4bc1997b 559@gccoptlist{
310668e8
JM
560-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol
561-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol
562-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol
563-mparallel-insns -mparallel-mpy -mpreserve-float}
282a61e6 564
f84271d9 565@emph{V850 Options}
4bc1997b 566@gccoptlist{
310668e8
JM
567-mlong-calls -mno-long-calls -mep -mno-ep @gol
568-mprolog-function -mno-prolog-function -mspace @gol
569-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
570-mv850 -mbig-switch}
83575957
ID
571
572@emph{NS32K Options}
4bc1997b 573@gccoptlist{
310668e8 574-m32032 -m32332 -m32532 -m32081 -m32381 @gol
feb48bde 575-mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol
310668e8
JM
576-mregparam -mnoregparam -msb -mnosb @gol
577-mbitfield -mnobitfield -mhimem -mnohimem}
789a3090 578
052a4b28 579@emph{AVR Options}
4bc1997b 580@gccoptlist{
310668e8
JM
581-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
582-mcall-prologues -mno-tablejump -mtiny-stack}
052a4b28 583
789a3090 584@emph{MCore Options}
4bc1997b 585@gccoptlist{
feb48bde 586-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
310668e8
JM
587-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
588-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
589-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
590-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
f84271d9 591
bcf684c7
HPN
592@emph{MMIX Options}
593@gccoptlist{
594-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
595-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
3e0f61ac
HPN
596-melf -mbranch-predict -mreg-stack-fill-bug-workaround @gol
597-mno-branch-predict -mno-reg-stack-fill-bug-workaround}
bcf684c7 598
df6194d4
JW
599@emph{IA-64 Options}
600@gccoptlist{
310668e8
JM
601-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
602-mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol
603-mconstant-gp -mauto-pic -minline-divide-min-latency @gol
604-minline-divide-max-throughput -mno-dwarf2-asm @gol
630d3d5a 605-mfixed-range=@var{register-range}}
df6194d4 606
5d22c1a5
JM
607@emph{D30V Options}
608@gccoptlist{
609-mextmem -mextmemory -monchip -mno-asm-optimize -masm-optimize @gol
610-mbranch-cost=@var{n} -mcond-exec=@var{n}}
611
91abf72d
HP
612@emph{S/390 and zSeries Options}
613@gccoptlist{
614-mhard-float -msoft-float -mbackchain -mno-backchain @gol
615-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
616-m64 -m31 -mdebug -mno-debug}
617
0b85d816
HPN
618@emph{CRIS Options}
619@gccoptlist{
620-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
621-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
622-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
623-mstack-align -mdata-align -mconst-align @gol
624-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
625-melf -maout -melinux -mlinux -sim -sim2}
626
9f85bca7
JM
627@emph{PDP-11 Options}
628@gccoptlist{
629-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
630-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
631-mint16 -mno-int32 -mfloat32 -mno-float64 @gol
632-mfloat64 -mno-float32 -mabshi -mno-abshi @gol
633-mbranch-expensive -mbranch-cheap @gol
634-msplit -mno-split -munix-asm -mdec-asm}
635
69a0611f
GK
636@emph{Xstormy16 Options}
637@gccoptlist{
638-msim}
639
74291a4b
MM
640@item Code Generation Options
641@xref{Code Gen Options,,Options for Code Generation Conventions}.
4bc1997b
JM
642@gccoptlist{
643-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
6cfc0341 644-ffixed-@var{reg} -fexceptions @gol
5d22c1a5
JM
645-fnon-call-exceptions -funwind-tables @gol
646-fasynchronous-unwind-tables @gol
4bc1997b 647-finhibit-size-directive -finstrument-functions @gol
4bc1997b
JM
648-fno-common -fno-ident -fno-gnu-linker @gol
649-fpcc-struct-return -fpic -fPIC @gol
650-freg-struct-return -fshared-data -fshort-enums @gol
310668e8
JM
651-fshort-double -fvolatile @gol
652-fvolatile-global -fvolatile-static @gol
4bc1997b
JM
653-fverbose-asm -fpack-struct -fstack-check @gol
654-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
655-fargument-alias -fargument-noalias @gol
310668e8 656-fargument-noalias-global -fleading-underscore}
74291a4b
MM
657@end table
658
659@menu
660* Overall Options:: Controlling the kind of output:
661 an executable, object files, assembler files,
662 or preprocessed source.
663* C Dialect Options:: Controlling the variant of C language compiled.
664* C++ Dialect Options:: Variations on C++.
60de6385 665* Objective-C Dialect Options:: Variations on Objective-C.
764dbbf2 666* Language Independent Options:: Controlling how diagnostics should be
02f52e19 667 formatted.
74291a4b
MM
668* Warning Options:: How picky should the compiler be?
669* Debugging Options:: Symbol tables, measurements, and debugging dumps.
670* Optimize Options:: How much optimization?
671* Preprocessor Options:: Controlling header files and macro definitions.
672 Also, getting dependency information for Make.
673* Assembler Options:: Passing options to the assembler.
674* Link Options:: Specifying libraries and so on.
675* Directory Options:: Where to find header files and libraries.
676 Where to find the compiler executable files.
a743d340 677* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 678* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
679@end menu
680
681@node Overall Options
682@section Options Controlling the Kind of Output
683
684Compilation can involve up to four stages: preprocessing, compilation
685proper, assembly and linking, always in that order. The first three
686stages apply to an individual source file, and end by producing an
687object file; linking combines all the object files (those newly
688compiled, and those specified as input) into an executable file.
689
690@cindex file name suffix
691For any given input file, the file name suffix determines what kind of
692compilation is done:
693
2642624b 694@table @gcctabopt
74291a4b
MM
695@item @var{file}.c
696C source code which must be preprocessed.
697
698@item @var{file}.i
699C source code which should not be preprocessed.
700
701@item @var{file}.ii
702C++ source code which should not be preprocessed.
703
704@item @var{file}.m
705Objective-C source code. Note that you must link with the library
706@file{libobjc.a} to make an Objective-C program work.
707
b9265ec1
JM
708@item @var{file}.mi
709Objective-C source code which should not be preprocessed.
710
74291a4b
MM
711@item @var{file}.h
712C header file (not to be compiled or linked).
713
714@item @var{file}.cc
b9265ec1 715@itemx @var{file}.cp
74291a4b
MM
716@itemx @var{file}.cxx
717@itemx @var{file}.cpp
b9265ec1 718@itemx @var{file}.c++
74291a4b
MM
719@itemx @var{file}.C
720C++ source code which must be preprocessed. Note that in @samp{.cxx},
721the last two letters must both be literally @samp{x}. Likewise,
161d7b59 722@samp{.C} refers to a literal capital C@.
74291a4b 723
b9265ec1
JM
724@item @var{file}.f
725@itemx @var{file}.for
726@itemx @var{file}.FOR
727Fortran source code which should not be preprocessed.
728
729@item @var{file}.F
730@itemx @var{file}.fpp
731@itemx @var{file}.FPP
732Fortran source code which must be preprocessed (with the traditional
733preprocessor).
734
735@item @var{file}.r
736Fortran source code which must be preprocessed with a RATFOR
161d7b59 737preprocessor (not included with GCC)@.
b9265ec1
JM
738
739@xref{Overall Options,,Options Controlling the Kind of Output, g77,
740Using and Porting GNU Fortran}, for more details of the handling of
741Fortran input files.
742
743@c FIXME: Descriptions of Java file types.
744@c @var{file}.java
745@c @var{file}.class
746@c @var{file}.zip
747@c @var{file}.jar
748
e23381df
GB
749@item @var{file}.ads
750Ada source code file which contains a library unit declaration (a
751declaration of a package, subprogram, or generic, or a generic
752instantiation), or a library unit renaming declaration (a package,
753generic, or subprogram renaming declaration). Such files are also
754called @dfn{specs}.
755
756@itemx @var{file}.adb
757Ada source code file containing a library unit body (a subprogram or
758package body). Such files are also called @dfn{bodies}.
759
b9265ec1 760@c GCC also knows about some suffixes for languages not yet included:
b9265ec1
JM
761@c Pascal:
762@c @var{file}.p
763@c @var{file}.pas
764
765@item @var{file}.ch
766@itemx @var{file}.chi
767CHILL source code (preprocessed with the traditional preprocessor).
768
74291a4b
MM
769@item @var{file}.s
770Assembler code.
771
772@item @var{file}.S
773Assembler code which must be preprocessed.
774
775@item @var{other}
776An object file to be fed straight into linking.
777Any file name with no recognized suffix is treated this way.
778@end table
779
cd3bb277 780@opindex x
630d3d5a 781You can specify the input language explicitly with the @option{-x} option:
74291a4b 782
2642624b 783@table @gcctabopt
74291a4b
MM
784@item -x @var{language}
785Specify explicitly the @var{language} for the following input files
786(rather than letting the compiler choose a default based on the file
787name suffix). This option applies to all following input files until
630d3d5a 788the next @option{-x} option. Possible values for @var{language} are:
74291a4b 789@example
b9265ec1
JM
790c c-header cpp-output
791c++ c++-cpp-output
792objective-c objc-cpp-output
74291a4b 793assembler assembler-with-cpp
e23381df
GB
794ada
795chill
b9265ec1 796f77 f77-cpp-input ratfor
e23381df 797java
74291a4b
MM
798@end example
799
800@item -x none
801Turn off any specification of a language, so that subsequent files are
630d3d5a 802handled according to their file name suffixes (as they are if @option{-x}
74291a4b 803has not been used at all).
14a774a9
RK
804
805@item -pass-exit-codes
cd3bb277 806@opindex pass-exit-codes
bedc7537 807Normally the @command{gcc} program will exit with the code of 1 if any
14a774a9 808phase of the compiler returns a non-success return code. If you specify
630d3d5a 809@option{-pass-exit-codes}, the @command{gcc} program will instead return with
14a774a9
RK
810numerically highest error produced by any phase that returned an error
811indication.
74291a4b
MM
812@end table
813
814If you only want some of the stages of compilation, you can use
630d3d5a
JM
815@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
816one of the options @option{-c}, @option{-S}, or @option{-E} to say where
bedc7537
NC
817@command{gcc} is to stop. Note that some combinations (for example,
818@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
74291a4b 819
2642624b 820@table @gcctabopt
74291a4b 821@item -c
cd3bb277 822@opindex c
74291a4b
MM
823Compile or assemble the source files, but do not link. The linking
824stage simply is not done. The ultimate output is in the form of an
825object file for each source file.
826
827By default, the object file name for a source file is made by replacing
828the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
829
830Unrecognized input files, not requiring compilation or assembly, are
831ignored.
832
833@item -S
cd3bb277 834@opindex S
74291a4b
MM
835Stop after the stage of compilation proper; do not assemble. The output
836is in the form of an assembler code file for each non-assembler input
837file specified.
838
839By default, the assembler file name for a source file is made by
840replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
841
842Input files that don't require compilation are ignored.
843
844@item -E
cd3bb277 845@opindex E
74291a4b
MM
846Stop after the preprocessing stage; do not run the compiler proper. The
847output is in the form of preprocessed source code, which is sent to the
848standard output.
849
850Input files which don't require preprocessing are ignored.
851
852@cindex output file option
853@item -o @var{file}
cd3bb277 854@opindex o
74291a4b
MM
855Place output in file @var{file}. This applies regardless to whatever
856sort of output is being produced, whether it be an executable file,
857an object file, an assembler file or preprocessed C code.
858
859Since only one output file can be specified, it does not make sense to
630d3d5a 860use @option{-o} when compiling more than one input file, unless you are
74291a4b
MM
861producing an executable file as output.
862
630d3d5a 863If @option{-o} is not specified, the default is to put an executable file
74291a4b
MM
864in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
865@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
bd819a4a 866all preprocessed C source on standard output.
74291a4b
MM
867
868@item -v
cd3bb277 869@opindex v
74291a4b
MM
870Print (on standard error output) the commands executed to run the stages
871of compilation. Also print the version number of the compiler driver
872program and of the preprocessor and the compiler proper.
873
874@item -pipe
cd3bb277 875@opindex pipe
74291a4b
MM
876Use pipes rather than temporary files for communication between the
877various stages of compilation. This fails to work on some systems where
878the assembler is unable to read from a pipe; but the GNU assembler has
879no trouble.
844642e6
NC
880
881@item --help
cd3bb277 882@opindex help
844642e6 883Print (on the standard output) a description of the command line options
bedc7537
NC
884understood by @command{gcc}. If the @option{-v} option is also specified
885then @option{--help} will also be passed on to the various processes
886invoked by @command{gcc}, so that they can display the command line options
887they accept. If the @option{-W} option is also specified then command
844642e6
NC
888line options which have no documentation associated with them will also
889be displayed.
10501d8f
CC
890
891@item --target-help
cd3bb277 892@opindex target-help
10501d8f
CC
893Print (on the standard output) a description of target specific command
894line options for each tool.
74291a4b
MM
895@end table
896
897@node Invoking G++
898@section Compiling C++ Programs
899
900@cindex suffixes for C++ source
901@cindex C++ source file suffixes
902C++ source files conventionally use one of the suffixes @samp{.C},
bba975d4 903@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
0c2d1a2a 904preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
bba975d4
JM
905files with these names and compiles them as C++ programs even if you
906call the compiler the same way as for compiling C programs (usually with
bedc7537 907the name @command{gcc}).
74291a4b
MM
908
909@findex g++
910@findex c++
911However, C++ programs often require class libraries as well as a
912compiler that understands the C++ language---and under some
913circumstances, you might want to compile programs from standard input,
914or otherwise without a suffix that flags them as C++ programs.
bedc7537 915@command{g++} is a program that calls GCC with the default language
e5e809f4 916set to C++, and automatically specifies linking against the C++
bedc7537
NC
917library. On many systems, @command{g++} is also
918installed with the name @command{c++}.
74291a4b 919
bedc7537 920@cindex invoking @command{g++}
74291a4b
MM
921When you compile C++ programs, you may specify many of the same
922command-line options that you use for compiling programs in any
923language; or command-line options meaningful for C and related
924languages; or options that are meaningful only for C++ programs.
925@xref{C Dialect Options,,Options Controlling C Dialect}, for
161d7b59 926explanations of options for languages related to C@.
74291a4b
MM
927@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
928explanations of options that are meaningful only for C++ programs.
929
930@node C Dialect Options
931@section Options Controlling C Dialect
932@cindex dialect options
933@cindex language dialect options
934@cindex options, dialect
935
936The following options control the dialect of C (or languages derived
2147b154 937from C, such as C++ and Objective-C) that the compiler accepts:
74291a4b 938
2642624b 939@table @gcctabopt
74291a4b 940@cindex ANSI support
c1030c7c 941@cindex ISO support
74291a4b 942@item -ansi
cd3bb277 943@opindex ansi
c1030c7c 944In C mode, support all ISO C89 programs. In C++ mode,
775afb25 945remove GNU extensions that conflict with ISO C++.
74291a4b 946
c1030c7c 947This turns off certain features of GCC that are incompatible with ISO
aee96fe9 948C89 (when compiling C code), or of standard C++ (when compiling C++ code),
0c2d1a2a 949such as the @code{asm} and @code{typeof} keywords, and
74291a4b
MM
950predefined macros such as @code{unix} and @code{vax} that identify the
951type of system you are using. It also enables the undesirable and
02f52e19 952rarely used ISO trigraph feature. For the C compiler,
0c2d1a2a 953it disables recognition of C++ style @samp{//} comments as well as
775afb25 954the @code{inline} keyword.
74291a4b
MM
955
956The alternate keywords @code{__asm__}, @code{__extension__},
957@code{__inline__} and @code{__typeof__} continue to work despite
630d3d5a 958@option{-ansi}. You would not want to use them in an ISO C program, of
74291a4b 959course, but it is useful to put them in header files that might be included
630d3d5a 960in compilations done with @option{-ansi}. Alternate predefined macros
74291a4b 961such as @code{__unix__} and @code{__vax__} are also available, with or
630d3d5a 962without @option{-ansi}.
74291a4b 963
630d3d5a
JM
964The @option{-ansi} option does not cause non-ISO programs to be
965rejected gratuitously. For that, @option{-pedantic} is required in
966addition to @option{-ansi}. @xref{Warning Options}.
74291a4b 967
630d3d5a 968The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
74291a4b
MM
969option is used. Some header files may notice this macro and refrain
970from declaring certain functions or defining certain macros that the
c1030c7c 971ISO standard doesn't call for; this is to avoid interfering with any
74291a4b
MM
972programs that might use these names for other things.
973
c771326b
JM
974Functions which would normally be built in but do not have semantics
975defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
630d3d5a 976functions with @option{-ansi} is used. @xref{Other Builtins,,Other
f0523f02 977built-in functions provided by GCC}, for details of the functions
01702459 978affected.
74291a4b 979
49419c8f 980@item -std=
cd3bb277 981@opindex std
aee96fe9
JM
982Determine the language standard. This option is currently only
983supported when compiling C@. A value for this option must be provided;
02f52e19 984possible values are
3932261a 985
ee457005 986@table @samp
aee96fe9
JM
987@item c89
988@itemx iso9899:1990
989ISO C89 (same as @option{-ansi}).
3043b30e
ML
990
991@item iso9899:199409
aee96fe9 992ISO C89 as modified in amendment 1.
3043b30e 993
49419c8f 994@item c99
aee96fe9
JM
995@itemx c9x
996@itemx iso9899:1999
997@itemx iso9899:199x
998ISO C99. Note that this standard is not yet fully supported; see
999@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1000names @samp{c9x} and @samp{iso9899:199x} are deprecated.
3043b30e
ML
1001
1002@item gnu89
aee96fe9 1003Default, ISO C89 plus GNU extensions (including some C99 features).
3043b30e 1004
49419c8f 1005@item gnu99
7dac2f89 1006@item gnu9x
d15a05b3
EC
1007ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
1008this will become the default. The name @samp{gnu9x} is deprecated.
49419c8f 1009
ee457005 1010@end table
3043b30e
ML
1011
1012Even when this option is not specified, you can still use some of the
1013features of newer standards in so far as they do not conflict with
1014previous C standards. For example, you may use @code{__restrict__} even
bedc7537 1015when @option{-std=c99} is not specified.
3932261a 1016
5490d604
JM
1017The @option{-std} options specifying some version of ISO C have the same
1018effects as @option{-ansi}, except that features that were not in ISO C89
1019but are in the specified version (for example, @samp{//} comments and
1020the @code{inline} keyword in ISO C99) are not disabled.
1021
c1030c7c
JM
1022@xref{Standards,,Language Standards Supported by GCC}, for details of
1023these standard versions.
1024
b1018de6
AO
1025@item -aux-info @var{filename}
1026@opindex aux-info
1027Output to the given filename prototyped declarations for all functions
1028declared and/or defined in a translation unit, including those in header
161d7b59 1029files. This option is silently ignored in any language other than C@.
b1018de6
AO
1030
1031Besides declarations, the file indicates, in comments, the origin of
1032each declaration (source file and line), whether the declaration was
1033implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1034@samp{O} for old, respectively, in the first character after the line
1035number and the colon), and whether it came from a declaration or a
1036definition (@samp{C} or @samp{F}, respectively, in the following
1037character). In the case of function definitions, a K&R-style list of
1038arguments followed by their declarations is also provided, inside
1039comments, after the declaration.
1040
74291a4b 1041@item -fno-asm
cd3bb277 1042@opindex fno-asm
74291a4b
MM
1043Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1044keyword, so that code can use these words as identifiers. You can use
1045the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
630d3d5a 1046instead. @option{-ansi} implies @option{-fno-asm}.
74291a4b
MM
1047
1048In C++, this switch only affects the @code{typeof} keyword, since
1049@code{asm} and @code{inline} are standard keywords. You may want to
630d3d5a 1050use the @option{-fno-gnu-keywords} flag instead, which has the same
5490d604
JM
1051effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1052switch only affects the @code{asm} and @code{typeof} keywords, since
1053@code{inline} is a standard keyword in ISO C99.
74291a4b
MM
1054
1055@item -fno-builtin
7d14c755 1056@itemx -fno-builtin-@var{function} @r{(C and Objective-C only)}
cd3bb277 1057@opindex fno-builtin
c771326b
JM
1058@cindex built-in functions
1059Don't recognize built-in functions that do not begin with
01702459 1060@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
f0523f02 1061functions provided by GCC}, for details of the functions affected,
c771326b 1062including those which are not built-in functions when @option{-ansi} or
5490d604
JM
1063@option{-std} options for strict ISO C conformance are used because they
1064do not have an ISO standard meaning.
74291a4b 1065
c771326b 1066GCC normally generates special code to handle certain built-in functions
74291a4b
MM
1067more efficiently; for instance, calls to @code{alloca} may become single
1068instructions that adjust the stack directly, and calls to @code{memcpy}
1069may become inline copy loops. The resulting code is often both smaller
1070and faster, but since the function calls no longer appear as such, you
1071cannot set a breakpoint on those calls, nor can you change the behavior
1072of the functions by linking with a different library.
1073
630d3d5a 1074In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin}
0b1161fc 1075option has no effect. Therefore, in C++, the only way to get the
c771326b 1076optimization benefits of built-in functions is to call the function
0b1161fc 1077using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses
c771326b 1078built-in functions to implement many functions (like
0b1161fc
MM
1079@code{std::strchr}), so that you automatically get efficient code.
1080
7d14c755
JM
1081With the @option{-fno-builtin-@var{function}} option, not available
1082when compiling C++, only the built-in function @var{function} is
1083disabled. @var{function} must not begin with @samp{__builtin_}. If a
1084function is named this is not built-in in this version of GCC, this
1085option is ignored. There is no corresponding
1086@option{-fbuiltin-@var{function}} option; if you wish to enable
1087built-in functions selectively when using @option{-fno-builtin} or
1088@option{-ffreestanding}, you may define macros such as:
1089
1090@smallexample
1091#define abs(n) __builtin_abs ((n))
1092#define strcpy(d, s) __builtin_strcpy ((d), (s))
1093@end smallexample
1094
861bb6c1 1095@item -fhosted
cd3bb277 1096@opindex fhosted
861bb6c1
JL
1097@cindex hosted environment
1098
1099Assert that compilation takes place in a hosted environment. This implies
630d3d5a 1100@option{-fbuiltin}. A hosted environment is one in which the
861bb6c1
JL
1101entire standard library is available, and in which @code{main} has a return
1102type of @code{int}. Examples are nearly everything except a kernel.
630d3d5a 1103This is equivalent to @option{-fno-freestanding}.
861bb6c1
JL
1104
1105@item -ffreestanding
cd3bb277 1106@opindex ffreestanding
861bb6c1
JL
1107@cindex hosted environment
1108
1109Assert that compilation takes place in a freestanding environment. This
630d3d5a 1110implies @option{-fno-builtin}. A freestanding environment
861bb6c1
JL
1111is one in which the standard library may not exist, and program startup may
1112not necessarily be at @code{main}. The most obvious example is an OS kernel.
630d3d5a 1113This is equivalent to @option{-fno-hosted}.
861bb6c1 1114
c1030c7c
JM
1115@xref{Standards,,Language Standards Supported by GCC}, for details of
1116freestanding and hosted environments.
1117
74291a4b 1118@item -trigraphs
cd3bb277 1119@opindex trigraphs
3bce8a01
NB
1120Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1121options for strict ISO C conformance) implies @option{-trigraphs}.
74291a4b
MM
1122
1123@cindex traditional C language
1124@cindex C language, traditional
1125@item -traditional
cd3bb277 1126@opindex traditional
74291a4b
MM
1127Attempt to support some aspects of traditional C compilers.
1128Specifically:
1129
1130@itemize @bullet
1131@item
1132All @code{extern} declarations take effect globally even if they
1133are written inside of a function definition. This includes implicit
1134declarations of functions.
1135
1136@item
1137The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
1138and @code{volatile} are not recognized. (You can still use the
1139alternative keywords such as @code{__typeof__}, @code{__inline__}, and
1140so on.)
1141
1142@item
1143Comparisons between pointers and integers are always allowed.
1144
1145@item
1146Integer types @code{unsigned short} and @code{unsigned char} promote
1147to @code{unsigned int}.
1148
1149@item
1150Out-of-range floating point literals are not an error.
1151
1152@item
c1030c7c 1153Certain constructs which ISO regards as a single invalid preprocessing
74291a4b
MM
1154number, such as @samp{0xe-0xd}, are treated as expressions instead.
1155
1156@item
1157String ``constants'' are not necessarily constant; they are stored in
1158writable space, and identical looking constants are allocated
1159separately. (This is the same as the effect of
630d3d5a 1160@option{-fwritable-strings}.)
74291a4b
MM
1161
1162@cindex @code{longjmp} and automatic variables
1163@item
1164All automatic variables not declared @code{register} are preserved by
c1030c7c 1165@code{longjmp}. Ordinarily, GNU C follows ISO C: automatic variables
74291a4b
MM
1166not declared @code{volatile} may be clobbered.
1167
1168@item
cd3bb277
JM
1169@cindex @samp{\x}
1170@cindex @samp{\a}
74291a4b
MM
1171@cindex escape sequences, traditional
1172The character escape sequences @samp{\x} and @samp{\a} evaluate as the
1173literal characters @samp{x} and @samp{a} respectively. Without
630d3d5a 1174@w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal
74291a4b 1175representation of a character, and @samp{\a} produces a bell.
ad299d9b 1176@end itemize
74291a4b 1177
aa99bd09
JM
1178This option is deprecated and may be removed.
1179
630d3d5a 1180You may wish to use @option{-fno-builtin} as well as @option{-traditional}
c771326b 1181if your program uses names that are normally GNU C built-in functions for
74291a4b
MM
1182other purposes of its own.
1183
630d3d5a 1184You cannot use @option{-traditional} if you include any header files that
c1030c7c 1185rely on ISO C features. Some vendors are starting to ship systems with
630d3d5a 1186ISO C header files and you cannot use @option{-traditional} on such
74291a4b
MM
1187systems to compile files that include any system headers.
1188
9c34dbbf 1189The @option{-traditional} option also enables @option{-traditional-cpp}.
74291a4b
MM
1190
1191@item -traditional-cpp
cd3bb277 1192@opindex traditional-cpp
74291a4b 1193Attempt to support some aspects of traditional C preprocessors.
9c34dbbf 1194See the GNU CPP manual for details.
74291a4b
MM
1195
1196@item -fcond-mismatch
cd3bb277 1197@opindex fcond-mismatch
74291a4b 1198Allow conditional expressions with mismatched types in the second and
a7537031
JM
1199third arguments. The value of such an expression is void. This option
1200is not supported for C++.
74291a4b
MM
1201
1202@item -funsigned-char
cd3bb277 1203@opindex funsigned-char
74291a4b
MM
1204Let the type @code{char} be unsigned, like @code{unsigned char}.
1205
1206Each kind of machine has a default for what @code{char} should
1207be. It is either like @code{unsigned char} by default or like
1208@code{signed char} by default.
1209
1210Ideally, a portable program should always use @code{signed char} or
1211@code{unsigned char} when it depends on the signedness of an object.
1212But many programs have been written to use plain @code{char} and
1213expect it to be signed, or expect it to be unsigned, depending on the
1214machines they were written for. This option, and its inverse, let you
1215make such a program work with the opposite default.
1216
1217The type @code{char} is always a distinct type from each of
1218@code{signed char} or @code{unsigned char}, even though its behavior
1219is always just like one of those two.
1220
1221@item -fsigned-char
cd3bb277 1222@opindex fsigned-char
74291a4b
MM
1223Let the type @code{char} be signed, like @code{signed char}.
1224
630d3d5a
JM
1225Note that this is equivalent to @option{-fno-unsigned-char}, which is
1226the negative form of @option{-funsigned-char}. Likewise, the option
1227@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
74291a4b 1228
74291a4b
MM
1229@item -fsigned-bitfields
1230@itemx -funsigned-bitfields
1231@itemx -fno-signed-bitfields
1232@itemx -fno-unsigned-bitfields
cd3bb277
JM
1233@opindex fsigned-bitfields
1234@opindex funsigned-bitfields
1235@opindex fno-signed-bitfields
1236@opindex fno-unsigned-bitfields
c771326b 1237These options control whether a bit-field is signed or unsigned, when the
74291a4b 1238declaration does not use either @code{signed} or @code{unsigned}. By
c771326b 1239default, such a bit-field is signed, because this is consistent: the
74291a4b
MM
1240basic integer types such as @code{int} are signed types.
1241
c771326b 1242However, when @option{-traditional} is used, bit-fields are all unsigned
74291a4b
MM
1243no matter what.
1244
1245@item -fwritable-strings
cd3bb277 1246@opindex fwritable-strings
74291a4b
MM
1247Store string constants in the writable data segment and don't uniquize
1248them. This is for compatibility with old programs which assume they can
630d3d5a 1249write into string constants. The option @option{-traditional} also has
74291a4b
MM
1250this effect.
1251
1252Writing into string constants is a very bad idea; ``constants'' should
1253be constant.
1254
1255@item -fallow-single-precision
cd3bb277 1256@opindex fallow-single-precision
74291a4b 1257Do not promote single precision math operations to double precision,
630d3d5a 1258even when compiling with @option{-traditional}.
74291a4b
MM
1259
1260Traditional K&R C promotes all floating point operations to double
1261precision, regardless of the sizes of the operands. On the
1262architecture for which you are compiling, single precision may be faster
630d3d5a 1263than double precision. If you must use @option{-traditional}, but want
74291a4b
MM
1264to use single precision operations when the operands are single
1265precision, use this option. This option has no effect when compiling
c1030c7c 1266with ISO or GNU C conventions (the default).
74291a4b 1267
3e37bef5 1268@item -fshort-wchar
cd3bb277 1269@opindex fshort-wchar
3e37bef5
JM
1270Override the underlying type for @samp{wchar_t} to be @samp{short
1271unsigned int} instead of the default for the target. This option is
161d7b59 1272useful for building programs to run under WINE@.
74291a4b
MM
1273@end table
1274
1275@node C++ Dialect Options
1276@section Options Controlling C++ Dialect
1277
1278@cindex compiler options, C++
1279@cindex C++ options, command line
1280@cindex options, C++
1281This section describes the command-line options that are only meaningful
1282for C++ programs; but you can also use most of the GNU compiler options
1283regardless of what language your program is in. For example, you
1284might compile a file @code{firstClass.C} like this:
1285
1286@example
1dc5fc4b 1287g++ -g -frepo -O -c firstClass.C
74291a4b
MM
1288@end example
1289
1290@noindent
630d3d5a 1291In this example, only @option{-frepo} is an option meant
74291a4b 1292only for C++ programs; you can use the other options with any
161d7b59 1293language supported by GCC@.
74291a4b
MM
1294
1295Here is a list of options that are @emph{only} for compiling C++ programs:
1296
2642624b 1297@table @gcctabopt
74291a4b 1298@item -fno-access-control
cd3bb277 1299@opindex fno-access-control
74291a4b
MM
1300Turn off all access checking. This switch is mainly useful for working
1301around bugs in the access control code.
1302
74291a4b 1303@item -fcheck-new
cd3bb277 1304@opindex fcheck-new
74291a4b
MM
1305Check that the pointer returned by @code{operator new} is non-null
1306before attempting to modify the storage allocated. The current Working
1307Paper requires that @code{operator new} never return a null pointer, so
1308this check is normally unnecessary.
1309
1dc5fc4b
JM
1310An alternative to using this option is to specify that your
1311@code{operator new} does not throw any exceptions; if you declare it
aee96fe9 1312@samp{throw()}, G++ will check the return value. See also @samp{new
1dc5fc4b
JM
1313(nothrow)}.
1314
74291a4b 1315@item -fconserve-space
cd3bb277 1316@opindex fconserve-space
74291a4b
MM
1317Put uninitialized or runtime-initialized global variables into the
1318common segment, as C does. This saves space in the executable at the
1319cost of not diagnosing duplicate definitions. If you compile with this
1320flag and your program mysteriously crashes after @code{main()} has
1321completed, you may have an object that is being destroyed twice because
1322two definitions were merged.
1323
1dc5fc4b
JM
1324This option is no longer useful on most targets, now that support has
1325been added for putting variables into BSS without making them common.
1326
02f52e19 1327@item -fno-const-strings
cd3bb277 1328@opindex fno-const-strings
fcca588c
MM
1329Give string constants type @code{char *} instead of type @code{const
1330char *}. By default, G++ uses type @code{const char *} as required by
630d3d5a 1331the standard. Even if you use @option{-fno-const-strings}, you cannot
fcca588c 1332actually modify the value of a string constant, unless you also use
630d3d5a 1333@option{-fwritable-strings}.
fcca588c
MM
1334
1335This option might be removed in a future release of G++. For maximum
1336portability, you should structure your code so that it works with
1337string constants that have type @code{const char *}.
1338
74291a4b 1339@item -fdollars-in-identifiers
cd3bb277 1340@opindex fdollars-in-identifiers
74291a4b 1341Accept @samp{$} in identifiers. You can also explicitly prohibit use of
630d3d5a 1342@samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows
eb795509 1343@samp{$} by default on most target systems, but there are a few exceptions.)
74291a4b 1344Traditional C allowed the character @samp{$} to form part of
c1030c7c 1345identifiers. However, ISO C and C++ forbid @samp{$} in identifiers.
74291a4b 1346
1dc5fc4b 1347@item -fno-elide-constructors
cd3bb277 1348@opindex fno-elide-constructors
1dc5fc4b
JM
1349The C++ standard allows an implementation to omit creating a temporary
1350which is only used to initialize another object of the same type.
aee96fe9 1351Specifying this option disables that optimization, and forces G++ to
1dc5fc4b 1352call the copy constructor in all cases.
74291a4b 1353
dd1ba632 1354@item -fno-enforce-eh-specs
cd3bb277 1355@opindex fno-enforce-eh-specs
dd1ba632
JM
1356Don't check for violation of exception specifications at runtime. This
1357option violates the C++ standard, but may be useful for reducing code
1358size in production builds, much like defining @samp{NDEBUG}. The compiler
1359will still optimize based on the exception specifications.
1360
74291a4b 1361@item -fexternal-templates
cd3bb277 1362@opindex fexternal-templates
9c34dbbf
ZW
1363
1364Cause @samp{#pragma interface} and @samp{implementation} to apply to
1365template instantiation; template instances are emitted or not according
74291a4b
MM
1366to the location of the template definition. @xref{Template
1367Instantiation}, for more information.
1368
37f6b6bf
MM
1369This option is deprecated.
1370
74291a4b 1371@item -falt-external-templates
cd3bb277 1372@opindex falt-external-templates
9c34dbbf
ZW
1373Similar to @option{-fexternal-templates}, but template instances are
1374emitted or not according to the place where they are first instantiated.
74291a4b
MM
1375@xref{Template Instantiation}, for more information.
1376
37f6b6bf
MM
1377This option is deprecated.
1378
74291a4b 1379@item -ffor-scope
8c81598d 1380@itemx -fno-for-scope
cd3bb277
JM
1381@opindex ffor-scope
1382@opindex fno-for-scope
695ac33f 1383If @option{-ffor-scope} is specified, the scope of variables declared in
74291a4b 1384a @i{for-init-statement} is limited to the @samp{for} loop itself,
34527c47 1385as specified by the C++ standard.
695ac33f 1386If @option{-fno-for-scope} is specified, the scope of variables declared in
74291a4b 1387a @i{for-init-statement} extends to the end of the enclosing scope,
aee96fe9 1388as was the case in old versions of G++, and other (traditional)
74291a4b
MM
1389implementations of C++.
1390
1391The default if neither flag is given to follow the standard,
1392but to allow and give a warning for old-style code that would
1393otherwise be invalid, or have different behavior.
1394
1395@item -fno-gnu-keywords
cd3bb277 1396@opindex fno-gnu-keywords
9762e8a4 1397Do not recognize @code{typeof} as a keyword, so that code can use this
767094dd 1398word as an identifier. You can use the keyword @code{__typeof__} instead.
630d3d5a 1399@option{-ansi} implies @option{-fno-gnu-keywords}.
74291a4b 1400
1dc5fc4b 1401@item -fno-implicit-templates
cd3bb277 1402@opindex fno-implicit-templates
bba975d4 1403Never emit code for non-inline templates which are instantiated
e979f9e8 1404implicitly (i.e.@: by use); only emit code for explicit instantiations.
bba975d4
JM
1405@xref{Template Instantiation}, for more information.
1406
1407@item -fno-implicit-inline-templates
cd3bb277 1408@opindex fno-implicit-inline-templates
bba975d4
JM
1409Don't emit code for implicit instantiations of inline templates, either.
1410The default is to handle inlines differently so that compiles with and
1411without optimization will need the same set of explicit instantiations.
1dc5fc4b 1412
74291a4b 1413@item -fno-implement-inlines
cd3bb277 1414@opindex fno-implement-inlines
74291a4b
MM
1415To save space, do not emit out-of-line copies of inline functions
1416controlled by @samp{#pragma implementation}. This will cause linker
1417errors if these functions are not inlined everywhere they are called.
1418
631cf95d 1419@item -fms-extensions
cd3bb277 1420@opindex fms-extensions
32fb1fb2
PE
1421Disable pedantic warnings about constructs used in MFC, such as implicit
1422int and getting a pointer to member function via non-standard syntax.
631cf95d 1423
fcca588c 1424@item -fno-nonansi-builtins
cd3bb277 1425@opindex fno-nonansi-builtins
c771326b 1426Disable built-in declarations of functions that are not mandated by
161d7b59 1427ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
fcca588c
MM
1428@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1429
775afb25 1430@item -fno-operator-names
cd3bb277 1431@opindex fno-operator-names
775afb25 1432Do not treat the operator name keywords @code{and}, @code{bitand},
74291a4b 1433@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
775afb25 1434synonyms as keywords.
74291a4b 1435
4f8b4fd9 1436@item -fno-optional-diags
cd3bb277 1437@opindex fno-optional-diags
4f8b4fd9 1438Disable diagnostics that the standard says a compiler does not need to
aee96fe9 1439issue. Currently, the only such diagnostic issued by G++ is the one for
bba975d4 1440a name having multiple meanings within a class.
4f8b4fd9 1441
8c7707b0 1442@item -fpermissive
cd3bb277 1443@opindex fpermissive
8c7707b0 1444Downgrade messages about nonconformant code from errors to warnings. By
aee96fe9 1445default, G++ effectively sets @option{-pedantic-errors} without
630d3d5a 1446@option{-pedantic}; this option reverses that. This behavior and this
161d7b59 1447option are superseded by @option{-pedantic}, which works as it does for GNU C@.
8c7707b0 1448
8c81598d 1449@item -frepo
cd3bb277 1450@opindex frepo
9c34dbbf
ZW
1451Enable automatic template instantiation at link time. This option also
1452implies @option{-fno-implicit-templates}. @xref{Template
1453Instantiation}, for more information.
8c81598d 1454
8c7707b0 1455@item -fno-rtti
cd3bb277 1456@opindex fno-rtti
a7fbfcf9
JM
1457Disable generation of information about every class with virtual
1458functions for use by the C++ runtime type identification features
1459(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1460of the language, you can save some space by using this flag. Note that
1461exception handling uses the same information, but it will generate it as
1462needed.
8c7707b0 1463
fcca588c 1464@item -fstats
cd3bb277 1465@opindex fstats
fcca588c
MM
1466Emit statistics about front-end processing at the end of the compilation.
1467This information is generally only useful to the G++ development team.
1468
1dc5fc4b 1469@item -ftemplate-depth-@var{n}
cd3bb277 1470@opindex ftemplate-depth
1dc5fc4b
JM
1471Set the maximum instantiation depth for template classes to @var{n}.
1472A limit on the template instantiation depth is needed to detect
767094dd 1473endless recursions during template class instantiation. ANSI/ISO C++
1dc5fc4b
JM
1474conforming programs must not rely on a maximum depth greater than 17.
1475
fc693822 1476@item -fuse-cxa-atexit
cd3bb277 1477@opindex fuse-cxa-atexit
fc693822
MM
1478Register destructors for objects with static storage duration with the
1479@code{__cxa_atexit} function rather than the @code{atexit} function.
1480This option is required for fully standards-compliant handling of static
1481destructors, but will only work if your C library supports
1482@code{__cxa_atexit}.
1483
90ecce3e 1484@item -fvtable-gc
cd3bb277 1485@opindex fvtable-gc
90ecce3e
JM
1486Emit special relocations for vtables and virtual function references
1487so that the linker can identify unused virtual functions and zero out
1488vtable slots that refer to them. This is most useful with
630d3d5a 1489@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
90ecce3e 1490also discard the functions themselves.
f5a1b0d2 1491
90ecce3e 1492This optimization requires GNU as and GNU ld. Not all systems support
630d3d5a 1493this option. @option{-Wl,--gc-sections} is ignored without @option{-static}.
861bb6c1 1494
02f52e19 1495@item -fno-weak
cd3bb277 1496@opindex fno-weak
90ecce3e 1497Do not use weak symbol support, even if it is provided by the linker.
fcca588c
MM
1498By default, G++ will use weak symbols if they are available. This
1499option exists only for testing, and should not be used by end-users;
1500it will result in inferior code and has no benefits. This option may
1501be removed in a future release of G++.
1502
74291a4b 1503@item -nostdinc++
cd3bb277 1504@opindex nostdinc++
74291a4b
MM
1505Do not search for header files in the standard directories specific to
1506C++, but do still search the other standard directories. (This option
e5e809f4 1507is used when building the C++ library.)
74291a4b
MM
1508@end table
1509
1510In addition, these optimization, warning, and code generation options
1511have meanings only for C++ programs:
1512
2642624b 1513@table @gcctabopt
74291a4b 1514@item -fno-default-inline
cd3bb277 1515@opindex fno-default-inline
74291a4b 1516Do not assume @samp{inline} for functions defined inside a class scope.
1dc5fc4b
JM
1517@xref{Optimize Options,,Options That Control Optimization}. Note that these
1518functions will have linkage like inline functions; they just won't be
1519inlined by default.
74291a4b 1520
aee96fe9 1521@item -Wctor-dtor-privacy @r{(C++ only)}
cd3bb277 1522@opindex Wctor-dtor-privacy
bba975d4
JM
1523Warn when a class seems unusable, because all the constructors or
1524destructors in a class are private and the class has no friends or
1525public static member functions.
1526
aee96fe9 1527@item -Wnon-virtual-dtor @r{(C++ only)}
cd3bb277 1528@opindex Wnon-virtual-dtor
bba975d4
JM
1529Warn when a class declares a non-virtual destructor that should probably
1530be virtual, because it looks like the class will be used polymorphically.
1531
aee96fe9 1532@item -Wreorder @r{(C++ only)}
cd3bb277 1533@opindex Wreorder
bba975d4
JM
1534@cindex reordering, warning
1535@cindex warning for reordering of member initializers
1536Warn when the order of member initializers given in the code does not
1537match the order in which they must be executed. For instance:
1538
1539@smallexample
1540struct A @{
1541 int i;
1542 int j;
1543 A(): j (0), i (1) @{ @}
1544@};
1545@end smallexample
1546
1547Here the compiler will warn that the member initializers for @samp{i}
1548and @samp{j} will be rearranged to match the declaration order of the
1549members.
1550@end table
1551
630d3d5a 1552The following @option{-W@dots{}} options are not affected by @option{-Wall}.
bba975d4 1553
2642624b 1554@table @gcctabopt
aee96fe9 1555@item -Weffc++ @r{(C++ only)}
cd3bb277 1556@opindex Weffc++
bba975d4
JM
1557Warn about violations of various style guidelines from Scott Meyers'
1558@cite{Effective C++} books. If you use this option, you should be aware
1559that the standard library headers do not obey all of these guidelines;
1560you can use @samp{grep -v} to filter out those warnings.
1561
aee96fe9 1562@item -Wno-deprecated @r{(C++ only)}
cd3bb277 1563@opindex Wno-deprecated
767094dd 1564Do not warn about usage of deprecated features. @xref{Deprecated Features}.
2de45c06 1565
aee96fe9 1566@item -Wno-non-template-friend @r{(C++ only)}
cd3bb277 1567@opindex Wno-non-template-friend
bba975d4 1568Disable warnings when non-templatized friend functions are declared
767094dd 1569within a template. With the advent of explicit template specification
aee96fe9 1570support in G++, if the name of the friend is an unqualified-id (i.e.,
bba975d4 1571@samp{friend foo(int)}), the C++ language specification demands that the
767094dd 1572friend declare or define an ordinary, nontemplate function. (Section
aee96fe9 157314.5.3). Before G++ implemented explicit specification, unqualified-ids
bba975d4 1574could be interpreted as a particular specialization of a templatized
767094dd 1575function. Because this non-conforming behavior is no longer the default
aee96fe9 1576behavior for G++, @option{-Wnon-template-friend} allows the compiler to
bba975d4 1577check existing code for potential trouble spots, and is on by default.
2228d450 1578This new compiler behavior can be turned off with
630d3d5a 1579@option{-Wno-non-template-friend} which keeps the conformant compiler code
2228d450 1580but disables the helpful warning.
bba975d4 1581
aee96fe9 1582@item -Wold-style-cast @r{(C++ only)}
cd3bb277 1583@opindex Wold-style-cast
323728aa
NS
1584Warn if an old-style (C-style) cast to a non-void type is used within
1585a C++ program. The new-style casts (@samp{static_cast},
1586@samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1587unintended effects, and much easier to grep for.
bba975d4 1588
aee96fe9 1589@item -Woverloaded-virtual @r{(C++ only)}
cd3bb277 1590@opindex Woverloaded-virtual
bba975d4
JM
1591@cindex overloaded virtual fn, warning
1592@cindex warning for overloaded virtual fn
3747f3dc
MM
1593Warn when a function declaration hides virtual functions from a
1594base class. For example, in:
1595
1596@smallexample
1597struct A @{
1598 virtual void f();
1599@};
1600
1601struct B: public A @{
1602 void f(int);
1603@};
1604@end smallexample
1605
1606the @code{A} class version of @code{f} is hidden in @code{B}, and code
1607like this:
1608
1609@smallexample
1610B* b;
1611b->f();
1612@end smallexample
1613
1614will fail to compile.
bba975d4 1615
aee96fe9 1616@item -Wno-pmf-conversions @r{(C++ only)}
cd3bb277 1617@opindex Wno-pmf-conversions
bba975d4
JM
1618Disable the diagnostic for converting a bound pointer to member function
1619to a plain pointer.
1620
aee96fe9 1621@item -Wsign-promo @r{(C++ only)}
cd3bb277 1622@opindex Wsign-promo
bba975d4
JM
1623Warn when overload resolution chooses a promotion from unsigned or
1624enumeral type to a signed type over a conversion to an unsigned type of
aee96fe9 1625the same size. Previous versions of G++ would try to preserve
bba975d4
JM
1626unsignedness, but the standard mandates the current behavior.
1627
aee96fe9 1628@item -Wsynth @r{(C++ only)}
cd3bb277 1629@opindex Wsynth
bba975d4
JM
1630@cindex warning for synthesized methods
1631@cindex synthesized methods, warning
aee96fe9 1632Warn when G++'s synthesis behavior does not match that of cfront. For
bba975d4
JM
1633instance:
1634
1635@smallexample
1636struct A @{
1637 operator int ();
1638 A& operator = (int);
1639@};
1640
1641main ()
1642@{
1643 A a,b;
1644 a = b;
1645@}
1646@end smallexample
74291a4b 1647
aee96fe9 1648In this example, G++ will synthesize a default @samp{A& operator =
bba975d4 1649(const A&);}, while cfront will use the user-defined @samp{operator =}.
74291a4b
MM
1650@end table
1651
60de6385
SS
1652@node Objective-C Dialect Options
1653@section Options Controlling Objective-C Dialect
1654
1655@cindex compiler options, Objective-C
1656@cindex Objective-C options, command line
1657@cindex options, Objective-C
1658This section describes the command-line options that are only meaningful
1659for Objective-C programs; but you can also use most of the GNU compiler
1660options regardless of what language your program is in. For example,
1661you might compile a file @code{some_class.m} like this:
1662
1663@example
1664gcc -g -fgnu-runtime -O -c some_class.m
1665@end example
1666
1667@noindent
630d3d5a 1668In this example, only @option{-fgnu-runtime} is an option meant only for
60de6385 1669Objective-C programs; you can use the other options with any language
161d7b59 1670supported by GCC@.
60de6385
SS
1671
1672Here is a list of options that are @emph{only} for compiling Objective-C
1673programs:
1674
1675@table @gcctabopt
630d3d5a 1676@item -fconstant-string-class=@var{class-name}
cd3bb277 1677@opindex fconstant-string-class
630d3d5a 1678Use @var{class-name} as the name of the class to instantiate for each
695ac33f 1679literal string specified with the syntax @code{@@"@dots{}"}. The default
60de6385
SS
1680class name is @code{NXConstantString}.
1681
1682@item -fgnu-runtime
cd3bb277 1683@opindex fgnu-runtime
60de6385
SS
1684Generate object code compatible with the standard GNU Objective-C
1685runtime. This is the default for most types of systems.
1686
1687@item -fnext-runtime
cd3bb277 1688@opindex fnext-runtime
60de6385 1689Generate output compatible with the NeXT runtime. This is the default
161d7b59 1690for NeXT-based systems, including Darwin and Mac OS X@.
60de6385
SS
1691
1692@item -gen-decls
cd3bb277 1693@opindex gen-decls
60de6385
SS
1694Dump interface declarations for all classes seen in the source file to a
1695file named @file{@var{sourcename}.decl}.
1696
1697@item -Wno-protocol
cd3bb277 1698@opindex Wno-protocol
60de6385
SS
1699Do not warn if methods required by a protocol are not implemented
1700in the class adopting it.
1701
1702@item -Wselector
cd3bb277 1703@opindex Wselector
60de6385
SS
1704Warn if a selector has multiple methods of different types defined.
1705
1706@c not documented because only avail via -Wp
1707@c @item -print-objc-runtime-info
1708
1709@end table
1710
764dbbf2
GDR
1711@node Language Independent Options
1712@section Options to Control Diagnostic Messages Formatting
1713@cindex options to control diagnostics formatting
1714@cindex diagnostic messages
1715@cindex message formatting
1716
b192711e 1717Traditionally, diagnostic messages have been formatted irrespective of
e979f9e8 1718the output device's aspect (e.g.@: its width, @dots{}). The options described
764dbbf2 1719below can be used to control the diagnostic messages formatting
e979f9e8 1720algorithm, e.g.@: how many characters per line, how often source location
6c0a4eab 1721information should be reported. Right now, only the C++ front end can
764dbbf2 1722honor these options. However it is expected, in the near future, that
6c0a4eab 1723the remaining front ends would be able to digest them correctly.
764dbbf2 1724
2642624b 1725@table @gcctabopt
764dbbf2 1726@item -fmessage-length=@var{n}
cd3bb277 1727@opindex fmessage-length
764dbbf2 1728Try to format error messages so that they fit on lines of about @var{n}
aee96fe9 1729characters. The default is 72 characters for @command{g++} and 0 for the rest of
161d7b59 1730the front ends supported by GCC@. If @var{n} is zero, then no
02f52e19 1731line-wrapping will be done; each error message will appear on a single
764dbbf2
GDR
1732line.
1733
cd3bb277 1734@opindex fdiagnostics-show-location
764dbbf2 1735@item -fdiagnostics-show-location=once
b192711e 1736Only meaningful in line-wrapping mode. Instructs the diagnostic messages
764dbbf2
GDR
1737reporter to emit @emph{once} source location information; that is, in
1738case the message is too long to fit on a single physical line and has to
1739be wrapped, the source location won't be emitted (as prefix) again,
1740over and over, in subsequent continuation lines. This is the default
c21cd8b1 1741behavior.
764dbbf2
GDR
1742
1743@item -fdiagnostics-show-location=every-line
1744Only meaningful in line-wrapping mode. Instructs the diagnostic
1745messages reporter to emit the same source location information (as
4fe9b91c 1746prefix) for physical lines that result from the process of breaking
b192711e 1747a message which is too long to fit on a single line.
764dbbf2
GDR
1748
1749@end table
1750
74291a4b
MM
1751@node Warning Options
1752@section Options to Request or Suppress Warnings
1753@cindex options to control warnings
1754@cindex warning messages
1755@cindex messages, warning
1756@cindex suppressing warnings
1757
1758Warnings are diagnostic messages that report constructions which
1759are not inherently erroneous but which are risky or suggest there
1760may have been an error.
1761
1762You can request many specific warnings with options beginning @samp{-W},
630d3d5a 1763for example @option{-Wimplicit} to request warnings on implicit
74291a4b
MM
1764declarations. Each of these specific warning options also has a
1765negative form beginning @samp{-Wno-} to turn off warnings;
630d3d5a 1766for example, @option{-Wno-implicit}. This manual lists only one of the
74291a4b
MM
1767two forms, whichever is not the default.
1768
0c2d1a2a 1769These options control the amount and kinds of warnings produced by GCC:
74291a4b 1770
2642624b 1771@table @gcctabopt
74291a4b
MM
1772@cindex syntax checking
1773@item -fsyntax-only
cd3bb277 1774@opindex fsyntax-only
74291a4b
MM
1775Check the code for syntax errors, but don't do anything beyond that.
1776
1777@item -pedantic
cd3bb277 1778@opindex pedantic
074e95e3
JM
1779Issue all the warnings demanded by strict ISO C and ISO C++;
1780reject all programs that use forbidden extensions, and some other
1781programs that do not follow ISO C and ISO C++. For ISO C, follows the
630d3d5a 1782version of the ISO C standard specified by any @option{-std} option used.
74291a4b 1783
074e95e3 1784Valid ISO C and ISO C++ programs should compile properly with or without
5490d604 1785this option (though a rare few will require @option{-ansi} or a
161d7b59 1786@option{-std} option specifying the required version of ISO C)@. However,
b1d16193
JL
1787without this option, certain GNU extensions and traditional C and C++
1788features are supported as well. With this option, they are rejected.
74291a4b 1789
630d3d5a 1790@option{-pedantic} does not cause warning messages for use of the
74291a4b
MM
1791alternate keywords whose names begin and end with @samp{__}. Pedantic
1792warnings are also disabled in the expression that follows
1793@code{__extension__}. However, only system header files should use
1794these escape routes; application programs should avoid them.
1795@xref{Alternate Keywords}.
1796
630d3d5a 1797Some users try to use @option{-pedantic} to check programs for strict ISO
74291a4b 1798C conformance. They soon find that it does not do quite what they want:
c1030c7c 1799it finds some non-ISO practices, but not all---only those for which
074e95e3
JM
1800ISO C @emph{requires} a diagnostic, and some others for which
1801diagnostics have been added.
74291a4b 1802
074e95e3 1803A feature to report any failure to conform to ISO C might be useful in
74291a4b 1804some instances, but would require considerable additional work and would
630d3d5a 1805be quite different from @option{-pedantic}. We don't have plans to
892d0a6d 1806support such a feature in the near future.
74291a4b 1807
91ea548a
JM
1808Where the standard specified with @option{-std} represents a GNU
1809extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
1810corresponding @dfn{base standard}, the version of ISO C on which the GNU
1811extended dialect is based. Warnings from @option{-pedantic} are given
1812where they are required by the base standard. (It would not make sense
1813for such warnings to be given only for features not in the specified GNU
1814C dialect, since by definition the GNU dialects of C include all
1815features the compiler supports with the given option, and there would be
1816nothing to warn about.)
1817
74291a4b 1818@item -pedantic-errors
cd3bb277 1819@opindex pedantic-errors
630d3d5a 1820Like @option{-pedantic}, except that errors are produced rather than
74291a4b
MM
1821warnings.
1822
1823@item -w
cd3bb277 1824@opindex w
74291a4b
MM
1825Inhibit all warning messages.
1826
1827@item -Wno-import
cd3bb277 1828@opindex Wno-import
74291a4b
MM
1829Inhibit warning messages about the use of @samp{#import}.
1830
1831@item -Wchar-subscripts
cd3bb277 1832@opindex Wchar-subscripts
74291a4b
MM
1833Warn if an array subscript has type @code{char}. This is a common cause
1834of error, as programmers often forget that this type is signed on some
1835machines.
1836
1837@item -Wcomment
cd3bb277 1838@opindex Wcomment
74291a4b
MM
1839Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1840comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1841
1842@item -Wformat
cd3bb277 1843@opindex Wformat
74291a4b
MM
1844Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1845the arguments supplied have types appropriate to the format string
26f6672d
JM
1846specified, and that the conversions specified in the format string make
1847sense. This includes standard functions, and others specified by format
1848attributes (@pxref{Function Attributes}), in the @code{printf},
1849@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
1850not in the C standard) families.
74291a4b 1851
8308e0b7
JM
1852The formats are checked against the format features supported by GNU
1853libc version 2.2. These include all ISO C89 and C99 features, as well
1854as features from the Single Unix Specification and some BSD and GNU
1855extensions. Other library implementations may not support all these
1856features; GCC does not support warning about features that go beyond a
630d3d5a
JM
1857particular library's limitations. However, if @option{-pedantic} is used
1858with @option{-Wformat}, warnings will be given about format features not
26f6672d
JM
1859in the selected standard version (but not for @code{strfmon} formats,
1860since those are not in any version of the C standard). @xref{C Dialect
1861Options,,Options Controlling C Dialect}.
8308e0b7 1862
630d3d5a
JM
1863@option{-Wformat} is included in @option{-Wall}. For more control over some
1864aspects of format checking, the options @option{-Wno-format-y2k},
1865@option{-Wno-format-extra-args}, @option{-Wformat-nonliteral},
1866@option{-Wformat-security} and @option{-Wformat=2} are available, but are
1867not included in @option{-Wall}.
4d808927
JM
1868
1869@item -Wno-format-y2k
cd3bb277 1870@opindex Wno-format-y2k
630d3d5a 1871If @option{-Wformat} is specified, do not warn about @code{strftime}
4d808927
JM
1872formats which may yield only a two-digit year.
1873
1874@item -Wno-format-extra-args
cd3bb277 1875@opindex Wno-format-extra-args
630d3d5a 1876If @option{-Wformat} is specified, do not warn about excess arguments to a
4d808927
JM
1877@code{printf} or @code{scanf} format function. The C standard specifies
1878that such arguments are ignored.
1879
7e5fb12f
JM
1880Where the unused arguments lie between used arguments that are
1881specified with @samp{$} operand number specifications, normally
1882warnings are still given, since the implementation could not know what
1883type to pass to @code{va_arg} to skip the unused arguments. However,
1884in the case of @code{scanf} formats, this option will suppress the
1885warning if the unused arguments are all pointers, since the Single
1886Unix Specification says that such unused arguments are allowed.
1887
4d808927 1888@item -Wformat-nonliteral
cd3bb277 1889@opindex Wformat-nonliteral
630d3d5a 1890If @option{-Wformat} is specified, also warn if the format string is not a
4d808927
JM
1891string literal and so cannot be checked, unless the format function
1892takes its format arguments as a @code{va_list}.
1893
c907e684 1894@item -Wformat-security
cd3bb277 1895@opindex Wformat-security
630d3d5a 1896If @option{-Wformat} is specified, also warn about uses of format
c907e684
JM
1897functions that represent possible security problems. At present, this
1898warns about calls to @code{printf} and @code{scanf} functions where the
1899format string is not a string literal and there are no format arguments,
1900as in @code{printf (foo);}. This may be a security hole if the format
1901string came from untrusted input and contains @samp{%n}. (This is
630d3d5a
JM
1902currently a subset of what @option{-Wformat-nonliteral} warns about, but
1903in future warnings may be added to @option{-Wformat-security} that are not
1904included in @option{-Wformat-nonliteral}.)
c907e684 1905
4d808927 1906@item -Wformat=2
cd3bb277 1907@opindex Wformat=2
630d3d5a
JM
1908Enable @option{-Wformat} plus format checks not included in
1909@option{-Wformat}. Currently equivalent to @samp{-Wformat
c907e684 1910-Wformat-nonliteral -Wformat-security}.
4d808927 1911
e9a25f70 1912@item -Wimplicit-int
cd3bb277 1913@opindex Wimplicit-int
e9a25f70
JL
1914Warn when a declaration does not specify a type.
1915
f5963e61
JL
1916@item -Wimplicit-function-declaration
1917@itemx -Werror-implicit-function-declaration
cd3bb277
JM
1918@opindex Wimplicit-function-declaration
1919@opindex Werror-implicit-function-declaration
f5963e61
JL
1920Give a warning (or error) whenever a function is used before being
1921declared.
e9a25f70 1922
74291a4b 1923@item -Wimplicit
cd3bb277 1924@opindex Wimplicit
630d3d5a 1925Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
861bb6c1
JL
1926
1927@item -Wmain
cd3bb277 1928@opindex Wmain
861bb6c1
JL
1929Warn if the type of @samp{main} is suspicious. @samp{main} should be a
1930function with external linkage, returning int, taking either zero
1931arguments, two, or three arguments of appropriate types.
4a870dba 1932
1f0c3120 1933@item -Wmissing-braces
cd3bb277 1934@opindex Wmissing-braces
1f0c3120
JM
1935Warn if an aggregate or union initializer is not fully bracketed. In
1936the following example, the initializer for @samp{a} is not fully
1937bracketed, but that for @samp{b} is fully bracketed.
1938
1939@smallexample
1940int a[2][2] = @{ 0, 1, 2, 3 @};
1941int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
1942@end smallexample
1943
74291a4b 1944@item -Wparentheses
cd3bb277 1945@opindex Wparentheses
74291a4b
MM
1946Warn if parentheses are omitted in certain contexts, such
1947as when there is an assignment in a context where a truth value
1948is expected, or when operators are nested whose precedence people
1949often get confused about.
1950
e9a25f70
JL
1951Also warn about constructions where there may be confusion to which
1952@code{if} statement an @code{else} branch belongs. Here is an example of
1953such a case:
1954
1955@smallexample
aee96fe9 1956@group
e9a25f70
JL
1957@{
1958 if (a)
1959 if (b)
1960 foo ();
1961 else
1962 bar ();
1963@}
aee96fe9 1964@end group
e9a25f70
JL
1965@end smallexample
1966
1967In C, every @code{else} branch belongs to the innermost possible @code{if}
1968statement, which in this example is @code{if (b)}. This is often not
1969what the programmer expected, as illustrated in the above example by
1970indentation the programmer chose. When there is the potential for this
f0523f02 1971confusion, GCC will issue a warning when this flag is specified.
e9a25f70
JL
1972To eliminate the warning, add explicit braces around the innermost
1973@code{if} statement so there is no way the @code{else} could belong to
1974the enclosing @code{if}. The resulting code would look like this:
1975
1976@smallexample
aee96fe9 1977@group
e9a25f70
JL
1978@{
1979 if (a)
1980 @{
1981 if (b)
1982 foo ();
1983 else
1984 bar ();
1985 @}
1986@}
aee96fe9 1987@end group
e9a25f70
JL
1988@end smallexample
1989
bb58bec5 1990@item -Wsequence-point
cd3bb277 1991@opindex Wsequence-point
bb58bec5
JM
1992Warn about code that may have undefined semantics because of violations
1993of sequence point rules in the C standard.
1994
1995The C standard defines the order in which expressions in a C program are
1996evaluated in terms of @dfn{sequence points}, which represent a partial
1997ordering between the execution of parts of the program: those executed
1998before the sequence point, and those executed after it. These occur
1999after the evaluation of a full expression (one which is not part of a
2000larger expression), after the evaluation of the first operand of a
2001@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2002function is called (but after the evaluation of its arguments and the
2003expression denoting the called function), and in certain other places.
2004Other than as expressed by the sequence point rules, the order of
2005evaluation of subexpressions of an expression is not specified. All
2006these rules describe only a partial order rather than a total order,
2007since, for example, if two functions are called within one expression
2008with no sequence point between them, the order in which the functions
2009are called is not specified. However, the standards committee have
2010ruled that function calls do not overlap.
2011
2012It is not specified when between sequence points modifications to the
2013values of objects take effect. Programs whose behavior depends on this
2014have undefined behavior; the C standard specifies that ``Between the
2015previous and next sequence point an object shall have its stored value
2016modified at most once by the evaluation of an expression. Furthermore,
2017the prior value shall be read only to determine the value to be
2018stored.''. If a program breaks these rules, the results on any
2019particular implementation are entirely unpredictable.
2020
2021Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2022= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
2023diagnosed by this option, and it may give an occasional false positive
2024result, but in general it has been found fairly effective at detecting
2025this sort of problem in programs.
2026
2027The present implementation of this option only works for C programs. A
2028future implementation may also work for C++ programs.
2029
9c34dbbf
ZW
2030The C standard is worded confusingly, therefore there is some debate
2031over the precise meaning of the sequence point rules in subtle cases.
2032Links to discussions of the problem, including proposed formal
2033definitions, may be found on our readings page, at
c5122d75 2034@w{@uref{http://gcc.gnu.org/readings.html}}.
bb58bec5 2035
74291a4b 2036@item -Wreturn-type
cd3bb277 2037@opindex Wreturn-type
32c4c36c
ML
2038Warn whenever a function is defined with a return-type that defaults to
2039@code{int}. Also warn about any @code{return} statement with no
02f52e19 2040return-value in a function whose return-type is not @code{void}.
32c4c36c
ML
2041
2042For C++, a function without return type always produces a diagnostic
767094dd 2043message, even when @option{-Wno-return-type} is specified. The only
32c4c36c 2044exceptions are @samp{main} and functions defined in system headers.
74291a4b
MM
2045
2046@item -Wswitch
cd3bb277 2047@opindex Wswitch
74291a4b
MM
2048Warn whenever a @code{switch} statement has an index of enumeral type
2049and lacks a @code{case} for one or more of the named codes of that
2050enumeration. (The presence of a @code{default} label prevents this
2051warning.) @code{case} labels outside the enumeration range also
2052provoke warnings when this option is used.
2053
2054@item -Wtrigraphs
cd3bb277 2055@opindex Wtrigraphs
f2ecb02d
JM
2056Warn if any trigraphs are encountered that might change the meaning of
2057the program (trigraphs within comments are not warned about).
74291a4b 2058
078721e1 2059@item -Wunused-function
cd3bb277 2060@opindex Wunused-function
078721e1
AC
2061Warn whenever a static function is declared but not defined or a
2062non\-inline static function is unused.
74291a4b 2063
078721e1 2064@item -Wunused-label
cd3bb277 2065@opindex Wunused-label
078721e1
AC
2066Warn whenever a label is declared but not used.
2067
2068To suppress this warning use the @samp{unused} attribute
2069(@pxref{Variable Attributes}).
2070
2071@item -Wunused-parameter
cd3bb277 2072@opindex Wunused-parameter
078721e1
AC
2073Warn whenever a function parameter is unused aside from its declaration.
2074
2075To suppress this warning use the @samp{unused} attribute
2076(@pxref{Variable Attributes}).
956d6950 2077
078721e1 2078@item -Wunused-variable
cd3bb277 2079@opindex Wunused-variable
078721e1
AC
2080Warn whenever a local variable or non-constant static variable is unused
2081aside from its declaration
2082
2083To suppress this warning use the @samp{unused} attribute
74291a4b
MM
2084(@pxref{Variable Attributes}).
2085
078721e1 2086@item -Wunused-value
cd3bb277 2087@opindex Wunused-value
078721e1
AC
2088Warn whenever a statement computes a result that is explicitly not used.
2089
2090To suppress this warning cast the expression to @samp{void}.
2091
2092@item -Wunused
cd3bb277 2093@opindex Wunused
630d3d5a 2094All all the above @option{-Wunused} options combined.
078721e1
AC
2095
2096In order to get a warning about an unused function parameter, you must
b192711e 2097either specify @samp{-W -Wunused} or separately specify
630d3d5a 2098@option{-Wunused-parameter}.
078721e1 2099
74291a4b 2100@item -Wuninitialized
cd3bb277 2101@opindex Wuninitialized
c5c76735
JL
2102Warn if an automatic variable is used without first being initialized or
2103if a variable may be clobbered by a @code{setjmp} call.
74291a4b
MM
2104
2105These warnings are possible only in optimizing compilation,
2106because they require data flow information that is computed only
630d3d5a 2107when optimizing. If you don't specify @option{-O}, you simply won't
74291a4b
MM
2108get these warnings.
2109
2110These warnings occur only for variables that are candidates for
2111register allocation. Therefore, they do not occur for a variable that
2112is declared @code{volatile}, or whose address is taken, or whose size
2113is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
2114structures, unions or arrays, even when they are in registers.
2115
2116Note that there may be no warning about a variable that is used only
2117to compute a value that itself is never used, because such
2118computations may be deleted by data flow analysis before the warnings
2119are printed.
2120
0c2d1a2a 2121These warnings are made optional because GCC is not smart
74291a4b
MM
2122enough to see all the reasons why the code might be correct
2123despite appearing to have an error. Here is one example of how
2124this can happen:
2125
2126@smallexample
aee96fe9 2127@group
74291a4b
MM
2128@{
2129 int x;
2130 switch (y)
2131 @{
2132 case 1: x = 1;
2133 break;
2134 case 2: x = 4;
2135 break;
2136 case 3: x = 5;
2137 @}
2138 foo (x);
2139@}
aee96fe9 2140@end group
74291a4b
MM
2141@end smallexample
2142
2143@noindent
2144If the value of @code{y} is always 1, 2 or 3, then @code{x} is
0c2d1a2a 2145always initialized, but GCC doesn't know this. Here is
74291a4b
MM
2146another common case:
2147
2148@smallexample
2149@{
2150 int save_y;
2151 if (change_y) save_y = y, y = new_y;
2152 @dots{}
2153 if (change_y) y = save_y;
2154@}
2155@end smallexample
2156
2157@noindent
2158This has no bug because @code{save_y} is used only if it is set.
2159
20300b05 2160@cindex @code{longjmp} warnings
b192711e 2161This option also warns when a non-volatile automatic variable might be
c5c76735
JL
2162changed by a call to @code{longjmp}. These warnings as well are possible
2163only in optimizing compilation.
20300b05
GK
2164
2165The compiler sees only the calls to @code{setjmp}. It cannot know
2166where @code{longjmp} will be called; in fact, a signal handler could
2167call it at any point in the code. As a result, you may get a warning
2168even when there is in fact no problem because @code{longjmp} cannot
2169in fact be called at the place which would cause a problem.
2170
74291a4b
MM
2171Some spurious warnings can be avoided if you declare all the functions
2172you use that never return as @code{noreturn}. @xref{Function
2173Attributes}.
2174
aee96fe9 2175@item -Wreorder @r{(C++ only)}
cd3bb277 2176@opindex Wreorder
c5c76735
JL
2177@cindex reordering, warning
2178@cindex warning for reordering of member initializers
2179Warn when the order of member initializers given in the code does not
2180match the order in which they must be executed. For instance:
2181
d300e551 2182@item -Wunknown-pragmas
cd3bb277 2183@opindex Wunknown-pragmas
d300e551
NC
2184@cindex warning for unknown pragmas
2185@cindex unknown pragmas, warning
2186@cindex pragmas, warning of unknown
2187Warn when a #pragma directive is encountered which is not understood by
161d7b59 2188GCC@. If this command line option is used, warnings will even be issued
d300e551 2189for unknown pragmas in system header files. This is not the case if
630d3d5a 2190the warnings were only enabled by the @option{-Wall} command line option.
d300e551 2191
74291a4b 2192@item -Wall
cd3bb277 2193@opindex Wall
74291a4b
MM
2194All of the above @samp{-W} options combined. This enables all the
2195warnings about constructions that some users consider questionable, and
2196that are easy to avoid (or modify to prevent the warning), even in
2197conjunction with macros.
317639a8 2198
6c36d76b
NB
2199@item -Wdiv-by-zero
2200@opindex Wno-div-by-zero
2201@opindex Wdiv-by-zero
2202Warn about compile-time integer division by zero. This is default. To
2203inhibit the warning messages, use @option{-Wno-div-by-zero}. Floating
2204point division by zero is not warned about, as it can be a legitimate
2205way of obtaining infinities and NaNs.
2206
2207@item -Wmultichar
2208@opindex Wno-multichar
2209@opindex Wmultichar
2210Warn if a multicharacter constant (@samp{'FOOF'}) is used. This is
2211default. To inhibit the warning messages, use @option{-Wno-multichar}.
2212Usually they indicate a typo in the user's code, as they have
2213implementation-defined values, and should not be used in portable code.
2214
317639a8 2215@item -Wsystem-headers
cd3bb277 2216@opindex Wsystem-headers
317639a8
BC
2217@cindex warnings from system headers
2218@cindex system headers, warnings from
2219Print warning messages for constructs found in system header files.
2220Warnings from system headers are normally suppressed, on the assumption
2221that they usually do not indicate real problems and would only make the
2222compiler output harder to read. Using this command line option tells
2223GCC to emit warnings from system headers as if they occurred in user
630d3d5a 2224code. However, note that using @option{-Wall} in conjunction with this
317639a8 2225option will @emph{not} warn about unknown pragmas in system
630d3d5a 2226headers---for that, @option{-Wunknown-pragmas} must also be used.
74291a4b
MM
2227@end table
2228
630d3d5a 2229The following @option{-W@dots{}} options are not implied by @option{-Wall}.
74291a4b
MM
2230Some of them warn about constructions that users generally do not
2231consider questionable, but which occasionally you might wish to check
2232for; others warn about constructions that are necessary or hard to avoid
2233in some cases, and there is no simple way to modify the code to suppress
2234the warning.
2235
2642624b 2236@table @gcctabopt
74291a4b 2237@item -W
cd3bb277 2238@opindex W
74291a4b
MM
2239Print extra warning messages for these events:
2240
2241@itemize @bullet
74291a4b
MM
2242@item
2243A function can return either with or without a value. (Falling
2244off the end of the function body is considered returning without
2245a value.) For example, this function would evoke such a
2246warning:
2247
2248@smallexample
2249@group
2250foo (a)
2251@{
2252 if (a > 0)
2253 return a;
2254@}
2255@end group
2256@end smallexample
2257
2258@item
2259An expression-statement or the left-hand side of a comma expression
2260contains no side effects.
2261To suppress the warning, cast the unused expression to void.
2262For example, an expression such as @samp{x[i,j]} will cause a warning,
2263but @samp{x[(void)i,j]} will not.
2264
2265@item
2266An unsigned value is compared against zero with @samp{<} or @samp{<=}.
2267
2268@item
2269A comparison like @samp{x<=y<=z} appears; this is equivalent to
2270@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2271that of ordinary mathematical notation.
2272
2273@item
2274Storage-class specifiers like @code{static} are not the first things in
2275a declaration. According to the C Standard, this usage is obsolescent.
2276
e0c9fbb7
JM
2277@item
2278The return type of a function has a type qualifier such as @code{const}.
2279Such a type qualifier has no effect, since the value returned by a
2280function is not an lvalue. (But don't warn about the GNU extension of
2281@code{volatile void} return types. That extension will be warned about
630d3d5a 2282if @option{-pedantic} is specified.)
e0c9fbb7 2283
74291a4b 2284@item
630d3d5a 2285If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
74291a4b
MM
2286arguments.
2287
e9a25f70
JL
2288@item
2289A comparison between signed and unsigned values could produce an
2290incorrect result when the signed value is converted to unsigned.
630d3d5a 2291(But don't warn if @option{-Wno-sign-compare} is also specified.)
e9a25f70 2292
74291a4b
MM
2293@item
2294An aggregate has a partly bracketed initializer.
2295For example, the following code would evoke such a warning,
2296because braces are missing around the initializer for @code{x.h}:
2297
2298@smallexample
2299struct s @{ int f, g; @};
2300struct t @{ struct s h; int i; @};
2301struct t x = @{ 1, 2, 3 @};
2302@end smallexample
dbde0d5d
BH
2303
2304@item
2305An aggregate has an initializer which does not initialize all members.
2306For example, the following code would cause such a warning, because
2307@code{x.h} would be implicitly initialized to zero:
2308
2309@smallexample
2310struct s @{ int f, g, h; @};
2311struct s x = @{ 3, 4 @};
2312@end smallexample
74291a4b
MM
2313@end itemize
2314
f793a95e 2315@item -Wfloat-equal
cd3bb277 2316@opindex Wfloat-equal
f793a95e
JL
2317Warn if floating point values are used in equality comparisons.
2318
488d3985
GK
2319The idea behind this is that sometimes it is convenient (for the
2320programmer) to consider floating-point values as approximations to
2321infinitely precise real numbers. If you are doing this, then you need
2322to compute (by analysing the code, or in some other way) the maximum or
2323likely maximum error that the computation introduces, and allow for it
2324when performing comparisons (and when producing output, but that's a
2325different problem). In particular, instead of testing for equality, you
2326would check to see whether the two values have ranges that overlap; and
2327this is done with the relational operators, so equality comparisons are
2328probably mistaken.
2329
aee96fe9 2330@item -Wtraditional @r{(C only)}
cd3bb277 2331@opindex Wtraditional
74291a4b 2332Warn about certain constructs that behave differently in traditional and
161d7b59 2333ISO C@. Also warn about ISO C constructs that have no traditional C
c8abc684 2334equivalent, and/or problematic constructs which should be avoided.
74291a4b
MM
2335
2336@itemize @bullet
2337@item
da312b55
NB
2338Macro parameters that appear within string literals in the macro body.
2339In traditional C macro replacement takes place within string literals,
161d7b59 2340but does not in ISO C@.
da312b55
NB
2341
2342@item
2343In traditional C, some preprocessor directives did not exist.
2344Traditional preprocessors would only consider a line to be a directive
2345if the @samp{#} appeared in column 1 on the line. Therefore
630d3d5a 2346@option{-Wtraditional} warns about directives that traditional C
da312b55
NB
2347understands but would ignore because the @samp{#} does not appear as the
2348first character on the line. It also suggests you hide directives like
2349@samp{#pragma} not understood by traditional C by indenting them. Some
c21cd8b1 2350traditional implementations would not recognize @samp{#elif}, so it
da312b55
NB
2351suggests avoiding it altogether.
2352
2353@item
2354A function-like macro that appears without arguments.
2355
2356@item
2357The unary plus operator.
2358
2359@item
c771326b
JM
2360The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2361constant suffixes. (Traditional C does support the @samp{L} suffix on integer
da312b55 2362constants.) Note, these suffixes appear in macros defined in the system
e979f9e8 2363headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
c8abc684
KG
2364Use of these macros in user code might normally lead to spurious
2365warnings, however gcc's integrated preprocessor has enough context to
2366avoid warning in these cases.
74291a4b
MM
2367
2368@item
2369A function declared external in one block and then used after the end of
2370the block.
2371
2372@item
2373A @code{switch} statement has an operand of type @code{long}.
db838bb8
KG
2374
2375@item
2376A non-@code{static} function declaration follows a @code{static} one.
2377This construct is not accepted by some traditional C compilers.
48776cde
KG
2378
2379@item
c1030c7c 2380The ISO type of an integer constant has a different width or
48776cde 2381signedness from its traditional type. This warning is only issued if
e979f9e8 2382the base of the constant is ten. I.e.@: hexadecimal or octal values, which
48776cde 2383typically represent bit patterns, are not warned about.
bb66adca
KG
2384
2385@item
c1030c7c 2386Usage of ISO string concatenation is detected.
7f094a94 2387
895ea614
KG
2388@item
2389Initialization of automatic aggregates.
2390
2391@item
2392Identifier conflicts with labels. Traditional C lacks a separate
2393namespace for labels.
253b6b82
KG
2394
2395@item
2396Initialization of unions. If the initializer is zero, the warning is
2397omitted. This is done under the assumption that the zero initializer in
e979f9e8 2398user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
253b6b82
KG
2399initializer warnings and relies on default initialization to zero in the
2400traditional C case.
03829ad2
KG
2401
2402@item
3ed56f8a
KG
2403Conversions by prototypes between fixed/floating point values and vice
2404versa. The absence of these prototypes when compiling with traditional
2405C would cause serious problems. This is a subset of the possible
630d3d5a 2406conversion warnings, for the full set use @option{-Wconversion}.
74291a4b
MM
2407@end itemize
2408
861bb6c1 2409@item -Wundef
cd3bb277 2410@opindex Wundef
861bb6c1
JL
2411Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2412
74291a4b 2413@item -Wshadow
cd3bb277 2414@opindex Wshadow
d773df5a
DB
2415Warn whenever a local variable shadows another local variable, parameter or
2416global variable or whenever a built-in function is shadowed.
74291a4b 2417
74291a4b 2418@item -Wlarger-than-@var{len}
cd3bb277 2419@opindex Wlarger-than
74291a4b
MM
2420Warn whenever an object of larger than @var{len} bytes is defined.
2421
2422@item -Wpointer-arith
cd3bb277 2423@opindex Wpointer-arith
74291a4b
MM
2424Warn about anything that depends on the ``size of'' a function type or
2425of @code{void}. GNU C assigns these types a size of 1, for
2426convenience in calculations with @code{void *} pointers and pointers
2427to functions.
2428
aee96fe9 2429@item -Wbad-function-cast @r{(C only)}
cd3bb277 2430@opindex Wbad-function-cast
74291a4b
MM
2431Warn whenever a function call is cast to a non-matching type.
2432For example, warn if @code{int malloc()} is cast to @code{anything *}.
2433
2434@item -Wcast-qual
cd3bb277 2435@opindex Wcast-qual
74291a4b
MM
2436Warn whenever a pointer is cast so as to remove a type qualifier from
2437the target type. For example, warn if a @code{const char *} is cast
2438to an ordinary @code{char *}.
2439
2440@item -Wcast-align
cd3bb277 2441@opindex Wcast-align
74291a4b
MM
2442Warn whenever a pointer is cast such that the required alignment of the
2443target is increased. For example, warn if a @code{char *} is cast to
2444an @code{int *} on machines where integers can only be accessed at
2445two- or four-byte boundaries.
2446
2447@item -Wwrite-strings
cd3bb277 2448@opindex Wwrite-strings
aee96fe9
JM
2449When compiling C, give string constants the type @code{const
2450char[@var{length}]} so that
74291a4b 2451copying the address of one into a non-@code{const} @code{char *}
aee96fe9
JM
2452pointer will get a warning; when compiling C++, warn about the
2453deprecated conversion from string constants to @code{char *}.
2454These warnings will help you find at
74291a4b
MM
2455compile time code that can try to write into a string constant, but
2456only if you have been very careful about using @code{const} in
2457declarations and prototypes. Otherwise, it will just be a nuisance;
630d3d5a 2458this is why we did not make @option{-Wall} request these warnings.
74291a4b
MM
2459
2460@item -Wconversion
cd3bb277 2461@opindex Wconversion
74291a4b
MM
2462Warn if a prototype causes a type conversion that is different from what
2463would happen to the same argument in the absence of a prototype. This
2464includes conversions of fixed point to floating and vice versa, and
2465conversions changing the width or signedness of a fixed point argument
2466except when the same as the default promotion.
2467
2468Also, warn if a negative integer constant expression is implicitly
2469converted to an unsigned type. For example, warn about the assignment
2470@code{x = -1} if @code{x} is unsigned. But do not warn about explicit
2471casts like @code{(unsigned) -1}.
2472
e9a25f70 2473@item -Wsign-compare
cd3bb277 2474@opindex Wsign-compare
e9a25f70
JL
2475@cindex warning for comparison of signed and unsigned values
2476@cindex comparison of signed and unsigned values, warning
2477@cindex signed and unsigned values, comparison warning
2478Warn when a comparison between signed and unsigned values could produce
2479an incorrect result when the signed value is converted to unsigned.
630d3d5a
JM
2480This warning is also enabled by @option{-W}; to get the other warnings
2481of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}.
e9a25f70 2482
74291a4b 2483@item -Waggregate-return
cd3bb277 2484@opindex Waggregate-return
74291a4b
MM
2485Warn if any functions that return structures or unions are defined or
2486called. (In languages where you can return an array, this also elicits
2487a warning.)
2488
aee96fe9 2489@item -Wstrict-prototypes @r{(C only)}
cd3bb277 2490@opindex Wstrict-prototypes
74291a4b
MM
2491Warn if a function is declared or defined without specifying the
2492argument types. (An old-style function definition is permitted without
2493a warning if preceded by a declaration which specifies the argument
2494types.)
2495
aee96fe9 2496@item -Wmissing-prototypes @r{(C only)}
cd3bb277 2497@opindex Wmissing-prototypes
74291a4b
MM
2498Warn if a global function is defined without a previous prototype
2499declaration. This warning is issued even if the definition itself
2500provides a prototype. The aim is to detect global functions that fail
2501to be declared in header files.
2502
2503@item -Wmissing-declarations
cd3bb277 2504@opindex Wmissing-declarations
74291a4b
MM
2505Warn if a global function is defined without a previous declaration.
2506Do so even if the definition itself provides a prototype.
2507Use this option to detect global functions that are not declared in
2508header files.
2509
0ca3fb0a 2510@item -Wmissing-noreturn
cd3bb277 2511@opindex Wmissing-noreturn
0ca3fb0a
KG
2512Warn about functions which might be candidates for attribute @code{noreturn}.
2513Note these are only possible candidates, not absolute ones. Care should
2514be taken to manually verify functions actually do not ever return before
2515adding the @code{noreturn} attribute, otherwise subtle code generation
21c7361e
AJ
2516bugs could be introduced. You will not get a warning for @code{main} in
2517hosted C environments.
0ca3fb0a 2518
74ff4629 2519@item -Wmissing-format-attribute
cd3bb277
JM
2520@opindex Wmissing-format-attribute
2521@opindex Wformat
630d3d5a 2522If @option{-Wformat} is enabled, also warn about functions which might be
74ff4629
JM
2523candidates for @code{format} attributes. Note these are only possible
2524candidates, not absolute ones. GCC will guess that @code{format}
2525attributes might be appropriate for any function that calls a function
2526like @code{vprintf} or @code{vscanf}, but this might not always be the
2527case, and some functions for which @code{format} attributes are
2528appropriate may not be detected. This option has no effect unless
630d3d5a 2529@option{-Wformat} is enabled (possibly by @option{-Wall}).
74ff4629 2530
e23bd218
IR
2531@item -Wno-deprecated-declarations
2532@opindex Wno-deprecated-declarations
2533Do not warn about uses of functions, variables, and types marked as
2534deprecated by using the @code{deprecated} attribute.
2535(@pxref{Function Attributes}, @pxref{Variable Attributes},
2536@pxref{Type Attributes}.)
2537
3c12fcc2 2538@item -Wpacked
cd3bb277 2539@opindex Wpacked
3c12fcc2 2540Warn if a structure is given the packed attribute, but the packed
02f52e19 2541attribute has no effect on the layout or size of the structure.
3c12fcc2
GM
2542Such structures may be mis-aligned for little benefit. For
2543instance, in this code, the variable @code{f.x} in @code{struct bar}
2544will be misaligned even though @code{struct bar} does not itself
2545have the packed attribute:
2546
2547@smallexample
2548@group
2549struct foo @{
2550 int x;
2551 char a, b, c, d;
2552@} __attribute__((packed));
2553struct bar @{
2554 char z;
2555 struct foo f;
2556@};
2557@end group
2558@end smallexample
2559
2560@item -Wpadded
cd3bb277 2561@opindex Wpadded
3c12fcc2
GM
2562Warn if padding is included in a structure, either to align an element
2563of the structure or to align the whole structure. Sometimes when this
2564happens it is possible to rearrange the fields of the structure to
2565reduce the padding and so make the structure smaller.
2566
74291a4b 2567@item -Wredundant-decls
cd3bb277 2568@opindex Wredundant-decls
74291a4b
MM
2569Warn if anything is declared more than once in the same scope, even in
2570cases where multiple declaration is valid and changes nothing.
2571
aee96fe9 2572@item -Wnested-externs @r{(C only)}
cd3bb277 2573@opindex Wnested-externs
252215a7 2574Warn if an @code{extern} declaration is encountered within a function.
74291a4b 2575
312f6255 2576@item -Wunreachable-code
cd3bb277 2577@opindex Wunreachable-code
312f6255
GK
2578Warn if the compiler detects that code will never be executed.
2579
2580This option is intended to warn when the compiler detects that at
2581least a whole line of source code will never be executed, because
2582some condition is never satisfied or because it is after a
2583procedure that never returns.
2584
2585It is possible for this option to produce a warning even though there
2586are circumstances under which part of the affected line can be executed,
2587so care should be taken when removing apparently-unreachable code.
2588
2589For instance, when a function is inlined, a warning may mean that the
02f52e19 2590line is unreachable in only one inlined copy of the function.
312f6255 2591
630d3d5a 2592This option is not made part of @option{-Wall} because in a debugging
312f6255
GK
2593version of a program there is often substantial code which checks
2594correct functioning of the program and is, hopefully, unreachable
2595because the program does work. Another common use of unreachable
c21cd8b1 2596code is to provide behavior which is selectable at compile-time.
312f6255 2597
74291a4b 2598@item -Winline
cd3bb277 2599@opindex Winline
c5c76735 2600Warn if a function can not be inlined and it was declared as inline.
74291a4b 2601
795add94 2602@item -Wlong-long
cd3bb277
JM
2603@opindex Wlong-long
2604@opindex Wno-long-long
795add94 2605Warn if @samp{long long} type is used. This is default. To inhibit
630d3d5a
JM
2606the warning messages, use @option{-Wno-long-long}. Flags
2607@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2608only when @option{-pedantic} flag is used.
795add94 2609
18424ae1 2610@item -Wdisabled-optimization
cd3bb277 2611@opindex Wdisabled-optimization
18424ae1
BL
2612Warn if a requested optimization pass is disabled. This warning does
2613not generally indicate that there is anything wrong with your code; it
2614merely indicates that GCC's optimizers were unable to handle the code
2615effectively. Often, the problem is that your code is too big or too
2616complex; GCC will refuse to optimize programs when the optimization
2617itself is likely to take inordinate amounts of time.
2618
74291a4b 2619@item -Werror
cd3bb277 2620@opindex Werror
74291a4b
MM
2621Make all warnings into errors.
2622@end table
2623
2624@node Debugging Options
0c2d1a2a 2625@section Options for Debugging Your Program or GCC
74291a4b
MM
2626@cindex options, debugging
2627@cindex debugging information options
2628
0c2d1a2a 2629GCC has various special options that are used for debugging
74291a4b
MM
2630either your program or GCC:
2631
2642624b 2632@table @gcctabopt
74291a4b 2633@item -g
cd3bb277 2634@opindex g
74291a4b 2635Produce debugging information in the operating system's native format
161d7b59 2636(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
74291a4b
MM
2637information.
2638
630d3d5a 2639On most systems that use stabs format, @option{-g} enables use of extra
74291a4b
MM
2640debugging information that only GDB can use; this extra information
2641makes debugging work better in GDB but will probably make other debuggers
2642crash or
2643refuse to read the program. If you want to control for certain whether
630d3d5a 2644to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
5f98259a
RK
2645@option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1},
2646or @option{-gvms} (see below).
74291a4b 2647
630d3d5a
JM
2648Unlike most other C compilers, GCC allows you to use @option{-g} with
2649@option{-O}. The shortcuts taken by optimized code may occasionally
74291a4b
MM
2650produce surprising results: some variables you declared may not exist
2651at all; flow of control may briefly move where you did not expect it;
2652some statements may not be executed because they compute constant
2653results or their values were already at hand; some statements may
2654execute in different places because they were moved out of loops.
2655
2656Nevertheless it proves possible to debug optimized output. This makes
2657it reasonable to use the optimizer for programs that might have bugs.
2658
0c2d1a2a 2659The following options are useful when GCC is generated with the
74291a4b
MM
2660capability for more than one debugging format.
2661
2662@item -ggdb
cd3bb277 2663@opindex ggdb
161d7b59 2664Produce debugging information for use by GDB@. This means to use the
861bb6c1
JL
2665most expressive format available (DWARF 2, stabs, or the native format
2666if neither of those are supported), including GDB extensions if at all
2667possible.
74291a4b
MM
2668
2669@item -gstabs
cd3bb277 2670@opindex gstabs
74291a4b
MM
2671Produce debugging information in stabs format (if that is supported),
2672without GDB extensions. This is the format used by DBX on most BSD
2673systems. On MIPS, Alpha and System V Release 4 systems this option
161d7b59 2674produces stabs debugging output which is not understood by DBX or SDB@.
74291a4b
MM
2675On System V Release 4 systems this option requires the GNU assembler.
2676
2677@item -gstabs+
cd3bb277 2678@opindex gstabs+
74291a4b 2679Produce debugging information in stabs format (if that is supported),
161d7b59 2680using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
2681use of these extensions is likely to make other debuggers crash or
2682refuse to read the program.
2683
2684@item -gcoff
cd3bb277 2685@opindex gcoff
74291a4b
MM
2686Produce debugging information in COFF format (if that is supported).
2687This is the format used by SDB on most System V systems prior to
2688System V Release 4.
2689
2690@item -gxcoff
cd3bb277 2691@opindex gxcoff
74291a4b
MM
2692Produce debugging information in XCOFF format (if that is supported).
2693This is the format used by the DBX debugger on IBM RS/6000 systems.
2694
2695@item -gxcoff+
cd3bb277 2696@opindex gxcoff+
74291a4b 2697Produce debugging information in XCOFF format (if that is supported),
161d7b59 2698using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
2699use of these extensions is likely to make other debuggers crash or
2700refuse to read the program, and may cause assemblers other than the GNU
2701assembler (GAS) to fail with an error.
2702
2703@item -gdwarf
cd3bb277 2704@opindex gdwarf
861bb6c1
JL
2705Produce debugging information in DWARF version 1 format (if that is
2706supported). This is the format used by SDB on most System V Release 4
2707systems.
74291a4b
MM
2708
2709@item -gdwarf+
cd3bb277 2710@opindex gdwarf+
861bb6c1
JL
2711Produce debugging information in DWARF version 1 format (if that is
2712supported), using GNU extensions understood only by the GNU debugger
161d7b59 2713(GDB)@. The use of these extensions is likely to make other debuggers
861bb6c1
JL
2714crash or refuse to read the program.
2715
2716@item -gdwarf-2
cd3bb277 2717@opindex gdwarf-2
861bb6c1
JL
2718Produce debugging information in DWARF version 2 format (if that is
2719supported). This is the format used by DBX on IRIX 6.
74291a4b 2720
5f98259a
RK
2721@item -gvms
2722@opindex gvms
2723Produce debugging information in VMS debug format (if that is
2724supported). This is the format used by DEBUG on VMS systems.
2725
74291a4b
MM
2726@item -g@var{level}
2727@itemx -ggdb@var{level}
2728@itemx -gstabs@var{level}
2729@itemx -gcoff@var{level}
2730@itemx -gxcoff@var{level}
2731@itemx -gdwarf@var{level}
861bb6c1 2732@itemx -gdwarf-2@var{level}
5f98259a 2733@itemx -gvms@var{level}
74291a4b
MM
2734Request debugging information and also use @var{level} to specify how
2735much information. The default level is 2.
2736
2737Level 1 produces minimal information, enough for making backtraces in
2738parts of the program that you don't plan to debug. This includes
2739descriptions of functions and external variables, but no information
2740about local variables and no line numbers.
2741
2742Level 3 includes extra information, such as all the macro definitions
2743present in the program. Some debuggers support macro expansion when
630d3d5a 2744you use @option{-g3}.
74291a4b
MM
2745
2746@cindex @code{prof}
2747@item -p
cd3bb277 2748@opindex p
74291a4b
MM
2749Generate extra code to write profile information suitable for the
2750analysis program @code{prof}. You must use this option when compiling
2751the source files you want data about, and you must also use it when
2752linking.
2753
2754@cindex @code{gprof}
2755@item -pg
cd3bb277 2756@opindex pg
74291a4b
MM
2757Generate extra code to write profile information suitable for the
2758analysis program @code{gprof}. You must use this option when compiling
2759the source files you want data about, and you must also use it when
2760linking.
2761
2762@cindex @code{tcov}
2763@item -a
cd3bb277 2764@opindex a
74291a4b
MM
2765Generate extra code to write profile information for basic blocks, which will
2766record the number of times each basic block is executed, the basic block start
630d3d5a 2767address, and the function name containing the basic block. If @option{-g} is
74291a4b
MM
2768used, the line number and filename of the start of the basic block will also be
2769recorded. If not overridden by the machine description, the default action is
2770to append to the text file @file{bb.out}.
2771
2772This data could be analyzed by a program like @code{tcov}. Note,
2773however, that the format of the data is not what @code{tcov} expects.
2774Eventually GNU @code{gprof} should be extended to process this data.
2775
898f531b 2776@item -Q
cd3bb277 2777@opindex Q
898f531b
JL
2778Makes the compiler print out each function name as it is compiled, and
2779print some statistics about each pass when it finishes.
2780
1f0c3120 2781@item -ftime-report
cd3bb277 2782@opindex ftime-report
1f0c3120
JM
2783Makes the compiler print some statistics about the time consumed by each
2784pass when it finishes.
2785
2786@item -fmem-report
cd3bb277 2787@opindex fmem-report
1f0c3120
JM
2788Makes the compiler print some statistics about permanent memory
2789allocation when it finishes.
2790
861bb6c1 2791@item -fprofile-arcs
cd3bb277 2792@opindex fprofile-arcs
3de87bf2
JJ
2793Instrument @dfn{arcs} during compilation to generate coverage data
2794or for profile-directed block ordering. During execution the program
2795records how many times each branch is executed and how many times it is
2796taken. When the compiled program exits it saves this data to a file
2797called @file{@var{sourcename}.da} for each source file.
2798
2799For profile-directed block ordering, compile the program with
2800@option{-fprofile-arcs} plus optimization and code generation options,
2801generate the arc profile information by running the program on a
2802selected workload, and then compile the program again with the same
2803optimization and code generation options plus
630d3d5a 2804@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
3de87bf2
JJ
2805Control Optimization}).
2806
2807The other use of @option{-fprofile-arcs} is for use with @code{gcov},
2808when it is used with the @option{-ftest-coverage} option. GCC
2809supports two methods of determining code coverage: the options that
2810support @code{gcov}, and options @option{-a} and @option{-ax}, which
2811write information to text files. The options that support @code{gcov}
2812do not need to instrument every arc in the program, so a program compiled
2813with them runs faster than a program compiled with @option{-a}, which
2814adds instrumentation code to every basic block in the program. The
2815tradeoff: since @code{gcov} does not have execution counts for all
2816branches, it must start with the execution counts for the instrumented
2817branches, and then iterate over the program flow graph until the entire
2818graph has been solved. Hence, @code{gcov} runs a little more slowly than
2819a program which uses information from @option{-a} and @option{-ax}.
2820
2821With @option{-fprofile-arcs}, for each function of your program GCC
2822creates a program flow graph, then finds a spanning tree for the graph.
2823Only arcs that are not on the spanning tree have to be instrumented: the
2824compiler adds code to count the number of times that these arcs are
2825executed. When an arc is the only exit or only entrance to a block, the
2826instrumentation code can be added to the block; otherwise, a new basic
2827block must be created to hold the instrumentation code.
2828
2829This option makes it possible to estimate branch probabilities and to
2830calculate basic block execution counts. In general, basic block
2831execution counts as provided by @option{-a} do not give enough
2832information to estimate all branch probabilities.
861bb6c1
JL
2833
2834@need 2000
2835@item -ftest-coverage
cd3bb277 2836@opindex ftest-coverage
861bb6c1 2837Create data files for the @code{gcov} code-coverage utility
0c2d1a2a 2838(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}).
861bb6c1
JL
2839The data file names begin with the name of your source file:
2840
2642624b 2841@table @gcctabopt
861bb6c1
JL
2842@item @var{sourcename}.bb
2843A mapping from basic blocks to line numbers, which @code{gcov} uses to
2844associate basic block execution counts with line numbers.
2845
2846@item @var{sourcename}.bbg
2847A list of all arcs in the program flow graph. This allows @code{gcov}
2848to reconstruct the program flow graph, so that it can compute all basic
2849block and arc execution counts from the information in the
3de87bf2 2850@code{@var{sourcename}.da} file.
861bb6c1
JL
2851@end table
2852
3de87bf2
JJ
2853Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter
2854option adds instrumentation to the program, which then writes
2855execution counts to another data file:
2856
2857@table @gcctabopt
2858@item @var{sourcename}.da
2859Runtime arc execution counts, used in conjunction with the arc
2860information in the file @code{@var{sourcename}.bbg}.
2861@end table
2862
2863Coverage data will map better to the source files if
2864@option{-ftest-coverage} is used without optimization.
2865
74291a4b 2866@item -d@var{letters}
cd3bb277 2867@opindex d
74291a4b
MM
2868Says to make debugging dumps during compilation at times specified by
2869@var{letters}. This is used for debugging the compiler. The file names
375e2d5c 2870for most of the dumps are made by appending a pass number and a word to
02f52e19 2871the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}).
375e2d5c 2872Here are the possible letters for use in @var{letters}, and their meanings:
74291a4b
MM
2873
2874@table @samp
375e2d5c 2875@item A
cd3bb277 2876@opindex dA
375e2d5c 2877Annotate the assembler output with miscellaneous debugging information.
956d6950 2878@item b
cd3bb277 2879@opindex db
0b47e4c1 2880Dump after computing branch probabilities, to @file{@var{file}.14.bp}.
48d9ade5 2881@item B
cd3bb277 2882@opindex dB
0b47e4c1 2883Dump after block reordering, to @file{@var{file}.28.bbro}.
032713aa 2884@item c
cd3bb277 2885@opindex dc
0b47e4c1 2886Dump after instruction combination, to the file @file{@var{file}.16.combine}.
470fc13d 2887@item C
cd3bb277 2888@opindex dC
0b47e4c1 2889Dump after the first if conversion, to the file @file{@var{file}.17.ce}.
032713aa 2890@item d
cd3bb277 2891@opindex dd
0b47e4c1 2892Dump after delayed branch scheduling, to @file{@var{file}.31.dbr}.
032713aa 2893@item D
cd3bb277 2894@opindex dD
f5963e61
JL
2895Dump all macro definitions, at the end of preprocessing, in addition to
2896normal output.
48d9ade5 2897@item e
cd3bb277 2898@opindex de
0826f1d8 2899Dump after SSA optimizations, to @file{@var{file}.04.ssa} and
0b47e4c1 2900@file{@var{file}.07.ussa}.
470fc13d 2901@item E
cd3bb277 2902@opindex dE
0b47e4c1 2903Dump after the second if conversion, to @file{@var{file}.26.ce2}.
74291a4b 2904@item f
cd3bb277 2905@opindex df
0b47e4c1 2906Dump after life analysis, to @file{@var{file}.15.life}.
48d9ade5 2907@item F
cd3bb277 2908@opindex dF
0b47e4c1 2909Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.09.addressof}.
74291a4b 2910@item g
cd3bb277 2911@opindex dg
0b47e4c1 2912Dump after global register allocation, to @file{@var{file}.21.greg}.
0826f1d8
JL
2913@item h
2914@opindex dh
2915Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
2916@item o
cd3bb277 2917@opindex do
9c34dbbf 2918Dump after post-reload optimizations, to @file{@var{file}.22.postreload}.
02f52e19 2919@item G
cd3bb277 2920@opindex dG
0b47e4c1 2921Dump after GCSE, to @file{@var{file}.10.gcse}.
48d9ade5 2922@item i
cd3bb277 2923@opindex di
48d9ade5 2924Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
032713aa 2925@item j
cd3bb277 2926@opindex dj
0826f1d8 2927Dump after the first jump optimization, to @file{@var{file}.03.jump}.
74291a4b 2928@item k
cd3bb277 2929@opindex dk
0b47e4c1 2930Dump after conversion from registers to stack, to @file{@var{file}.32.stack}.
032713aa 2931@item l
cd3bb277 2932@opindex dl
0b47e4c1 2933Dump after local register allocation, to @file{@var{file}.20.lreg}.
032713aa 2934@item L
cd3bb277 2935@opindex dL
0b47e4c1 2936Dump after loop optimization, to @file{@var{file}.11.loop}.
032713aa 2937@item M
cd3bb277 2938@opindex dM
032713aa 2939Dump after performing the machine dependent reorganisation pass, to
0b47e4c1 2940@file{@var{file}.30.mach}.
48d9ade5 2941@item n
cd3bb277 2942@opindex dn
0b47e4c1 2943Dump after register renumbering, to @file{@var{file}.25.rnreg}.
032713aa 2944@item N
cd3bb277 2945@opindex dN
0b47e4c1 2946Dump after the register move pass, to @file{@var{file}.18.regmove}.
032713aa 2947@item r
cd3bb277 2948@opindex dr
375e2d5c 2949Dump after RTL generation, to @file{@var{file}.00.rtl}.
032713aa 2950@item R
cd3bb277 2951@opindex dR
9c34dbbf 2952Dump after the second scheduling pass, to @file{@var{file}.27.sched2}.
032713aa 2953@item s
cd3bb277 2954@opindex ds
032713aa 2955Dump after CSE (including the jump optimization that sometimes follows
0b47e4c1 2956CSE), to @file{@var{file}.08.cse}.
032713aa 2957@item S
cd3bb277 2958@opindex dS
9c34dbbf 2959Dump after the first scheduling pass, to @file{@var{file}.19.sched}.
032713aa 2960@item t
cd3bb277 2961@opindex dt
032713aa 2962Dump after the second CSE pass (including the jump optimization that
0b47e4c1 2963sometimes follows CSE), to @file{@var{file}.12.cse2}.
48d9ade5 2964@item w
cd3bb277 2965@opindex dw
0b47e4c1 2966Dump after the second flow pass, to @file{@var{file}.23.flow2}.
470fc13d 2967@item X
cd3bb277 2968@opindex dX
9c34dbbf 2969Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}.
48d9ade5 2970@item z
cd3bb277 2971@opindex dz
0b47e4c1 2972Dump after the peephole pass, to @file{@var{file}.24.peephole2}.
74291a4b 2973@item a
cd3bb277 2974@opindex da
74291a4b
MM
2975Produce all the dumps listed above.
2976@item m
cd3bb277 2977@opindex dm
74291a4b
MM
2978Print statistics on memory usage, at the end of the run, to
2979standard error.
2980@item p
cd3bb277 2981@opindex dp
74291a4b 2982Annotate the assembler output with a comment indicating which
f20b5577
MM
2983pattern and alternative was used. The length of each instruction is
2984also printed.
2856c3e3 2985@item P
cd3bb277 2986@opindex dP
2856c3e3 2987Dump the RTL in the assembler output as a comment before each instruction.
630d3d5a 2988Also turns on @option{-dp} annotation.
375e2d5c 2989@item v
cd3bb277 2990@opindex dv
375e2d5c
RH
2991For each of the other indicated dump files (except for
2992@file{@var{file}.00.rtl}), dump a representation of the control flow graph
b192711e 2993suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
62a1403d 2994@item x
cd3bb277 2995@opindex dx
62a1403d
AS
2996Just generate RTL for a function instead of compiling it. Usually used
2997with @samp{r}.
032713aa 2998@item y
cd3bb277 2999@opindex dy
032713aa 3000Dump debugging information during parsing, to standard error.
74291a4b
MM
3001@end table
3002
b707b450 3003@item -fdump-unnumbered
cd3bb277 3004@opindex fdump-unnumbered
695ac33f 3005When doing debugging dumps (see @option{-d} option above), suppress instruction
b707b450 3006numbers and line number note output. This makes it more feasible to
b192711e 3007use diff on debugging dumps for compiler invocations with different
695ac33f 3008options, in particular with and without @option{-g}.
b707b450 3009
aee96fe9 3010@item -fdump-class-hierarchy @r{(C++ only)}
22367161 3011@itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
cd3bb277 3012@opindex fdump-class-hierarchy
e76b4820 3013Dump a representation of each class's hierarchy and virtual function
767094dd 3014table layout to a file. The file name is made by appending @file{.class}
22367161
NS
3015to the source file name. If the @samp{-@var{options}} form is used,
3016@var{options} controls the details of the dump as described for the
3017@option{-fdump-tree} options.
3018
3019@item -fdump-tree-@var{switch} @r{(C++ only)}
3020@itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3021@opindex fdump-tree
3022Control the dumping at various stages of processing the intermediate
3023language tree to a file. The file name is generated by appending a switch
3024specific suffix to the source file name. If the @samp{-@var{options}}
3025form is used, @var{options} is a list of @samp{-} separated options that
3026control the details of the dump. Not all options are applicable to all
3027dumps, those which are not meaningful will be ignored. The following
3028options are available
f71f87f9 3029
e76b4820 3030@table @samp
22367161 3031@item address
767094dd 3032Print the address of each node. Usually this is not meaningful as it
22367161
NS
3033changes according to the environment and source file. Its primary use
3034is for tying up a dump file with a debug environment.
3035@item slim
3036Inhibit dumping of members of a scope or body of a function merely
3037because that scope has been reached. Only dump such items when they
3038are directly reachable by some other path.
3039@item all
3040Turn on all options.
e76b4820
NS
3041@end table
3042
3043The following tree dumps are possible:
3044@table @samp
3045@item original
3046Dump before any tree based optimization, to @file{@var{file}.original}.
3047@item optimized
3048Dump after all tree based optimization, to @file{@var{file}.optimized}.
6be77748 3049@item inlined
9c34dbbf 3050Dump after function inlining, to @file{@var{file}.inlined}.
e76b4820 3051@end table
9965d119 3052
74291a4b 3053@item -fpretend-float
cd3bb277 3054@opindex fpretend-float
74291a4b
MM
3055When running a cross-compiler, pretend that the target machine uses the
3056same floating point format as the host machine. This causes incorrect
3057output of the actual floating constants, but the actual instruction
0c2d1a2a 3058sequence will probably be the same as GCC would make when running on
74291a4b
MM
3059the target machine.
3060
3061@item -save-temps
cd3bb277 3062@opindex save-temps
74291a4b
MM
3063Store the usual ``temporary'' intermediate files permanently; place them
3064in the current directory and name them based on the source file. Thus,
3065compiling @file{foo.c} with @samp{-c -save-temps} would produce files
f2ecb02d
JM
3066@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
3067preprocessed @file{foo.i} output file even though the compiler now
3068normally uses an integrated preprocessor.
74291a4b 3069
03c41c05 3070@item -time
cd3bb277 3071@opindex time
03c41c05 3072Report the CPU time taken by each subprocess in the compilation
f2ecb02d
JM
3073sequence. For C source files, this is the compiler proper and assembler
3074(plus the linker if linking is done). The output looks like this:
03c41c05
ZW
3075
3076@smallexample
03c41c05
ZW
3077# cc1 0.12 0.01
3078# as 0.00 0.01
3079@end smallexample
3080
3081The first number on each line is the ``user time,'' that is time spent
3082executing the program itself. The second number is ``system time,''
3083time spent executing operating system routines on behalf of the program.
3084Both numbers are in seconds.
3085
74291a4b 3086@item -print-file-name=@var{library}
cd3bb277 3087@opindex print-file-name
74291a4b
MM
3088Print the full absolute name of the library file @var{library} that
3089would be used when linking---and don't do anything else. With this
0c2d1a2a 3090option, GCC does not compile or link anything; it just prints the
74291a4b
MM
3091file name.
3092
b1018de6
AO
3093@item -print-multi-directory
3094@opindex print-multi-directory
3095Print the directory name corresponding to the multilib selected by any
3096other switches present in the command line. This directory is supposed
3097to exist in @env{GCC_EXEC_PREFIX}.
3098
3099@item -print-multi-lib
3100@opindex print-multi-lib
3101Print the mapping from multilib directory names to compiler switches
3102that enable them. The directory name is separated from the switches by
3103@samp{;}, and each switch starts with an @samp{@@} instead of the
3104@samp{-}, without spaces between multiple switches. This is supposed to
3105ease shell-processing.
3106
74291a4b 3107@item -print-prog-name=@var{program}
cd3bb277 3108@opindex print-prog-name
630d3d5a 3109Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
74291a4b
MM
3110
3111@item -print-libgcc-file-name
cd3bb277 3112@opindex print-libgcc-file-name
630d3d5a 3113Same as @option{-print-file-name=libgcc.a}.
74291a4b 3114
630d3d5a 3115This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
74291a4b
MM
3116but you do want to link with @file{libgcc.a}. You can do
3117
3118@example
3119gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3120@end example
3121
3122@item -print-search-dirs
cd3bb277 3123@opindex print-search-dirs
74291a4b
MM
3124Print the name of the configured installation directory and a list of
3125program and library directories gcc will search---and don't do anything else.
3126
3127This is useful when gcc prints the error message
3c0b7970
JM
3128@samp{installation problem, cannot exec cpp0: No such file or directory}.
3129To resolve this you either need to put @file{cpp0} and the other compiler
74291a4b 3130components where gcc expects to find them, or you can set the environment
bedc7537 3131variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
74291a4b
MM
3132Don't forget the trailing '/'.
3133@xref{Environment Variables}.
1f0c3120
JM
3134
3135@item -dumpmachine
cd3bb277 3136@opindex dumpmachine
1f0c3120
JM
3137Print the compiler's target machine (for example,
3138@samp{i686-pc-linux-gnu})---and don't do anything else.
3139
3140@item -dumpversion
cd3bb277 3141@opindex dumpversion
1f0c3120
JM
3142Print the compiler version (for example, @samp{3.0})---and don't do
3143anything else.
3144
3145@item -dumpspecs
cd3bb277 3146@opindex dumpspecs
1f0c3120
JM
3147Print the compiler's built-in specs---and don't do anything else. (This
3148is used when GCC itself is being built.) @xref{Spec Files}.
74291a4b
MM
3149@end table
3150
3151@node Optimize Options
3152@section Options That Control Optimization
3153@cindex optimize options
3154@cindex options, optimization
3155
3156These options control various sorts of optimizations:
3157
2642624b 3158@table @gcctabopt
74291a4b
MM
3159@item -O
3160@itemx -O1
cd3bb277
JM
3161@opindex O
3162@opindex O1
74291a4b
MM
3163Optimize. Optimizing compilation takes somewhat more time, and a lot
3164more memory for a large function.
3165
630d3d5a 3166Without @option{-O}, the compiler's goal is to reduce the cost of
74291a4b
MM
3167compilation and to make debugging produce the expected results.
3168Statements are independent: if you stop the program with a breakpoint
3169between statements, you can then assign a new value to any variable or
3170change the program counter to any other statement in the function and
3171get exactly the results you would expect from the source code.
3172
630d3d5a 3173With @option{-O}, the compiler tries to reduce code size and execution
9c34dbbf
ZW
3174time, without performing any optimizations that take a great deal of
3175compilation time.
74291a4b
MM
3176
3177@item -O2
cd3bb277 3178@opindex O2
0c2d1a2a 3179Optimize even more. GCC performs nearly all supported optimizations
74291a4b 3180that do not involve a space-speed tradeoff. The compiler does not
630d3d5a
JM
3181perform loop unrolling or function inlining when you specify @option{-O2}.
3182As compared to @option{-O}, this option increases both compilation time
74291a4b
MM
3183and the performance of the generated code.
3184
630d3d5a 3185@option{-O2} turns on all optional optimizations except for loop unrolling,
2b2a8f1f 3186function inlining, and register renaming. It also turns on the
630d3d5a 3187@option{-fforce-mem} option on all machines and frame pointer elimination
2b2a8f1f 3188on machines where doing so does not interfere with debugging.
74291a4b 3189
081ca317
BL
3190Please note the warning under @option{-fgcse} about
3191invoking @option{-O2} on programs that use computed gotos.
3192
74291a4b 3193@item -O3
cd3bb277 3194@opindex O3
630d3d5a
JM
3195Optimize yet more. @option{-O3} turns on all optimizations specified by
3196@option{-O2} and also turns on the @option{-finline-functions} and
3197@option{-frename-registers} options.
74291a4b
MM
3198
3199@item -O0
cd3bb277 3200@opindex O0
74291a4b
MM
3201Do not optimize.
3202
c6aded7c 3203@item -Os
cd3bb277 3204@opindex Os
630d3d5a 3205Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
c6aded7c
AG
3206do not typically increase code size. It also performs further
3207optimizations designed to reduce code size.
3208
630d3d5a 3209If you use multiple @option{-O} options, with or without level numbers,
74291a4b
MM
3210the last such option is the one that is effective.
3211@end table
3212
630d3d5a 3213Options of the form @option{-f@var{flag}} specify machine-independent
74291a4b 3214flags. Most flags have both positive and negative forms; the negative
630d3d5a 3215form of @option{-ffoo} would be @option{-fno-foo}. In the table below,
74291a4b
MM
3216only one of the forms is listed---the one which is not the default.
3217You can figure out the other form by either removing @samp{no-} or
3218adding it.
3219
2642624b 3220@table @gcctabopt
74291a4b 3221@item -ffloat-store
cd3bb277 3222@opindex ffloat-store
74291a4b
MM
3223Do not store floating point variables in registers, and inhibit other
3224options that might change whether a floating point value is taken from a
3225register or memory.
3226
3227@cindex floating point precision
3228This option prevents undesirable excess precision on machines such as
3229the 68000 where the floating registers (of the 68881) keep more
3230precision than a @code{double} is supposed to have. Similarly for the
3231x86 architecture. For most programs, the excess precision does only
3232good, but a few programs rely on the precise definition of IEEE floating
630d3d5a 3233point. Use @option{-ffloat-store} for such programs, after modifying
6fd74494 3234them to store all pertinent intermediate computations into variables.
74291a4b
MM
3235
3236@item -fno-default-inline
cd3bb277 3237@opindex fno-default-inline
74291a4b
MM
3238Do not make member functions inline by default merely because they are
3239defined inside the class scope (C++ only). Otherwise, when you specify
630d3d5a 3240@w{@option{-O}}, member functions defined inside class scope are compiled
74291a4b
MM
3241inline by default; i.e., you don't need to add @samp{inline} in front of
3242the member function name.
3243
3244@item -fno-defer-pop
cd3bb277 3245@opindex fno-defer-pop
74291a4b
MM
3246Always pop the arguments to each function call as soon as that function
3247returns. For machines which must pop arguments after a function call,
3248the compiler normally lets arguments accumulate on the stack for several
3249function calls and pops them all at once.
3250
3251@item -fforce-mem
cd3bb277 3252@opindex fforce-mem
74291a4b
MM
3253Force memory operands to be copied into registers before doing
3254arithmetic on them. This produces better code by making all memory
3255references potential common subexpressions. When they are not common
3256subexpressions, instruction combination should eliminate the separate
630d3d5a 3257register-load. The @option{-O2} option turns on this option.
74291a4b
MM
3258
3259@item -fforce-addr
cd3bb277 3260@opindex fforce-addr
74291a4b
MM
3261Force memory address constants to be copied into registers before
3262doing arithmetic on them. This may produce better code just as
630d3d5a 3263@option{-fforce-mem} may.
74291a4b
MM
3264
3265@item -fomit-frame-pointer
cd3bb277 3266@opindex fomit-frame-pointer
74291a4b
MM
3267Don't keep the frame pointer in a register for functions that
3268don't need one. This avoids the instructions to save, set up and
3269restore frame pointers; it also makes an extra register available
3270in many functions. @strong{It also makes debugging impossible on
3271some machines.}
3272
8aeea6e6 3273On some machines, such as the VAX, this flag has no effect, because
74291a4b
MM
3274the standard calling sequence automatically handles the frame pointer
3275and nothing is saved by pretending it doesn't exist. The
3276machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3277whether a target machine supports this flag. @xref{Registers,,Register
b11cc610 3278Usage, gccint, GNU Compiler Collection (GCC) Internals}.
74291a4b 3279
1aaef9c1 3280@item -foptimize-sibling-calls
cd3bb277 3281@opindex foptimize-sibling-calls
1aaef9c1
JH
3282Optimize sibling and tail recursive calls.
3283
91ce572a 3284@item -ftrapv
cd3bb277 3285@opindex ftrapv
91ce572a
CC
3286This option generates traps for signed overflow on addition, subtraction,
3287multiplication operations.
3288
74291a4b 3289@item -fno-inline
cd3bb277 3290@opindex fno-inline
74291a4b
MM
3291Don't pay attention to the @code{inline} keyword. Normally this option
3292is used to keep the compiler from expanding any functions inline.
3293Note that if you are not optimizing, no functions can be expanded inline.
3294
3295@item -finline-functions
cd3bb277 3296@opindex finline-functions
74291a4b
MM
3297Integrate all simple functions into their callers. The compiler
3298heuristically decides which functions are simple enough to be worth
3299integrating in this way.
3300
3301If all calls to a given function are integrated, and the function is
3302declared @code{static}, then the function is normally not output as
3303assembler code in its own right.
3304
efa3896a 3305@item -finline-limit=@var{n}
cd3bb277 3306@opindex finline-limit
f9e814f1
TP
3307By default, gcc limits the size of functions that can be inlined. This flag
3308allows the control of this limit for functions that are explicitly marked as
02f52e19
AJ
3309inline (ie marked with the inline keyword or defined within the class
3310definition in c++). @var{n} is the size of functions that can be inlined in
f9e814f1 3311number of pseudo instructions (not counting parameter handling). The default
93ee12c4
GP
3312value of @var{n} is 600.
3313Increasing this value can result in more inlined code at
f9e814f1 3314the cost of compilation time and memory consumption. Decreasing usually makes
02f52e19
AJ
3315the compilation faster and less code will be inlined (which presumably
3316means slower programs). This option is particularly useful for programs that
aee96fe9 3317use inlining heavily such as those based on recursive templates with C++.
f9e814f1
TP
3318
3319@emph{Note:} pseudo instruction represents, in this particular context, an
3320abstract measurement of function's size. In no way, it represents a count
3321of assembly instructions and as such its exact meaning might change from one
3322release to an another.
3323
74291a4b 3324@item -fkeep-inline-functions
cd3bb277 3325@opindex fkeep-inline-functions
74291a4b
MM
3326Even if all calls to a given function are integrated, and the function
3327is declared @code{static}, nevertheless output a separate run-time
3328callable version of the function. This switch does not affect
3329@code{extern inline} functions.
3330
3331@item -fkeep-static-consts
cd3bb277 3332@opindex fkeep-static-consts
74291a4b
MM
3333Emit variables declared @code{static const} when optimization isn't turned
3334on, even if the variables aren't referenced.
3335
0c2d1a2a 3336GCC enables this option by default. If you want to force the compiler to
74291a4b 3337check if the variable was referenced, regardless of whether or not
630d3d5a 3338optimization is turned on, use the @option{-fno-keep-static-consts} option.
74291a4b 3339
201556f0
JJ
3340@item -fmerge-constants
3341Attempt to merge identical constants (string constants and floating point
3342constants) accross compilation units.
3343
3344This option is default for optimized compilation if assembler and linker
c21cd8b1 3345support it. Use @option{-fno-merge-constants} to inhibit this behavior.
201556f0
JJ
3346
3347@item -fmerge-all-constants
3348Attempt to merge identical constants and identical variables.
3349
3350This option implies @option{-fmerge-constants}. In addition to
3351@option{-fmerge-constants} this considers e.g. even constant initialized
3352arrays or initialized constant variables with integral or floating point
3353types. Languages like C or C++ require each non-automatic variable to
3354have distinct location, so using this option will result in non-conforming
c21cd8b1 3355behavior.
201556f0 3356
74291a4b 3357@item -fno-function-cse
cd3bb277 3358@opindex fno-function-cse
74291a4b
MM
3359Do not put function addresses in registers; make each instruction that
3360calls a constant function contain the function's address explicitly.
3361
3362This option results in less efficient code, but some strange hacks
3363that alter the assembler output may be confused by the optimizations
3364performed when this option is not used.
3365
3366@item -ffast-math
cd3bb277 3367@opindex ffast-math
9c34dbbf
ZW
3368Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, and @*
3369@option{-fno-trapping-math}.
de6c5979 3370
630d3d5a 3371This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
74291a4b 3372
630d3d5a 3373This option should never be turned on by any @option{-O} option since
74291a4b 3374it can result in incorrect output for programs which depend on
c1030c7c 3375an exact implementation of IEEE or ISO rules/specifications for
74291a4b 3376math functions.
9605da8a
BL
3377
3378@item -fno-math-errno
cd3bb277 3379@opindex fno-math-errno
9605da8a
BL
3380Do not set ERRNO after calling math functions that are executed
3381with a single instruction, e.g., sqrt. A program that relies on
3382IEEE exceptions for math error handling may want to use this flag
3383for speed while maintaining IEEE arithmetic compatibility.
3384
630d3d5a 3385This option should never be turned on by any @option{-O} option since
de6c5979
BL
3386it can result in incorrect output for programs which depend on
3387an exact implementation of IEEE or ISO rules/specifications for
3388math functions.
3389
9c34dbbf 3390The default is @option{-fmath-errno}.
de6c5979
BL
3391
3392@item -funsafe-math-optimizations
cd3bb277 3393@opindex funsafe-math-optimizations
de6c5979
BL
3394Allow optimizations for floating-point arithmetic that (a) assume
3395that arguments and results are valid and (b) may violate IEEE or
237b14f7
RH
3396ANSI standards. When used at link-time, it may include libraries
3397or startup files that change the default FPU control word or other
3398similar optimizations.
de6c5979 3399
630d3d5a 3400This option should never be turned on by any @option{-O} option since
de6c5979
BL
3401it can result in incorrect output for programs which depend on
3402an exact implementation of IEEE or ISO rules/specifications for
3403math functions.
3404
9c34dbbf 3405The default is @option{-fno-unsafe-math-optimizations}.
de6c5979
BL
3406
3407@item -fno-trapping-math
cd3bb277 3408@opindex fno-trapping-math
de6c5979
BL
3409Compile code assuming that floating-point operations cannot generate
3410user-visible traps. Setting this option may allow faster code
3411if one relies on ``non-stop'' IEEE arithmetic, for example.
3412
630d3d5a 3413This option should never be turned on by any @option{-O} option since
de6c5979
BL
3414it can result in incorrect output for programs which depend on
3415an exact implementation of IEEE or ISO rules/specifications for
3416math functions.
3417
9c34dbbf 3418The default is @option{-ftrapping-math}.
74291a4b
MM
3419@end table
3420
630d3d5a
JM
3421The following options control specific optimizations. The @option{-O2}
3422option turns on all of these optimizations except @option{-funroll-loops}
3423and @option{-funroll-all-loops}. On most machines, the @option{-O} option
3424turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options,
74291a4b
MM
3425but specific machines may handle it differently.
3426
3427You can use the following flags in the rare cases when ``fine-tuning''
3428of optimizations to be performed is desired.
3429
9c34dbbf
ZW
3430Not all of the optimizations performed by GCC have @option{-f} options
3431to control them.
3432
ad919812 3433@table @gcctabopt
74291a4b 3434@item -fstrength-reduce
cd3bb277 3435@opindex fstrength-reduce
74291a4b
MM
3436Perform the optimizations of loop strength reduction and
3437elimination of iteration variables.
3438
3439@item -fthread-jumps
cd3bb277 3440@opindex fthread-jumps
74291a4b
MM
3441Perform optimizations where we check to see if a jump branches to a
3442location where another comparison subsumed by the first is found. If
3443so, the first branch is redirected to either the destination of the
3444second branch or a point immediately following it, depending on whether
3445the condition is known to be true or false.
3446
3447@item -fcse-follow-jumps
cd3bb277 3448@opindex fcse-follow-jumps
74291a4b
MM
3449In common subexpression elimination, scan through jump instructions
3450when the target of the jump is not reached by any other path. For
3451example, when CSE encounters an @code{if} statement with an
3452@code{else} clause, CSE will follow the jump when the condition
3453tested is false.
3454
3455@item -fcse-skip-blocks
cd3bb277 3456@opindex fcse-skip-blocks
630d3d5a 3457This is similar to @option{-fcse-follow-jumps}, but causes CSE to
74291a4b
MM
3458follow jumps which conditionally skip over blocks. When CSE
3459encounters a simple @code{if} statement with no else clause,
630d3d5a 3460@option{-fcse-skip-blocks} causes CSE to follow the jump around the
74291a4b
MM
3461body of the @code{if}.
3462
3463@item -frerun-cse-after-loop
cd3bb277 3464@opindex frerun-cse-after-loop
74291a4b
MM
3465Re-run common subexpression elimination after loop optimizations has been
3466performed.
3467
6d6d0fa0 3468@item -frerun-loop-opt
cd3bb277 3469@opindex frerun-loop-opt
6d6d0fa0
JL
3470Run the loop optimizer twice.
3471
7506f491 3472@item -fgcse
cd3bb277 3473@opindex fgcse
7506f491
DE
3474Perform a global common subexpression elimination pass.
3475This pass also performs global constant and copy propagation.
3476
081ca317
BL
3477@emph{Note:} When compiling a program using computed gotos, a GCC
3478extension, you may get better runtime performance if you disable
3479the global common subexpression elmination pass by adding
3480@option{-fno-gcse} to the command line.
3481
a13d4ebf 3482@item -fgcse-lm
cd3bb277 3483@opindex fgcse-lm
695ac33f 3484When @option{-fgcse-lm} is enabled, global common subexpression elimination will
767094dd 3485attempt to move loads which are only killed by stores into themselves. This
a13d4ebf 3486allows a loop containing a load/store sequence to be changed to a load outside
02f52e19 3487the loop, and a copy/store within the loop.
a13d4ebf
AM
3488
3489@item -fgcse-sm
cd3bb277 3490@opindex fgcse-sm
695ac33f 3491When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
767094dd 3492subexpression elimination. This pass will attempt to move stores out of loops.
695ac33f 3493When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
a13d4ebf
AM
3494can be changed to a load before the loop and a store after the loop.
3495
b6d24183 3496@item -fdelete-null-pointer-checks
cd3bb277 3497@opindex fdelete-null-pointer-checks
9c34dbbf
ZW
3498Use global dataflow analysis to identify and eliminate useless checks
3499for null pointers. The compiler assumes that dereferencing a null
3500pointer would have halted the program. If a pointer is checked after
3501it has already been dereferenced, it cannot be null.
3502
3503In some environments, this assumption is not true, and programs can
3504safely dereference null pointers. Use
3505@option{-fno-delete-null-pointer-checks} to disable this optimization
3506for programs which depend on that behavior.
b6d24183 3507
74291a4b 3508@item -fexpensive-optimizations
cd3bb277 3509@opindex fexpensive-optimizations
74291a4b
MM
3510Perform a number of minor optimizations that are relatively expensive.
3511
639726ba 3512@item -foptimize-register-move
59d40964 3513@itemx -fregmove
cd3bb277
JM
3514@opindex foptimize-register-move
3515@opindex fregmove
9ec36da5
JL
3516Attempt to reassign register numbers in move instructions and as
3517operands of other simple instructions in order to maximize the amount of
56159047 3518register tying. This is especially helpful on machines with two-operand
630d3d5a 3519instructions. GCC enables this optimization by default with @option{-O2}
9ec36da5
JL
3520or higher.
3521
bedc7537 3522Note @option{-fregmove} and @option{-foptimize-register-move} are the same
9ec36da5
JL
3523optimization.
3524
74291a4b 3525@item -fdelayed-branch
cd3bb277 3526@opindex fdelayed-branch
74291a4b
MM
3527If supported for the target machine, attempt to reorder instructions
3528to exploit instruction slots available after delayed branch
3529instructions.
3530
3531@item -fschedule-insns
cd3bb277 3532@opindex fschedule-insns
74291a4b
MM
3533If supported for the target machine, attempt to reorder instructions to
3534eliminate execution stalls due to required data being unavailable. This
3535helps machines that have slow floating point or memory load instructions
3536by allowing other instructions to be issued until the result of the load
3537or floating point instruction is required.
3538
3539@item -fschedule-insns2
cd3bb277 3540@opindex fschedule-insns2
630d3d5a 3541Similar to @option{-fschedule-insns}, but requests an additional pass of
74291a4b
MM
3542instruction scheduling after register allocation has been done. This is
3543especially useful on machines with a relatively small number of
3544registers and where memory load instructions take more than one cycle.
3545
3546@item -ffunction-sections
59d40964 3547@itemx -fdata-sections
cd3bb277
JM
3548@opindex ffunction-sections
3549@opindex fdata-sections
7d0756fb
CM
3550Place each function or data item into its own section in the output
3551file if the target supports arbitrary sections. The name of the
3552function or the name of the data item determines the section's name
3553in the output file.
74291a4b 3554
7d0756fb 3555Use these options on systems where the linker can perform optimizations
74291a4b
MM
3556to improve locality of reference in the instruction space. HPPA
3557processors running HP-UX and Sparc processors running Solaris 2 have
3558linkers with such optimizations. Other systems using the ELF object format
3559as well as AIX may have these optimizations in the future.
3560
7d0756fb
CM
3561Only use these options when there are significant benefits from doing
3562so. When you specify these options, the assembler and linker will
74291a4b
MM
3563create larger object and executable files and will also be slower.
3564You will not be able to use @code{gprof} on all systems if you
3565specify this option and you may have problems with debugging if
630d3d5a 3566you specify both this option and @option{-g}.
74291a4b
MM
3567
3568@item -fcaller-saves
cd3bb277 3569@opindex fcaller-saves
74291a4b
MM
3570Enable values to be allocated in registers that will be clobbered by
3571function calls, by emitting extra instructions to save and restore the
3572registers around such calls. Such allocation is done only when it
3573seems to result in better code than would otherwise be produced.
3574
81610a0d
HPN
3575This option is always enabled by default on certain machines, usually
3576those which have no call-preserved registers to use instead.
3577
3578For all machines, optimization level 2 and higher enables this flag by
3579default.
74291a4b
MM
3580
3581@item -funroll-loops
cd3bb277 3582@opindex funroll-loops
9c34dbbf
ZW
3583Unroll loops whose number of iterations can be determined at compile
3584time or upon entry to the loop. @option{-funroll-loops} implies both
3585@option{-fstrength-reduce} and @option{-frerun-cse-after-loop}. This
3586option makes code larger, and may or may not make it run faster.
74291a4b
MM
3587
3588@item -funroll-all-loops
cd3bb277 3589@opindex funroll-all-loops
9c34dbbf
ZW
3590Unroll all loops, even if their number of iterations is uncertain when
3591the loop is entered. This usually makes programs run more slowly.
3592@option{-funroll-all-loops} implies the same options as
3593@option{-funroll-loops},
3594
0dd0e980
JH
3595@item -fprefetch-loop-arrays
3596@opindex fprefetch-loop-arrays
3597If supported by the target machine, generate instructions to prefetch
3598memory to improve the performance of loops that access large arrays.
74291a4b 3599
e5eb27e5 3600@item -fmove-all-movables
cd3bb277 3601@opindex fmove-all-movables
e5eb27e5
JL
3602Forces all invariant computations in loops to be moved
3603outside the loop.
3604
3605@item -freduce-all-givs
cd3bb277 3606@opindex freduce-all-givs
e5eb27e5
JL
3607Forces all general-induction variables in loops to be
3608strength-reduced.
3609
3610@emph{Note:} When compiling programs written in Fortran,
630d3d5a 3611@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
e5eb27e5
JL
3612by default when you use the optimizer.
3613
3614These options may generate better or worse code; results are highly
3615dependent on the structure of loops within the source code.
3616
3617These two options are intended to be removed someday, once
3618they have helped determine the efficacy of various
3619approaches to improving loop optimizations.
3620
2642624b 3621Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
e5eb27e5
JL
3622know how use of these options affects
3623the performance of your production code.
3624We're very interested in code that runs @emph{slower}
3625when these options are @emph{enabled}.
3626
74291a4b 3627@item -fno-peephole
6cfc0341 3628@itemx -fno-peephole2
cd3bb277 3629@opindex fno-peephole
6cfc0341
RH
3630@opindex fno-peephole2
3631Disable any machine-specific peephole optimizations. The difference
630d3d5a 3632between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6cfc0341
RH
3633are implemented in the compiler; some targets use one, some use the
3634other, a few use both.
861bb6c1
JL
3635
3636@item -fbranch-probabilities
cd3bb277 3637@opindex fbranch-probabilities
630d3d5a 3638After running a program compiled with @option{-fprofile-arcs}
861bb6c1 3639(@pxref{Debugging Options,, Options for Debugging Your Program or
bedc7537 3640@command{gcc}}), you can compile it a second time using
630d3d5a 3641@option{-fbranch-probabilities}, to improve optimizations based on
3de87bf2
JJ
3642the number of times each branch was taken. When the program
3643compiled with @option{-fprofile-arcs} exits it saves arc execution
3644counts to a file called @file{@var{sourcename}.da} for each source
3645file The information in this data file is very dependent on the
3646structure of the generated code, so you must use the same source code
3647and the same optimization options for both compilations.
861bb6c1 3648
630d3d5a 3649With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
861bb6c1
JL
3650note on the first instruction of each basic block, and a
3651@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
3652These can be used to improve optimization. Currently, they are only
3653used in one place: in @file{reorg.c}, instead of guessing which path a
3654branch is mostly to take, the @samp{REG_BR_PROB} values are used to
3655exactly determine which path is taken more often.
8c660648 3656
454d0cc7 3657@item -fno-guess-branch-probability
cd3bb277 3658@opindex fno-guess-branch-probability
9c34dbbf
ZW
3659Do not guess branch probabilities using a randomized model.
3660
3661Sometimes gcc will opt to use a randomized model to guess branch
3662probabilities, when none are available from either profiling feedback
3663(@option{-fprofile-arcs}) or @samp{__builtin_expect}. This means that
3664different runs of the compiler on the same program may produce different
3665object code.
3666
3667In a hard real-time system, people don't want different runs of the
3668compiler to produce code that has different behavior; minimizing
3669non-determinism is of paramount import. This switch allows users to
3670reduce non-determinism, possibly at the expense of inferior
3671optimization.
454d0cc7 3672
41472af8 3673@item -fstrict-aliasing
cd3bb277 3674@opindex fstrict-aliasing
41472af8
MM
3675Allows the compiler to assume the strictest aliasing rules applicable to
3676the language being compiled. For C (and C++), this activates
3677optimizations based on the type of expressions. In particular, an
3678object of one type is assumed never to reside at the same address as an
3679object of a different type, unless the types are almost the same. For
3680example, an @code{unsigned int} can alias an @code{int}, but not a
3681@code{void*} or a @code{double}. A character type may alias any other
02f52e19 3682type.
41472af8
MM
3683
3684Pay special attention to code like this:
3685@example
02f52e19 3686union a_union @{
41472af8
MM
3687 int i;
3688 double d;
3689@};
3690
3691int f() @{
3692 a_union t;
3693 t.d = 3.0;
3694 return t.i;
3695@}
3696@end example
3697The practice of reading from a different union member than the one most
3698recently written to (called ``type-punning'') is common. Even with
630d3d5a 3699@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
41472af8
MM
3700is accessed through the union type. So, the code above will work as
3701expected. However, this code might not:
3702@example
02f52e19 3703int f() @{
41472af8
MM
3704 a_union t;
3705 int* ip;
3706 t.d = 3.0;
3707 ip = &t.i;
3708 return *ip;
3709@}
3710@end example
3711
41472af8
MM
3712Every language that wishes to perform language-specific alias analysis
3713should define a function that computes, given an @code{tree}
3714node, an alias set for the node. Nodes in different alias sets are not
3715allowed to alias. For an example, see the C front-end function
3716@code{c_get_alias_set}.
41472af8 3717
efa3896a
GK
3718@item -falign-functions
3719@itemx -falign-functions=@var{n}
cd3bb277 3720@opindex falign-functions
efa3896a
GK
3721Align the start of functions to the next power-of-two greater than
3722@var{n}, skipping up to @var{n} bytes. For instance,
630d3d5a
JM
3723@option{-falign-functions=32} aligns functions to the next 32-byte
3724boundary, but @option{-falign-functions=24} would align to the next
efa3896a
GK
372532-byte boundary only if this can be done by skipping 23 bytes or less.
3726
630d3d5a 3727@option{-fno-align-functions} and @option{-falign-functions=1} are
efa3896a
GK
3728equivalent and mean that functions will not be aligned.
3729
3730Some assemblers only support this flag when @var{n} is a power of two;
3731in that case, it is rounded up.
3732
3733If @var{n} is not specified, use a machine-dependent default.
3734
3735@item -falign-labels
3736@itemx -falign-labels=@var{n}
cd3bb277 3737@opindex falign-labels
efa3896a 3738Align all branch targets to a power-of-two boundary, skipping up to
630d3d5a 3739@var{n} bytes like @option{-falign-functions}. This option can easily
efa3896a
GK
3740make code slower, because it must insert dummy operations for when the
3741branch target is reached in the usual flow of the code.
3742
630d3d5a 3743If @option{-falign-loops} or @option{-falign-jumps} are applicable and
efa3896a
GK
3744are greater than this value, then their values are used instead.
3745
3746If @var{n} is not specified, use a machine-dependent default which is
3747very likely to be @samp{1}, meaning no alignment.
3748
3749@item -falign-loops
3750@itemx -falign-loops=@var{n}
cd3bb277 3751@opindex falign-loops
efa3896a 3752Align loops to a power-of-two boundary, skipping up to @var{n} bytes
630d3d5a 3753like @option{-falign-functions}. The hope is that the loop will be
efa3896a
GK
3754executed many times, which will make up for any execution of the dummy
3755operations.
3756
3757If @var{n} is not specified, use a machine-dependent default.
3758
3759@item -falign-jumps
3760@itemx -falign-jumps=@var{n}
cd3bb277 3761@opindex falign-jumps
efa3896a
GK
3762Align branch targets to a power-of-two boundary, for branch targets
3763where the targets can only be reached by jumping, skipping up to @var{n}
630d3d5a 3764bytes like @option{-falign-functions}. In this case, no dummy operations
efa3896a
GK
3765need be executed.
3766
3767If @var{n} is not specified, use a machine-dependent default.
3768
4bae0b47 3769@item -fssa
cd3bb277 3770@opindex fssa
4bae0b47
AS
3771Perform optimizations in static single assignment form. Each function's
3772flow graph is translated into SSA form, optimizations are performed, and
90ecce3e 3773the flow graph is translated back from SSA form. Users should not
b53978a3
JO
3774specify this option, since it is not yet ready for production use.
3775
0b47e4c1
JL
3776@item -fssa-ccp
3777@opindex fssa-ccp
3778Perform Sparse Conditional Constant Propagation in SSA form. Requires
3779@option{-fssa}. Like @option{-fssa}, this is an experimental feature.
3780
62d285ff
JL
3781@item -fssa-dce
3782@opindex fssa-dce
3783Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}.
3784Like @option{-fssa}, this is an experimental feature.
4bae0b47 3785
46d3a873 3786@item -fsingle-precision-constant
cd3bb277 3787@opindex fsingle-precision-constant
46d3a873
CC
3788Treat floating point constant as single precision constant instead of
3789implicitly converting it to double precision constant.
3790
2b2a8f1f 3791@item -frename-registers
cd3bb277 3792@opindex frename-registers
c771326b 3793Attempt to avoid false dependencies in scheduled code by making use
2b2a8f1f
RH
3794of registers left over after register allocation. This optimization
3795will most benefit processors with lots of registers. It can, however,
3796make debugging impossible, since variables will no longer stay in
3797a ``home register''.
3af64fd6 3798
8582c27b
RH
3799@item -fno-cprop-registers
3800@opindex fno-cprop-registers
3801After register allocation and post-register allocation instruction splitting,
3802we perform a copy-propagation pass to try to reduce scheduling dependencies
3803and occasionally eliminate the copy.
3804
3af64fd6 3805@item --param @var{name}=@var{value}
cd3bb277 3806@opindex param
3af64fd6
MM
3807In some places, GCC uses various constants to control the amount of
3808optimization that is done. For example, GCC will not inline functions
3809that contain more that a certain number of instructions. You can
3810control some of these constants on the command-line using the
630d3d5a 3811@option{--param} option.
3af64fd6 3812
4fe9b91c 3813In each case, the @var{value} is an integer. The allowable choices for
3af64fd6
MM
3814@var{name} are given in the following table:
3815
3816@table @gcctabopt
1c4c47db
JO
3817@item max-delay-slot-insn-search
3818The maximum number of instructions to consider when looking for an
3819instruction to fill a delay slot. If more than this arbitrary number of
3820instructions is searched, the time savings from filling the delay slot
3821will be minimal so stop searching. Increasing values mean more
3822aggressive optimization, making the compile time increase with probably
3823small improvement in executable run time.
3824
3825@item max-delay-slot-live-search
3826When trying to fill delay slots, the maximum number of instructions to
3827consider when searching for a block with valid live register
3828information. Increasing this arbitrarily chosen value means more
3829aggressive optimization, increasing the compile time. This parameter
3830should be removed when the delay slot code is rewritten to maintain the
3831control-flow graph.
33d3b05b
MM
3832
3833@item max-gcse-memory
3834The approximate maximum amount of memory that will be allocated in
3835order to perform the global common subexpression elimination
3836optimization. If more memory than specified is required, the
3837optimization will not be done.
3af64fd6 3838
740f35a0 3839@item max-gcse-passes
7dac2f89 3840The maximum number of passes of GCSE to run.
740f35a0 3841
4a121cc3 3842@item max-pending-list-length
0c688a7d 3843The maximum number of pending dependencies scheduling will allow
4a121cc3
AM
3844before flushing the current state and starting over. Large functions
3845with few branches or calls can create excessively large lists which
3846needlessly consume memory and resources.
3847
1c4c47db
JO
3848@item max-inline-insns
3849If an function contains more than this many instructions, it
3850will not be inlined. This option is precisely equivalent to
630d3d5a 3851@option{-finline-limit}.
1c4c47db
JO
3852
3853@end table
74291a4b
MM
3854@end table
3855
3856@node Preprocessor Options
3857@section Options Controlling the Preprocessor
3858@cindex preprocessor options
3859@cindex options, preprocessor
3860
3861These options control the C preprocessor, which is run on each C source
3862file before actual compilation.
3863
630d3d5a
JM
3864If you use the @option{-E} option, nothing is done except preprocessing.
3865Some of these options make sense only together with @option{-E} because
74291a4b
MM
3866they cause the preprocessor output to be unsuitable for actual
3867compilation.
3868
2642624b 3869@table @gcctabopt
74291a4b 3870@item -include @var{file}
cd3bb277 3871@opindex include
74291a4b 3872Process @var{file} as input before processing the regular input file.
630d3d5a
JM
3873In effect, the contents of @var{file} are compiled first. Any @option{-D}
3874and @option{-U} options on the command line are always processed before
3875@option{-include @var{file}}, regardless of the order in which they are
3876written. All the @option{-include} and @option{-imacros} options are
74291a4b
MM
3877processed in the order in which they are written.
3878
3879@item -imacros @var{file}
cd3bb277 3880@opindex imacros
74291a4b
MM
3881Process @var{file} as input, discarding the resulting output, before
3882processing the regular input file. Because the output generated from
630d3d5a 3883@var{file} is discarded, the only effect of @option{-imacros @var{file}}
74291a4b 3884is to make the macros defined in @var{file} available for use in the
630d3d5a 3885main input. All the @option{-include} and @option{-imacros} options are
e582248c 3886processed in the order in which they are written.
74291a4b
MM
3887
3888@item -idirafter @var{dir}
cd3bb277 3889@opindex idirafter
74291a4b
MM
3890@cindex second include path
3891Add the directory @var{dir} to the second include path. The directories
3892on the second include path are searched when a header file is not found
3893in any of the directories in the main include path (the one that
630d3d5a 3894@option{-I} adds to).
74291a4b
MM
3895
3896@item -iprefix @var{prefix}
cd3bb277 3897@opindex iprefix
630d3d5a 3898Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
74291a4b
MM
3899options.
3900
3901@item -iwithprefix @var{dir}
cd3bb277 3902@opindex iwithprefix
74291a4b
MM
3903Add a directory to the second include path. The directory's name is
3904made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
630d3d5a 3905specified previously with @option{-iprefix}. If you have not specified a
74291a4b
MM
3906prefix yet, the directory containing the installed passes of the
3907compiler is used as the default.
3908
3909@item -iwithprefixbefore @var{dir}
cd3bb277 3910@opindex iwithprefixbefore
74291a4b
MM
3911Add a directory to the main include path. The directory's name is made
3912by concatenating @var{prefix} and @var{dir}, as in the case of
630d3d5a 3913@option{-iwithprefix}.
74291a4b
MM
3914
3915@item -isystem @var{dir}
cd3bb277 3916@opindex isystem
74291a4b
MM
3917Add a directory to the beginning of the second include path, marking it
3918as a system directory, so that it gets the same special treatment as
3919is applied to the standard system directories.
3920
3921@item -nostdinc
cd3bb277 3922@opindex nostdinc
74291a4b 3923Do not search the standard system directories for header files. Only
630d3d5a 3924the directories you have specified with @option{-I} options (and the
74291a4b 3925current directory, if appropriate) are searched. @xref{Directory
630d3d5a 3926Options}, for information on @option{-I}.
74291a4b 3927
dfb5868d
NS
3928By using both @option{-nostdinc} and @option{-I-}, you can limit the include-file
3929search path to only those directories you specify explicitly.
74291a4b 3930
e582248c 3931@item -remap
cd3bb277 3932@opindex remap
e582248c
NB
3933When searching for a header file in a directory, remap file names if a
3934file named @file{header.gcc} exists in that directory. This can be used
3935to work around limitations of file systems with file name restrictions.
3936The @file{header.gcc} file should contain a series of lines with two
3937tokens on each line: the first token is the name to map, and the second
3938token is the actual name to use.
3939
74291a4b 3940@item -undef
cd3bb277 3941@opindex undef
74291a4b
MM
3942Do not predefine any nonstandard macros. (Including architecture flags).
3943
3944@item -E
cd3bb277 3945@opindex E
74291a4b
MM
3946Run only the C preprocessor. Preprocess all the C source files
3947specified and output the results to standard output or to the
3948specified output file.
3949
3950@item -C
cd3bb277 3951@opindex C
74291a4b 3952Tell the preprocessor not to discard comments. Used with the
630d3d5a 3953@option{-E} option.
74291a4b
MM
3954
3955@item -P
cd3bb277 3956@opindex P
74291a4b 3957Tell the preprocessor not to generate @samp{#line} directives.
630d3d5a 3958Used with the @option{-E} option.
74291a4b
MM
3959
3960@cindex make
3961@cindex dependencies, make
3962@item -M
cd3bb277 3963@opindex M
e582248c
NB
3964Instead of outputting the result of preprocessing, output a rule
3965suitable for @code{make} describing the dependencies of the main source
3966file. The preprocessor outputs one @code{make} rule containing the
3967object file name for that source file, a colon, and the names of all the
48ce6bbb
NS
3968included files. Unless overridden explicitly, the object file name
3969consists of the basename of the source file with any suffix replaced with
767094dd 3970object file suffix. If there are many included files then the
48ce6bbb 3971rule is split into several lines using @samp{\}-newline.
74291a4b 3972
630d3d5a 3973@option{-M} implies @option{-E}.
74291a4b 3974
e582248c 3975@item -MM
cd3bb277 3976@opindex MM
630d3d5a 3977Like @option{-M}, but mention only the files included with @samp{#include
e582248c
NB
3978"@var{file}"}. System header files included with @samp{#include
3979<@var{file}>} are omitted.
3980
7da723ef 3981@item -MD
cd3bb277 3982@opindex MD
630d3d5a 3983Like @option{-M} but the dependency information is written to a file
7da723ef 3984rather than stdout. @code{gcc} will use the same file name and
695ac33f 3985directory as the object file, but with the suffix @file{.d} instead.
7da723ef 3986
630d3d5a
JM
3987This is in addition to compiling the main file as specified---@option{-MD}
3988does not inhibit ordinary compilation the way @option{-M} does,
3989unless you also specify @option{-MG}.
7da723ef
NB
3990
3991With Mach, you can use the utility @code{md} to merge multiple
3992dependency files into a single dependency file suitable for using with
3993the @samp{make} command.
3994
d396403a 3995@item -MMD
cd3bb277 3996@opindex MMD
630d3d5a 3997Like @option{-MD} except mention only user header files, not system
7da723ef
NB
3998-header files.
3999
e582248c 4000@item -MF @var{file}
cd3bb277 4001@opindex MF
630d3d5a 4002When used with @option{-M} or @option{-MM}, specifies a file to write the
e582248c 4003dependencies to. This allows the preprocessor to write the preprocessed
630d3d5a 4004file to stdout normally. If no @option{-MF} switch is given, CPP sends
e582248c
NB
4005the rules to stdout and suppresses normal preprocessed output.
4006
74291a4b 4007Another way to specify output of a @code{make} rule is by setting
bedc7537 4008the environment variable @env{DEPENDENCIES_OUTPUT} (@pxref{Environment
74291a4b
MM
4009Variables}).
4010
74291a4b 4011@item -MG
cd3bb277 4012@opindex MG
630d3d5a 4013When used with @option{-M} or @option{-MM}, @option{-MG} says to treat missing
e582248c
NB
4014header files as generated files and assume they live in the same
4015directory as the source file. It suppresses preprocessed output, as a
4016missing header file is ordinarily an error.
4017
4018This feature is used in automatic updating of makefiles.
4019
4020@item -MP
cd3bb277 4021@opindex MP
e582248c
NB
4022This option instructs CPP to add a phony target for each dependency
4023other than the main file, causing each to depend on nothing. These
4024dummy rules work around errors @code{make} gives if you remove header
4025files without updating the @code{Makefile} to match.
4026
4027This is typical output:-
4028
4029@smallexample
4030/tmp/test.o: /tmp/test.c /tmp/test.h
4031
4032/tmp/test.h:
4033@end smallexample
4034
4035@item -MQ @var{target}
4036@item -MT @var{target}
cd3bb277
JM
4037@opindex MQ
4038@opindex MT
e582248c
NB
4039By default CPP uses the main file name, including any path, and appends
4040the object suffix, normally ``.o'', to it to obtain the name of the
630d3d5a 4041target for dependency generation. With @option{-MT} you can specify a
e582248c
NB
4042target yourself, overriding the default one.
4043
4044If you want multiple targets, you can specify them as a single argument
630d3d5a 4045to @option{-MT}, or use multiple @option{-MT} options.
e582248c
NB
4046
4047The targets you specify are output in the order they appear on the
630d3d5a
JM
4048command line. @option{-MQ} is identical to @option{-MT}, except that the
4049target name is quoted for Make, but with @option{-MT} it isn't. For
4050example, @option{-MT '$(objpfx)foo.o'} gives
e582248c
NB
4051
4052@smallexample
4053$(objpfx)foo.o: /tmp/foo.c
4054@end smallexample
4055
630d3d5a 4056but @option{-MQ '$(objpfx)foo.o'} gives
e582248c
NB
4057
4058@smallexample
4059$$(objpfx)foo.o: /tmp/foo.c
4060@end smallexample
4061
4062The default target is automatically quoted, as if it were given with
630d3d5a 4063@option{-MQ}.
74291a4b
MM
4064
4065@item -H
cd3bb277 4066@opindex H
74291a4b
MM
4067Print the name of each header file used, in addition to other normal
4068activities.
4069
4070@item -A@var{question}(@var{answer})
cd3bb277 4071@opindex A
74291a4b
MM
4072Assert the answer @var{answer} for @var{question}, in case it is tested
4073with a preprocessing conditional such as @samp{#if
630d3d5a 4074#@var{question}(@var{answer})}. @option{-A-} disables the standard
74291a4b
MM
4075assertions that normally describe the target machine.
4076
4077@item -D@var{macro}
cd3bb277 4078@opindex D
74291a4b
MM
4079Define macro @var{macro} with the string @samp{1} as its definition.
4080
4081@item -D@var{macro}=@var{defn}
630d3d5a
JM
4082Define macro @var{macro} as @var{defn}. All instances of @option{-D} on
4083the command line are processed before any @option{-U} options.
74291a4b 4084
630d3d5a
JM
4085Any @option{-D} and @option{-U} options on the command line are processed in
4086order, and always before @option{-imacros @var{file}}, regardless of the
e582248c
NB
4087order in which they are written.
4088
74291a4b 4089@item -U@var{macro}
cd3bb277 4090@opindex U
630d3d5a
JM
4091Undefine macro @var{macro}. @option{-U} options are evaluated after all
4092@option{-D} options, but before any @option{-include} and @option{-imacros}
74291a4b
MM
4093options.
4094
630d3d5a
JM
4095Any @option{-D} and @option{-U} options on the command line are processed in
4096order, and always before @option{-imacros @var{file}}, regardless of the
e582248c
NB
4097order in which they are written.
4098
74291a4b 4099@item -dM
cd3bb277 4100@opindex dM
74291a4b 4101Tell the preprocessor to output only a list of the macro definitions
630d3d5a 4102that are in effect at the end of preprocessing. Used with the @option{-E}
74291a4b
MM
4103option.
4104
4105@item -dD
cd3bb277 4106@opindex dD
74291a4b
MM
4107Tell the preprocessing to pass all macro definitions into the output, in
4108their proper sequence in the rest of the output.
4109
4110@item -dN
cd3bb277 4111@opindex dN
630d3d5a 4112Like @option{-dD} except that the macro arguments and contents are omitted.
74291a4b
MM
4113Only @samp{#define @var{name}} is included in the output.
4114
e582248c 4115@item -dI
cd3bb277 4116@opindex dI
e582248c
NB
4117Output @samp{#include} directives in addition to the result of
4118preprocessing.
4119
3bce8a01
NB
4120@item -fpreprocessed
4121@opindex fpreprocessed
4122Indicate to the preprocessor that the input file has already been
4123preprocessed. This suppresses things like macro expansion, trigraph
4124conversion, escaped newline splicing, and processing of most directives.
6d34c1c4
NB
4125The preprocessor still recognizes and removes comments, so that you can
4126pass a file preprocessed with @option{-C} to the compiler without
4127problems. In this mode the integrated preprocessor is little more than
4128a tokenizer for the front ends.
3bce8a01 4129
630d3d5a 4130@option{-fpreprocessed} is implicit if the input file has one of the
6d34c1c4
NB
4131extensions @samp{i}, @samp{ii} or @samp{mi}. These are the extensions
4132that GCC uses for preprocessed files created by @option{-save-temps}.
3bce8a01 4133
74291a4b 4134@item -trigraphs
cd3bb277 4135@opindex trigraphs
e582248c
NB
4136Process ISO standard trigraph sequences. These are three-character
4137sequences, all starting with @samp{??}, that are defined by ISO C to
4138stand for single characters. For example, @samp{??/} stands for
4139@samp{\}, so @samp{'??/n'} is a character constant for a newline. By
4140default, GCC ignores trigraphs, but in standard-conforming modes it
630d3d5a 4141converts them. See the @option{-std} and @option{-ansi} options.
e582248c
NB
4142
4143The nine trigraph sequences are
4144@table @samp
4145@item ??(
aee96fe9 4146@expansion{} @samp{[}
e582248c
NB
4147
4148@item ??)
aee96fe9 4149@expansion{} @samp{]}
e582248c
NB
4150
4151@item ??<
aee96fe9 4152@expansion{} @samp{@{}
e582248c
NB
4153
4154@item ??>
aee96fe9 4155@expansion{} @samp{@}}
e582248c
NB
4156
4157@item ??=
aee96fe9 4158@expansion{} @samp{#}
e582248c
NB
4159
4160@item ??/
aee96fe9 4161@expansion{} @samp{\}
e582248c
NB
4162
4163@item ??'
aee96fe9 4164@expansion{} @samp{^}
e582248c
NB
4165
4166@item ??!
aee96fe9 4167@expansion{} @samp{|}
e582248c
NB
4168
4169@item ??-
aee96fe9 4170@expansion{} @samp{~}
e582248c
NB
4171
4172@end table
4173
4174Trigraph support is not popular, so many compilers do not implement it
4175properly. Portable code should not rely on trigraphs being either
4176converted or ignored.
74291a4b 4177
aee96fe9 4178@item -Wp,@var{option}
cd3bb277 4179@opindex Wp
bedc7537 4180Pass @var{option} as an option to the preprocessor. If @var{option}
74291a4b
MM
4181contains commas, it is split into multiple options at the commas.
4182@end table
4183
4184@node Assembler Options
4185@section Passing Options to the Assembler
4186
4187@c prevent bad page break with this line
4188You can pass options to the assembler.
4189
2642624b 4190@table @gcctabopt
aee96fe9 4191@item -Wa,@var{option}
cd3bb277 4192@opindex Wa
74291a4b
MM
4193Pass @var{option} as an option to the assembler. If @var{option}
4194contains commas, it is split into multiple options at the commas.
4195@end table
4196
4197@node Link Options
4198@section Options for Linking
4199@cindex link options
4200@cindex options, linking
4201
4202These options come into play when the compiler links object files into
4203an executable output file. They are meaningless if the compiler is
4204not doing a link step.
4205
2642624b 4206@table @gcctabopt
74291a4b
MM
4207@cindex file names
4208@item @var{object-file-name}
4209A file name that does not end in a special recognized suffix is
4210considered to name an object file or library. (Object files are
4211distinguished from libraries by the linker according to the file
4212contents.) If linking is done, these object files are used as input
4213to the linker.
4214
4215@item -c
4216@itemx -S
4217@itemx -E
cd3bb277
JM
4218@opindex c
4219@opindex S
4220@opindex E
74291a4b
MM
4221If any of these options is used, then the linker is not run, and
4222object file names should not be used as arguments. @xref{Overall
4223Options}.
4224
4225@cindex Libraries
4226@item -l@var{library}
4275c4c4 4227@itemx -l @var{library}
cd3bb277 4228@opindex l
4275c4c4
JS
4229Search the library named @var{library} when linking. (The second
4230alternative with the library as a separate argument is only for
4231POSIX compliance and is not recommended.)
74291a4b
MM
4232
4233It makes a difference where in the command you write this option; the
4275c4c4 4234linker searches and processes libraries and object files in the order they
74291a4b
MM
4235are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4236after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
4237to functions in @samp{z}, those functions may not be loaded.
4238
4239The linker searches a standard list of directories for the library,
4240which is actually a file named @file{lib@var{library}.a}. The linker
4241then uses this file as if it had been specified precisely by name.
4242
4243The directories searched include several standard system directories
630d3d5a 4244plus any that you specify with @option{-L}.
74291a4b
MM
4245
4246Normally the files found this way are library files---archive files
4247whose members are object files. The linker handles an archive file by
4248scanning through it for members which define symbols that have so far
4249been referenced but not defined. But if the file that is found is an
4250ordinary object file, it is linked in the usual fashion. The only
630d3d5a
JM
4251difference between using an @option{-l} option and specifying a file name
4252is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
74291a4b
MM
4253and searches several directories.
4254
4255@item -lobjc
cd3bb277 4256@opindex lobjc
630d3d5a 4257You need this special case of the @option{-l} option in order to
2147b154 4258link an Objective-C program.
74291a4b
MM
4259
4260@item -nostartfiles
cd3bb277 4261@opindex nostartfiles
74291a4b 4262Do not use the standard system startup files when linking.
bedc7537
NC
4263The standard system libraries are used normally, unless @option{-nostdlib}
4264or @option{-nodefaultlibs} is used.
74291a4b
MM
4265
4266@item -nodefaultlibs
cd3bb277 4267@opindex nodefaultlibs
74291a4b
MM
4268Do not use the standard system libraries when linking.
4269Only the libraries you specify will be passed to the linker.
bedc7537 4270The standard startup files are used normally, unless @option{-nostartfiles}
4754172c 4271is used. The compiler may generate calls to memcmp, memset, and memcpy
c1030c7c 4272for System V (and ISO C) environments or to bcopy and bzero for
4754172c
CM
4273BSD environments. These entries are usually resolved by entries in
4274libc. These entry points should be supplied through some other
4275mechanism when this option is specified.
74291a4b
MM
4276
4277@item -nostdlib
cd3bb277 4278@opindex nostdlib
74291a4b
MM
4279Do not use the standard system startup files or libraries when linking.
4280No startup files and only the libraries you specify will be passed to
767094dd 4281the linker. The compiler may generate calls to memcmp, memset, and memcpy
c1030c7c 4282for System V (and ISO C) environments or to bcopy and bzero for
4754172c
CM
4283BSD environments. These entries are usually resolved by entries in
4284libc. These entry points should be supplied through some other
4285mechanism when this option is specified.
74291a4b 4286
630d3d5a
JM
4287@cindex @option{-lgcc}, use with @option{-nostdlib}
4288@cindex @option{-nostdlib} and unresolved references
4289@cindex unresolved references and @option{-nostdlib}
4290@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
4291@cindex @option{-nodefaultlibs} and unresolved references
4292@cindex unresolved references and @option{-nodefaultlibs}
4293One of the standard libraries bypassed by @option{-nostdlib} and
4294@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
0c2d1a2a 4295that GCC uses to overcome shortcomings of particular machines, or special
74291a4b 4296needs for some languages.
b11cc610
JM
4297(@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
4298Collection (GCC) Internals},
74291a4b 4299for more discussion of @file{libgcc.a}.)
74291a4b 4300In most cases, you need @file{libgcc.a} even when you want to avoid
630d3d5a
JM
4301other standard libraries. In other words, when you specify @option{-nostdlib}
4302or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
0c2d1a2a 4303This ensures that you have no unresolved references to internal GCC
74291a4b 4304library subroutines. (For example, @samp{__main}, used to ensure C++
b11cc610
JM
4305constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
4306GNU Compiler Collection (GCC) Internals}.)
74291a4b
MM
4307
4308@item -s
cd3bb277 4309@opindex s
74291a4b
MM
4310Remove all symbol table and relocation information from the executable.
4311
4312@item -static
cd3bb277 4313@opindex static
74291a4b
MM
4314On systems that support dynamic linking, this prevents linking with the shared
4315libraries. On other systems, this option has no effect.
4316
4317@item -shared
cd3bb277 4318@opindex shared
74291a4b 4319Produce a shared object which can then be linked with other objects to
1d3b0e2c 4320form an executable. Not all systems support this option. For predictable
02f52e19 4321results, you must also specify the same set of options that were used to
630d3d5a 4322generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
2642624b 4323when you specify this option.@footnote{On some systems, @samp{gcc -shared}
767094dd 4324needs to build supplementary stub code for constructors to work. On
2642624b 4325multi-libbed systems, @samp{gcc -shared} must select the correct support
1d3b0e2c 4326libraries to link against. Failing to supply the correct flags may lead
767094dd 4327to subtle defects. Supplying them in cases where they are not necessary
1d3b0e2c 4328is innocuous.}
74291a4b 4329
9db0819e
RH
4330@item -shared-libgcc
4331@itemx -static-libgcc
cd3bb277
JM
4332@opindex shared-libgcc
4333@opindex static-libgcc
9db0819e
RH
4334On systems that provide @file{libgcc} as a shared library, these options
4335force the use of either the shared or static version respectively.
4336If no shared version of @file{libgcc} was built when the compiler was
4337configured, these options have no effect.
4338
4339There are several situations in which an application should use the
4340shared @file{libgcc} instead of the static version. The most common
4341of these is when the application wishes to throw and catch exceptions
4342across different shared libraries. In that case, each of the libraries
4343as well as the application itself should use the shared @file{libgcc}.
4344
630d3d5a
JM
4345Therefore, whenever you specify the @option{-shared} option, the GCC
4346driver automatically adds @option{-shared-libgcc}, unless you explicitly
4347specify @option{-static-libgcc}. The G++ driver automatically adds
4348@option{-shared-libgcc} when you build a main executable as well because
049f6ec9
MM
4349for C++ programs that is typically the right thing to do.
4350(Exception-handling will not work reliably otherwise.)
4351
4352However, when linking a main executable written in C, you must
630d3d5a 4353explicitly say @option{-shared-libgcc} if you want to use the shared
049f6ec9 4354@file{libgcc}.
9db0819e 4355
74291a4b 4356@item -symbolic
cd3bb277 4357@opindex symbolic
74291a4b
MM
4358Bind references to global symbols when building a shared object. Warn
4359about any unresolved references (unless overridden by the link editor
4360option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
4361this option.
4362
4363@item -Xlinker @var{option}
cd3bb277 4364@opindex Xlinker
74291a4b 4365Pass @var{option} as an option to the linker. You can use this to
0c2d1a2a 4366supply system-specific linker options which GCC does not know how to
74291a4b
MM
4367recognize.
4368
4369If you want to pass an option that takes an argument, you must use
630d3d5a
JM
4370@option{-Xlinker} twice, once for the option and once for the argument.
4371For example, to pass @option{-assert definitions}, you must write
74291a4b 4372@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
630d3d5a 4373@option{-Xlinker "-assert definitions"}, because this passes the entire
74291a4b
MM
4374string as a single argument, which is not what the linker expects.
4375
aee96fe9 4376@item -Wl,@var{option}
cd3bb277 4377@opindex Wl
74291a4b
MM
4378Pass @var{option} as an option to the linker. If @var{option} contains
4379commas, it is split into multiple options at the commas.
4380
4381@item -u @var{symbol}
cd3bb277 4382@opindex u
74291a4b 4383Pretend the symbol @var{symbol} is undefined, to force linking of
630d3d5a 4384library modules to define it. You can use @option{-u} multiple times with
74291a4b
MM
4385different symbols to force loading of additional library modules.
4386@end table
4387
4388@node Directory Options
4389@section Options for Directory Search
4390@cindex directory options
4391@cindex options, directory search
4392@cindex search path
4393
4394These options specify directories to search for header files, for
4395libraries and for parts of the compiler:
4396
2642624b 4397@table @gcctabopt
74291a4b 4398@item -I@var{dir}
cd3bb277 4399@opindex I
861bb6c1
JL
4400Add the directory @var{dir} to the head of the list of directories to be
4401searched for header files. This can be used to override a system header
4402file, substituting your own version, since these directories are
d0a5eb32
RK
4403searched before the system header file directories. However, you should
4404not use this option to add directories that contain vendor-supplied
767094dd 4405system header files (use @option{-isystem} for that). If you use more than
630d3d5a 4406one @option{-I} option, the directories are scanned in left-to-right
74291a4b
MM
4407order; the standard system directories come after.
4408
dbead49c
NS
4409If a standard system include directory, or a directory specified with
4410@option{-isystem}, is also specified with @option{-I}, it will be
4411searched only in the position requested by @option{-I}. Also, it will
4412not be considered a system include directory. If that directory really
4413does contain system headers, there is a good chance that they will
4414break. For instance, if GCC's installation procedure edited the headers
4415in @file{/usr/include} to fix bugs, @samp{-I/usr/include} will cause the
4416original, buggy headers to be found instead of the corrected ones. GCC
4417will issue a warning when a system include directory is hidden in this
4418way.
4419
74291a4b 4420@item -I-
cd3bb277 4421@opindex I-
630d3d5a 4422Any directories you specify with @option{-I} options before the @option{-I-}
74291a4b
MM
4423option are searched only for the case of @samp{#include "@var{file}"};
4424they are not searched for @samp{#include <@var{file}>}.
4425
630d3d5a
JM
4426If additional directories are specified with @option{-I} options after
4427the @option{-I-}, these directories are searched for all @samp{#include}
4428directives. (Ordinarily @emph{all} @option{-I} directories are used
74291a4b
MM
4429this way.)
4430
630d3d5a 4431In addition, the @option{-I-} option inhibits the use of the current
74291a4b
MM
4432directory (where the current input file came from) as the first search
4433directory for @samp{#include "@var{file}"}. There is no way to
630d3d5a 4434override this effect of @option{-I-}. With @option{-I.} you can specify
74291a4b
MM
4435searching the directory which was current when the compiler was
4436invoked. That is not exactly the same as what the preprocessor does
4437by default, but it is often satisfactory.
4438
630d3d5a
JM
4439@option{-I-} does not inhibit the use of the standard system directories
4440for header files. Thus, @option{-I-} and @option{-nostdinc} are
74291a4b
MM
4441independent.
4442
4443@item -L@var{dir}
cd3bb277 4444@opindex L
74291a4b 4445Add directory @var{dir} to the list of directories to be searched
630d3d5a 4446for @option{-l}.
74291a4b
MM
4447
4448@item -B@var{prefix}
cd3bb277 4449@opindex B
74291a4b
MM
4450This option specifies where to find the executables, libraries,
4451include files, and data files of the compiler itself.
4452
4453The compiler driver program runs one or more of the subprograms
4454@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
4455@var{prefix} as a prefix for each program it tries to run, both with and
4456without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
4457
4458For each subprogram to be run, the compiler driver first tries the
630d3d5a 4459@option{-B} prefix, if any. If that name is not found, or if @option{-B}
74291a4b
MM
4460was not specified, the driver tries two standard prefixes, which are
4461@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of
4462those results in a file name that is found, the unmodified program
4463name is searched for using the directories specified in your
bedc7537 4464@env{PATH} environment variable.
74291a4b 4465
07804c3b
NC
4466The compiler will check to see if the path provided by the @option{-B}
4467refers to a directory, and if necessary it will add a directory
4468separator character at the end of the path.
4469
630d3d5a 4470@option{-B} prefixes that effectively specify directory names also apply
74291a4b 4471to libraries in the linker, because the compiler translates these
630d3d5a 4472options into @option{-L} options for the linker. They also apply to
74291a4b 4473includes files in the preprocessor, because the compiler translates these
630d3d5a 4474options into @option{-isystem} options for the preprocessor. In this case,
74291a4b
MM
4475the compiler appends @samp{include} to the prefix.
4476
4477The run-time support file @file{libgcc.a} can also be searched for using
630d3d5a 4478the @option{-B} prefix, if needed. If it is not found there, the two
74291a4b
MM
4479standard prefixes above are tried, and that is all. The file is left
4480out of the link if it is not found by those means.
4481
630d3d5a 4482Another way to specify a prefix much like the @option{-B} prefix is to use
bedc7537 4483the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
74291a4b 4484Variables}.
861bb6c1 4485
07804c3b 4486As a special kludge, if the path provided by @option{-B} is
bf4eebe0
NC
4487@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
44889, then it will be replaced by @file{[dir/]include}. This is to help
7dac2f89 4489with boot-strapping the compiler.
07804c3b 4490
861bb6c1 4491@item -specs=@var{file}
cd3bb277 4492@opindex specs
861bb6c1
JL
4493Process @var{file} after the compiler reads in the standard @file{specs}
4494file, in order to override the defaults that the @file{gcc} driver
4495program uses when determining what switches to pass to @file{cc1},
4496@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
630d3d5a 4497@option{-specs=@var{file}} can be specified on the command line, and they
861bb6c1 4498are processed in order, from left to right.
74291a4b
MM
4499@end table
4500
ee457005
JM
4501@c man end
4502
a743d340
NC
4503@node Spec Files
4504@section Specifying subprocesses and the switches to pass to them
4505@cindex Spec Files
bedc7537 4506@command{gcc} is a driver program. It performs its job by invoking a
a743d340
NC
4507sequence of other programs to do the work of compiling, assembling and
4508linking. GCC interprets its command-line parameters and uses these to
4509deduce which programs it should invoke, and which command-line options
c21cd8b1 4510it ought to place on their command lines. This behavior is controlled
a743d340
NC
4511by @dfn{spec strings}. In most cases there is one spec string for each
4512program that GCC can invoke, but a few programs have multiple spec
c21cd8b1 4513strings to control their behavior. The spec strings built into GCC can
630d3d5a 4514be overridden by using the @option{-specs=} command-line switch to specify
a743d340
NC
4515a spec file.
4516
4517@dfn{Spec files} are plaintext files that are used to construct spec
4518strings. They consist of a sequence of directives separated by blank
4519lines. The type of directive is determined by the first non-whitespace
4520character on the line and it can be one of the following:
4521
4522@table @code
4523@item %@var{command}
4524Issues a @var{command} to the spec file processor. The commands that can
02f52e19 4525appear here are:
a743d340
NC
4526
4527@table @code
4528@item %include <@var{file}>
4529@cindex %include
4530Search for @var{file} and insert its text at the current point in the
4531specs file.
4532
4533@item %include_noerr <@var{file}>
4534@cindex %include_noerr
4535Just like @samp{%include}, but do not generate an error message if the include
4536file cannot be found.
4537
4538@item %rename @var{old_name} @var{new_name}
4539@cindex %rename
4540Rename the spec string @var{old_name} to @var{new_name}.
4541
4542@end table
4543
4544@item *[@var{spec_name}]:
4545This tells the compiler to create, override or delete the named spec
4546string. All lines after this directive up to the next directive or
4547blank line are considered to be the text for the spec string. If this
4548results in an empty string then the spec will be deleted. (Or, if the
4549spec did not exist, then nothing will happened.) Otherwise, if the spec
4550does not currently exist a new spec will be created. If the spec does
4551exist then its contents will be overridden by the text of this
4552directive, unless the first character of that text is the @samp{+}
4553character, in which case the text will be appended to the spec.
4554
4555@item [@var{suffix}]:
4556Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
4557and up to the next directive or blank line are considered to make up the
02f52e19 4558spec string for the indicated suffix. When the compiler encounters an
a743d340
NC
4559input file with the named suffix, it will processes the spec string in
4560order to work out how to compile that file. For example:
4561
4562@smallexample
4563.ZZ:
4564z-compile -input %i
4565@end smallexample
4566
4567This says that any input file whose name ends in @samp{.ZZ} should be
4568passed to the program @samp{z-compile}, which should be invoked with the
630d3d5a 4569command-line switch @option{-input} and with the result of performing the
a743d340
NC
4570@samp{%i} substitution. (See below.)
4571
4572As an alternative to providing a spec string, the text that follows a
4573suffix directive can be one of the following:
4574
4575@table @code
4576@item @@@var{language}
4577This says that the suffix is an alias for a known @var{language}. This is
bedc7537 4578similar to using the @option{-x} command-line switch to GCC to specify a
a743d340
NC
4579language explicitly. For example:
4580
4581@smallexample
4582.ZZ:
4583@@c++
4584@end smallexample
4585
4586Says that .ZZ files are, in fact, C++ source files.
4587
4588@item #@var{name}
4589This causes an error messages saying:
4590
4591@smallexample
4592@var{name} compiler not installed on this system.
4593@end smallexample
4594@end table
4595
4596GCC already has an extensive list of suffixes built into it.
4597This directive will add an entry to the end of the list of suffixes, but
4598since the list is searched from the end backwards, it is effectively
4599possible to override earlier entries using this technique.
4600
4601@end table
4602
4603GCC has the following spec strings built into it. Spec files can
4604override these strings or create their own. Note that individual
02f52e19 4605targets can also add their own spec strings to this list.
a743d340
NC
4606
4607@smallexample
4608asm Options to pass to the assembler
4609asm_final Options to pass to the assembler post-processor
4610cpp Options to pass to the C preprocessor
4611cc1 Options to pass to the C compiler
4612cc1plus Options to pass to the C++ compiler
4613endfile Object files to include at the end of the link
4614link Options to pass to the linker
4615lib Libraries to include on the command line to the linker
4616libgcc Decides which GCC support library to pass to the linker
4617linker Sets the name of the linker
4618predefines Defines to be passed to the C preprocessor
310668e8
JM
4619signed_char Defines to pass to CPP to say whether @code{char} is signed
4620 by default
a743d340
NC
4621startfile Object files to include at the start of the link
4622@end smallexample
4623
4624Here is a small example of a spec file:
4625
4626@smallexample
4627%rename lib old_lib
4628
4629*lib:
4630--start-group -lgcc -lc -leval1 --end-group %(old_lib)
4631@end smallexample
4632
4633This example renames the spec called @samp{lib} to @samp{old_lib} and
4634then overrides the previous definition of @samp{lib} with a new one.
4635The new definition adds in some extra command-line options before
4636including the text of the old definition.
4637
4638@dfn{Spec strings} are a list of command-line options to be passed to their
4639corresponding program. In addition, the spec strings can contain
4640@samp{%}-prefixed sequences to substitute variable text or to
4641conditionally insert text into the command line. Using these constructs
4642it is possible to generate quite complex command lines.
4643
4644Here is a table of all defined @samp{%}-sequences for spec
4645strings. Note that spaces are not generated automatically around the
4646results of expanding these sequences. Therefore you can concatenate them
02f52e19 4647together or combine them with constant text in a single argument.
a743d340
NC
4648
4649@table @code
4650@item %%
4651Substitute one @samp{%} into the program name or argument.
4652
4653@item %i
4654Substitute the name of the input file being processed.
4655
4656@item %b
4657Substitute the basename of the input file being processed.
4658This is the substring up to (and not including) the last period
4659and not including the directory.
4660
371e300b
NC
4661@item %B
4662This is the same as @samp{%b}, but include the file suffix (text after
4663the last period).
4664
a743d340
NC
4665@item %d
4666Marks the argument containing or following the @samp{%d} as a
4667temporary file name, so that that file will be deleted if GCC exits
4668successfully. Unlike @samp{%g}, this contributes no text to the
02f52e19 4669argument.
a743d340
NC
4670
4671@item %g@var{suffix}
4672Substitute a file name that has suffix @var{suffix} and is chosen
4673once per compilation, and mark the argument in the same way as
4674@samp{%d}. To reduce exposure to denial-of-service attacks, the file
02f52e19 4675name is now chosen in a way that is hard to predict even when previously
695ac33f 4676chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
a743d340
NC
4677might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
4678the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
4679treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
4680was simply substituted with a file name chosen once per compilation,
4681without regard to any appended suffix (which was therefore treated
4682just like ordinary text), making such attacks more likely to succeed.
4683
4684@item %u@var{suffix}
4685Like @samp{%g}, but generates a new temporary file name even if
4686@samp{%u@var{suffix}} was already seen.
4687
4688@item %U@var{suffix}
4689Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
4690new one if there is no such last file name. In the absence of any
4691@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
695ac33f 4692the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
a743d340
NC
4693would involve the generation of two distinct file names, one
4694for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
4695simply substituted with a file name chosen for the previous @samp{%u},
4696without regard to any appended suffix.
4697
371e300b 4698@item %j@var{SUFFIX}
aee96fe9 4699Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
371e300b
NC
4700writable, and if save-temps is off; otherwise, substitute the name
4701of a temporary file, just like @samp{%u}. This temporary file is not
4702meant for communication between processes, but rather as a junk
4703disposal mechanism.
4704
4705@item %.@var{SUFFIX}
4706Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
767094dd 4707when it is subsequently output with @samp{%*}. @var{SUFFIX} is
371e300b
NC
4708terminated by the next space or %.
4709
a743d340
NC
4710@item %w
4711Marks the argument containing or following the @samp{%w} as the
4712designated output file of this compilation. This puts the argument
4713into the sequence of arguments that @samp{%o} will substitute later.
4714
4715@item %o
4716Substitutes the names of all the output files, with spaces
4717automatically placed around them. You should write spaces
4718around the @samp{%o} as well or the results are undefined.
4719@samp{%o} is for use in the specs for running the linker.
4720Input files whose names have no recognized suffix are not compiled
4721at all, but they are included among the output files, so they will
4722be linked.
4723
4724@item %O
4725Substitutes the suffix for object files. Note that this is
4726handled specially when it immediately follows @samp{%g, %u, or %U},
4727because of the need for those to form complete file names. The
4728handling is such that @samp{%O} is treated exactly as if it had already
4729been substituted, except that @samp{%g, %u, and %U} do not currently
4730support additional @var{suffix} characters following @samp{%O} as they would
4731following, for example, @samp{.o}.
4732
4733@item %p
4734Substitutes the standard macro predefinitions for the
4735current target machine. Use this when running @code{cpp}.
4736
4737@item %P
4738Like @samp{%p}, but puts @samp{__} before and after the name of each
4739predefined macro, except for macros that start with @samp{__} or with
c1030c7c 4740@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
161d7b59 4741C@.
a743d340
NC
4742
4743@item %I
aee96fe9 4744Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}.
a743d340
NC
4745
4746@item %s
4747Current argument is the name of a library or startup file of some sort.
4748Search for that file in a standard list of directories and substitute
02f52e19 4749the full name found.
a743d340
NC
4750
4751@item %e@var{str}
4752Print @var{str} as an error message. @var{str} is terminated by a newline.
4753Use this when inconsistent options are detected.
4754
4755@item %|
4756Output @samp{-} if the input for the current command is coming from a pipe.
4757
4758@item %(@var{name})
4759Substitute the contents of spec string @var{name} at this point.
4760
4761@item %[@var{name}]
630d3d5a 4762Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
a743d340
NC
4763
4764@item %x@{@var{option}@}
4765Accumulate an option for @samp{%X}.
4766
4767@item %X
630d3d5a 4768Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
a743d340
NC
4769spec string.
4770
4771@item %Y
630d3d5a 4772Output the accumulated assembler options specified by @option{-Wa}.
a743d340
NC
4773
4774@item %Z
630d3d5a 4775Output the accumulated preprocessor options specified by @option{-Wp}.
a743d340
NC
4776
4777@item %v1
161d7b59 4778Substitute the major version number of GCC@.
a743d340
NC
4779(For version 2.9.5, this is 2.)
4780
4781@item %v2
161d7b59 4782Substitute the minor version number of GCC@.
a743d340
NC
4783(For version 2.9.5, this is 9.)
4784
371e300b 4785@item %v3
161d7b59 4786Substitute the patch level number of GCC@.
371e300b
NC
4787(For version 2.9.5, this is 5.)
4788
a743d340
NC
4789@item %a
4790Process the @code{asm} spec. This is used to compute the
4791switches to be passed to the assembler.
4792
4793@item %A
4794Process the @code{asm_final} spec. This is a spec string for
4795passing switches to an assembler post-processor, if such a program is
4796needed.
4797
4798@item %l
4799Process the @code{link} spec. This is the spec for computing the
4800command line passed to the linker. Typically it will make use of the
4801@samp{%L %G %S %D and %E} sequences.
4802
4803@item %D
630d3d5a 4804Dump out a @option{-L} option for each directory that GCC believes might
a743d340 4805contain startup files. If the target supports multilibs then the
02f52e19 4806current multilib directory will be prepended to each of these paths.
a743d340 4807
371e300b 4808@item %M
c771326b 4809Output the multilib directory with directory separators replaced with
695ac33f
JM
4810@samp{_}. If multilib directories are not set, or the multilib directory is
4811@file{.} then this option emits nothing.
371e300b 4812
a743d340
NC
4813@item %L
4814Process the @code{lib} spec. This is a spec string for deciding which
02f52e19 4815libraries should be included on the command line to the linker.
a743d340
NC
4816
4817@item %G
4818Process the @code{libgcc} spec. This is a spec string for deciding
02f52e19 4819which GCC support library should be included on the command line to the linker.
a743d340
NC
4820
4821@item %S
4822Process the @code{startfile} spec. This is a spec for deciding which
4823object files should be the first ones passed to the linker. Typically
02f52e19 4824this might be a file named @file{crt0.o}.
a743d340
NC
4825
4826@item %E
4827Process the @code{endfile} spec. This is a spec string that specifies
02f52e19 4828the last object files that will be passed to the linker.
a743d340
NC
4829
4830@item %C
4831Process the @code{cpp} spec. This is used to construct the arguments
4832to be passed to the C preprocessor.
4833
4834@item %c
4835Process the @code{signed_char} spec. This is intended to be used
02f52e19 4836to tell cpp whether a char is signed. It typically has the definition:
a743d340
NC
4837@smallexample
4838%@{funsigned-char:-D__CHAR_UNSIGNED__@}
4839@end smallexample
4840
4841@item %1
4842Process the @code{cc1} spec. This is used to construct the options to be
4843passed to the actual C compiler (@samp{cc1}).
4844
4845@item %2
4846Process the @code{cc1plus} spec. This is used to construct the options to be
4847passed to the actual C++ compiler (@samp{cc1plus}).
4848
4849@item %*
4850Substitute the variable part of a matched option. See below.
4851Note that each comma in the substituted string is replaced by
4852a single space.
4853
4854@item %@{@code{S}@}
161d7b59 4855Substitutes the @code{-S} switch, if that switch was given to GCC@.
a743d340
NC
4856If that switch was not specified, this substitutes nothing. Note that
4857the leading dash is omitted when specifying this option, and it is
4858automatically inserted if the substitution is performed. Thus the spec
630d3d5a
JM
4859string @samp{%@{foo@}} would match the command-line option @option{-foo}
4860and would output the command line option @option{-foo}.
a743d340
NC
4861
4862@item %W@{@code{S}@}
4863Like %@{@code{S}@} but mark last argument supplied within as a file to be
02f52e19 4864deleted on failure.
a743d340
NC
4865
4866@item %@{@code{S}*@}
4867Substitutes all the switches specified to GCC whose names start
4868with @code{-S}, but which also take an argument. This is used for
695ac33f 4869switches like @option{-o}, @option{-D}, @option{-I}, etc.
630d3d5a 4870GCC considers @option{-o foo} as being
a743d340 4871one switch whose names starts with @samp{o}. %@{o*@} would substitute this
02f52e19 4872text, including the space. Thus two arguments would be generated.
a743d340
NC
4873
4874@item %@{^@code{S}*@}
4875Like %@{@code{S}*@}, but don't put a blank between a switch and its
4876argument. Thus %@{^o*@} would only generate one argument, not two.
4877
371e300b
NC
4878@item %@{@code{S}*&@code{T}*@}
4879Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
4880(the order of @code{S} and @code{T} in the spec is not significant).
4881There can be any number of ampersand-separated variables; for each the
4882wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
4883
d630442f 4884@item %@{<@code{S}@}
695ac33f 4885Remove all occurrences of @code{-S} from the command line. Note---this
d630442f 4886command is position dependent. @samp{%} commands in the spec string
50c57e7b 4887before this option will see @code{-S}, @samp{%} commands in the spec
d630442f
NC
4888string after this option will not.
4889
a743d340
NC
4890@item %@{@code{S}*:@code{X}@}
4891Substitutes @code{X} if one or more switches whose names start with
161d7b59 4892@code{-S} are specified to GCC@. Note that the tail part of the
e979f9e8 4893@code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted
02f52e19 4894for each occurrence of @samp{%*} within @code{X}.
a743d340
NC
4895
4896@item %@{@code{S}:@code{X}@}
161d7b59 4897Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@.
a743d340
NC
4898
4899@item %@{!@code{S}:@code{X}@}
161d7b59 4900Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@.
a743d340
NC
4901
4902@item %@{|@code{S}:@code{X}@}
4903Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}.
4904
4905@item %@{|!@code{S}:@code{X}@}
4906Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}.
4907
4908@item %@{.@code{S}:@code{X}@}
4909Substitutes @code{X}, but only if processing a file with suffix @code{S}.
4910
4911@item %@{!.@code{S}:@code{X}@}
4912Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}.
4913
4914@item %@{@code{S}|@code{P}:@code{X}@}
161d7b59 4915Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be
a743d340
NC
4916combined with @samp{!} and @samp{.} sequences as well, although they
4917have a stronger binding than the @samp{|}. For example a spec string
4918like this:
4919
4920@smallexample
4921%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
4922@end smallexample
4923
4924will output the following command-line options from the following input
4925command-line options:
4926
4927@smallexample
4928fred.c -foo -baz
4929jim.d -bar -boggle
4930-d fred.c -foo -baz -boggle
4931-d jim.d -bar -baz -boggle
4932@end smallexample
4933
4934@end table
4935
4936The conditional text @code{X} in a %@{@code{S}:@code{X}@} or
4937%@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs
4938or spaces, or even newlines. They are processed as usual, as described
02f52e19 4939above.
a743d340 4940
695ac33f
JM
4941The @option{-O}, @option{-f}, @option{-m}, and @option{-W}
4942switches are handled specifically in these
630d3d5a
JM
4943constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or
4944@option{-W} switch is found later in the command line, the earlier switch
a743d340
NC
4945value is ignored, except with @{@code{S}*@} where @code{S} is just one
4946letter, which passes all matching options.
4947
4948The character @samp{|} at the beginning of the predicate text is used to indicate
630d3d5a 4949that a command should be piped to the following command, but only if @option{-pipe}
a743d340
NC
4950is specified.
4951
4952It is built into GCC which switches take arguments and which do not.
4953(You might think it would be useful to generalize this to allow each
4954compiler's spec to say which switches take arguments. But this cannot
4955be done in a consistent fashion. GCC cannot even decide which input
4956files have been specified without knowing which switches take arguments,
4957and it must know which input files to compile in order to tell which
02f52e19 4958compilers to run).
a743d340 4959
630d3d5a 4960GCC also knows implicitly that arguments starting in @option{-l} are to be
a743d340
NC
4961treated as compiler output files, and passed to the linker in their
4962proper position among the other output files.
4963
ee457005
JM
4964@c man begin OPTIONS
4965
74291a4b
MM
4966@node Target Options
4967@section Specifying Target Machine and Compiler Version
4968@cindex target options
4969@cindex cross compiling
4970@cindex specifying machine version
4971@cindex specifying compiler version and target machine
4972@cindex compiler version, specifying
4973@cindex target machine, specifying
4974
0c2d1a2a 4975By default, GCC compiles code for the same type of machine that you
74291a4b
MM
4976are using. However, it can also be installed as a cross-compiler, to
4977compile for some other type of machine. In fact, several different
0c2d1a2a 4978configurations of GCC, for different target machines, can be
74291a4b 4979installed side by side. Then you specify which one to use with the
630d3d5a 4980@option{-b} option.
74291a4b 4981
0c2d1a2a 4982In addition, older and newer versions of GCC can be installed side
74291a4b
MM
4983by side. One of them (probably the newest) will be the default, but
4984you may sometimes wish to use another.
4985
2642624b 4986@table @gcctabopt
74291a4b 4987@item -b @var{machine}
cd3bb277 4988@opindex b
74291a4b 4989The argument @var{machine} specifies the target machine for compilation.
0c2d1a2a 4990This is useful when you have installed GCC as a cross-compiler.
74291a4b
MM
4991
4992The value to use for @var{machine} is the same as was specified as the
0c2d1a2a 4993machine type when configuring GCC as a cross-compiler. For
74291a4b
MM
4994example, if a cross-compiler was configured with @samp{configure
4995i386v}, meaning to compile for an 80386 running System V, then you
630d3d5a 4996would specify @option{-b i386v} to run that cross compiler.
74291a4b 4997
630d3d5a 4998When you do not specify @option{-b}, it normally means to compile for
74291a4b
MM
4999the same type of machine that you are using.
5000
5001@item -V @var{version}
cd3bb277 5002@opindex V
0c2d1a2a 5003The argument @var{version} specifies which version of GCC to run.
74291a4b 5004This is useful when multiple versions are installed. For example,
0c2d1a2a 5005@var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
74291a4b 5006
630d3d5a 5007The default version, when you do not specify @option{-V}, is the last
0c2d1a2a 5008version of GCC that you installed.
74291a4b
MM
5009@end table
5010
630d3d5a 5011The @option{-b} and @option{-V} options actually work by controlling part of
74291a4b 5012the file name used for the executable files and libraries used for
0c2d1a2a 5013compilation. A given version of GCC, for a given target machine, is
bd819a4a 5014normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.
74291a4b 5015
630d3d5a 5016Thus, sites can customize the effect of @option{-b} or @option{-V} either by
74291a4b
MM
5017changing the names of these directories or adding alternate names (or
5018symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the
630d3d5a
JM
5019file @file{80386} is a link to the file @file{i386v}, then @option{-b
502080386} becomes an alias for @option{-b i386v}.
74291a4b 5021
630d3d5a 5022In one respect, the @option{-b} or @option{-V} do not completely change
bedc7537 5023to a different compiler: the top-level driver program @command{gcc}
74291a4b
MM
5024that you originally invoked continues to run and invoke the other
5025executables (preprocessor, compiler per se, assembler and linker)
5026that do the real work. However, since no real work is done in the
5027driver program, it usually does not matter that the driver program
8c7b74b9
JM
5028in use is not the one for the specified target. It is common for the
5029interface to the other executables to change incompatibly between
5030compiler versions, so unless the version specified is very close to that
630d3d5a
JM
5031of the driver (for example, @option{-V 3.0} with a driver program from GCC
5032version 3.0.1), use of @option{-V} may not work; for example, using
5033@option{-V 2.95.2} will not work with a driver program from GCC 3.0.
74291a4b
MM
5034
5035The only way that the driver program depends on the target machine is
5036in the parsing and handling of special machine-specific options.
5037However, this is controlled by a file which is found, along with the
5038other executables, in the directory for the specified version and
5039target machine. As a result, a single installed driver program adapts
8c7b74b9
JM
5040to any specified target machine, and sufficiently similar compiler
5041versions.
74291a4b
MM
5042
5043The driver program executable does control one significant thing,
5044however: the default version and target machine. Therefore, you can
5045install different instances of the driver program, compiled for
5046different targets or versions, under different names.
5047
bedc7537
NC
5048For example, if the driver for version 2.0 is installed as @command{ogcc}
5049and that for version 2.1 is installed as @command{gcc}, then the command
5050@command{gcc} will use version 2.1 by default, while @command{ogcc} will use
74291a4b 50512.0 by default. However, you can choose either version with either
630d3d5a 5052command with the @option{-V} option.
74291a4b
MM
5053
5054@node Submodel Options
5055@section Hardware Models and Configurations
5056@cindex submodel options
5057@cindex specifying hardware config
5058@cindex hardware models and configurations, specifying
5059@cindex machine dependent options
5060
630d3d5a 5061Earlier we discussed the standard option @option{-b} which chooses among
74291a4b 5062different installed compilers for completely different target
8aeea6e6 5063machines, such as VAX vs.@: 68000 vs.@: 80386.
74291a4b
MM
5064
5065In addition, each of these target machine types can have its own
5066special options, starting with @samp{-m}, to choose among various
5067hardware models or configurations---for example, 68010 vs 68020,
5068floating coprocessor or none. A single installed version of the
5069compiler can compile for any model or configuration, according to the
5070options specified.
5071
5072Some configurations of the compiler also support additional special
5073options, usually for compatibility with other compilers on the same
5074platform.
5075
74291a4b
MM
5076These options are defined by the macro @code{TARGET_SWITCHES} in the
5077machine description. The default for the options is also defined by
5078that macro, which enables you to change the defaults.
74291a4b
MM
5079
5080@menu
5081* M680x0 Options::
2856c3e3 5082* M68hc1x Options::
74291a4b
MM
5083* VAX Options::
5084* SPARC Options::
5085* Convex Options::
5086* AMD29K Options::
5087* ARM Options::
ecff22ab 5088* MN10200 Options::
6d6d0fa0 5089* MN10300 Options::
861bb6c1 5090* M32R/D Options::
74291a4b
MM
5091* M88K Options::
5092* RS/6000 and PowerPC Options::
5093* RT Options::
5094* MIPS Options::
14f73b5a 5095* i386 and x86-64 Options::
74291a4b
MM
5096* HPPA Options::
5097* Intel 960 Options::
5098* DEC Alpha Options::
d7c23cdc 5099* DEC Alpha/VMS Options::
74291a4b
MM
5100* Clipper Options::
5101* H8/300 Options::
5102* SH Options::
5103* System V Options::
282a61e6 5104* TMS320C3x/C4x Options::
f84271d9 5105* V850 Options::
56b2d7a7 5106* ARC Options::
83575957 5107* NS32K Options::
052a4b28
DC
5108* AVR Options::
5109* MCore Options::
df6194d4 5110* IA-64 Options::
e8ad90e5 5111* D30V Options::
91abf72d 5112* S/390 and zSeries Options::
0b85d816 5113* CRIS Options::
bcf684c7 5114* MMIX Options::
9f85bca7 5115* PDP-11 Options::
69a0611f 5116* Xstormy16 Options::
74291a4b
MM
5117@end menu
5118
5119@node M680x0 Options
5120@subsection M680x0 Options
5121@cindex M680x0 options
5122
5123These are the @samp{-m} options defined for the 68000 series. The default
5124values for these options depends on which style of 68000 was selected when
5125the compiler was configured; the defaults for the most common choices are
5126given below.
5127
2642624b 5128@table @gcctabopt
74291a4b
MM
5129@item -m68000
5130@itemx -mc68000
cd3bb277
JM
5131@opindex m68000
5132@opindex mc68000
74291a4b
MM
5133Generate output for a 68000. This is the default
5134when the compiler is configured for 68000-based systems.
5135
74cf1c6d
RK
5136Use this option for microcontrollers with a 68000 or EC000 core,
5137including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5138
74291a4b
MM
5139@item -m68020
5140@itemx -mc68020
cd3bb277
JM
5141@opindex m68020
5142@opindex mc68020
74291a4b
MM
5143Generate output for a 68020. This is the default
5144when the compiler is configured for 68020-based systems.
5145
5146@item -m68881
cd3bb277 5147@opindex m68881
74291a4b 5148Generate output containing 68881 instructions for floating point.
630d3d5a 5149This is the default for most 68020 systems unless @option{--nfp} was
74291a4b
MM
5150specified when the compiler was configured.
5151
5152@item -m68030
cd3bb277 5153@opindex m68030
74291a4b
MM
5154Generate output for a 68030. This is the default when the compiler is
5155configured for 68030-based systems.
5156
5157@item -m68040
cd3bb277 5158@opindex m68040
74291a4b
MM
5159Generate output for a 68040. This is the default when the compiler is
5160configured for 68040-based systems.
5161
5162This option inhibits the use of 68881/68882 instructions that have to be
74cf1c6d
RK
5163emulated by software on the 68040. Use this option if your 68040 does not
5164have code to emulate those instructions.
74291a4b
MM
5165
5166@item -m68060
cd3bb277 5167@opindex m68060
74291a4b
MM
5168Generate output for a 68060. This is the default when the compiler is
5169configured for 68060-based systems.
5170
5171This option inhibits the use of 68020 and 68881/68882 instructions that
74cf1c6d
RK
5172have to be emulated by software on the 68060. Use this option if your 68060
5173does not have code to emulate those instructions.
5174
5175@item -mcpu32
cd3bb277 5176@opindex mcpu32
767094dd 5177Generate output for a CPU32. This is the default
74cf1c6d
RK
5178when the compiler is configured for CPU32-based systems.
5179
5180Use this option for microcontrollers with a
5181CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
518268336, 68340, 68341, 68349 and 68360.
74291a4b
MM
5183
5184@item -m5200
cd3bb277 5185@opindex m5200
695ac33f 5186Generate output for a 520X ``coldfire'' family cpu. This is the default
74291a4b
MM
5187when the compiler is configured for 520X-based systems.
5188
02f52e19 5189Use this option for microcontroller with a 5200 core, including
74cf1c6d
RK
5190the MCF5202, MCF5203, MCF5204 and MCF5202.
5191
74291a4b
MM
5192
5193@item -m68020-40
cd3bb277 5194@opindex m68020-40
74291a4b
MM
5195Generate output for a 68040, without using any of the new instructions.
5196This results in code which can run relatively efficiently on either a
519768020/68881 or a 68030 or a 68040. The generated code does use the
519868881 instructions that are emulated on the 68040.
5199
861bb6c1 5200@item -m68020-60
cd3bb277 5201@opindex m68020-60
861bb6c1
JL
5202Generate output for a 68060, without using any of the new instructions.
5203This results in code which can run relatively efficiently on either a
520468020/68881 or a 68030 or a 68040. The generated code does use the
520568881 instructions that are emulated on the 68060.
5206
74291a4b 5207@item -mfpa
cd3bb277 5208@opindex mfpa
74291a4b
MM
5209Generate output containing Sun FPA instructions for floating point.
5210
5211@item -msoft-float
cd3bb277 5212@opindex msoft-float
74291a4b
MM
5213Generate output containing library calls for floating point.
5214@strong{Warning:} the requisite libraries are not available for all m68k
5215targets. Normally the facilities of the machine's usual C compiler are
5216used, but this can't be done directly in cross-compilation. You must
5217make your own arrangements to provide suitable library functions for
5218cross-compilation. The embedded targets @samp{m68k-*-aout} and
5219@samp{m68k-*-coff} do provide software floating point support.
5220
5221@item -mshort
cd3bb277 5222@opindex mshort
74291a4b
MM
5223Consider type @code{int} to be 16 bits wide, like @code{short int}.
5224
5225@item -mnobitfield
cd3bb277 5226@opindex mnobitfield
630d3d5a
JM
5227Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
5228and @option{-m5200} options imply @w{@option{-mnobitfield}}.
74291a4b
MM
5229
5230@item -mbitfield
cd3bb277 5231@opindex mbitfield
630d3d5a
JM
5232Do use the bit-field instructions. The @option{-m68020} option implies
5233@option{-mbitfield}. This is the default if you use a configuration
74291a4b
MM
5234designed for a 68020.
5235
5236@item -mrtd
cd3bb277 5237@opindex mrtd
74291a4b
MM
5238Use a different function-calling convention, in which functions
5239that take a fixed number of arguments return with the @code{rtd}
5240instruction, which pops their arguments while returning. This
5241saves one instruction in the caller since there is no need to pop
5242the arguments there.
5243
5244This calling convention is incompatible with the one normally
5245used on Unix, so you cannot use it if you need to call libraries
5246compiled with the Unix compiler.
5247
5248Also, you must provide function prototypes for all functions that
5249take variable numbers of arguments (including @code{printf});
5250otherwise incorrect code will be generated for calls to those
5251functions.
5252
5253In addition, seriously incorrect code will result if you call a
5254function with too many arguments. (Normally, extra arguments are
5255harmlessly ignored.)
5256
5257The @code{rtd} instruction is supported by the 68010, 68020, 68030,
74cf1c6d 525868040, 68060 and CPU32 processors, but not by the 68000 or 5200.
861bb6c1
JL
5259
5260@item -malign-int
5261@itemx -mno-align-int
cd3bb277
JM
5262@opindex malign-int
5263@opindex mno-align-int
02f52e19 5264Control whether GCC aligns @code{int}, @code{long}, @code{long long},
861bb6c1 5265@code{float}, @code{double}, and @code{long double} variables on a 32-bit
630d3d5a 5266boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
861bb6c1
JL
5267Aligning variables on 32-bit boundaries produces code that runs somewhat
5268faster on processors with 32-bit busses at the expense of more memory.
5269
630d3d5a 5270@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
861bb6c1
JL
5271align structures containing the above types differently than
5272most published application binary interface specifications for the m68k.
5273
fb868474 5274@item -mpcrel
cd3bb277 5275@opindex mpcrel
fb868474 5276Use the pc-relative addressing mode of the 68000 directly, instead of
695ac33f
JM
5277using a global offset table. At present, this option implies @option{-fpic},
5278allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
5279not presently supported with @option{-mpcrel}, though this could be supported for
fb868474
DL
528068020 and higher processors.
5281
b71733d5
GM
5282@item -mno-strict-align
5283@itemx -mstrict-align
cd3bb277
JM
5284@opindex mno-strict-align
5285@opindex mstrict-align
b71733d5
GM
5286Do not (do) assume that unaligned memory references will be handled by
5287the system.
5288
74291a4b
MM
5289@end table
5290
2856c3e3
SC
5291@node M68hc1x Options
5292@subsection M68hc1x Options
5293@cindex M68hc1x options
5294
5295These are the @samp{-m} options defined for the 68hc11 and 68hc12
02f52e19 5296microcontrollers. The default values for these options depends on
2856c3e3
SC
5297which style of microcontroller was selected when the compiler was configured;
5298the defaults for the most common choices are given below.
5299
2642624b 5300@table @gcctabopt
2856c3e3
SC
5301@item -m6811
5302@itemx -m68hc11
cd3bb277
JM
5303@opindex m6811
5304@opindex m68hc11
2856c3e3
SC
5305Generate output for a 68HC11. This is the default
5306when the compiler is configured for 68HC11-based systems.
5307
5308@item -m6812
5309@itemx -m68hc12
cd3bb277
JM
5310@opindex m6812
5311@opindex m68hc12
2856c3e3
SC
5312Generate output for a 68HC12. This is the default
5313when the compiler is configured for 68HC12-based systems.
5314
5315@item -mauto-incdec
cd3bb277 5316@opindex mauto-incdec
2856c3e3
SC
5317Enable the use of 68HC12 pre and post auto-increment and auto-decrement
5318addressing modes.
5319
5320@item -mshort
cd3bb277 5321@opindex mshort
2856c3e3
SC
5322Consider type @code{int} to be 16 bits wide, like @code{short int}.
5323
5324@item -msoft-reg-count=@var{count}
cd3bb277 5325@opindex msoft-reg-count
2856c3e3
SC
5326Specify the number of pseudo-soft registers which are used for the
5327code generation. The maximum number is 32. Using more pseudo-soft
5328register may or may not result in better code depending on the program.
5329The default is 4 for 68HC11 and 2 for 68HC12.
5330
5331@end table
5332
74291a4b
MM
5333@node VAX Options
5334@subsection VAX Options
5335@cindex VAX options
5336
8aeea6e6 5337These @samp{-m} options are defined for the VAX:
74291a4b 5338
2642624b 5339@table @gcctabopt
74291a4b 5340@item -munix
cd3bb277 5341@opindex munix
74291a4b 5342Do not output certain jump instructions (@code{aobleq} and so on)
8aeea6e6 5343that the Unix assembler for the VAX cannot handle across long
74291a4b
MM
5344ranges.
5345
5346@item -mgnu
cd3bb277 5347@opindex mgnu
74291a4b
MM
5348Do output those jump instructions, on the assumption that you
5349will assemble with the GNU assembler.
5350
5351@item -mg
cd3bb277 5352@opindex mg
74291a4b
MM
5353Output code for g-format floating point numbers instead of d-format.
5354@end table
5355
5356@node SPARC Options
5357@subsection SPARC Options
5358@cindex SPARC options
5359
5360These @samp{-m} switches are supported on the SPARC:
5361
2642624b 5362@table @gcctabopt
74291a4b
MM
5363@item -mno-app-regs
5364@itemx -mapp-regs
cd3bb277
JM
5365@opindex mno-app-regs
5366@opindex mapp-regs
630d3d5a 5367Specify @option{-mapp-regs} to generate output using the global registers
74291a4b
MM
53682 through 4, which the SPARC SVR4 ABI reserves for applications. This
5369is the default.
5370
5371To be fully SVR4 ABI compliant at the cost of some performance loss,
630d3d5a 5372specify @option{-mno-app-regs}. You should compile libraries and system
74291a4b
MM
5373software with this option.
5374
5375@item -mfpu
5376@itemx -mhard-float
cd3bb277
JM
5377@opindex mfpu
5378@opindex mhard-float
74291a4b
MM
5379Generate output containing floating point instructions. This is the
5380default.
5381
5382@item -mno-fpu
5383@itemx -msoft-float
cd3bb277
JM
5384@opindex mno-fpu
5385@opindex msoft-float
74291a4b
MM
5386Generate output containing library calls for floating point.
5387@strong{Warning:} the requisite libraries are not available for all SPARC
5388targets. Normally the facilities of the machine's usual C compiler are
5389used, but this cannot be done directly in cross-compilation. You must make
5390your own arrangements to provide suitable library functions for
5391cross-compilation. The embedded targets @samp{sparc-*-aout} and
5392@samp{sparclite-*-*} do provide software floating point support.
5393
630d3d5a 5394@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
5395therefore, it is only useful if you compile @emph{all} of a program with
5396this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 5397library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
5398this to work.
5399
5400@item -mhard-quad-float
cd3bb277 5401@opindex mhard-quad-float
74291a4b
MM
5402Generate output containing quad-word (long double) floating point
5403instructions.
5404
5405@item -msoft-quad-float
cd3bb277 5406@opindex msoft-quad-float
74291a4b
MM
5407Generate output containing library calls for quad-word (long double)
5408floating point instructions. The functions called are those specified
161d7b59 5409in the SPARC ABI@. This is the default.
74291a4b
MM
5410
5411As of this writing, there are no sparc implementations that have hardware
5412support for the quad-word floating point instructions. They all invoke
5413a trap handler for one of these instructions, and then the trap handler
5414emulates the effect of the instruction. Because of the trap handler overhead,
5415this is much slower than calling the ABI library routines. Thus the
630d3d5a 5416@option{-msoft-quad-float} option is the default.
74291a4b
MM
5417
5418@item -mno-epilogue
5419@itemx -mepilogue
cd3bb277
JM
5420@opindex mno-epilogue
5421@opindex mepilogue
630d3d5a 5422With @option{-mepilogue} (the default), the compiler always emits code for
74291a4b
MM
5423function exit at the end of each function. Any function exit in
5424the middle of the function (such as a return statement in C) will
5425generate a jump to the exit code at the end of the function.
5426
630d3d5a 5427With @option{-mno-epilogue}, the compiler tries to emit exit code inline
74291a4b
MM
5428at every function exit.
5429
5430@item -mno-flat
5431@itemx -mflat
cd3bb277
JM
5432@opindex mno-flat
5433@opindex mflat
630d3d5a 5434With @option{-mflat}, the compiler does not generate save/restore instructions
695ac33f 5435and will use a ``flat'' or single register window calling convention.
74291a4b
MM
5436This model uses %i7 as the frame pointer and is compatible with the normal
5437register window model. Code from either may be intermixed.
aee96fe9 5438The local registers and the input registers (0--5) are still treated as
695ac33f 5439``call saved'' registers and will be saved on the stack as necessary.
74291a4b 5440
630d3d5a 5441With @option{-mno-flat} (the default), the compiler emits save/restore
74291a4b
MM
5442instructions (except for leaf functions) and is the normal mode of operation.
5443
5444@item -mno-unaligned-doubles
5445@itemx -munaligned-doubles
cd3bb277
JM
5446@opindex mno-unaligned-doubles
5447@opindex munaligned-doubles
74291a4b
MM
5448Assume that doubles have 8 byte alignment. This is the default.
5449
630d3d5a 5450With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
74291a4b
MM
5451alignment only if they are contained in another type, or if they have an
5452absolute address. Otherwise, it assumes they have 4 byte alignment.
5453Specifying this option avoids some rare compatibility problems with code
5454generated by other compilers. It is not the default because it results
5455in a performance loss, especially for floating point code.
5456
c219ddf7
BK
5457@item -mno-faster-structs
5458@itemx -mfaster-structs
cd3bb277
JM
5459@opindex mno-faster-structs
5460@opindex mfaster-structs
630d3d5a 5461With @option{-mfaster-structs}, the compiler assumes that structures
c219ddf7
BK
5462should have 8 byte alignment. This enables the use of pairs of
5463@code{ldd} and @code{std} instructions for copies in structure
5464assignment, in place of twice as many @code{ld} and @code{st} pairs.
5465However, the use of this changed alignment directly violates the Sparc
161d7b59 5466ABI@. Thus, it's intended only for use on targets where the developer
c219ddf7 5467acknowledges that their resulting code will not be directly in line with
161d7b59 5468the rules of the ABI@.
c219ddf7 5469
74291a4b
MM
5470@item -mv8
5471@itemx -msparclite
cd3bb277
JM
5472@opindex mv8
5473@opindex msparclite
74291a4b
MM
5474These two options select variations on the SPARC architecture.
5475
5476By default (unless specifically configured for the Fujitsu SPARClite),
5477GCC generates code for the v7 variant of the SPARC architecture.
5478
630d3d5a 5479@option{-mv8} will give you SPARC v8 code. The only difference from v7
74291a4b
MM
5480code is that the compiler emits the integer multiply and integer
5481divide instructions which exist in SPARC v8 but not in SPARC v7.
5482
630d3d5a 5483@option{-msparclite} will give you SPARClite code. This adds the integer
74291a4b
MM
5484multiply, integer divide step and scan (@code{ffs}) instructions which
5485exist in SPARClite but not in SPARC v7.
5486
0c2d1a2a 5487These options are deprecated and will be deleted in a future GCC release.
630d3d5a 5488They have been replaced with @option{-mcpu=xxx}.
74291a4b
MM
5489
5490@item -mcypress
5491@itemx -msupersparc
cd3bb277
JM
5492@opindex mcypress
5493@opindex msupersparc
c21cd8b1 5494These two options select the processor for which the code is optimized.
74291a4b 5495
630d3d5a 5496With @option{-mcypress} (the default), the compiler optimizes code for the
74291a4b
MM
5497Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
5498This is also appropriate for the older SparcStation 1, 2, IPX etc.
5499
630d3d5a 5500With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
767094dd 5501used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
74291a4b
MM
5502of the full SPARC v8 instruction set.
5503
0c2d1a2a 5504These options are deprecated and will be deleted in a future GCC release.
630d3d5a 5505They have been replaced with @option{-mcpu=xxx}.
74291a4b
MM
5506
5507@item -mcpu=@var{cpu_type}
cd3bb277 5508@opindex mcpu
c0498f43
DE
5509Set the instruction set, register set, and instruction scheduling parameters
5510for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
5511@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
ad6843d7
RH
5512@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
5513@samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}.
c0498f43
DE
5514
5515Default instruction scheduling parameters are used for values that select
5516an architecture and not an implementation. These are @samp{v7}, @samp{v8},
5517@samp{sparclite}, @samp{sparclet}, @samp{v9}.
5518
5519Here is a list of each supported architecture and their supported
5520implementations.
5521
5522@smallexample
5523 v7: cypress
ad6843d7
RH
5524 v8: supersparc, hypersparc
5525 sparclite: f930, f934, sparclite86x
c0498f43
DE
5526 sparclet: tsc701
5527 v9: ultrasparc
5528@end smallexample
74291a4b
MM
5529
5530@item -mtune=@var{cpu_type}
cd3bb277 5531@opindex mtune
74291a4b 5532Set the instruction scheduling parameters for machine type
c0498f43 5533@var{cpu_type}, but do not set the instruction set or register set that the
630d3d5a 5534option @option{-mcpu=@var{cpu_type}} would.
c0498f43 5535
9c34dbbf
ZW
5536The same values for @option{-mcpu=@var{cpu_type}} can be used for
5537@option{-mtune=@var{cpu_type}}, but the only useful values are those
5538that select a particular cpu implementation. Those are @samp{cypress},
5539@samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
5540@samp{sparclite86x}, @samp{tsc701}, and @samp{ultrasparc}.
74291a4b
MM
5541
5542@end table
5543
5544These @samp{-m} switches are supported in addition to the above
5545on the SPARCLET processor.
5546
2642624b 5547@table @gcctabopt
74291a4b 5548@item -mlittle-endian
cd3bb277 5549@opindex mlittle-endian
74291a4b
MM
5550Generate code for a processor running in little-endian mode.
5551
5552@item -mlive-g0
cd3bb277 5553@opindex mlive-g0
74291a4b
MM
5554Treat register @code{%g0} as a normal register.
5555GCC will continue to clobber it as necessary but will not assume
5556it always reads as 0.
5557
5558@item -mbroken-saverestore
cd3bb277 5559@opindex mbroken-saverestore
74291a4b
MM
5560Generate code that does not use non-trivial forms of the @code{save} and
5561@code{restore} instructions. Early versions of the SPARCLET processor do
5562not correctly handle @code{save} and @code{restore} instructions used with
5563arguments. They correctly handle them used without arguments. A @code{save}
5564instruction used without arguments increments the current window pointer
5565but does not allocate a new stack frame. It is assumed that the window
5566overflow trap handler will properly handle this case as will interrupt
5567handlers.
5568@end table
5569
5570These @samp{-m} switches are supported in addition to the above
02f52e19 5571on SPARC V9 processors in 64-bit environments.
74291a4b 5572
2642624b 5573@table @gcctabopt
74291a4b 5574@item -mlittle-endian
cd3bb277 5575@opindex mlittle-endian
74291a4b
MM
5576Generate code for a processor running in little-endian mode.
5577
ded17aad
DE
5578@item -m32
5579@itemx -m64
cd3bb277
JM
5580@opindex m32
5581@opindex m64
02f52e19
AJ
5582Generate code for a 32-bit or 64-bit environment.
5583The 32-bit environment sets int, long and pointer to 32 bits.
5584The 64-bit environment sets int to 32 bits and long and pointer
ded17aad
DE
5585to 64 bits.
5586
5587@item -mcmodel=medlow
cd3bb277 5588@opindex mcmodel=medlow
ded17aad
DE
5589Generate code for the Medium/Low code model: the program must be linked
5590in the low 32 bits of the address space. Pointers are 64 bits.
5591Programs can be statically or dynamically linked.
5592
5593@item -mcmodel=medmid
cd3bb277 5594@opindex mcmodel=medmid
ded17aad
DE
5595Generate code for the Medium/Middle code model: the program must be linked
5596in the low 44 bits of the address space, the text segment must be less than
55972G bytes, and data segment must be within 2G of the text segment.
5598Pointers are 64 bits.
5599
5600@item -mcmodel=medany
cd3bb277 5601@opindex mcmodel=medany
ded17aad
DE
5602Generate code for the Medium/Anywhere code model: the program may be linked
5603anywhere in the address space, the text segment must be less than
56042G bytes, and data segment must be within 2G of the text segment.
5605Pointers are 64 bits.
5606
5607@item -mcmodel=embmedany
cd3bb277 5608@opindex mcmodel=embmedany
ded17aad 5609Generate code for the Medium/Anywhere code model for embedded systems:
02f52e19 5610assume a 32-bit text and a 32-bit data segment, both starting anywhere
ded17aad 5611(determined at link time). Register %g4 points to the base of the
02f52e19 5612data segment. Pointers are still 64 bits.
ded17aad 5613Programs are statically linked, PIC is not supported.
74291a4b
MM
5614
5615@item -mstack-bias
5616@itemx -mno-stack-bias
cd3bb277
JM
5617@opindex mstack-bias
5618@opindex mno-stack-bias
630d3d5a
JM
5619With @option{-mstack-bias}, GCC assumes that the stack pointer, and
5620frame pointer if present, are offset by @minus{}2047 which must be added back
74291a4b
MM
5621when making stack frame references.
5622Otherwise, assume no such offset is present.
5623@end table
5624
5625@node Convex Options
5626@subsection Convex Options
5627@cindex Convex options
5628
5629These @samp{-m} options are defined for Convex:
5630
2642624b 5631@table @gcctabopt
74291a4b 5632@item -mc1
cd3bb277 5633@opindex mc1
74291a4b
MM
5634Generate output for C1. The code will run on any Convex machine.
5635The preprocessor symbol @code{__convex__c1__} is defined.
5636
5637@item -mc2
cd3bb277 5638@opindex mc2
74291a4b
MM
5639Generate output for C2. Uses instructions not available on C1.
5640Scheduling and other optimizations are chosen for max performance on C2.
5641The preprocessor symbol @code{__convex_c2__} is defined.
5642
5643@item -mc32
cd3bb277 5644@opindex mc32
74291a4b
MM
5645Generate output for C32xx. Uses instructions not available on C1.
5646Scheduling and other optimizations are chosen for max performance on C32.
5647The preprocessor symbol @code{__convex_c32__} is defined.
5648
5649@item -mc34
cd3bb277 5650@opindex mc34
74291a4b
MM
5651Generate output for C34xx. Uses instructions not available on C1.
5652Scheduling and other optimizations are chosen for max performance on C34.
5653The preprocessor symbol @code{__convex_c34__} is defined.
5654
5655@item -mc38
cd3bb277 5656@opindex mc38
74291a4b
MM
5657Generate output for C38xx. Uses instructions not available on C1.
5658Scheduling and other optimizations are chosen for max performance on C38.
5659The preprocessor symbol @code{__convex_c38__} is defined.
5660
5661@item -margcount
cd3bb277 5662@opindex margcount
74291a4b
MM
5663Generate code which puts an argument count in the word preceding each
5664argument list. This is compatible with regular CC, and a few programs
5665may need the argument count word. GDB and other source-level debuggers
5666do not need it; this info is in the symbol table.
5667
5668@item -mnoargcount
cd3bb277 5669@opindex mnoargcount
74291a4b
MM
5670Omit the argument count word. This is the default.
5671
5672@item -mvolatile-cache
cd3bb277 5673@opindex mvolatile-cache
74291a4b
MM
5674Allow volatile references to be cached. This is the default.
5675
5676@item -mvolatile-nocache
cd3bb277 5677@opindex mvolatile-nocache
74291a4b
MM
5678Volatile references bypass the data cache, going all the way to memory.
5679This is only needed for multi-processor code that does not use standard
5680synchronization instructions. Making non-volatile references to volatile
5681locations will not necessarily work.
5682
5683@item -mlong32
cd3bb277 5684@opindex mlong32
74291a4b
MM
5685Type long is 32 bits, the same as type int. This is the default.
5686
5687@item -mlong64
cd3bb277 5688@opindex mlong64
74291a4b
MM
5689Type long is 64 bits, the same as type long long. This option is useless,
5690because no library support exists for it.
5691@end table
5692
5693@node AMD29K Options
5694@subsection AMD29K Options
5695@cindex AMD29K options
5696
5697These @samp{-m} options are defined for the AMD Am29000:
5698
2642624b 5699@table @gcctabopt
74291a4b 5700@item -mdw
cd3bb277 5701@opindex mdw
74291a4b
MM
5702@cindex DW bit (29k)
5703Generate code that assumes the @code{DW} bit is set, i.e., that byte and
5704halfword operations are directly supported by the hardware. This is the
5705default.
5706
5707@item -mndw
cd3bb277 5708@opindex mndw
74291a4b
MM
5709Generate code that assumes the @code{DW} bit is not set.
5710
5711@item -mbw
cd3bb277 5712@opindex mbw
74291a4b
MM
5713@cindex byte writes (29k)
5714Generate code that assumes the system supports byte and halfword write
5715operations. This is the default.
5716
5717@item -mnbw
cd3bb277 5718@opindex mnbw
74291a4b 5719Generate code that assumes the systems does not support byte and
630d3d5a 5720halfword write operations. @option{-mnbw} implies @option{-mndw}.
74291a4b
MM
5721
5722@item -msmall
cd3bb277 5723@opindex msmall
74291a4b
MM
5724@cindex memory model (29k)
5725Use a small memory model that assumes that all function addresses are
5726either within a single 256 KB segment or at an absolute address of less
5727than 256k. This allows the @code{call} instruction to be used instead
5728of a @code{const}, @code{consth}, @code{calli} sequence.
5729
5730@item -mnormal
cd3bb277 5731@opindex mnormal
74291a4b
MM
5732Use the normal memory model: Generate @code{call} instructions only when
5733calling functions in the same file and @code{calli} instructions
5734otherwise. This works if each file occupies less than 256 KB but allows
161d7b59 5735the entire executable to be larger than 256 KB@. This is the default.
74291a4b
MM
5736
5737@item -mlarge
cd3bb277 5738@opindex mlarge
74291a4b
MM
5739Always use @code{calli} instructions. Specify this option if you expect
5740a single file to compile into more than 256 KB of code.
5741
5742@item -m29050
cd3bb277 5743@opindex m29050
74291a4b
MM
5744@cindex processor selection (29k)
5745Generate code for the Am29050.
5746
5747@item -m29000
cd3bb277 5748@opindex m29000
74291a4b
MM
5749Generate code for the Am29000. This is the default.
5750
5751@item -mkernel-registers
cd3bb277 5752@opindex mkernel-registers
74291a4b
MM
5753@cindex kernel and user registers (29k)
5754Generate references to registers @code{gr64-gr95} instead of to
5755registers @code{gr96-gr127}. This option can be used when compiling
5756kernel code that wants a set of global registers disjoint from that used
5757by user-mode code.
5758
5759Note that when this option is used, register names in @samp{-f} flags
5760must use the normal, user-mode, names.
5761
5762@item -muser-registers
cd3bb277 5763@opindex muser-registers
74291a4b
MM
5764Use the normal set of global registers, @code{gr96-gr127}. This is the
5765default.
5766
5767@item -mstack-check
5768@itemx -mno-stack-check
cd3bb277
JM
5769@opindex mstack-check
5770@opindex mno-stack-check
74291a4b
MM
5771@cindex stack checks (29k)
5772Insert (or do not insert) a call to @code{__msp_check} after each stack
5773adjustment. This is often used for kernel code.
5774
5775@item -mstorem-bug
5776@itemx -mno-storem-bug
cd3bb277
JM
5777@opindex mstorem-bug
5778@opindex mno-storem-bug
74291a4b 5779@cindex storem bug (29k)
630d3d5a 5780@option{-mstorem-bug} handles 29k processors which cannot handle the
74291a4b
MM
5781separation of a mtsrim insn and a storem instruction (most 29000 chips
5782to date, but not the 29050).
5783
5784@item -mno-reuse-arg-regs
5785@itemx -mreuse-arg-regs
cd3bb277
JM
5786@opindex mno-reuse-arg-regs
5787@opindex mreuse-arg-regs
630d3d5a 5788@option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
74291a4b
MM
5789registers for copying out arguments. This helps detect calling a function
5790with fewer arguments than it was declared with.
5791
861bb6c1
JL
5792@item -mno-impure-text
5793@itemx -mimpure-text
cd3bb277
JM
5794@opindex mno-impure-text
5795@opindex mimpure-text
630d3d5a
JM
5796@option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to
5797not pass @option{-assert pure-text} to the linker when linking a shared object.
861bb6c1 5798
74291a4b 5799@item -msoft-float
cd3bb277 5800@opindex msoft-float
74291a4b 5801Generate output containing library calls for floating point.
161d7b59 5802@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
5803Normally the facilities of the machine's usual C compiler are used, but
5804this can't be done directly in cross-compilation. You must make your
5805own arrangements to provide suitable library functions for
5806cross-compilation.
4e8d7ddc
JW
5807
5808@item -mno-multm
cd3bb277 5809@opindex mno-multm
4e8d7ddc
JW
5810Do not generate multm or multmu instructions. This is useful for some embedded
5811systems which do not have trap handlers for these instructions.
74291a4b
MM
5812@end table
5813
5814@node ARM Options
5815@subsection ARM Options
5816@cindex ARM options
5817
5818These @samp{-m} options are defined for Advanced RISC Machines (ARM)
5819architectures:
5820
2642624b 5821@table @gcctabopt
74291a4b 5822@item -mapcs-frame
cd3bb277 5823@opindex mapcs-frame
74291a4b
MM
5824Generate a stack frame that is compliant with the ARM Procedure Call
5825Standard for all functions, even if this is not strictly necessary for
630d3d5a 5826correct execution of the code. Specifying @option{-fomit-frame-pointer}
157a620e 5827with this option will cause the stack frames not to be generated for
630d3d5a 5828leaf functions. The default is @option{-mno-apcs-frame}.
157a620e
NC
5829
5830@item -mapcs
cd3bb277 5831@opindex mapcs
630d3d5a 5832This is a synonym for @option{-mapcs-frame}.
74291a4b
MM
5833
5834@item -mapcs-26
cd3bb277 5835@opindex mapcs-26
74291a4b
MM
5836Generate code for a processor running with a 26-bit program counter,
5837and conforming to the function calling standards for the APCS 26-bit
630d3d5a 5838option. This option replaces the @option{-m2} and @option{-m3} options
74291a4b
MM
5839of previous releases of the compiler.
5840
5841@item -mapcs-32
cd3bb277 5842@opindex mapcs-32
74291a4b
MM
5843Generate code for a processor running with a 32-bit program counter,
5844and conforming to the function calling standards for the APCS 32-bit
630d3d5a 5845option. This option replaces the @option{-m6} option of previous releases
74291a4b
MM
5846of the compiler.
5847
247f8561
PB
5848@ignore
5849@c not currently implemented
157a620e 5850@item -mapcs-stack-check
cd3bb277 5851@opindex mapcs-stack-check
157a620e
NC
5852Generate code to check the amount of stack space available upon entry to
5853every function (that actually uses some stack space). If there is
5854insufficient space available then either the function
5855@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
5856called, depending upon the amount of stack space required. The run time
5857system is required to provide these functions. The default is
630d3d5a 5858@option{-mno-apcs-stack-check}, since this produces smaller code.
157a620e 5859
247f8561 5860@c not currently implemented
157a620e 5861@item -mapcs-float
cd3bb277 5862@opindex mapcs-float
157a620e 5863Pass floating point arguments using the float point registers. This is
161d7b59 5864one of the variants of the APCS@. This option is recommended if the
157a620e
NC
5865target hardware has a floating point unit or if a lot of floating point
5866arithmetic is going to be performed by the code. The default is
630d3d5a
JM
5867@option{-mno-apcs-float}, since integer only code is slightly increased in
5868size if @option{-mapcs-float} is used.
157a620e 5869
247f8561 5870@c not currently implemented
157a620e 5871@item -mapcs-reentrant
cd3bb277 5872@opindex mapcs-reentrant
247f8561 5873Generate reentrant, position independent code. The default is
630d3d5a 5874@option{-mno-apcs-reentrant}.
247f8561 5875@end ignore
157a620e
NC
5876
5877@item -mthumb-interwork
cd3bb277 5878@opindex mthumb-interwork
247f8561 5879Generate code which supports calling between the ARM and Thumb
157a620e
NC
5880instruction sets. Without this option the two instruction sets cannot
5881be reliably used inside one program. The default is
630d3d5a
JM
5882@option{-mno-thumb-interwork}, since slightly larger code is generated
5883when @option{-mthumb-interwork} is specified.
157a620e
NC
5884
5885@item -mno-sched-prolog
cd3bb277 5886@opindex mno-sched-prolog
157a620e
NC
5887Prevent the reordering of instructions in the function prolog, or the
5888merging of those instruction with the instructions in the function's
ed0e6530
PB
5889body. This means that all functions will start with a recognizable set
5890of instructions (or in fact one of a choice from a small set of
157a620e
NC
5891different function prologues), and this information can be used to
5892locate the start if functions inside an executable piece of code. The
630d3d5a 5893default is @option{-msched-prolog}.
157a620e 5894
74291a4b 5895@item -mhard-float
cd3bb277 5896@opindex mhard-float
74291a4b
MM
5897Generate output containing floating point instructions. This is the
5898default.
5899
5900@item -msoft-float
cd3bb277 5901@opindex msoft-float
74291a4b
MM
5902Generate output containing library calls for floating point.
5903@strong{Warning:} the requisite libraries are not available for all ARM
5904targets. Normally the facilities of the machine's usual C compiler are
5905used, but this cannot be done directly in cross-compilation. You must make
5906your own arrangements to provide suitable library functions for
5907cross-compilation.
5908
630d3d5a 5909@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
5910therefore, it is only useful if you compile @emph{all} of a program with
5911this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 5912library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
5913this to work.
5914
5915@item -mlittle-endian
cd3bb277 5916@opindex mlittle-endian
74291a4b
MM
5917Generate code for a processor running in little-endian mode. This is
5918the default for all standard configurations.
5919
5920@item -mbig-endian
cd3bb277 5921@opindex mbig-endian
74291a4b
MM
5922Generate code for a processor running in big-endian mode; the default is
5923to compile code for a little-endian processor.
5924
5925@item -mwords-little-endian
cd3bb277 5926@opindex mwords-little-endian
74291a4b
MM
5927This option only applies when generating code for big-endian processors.
5928Generate code for a little-endian word order but a big-endian byte
5929order. That is, a byte order of the form @samp{32107654}. Note: this
5930option should only be used if you require compatibility with code for
5931big-endian ARM processors generated by versions of the compiler prior to
59322.8.
5933
5f1e6755 5934@item -malignment-traps
cd3bb277 5935@opindex malignment-traps
5f1e6755
NC
5936Generate code that will not trap if the MMU has alignment traps enabled.
5937On ARM architectures prior to ARMv4, there were no instructions to
5938access half-word objects stored in memory. However, when reading from
5939memory a feature of the ARM architecture allows a word load to be used,
5940even if the address is unaligned, and the processor core will rotate the
5941data as it is being loaded. This option tells the compiler that such
5942misaligned accesses will cause a MMU trap and that it should instead
5943synthesise the access as a series of byte accesses. The compiler can
5944still use word accesses to load half-word data if it knows that the
5945address is aligned to a word boundary.
5946
5947This option is ignored when compiling for ARM architecture 4 or later,
5948since these processors have instructions to directly access half-word
02f52e19
AJ
5949objects in memory.
5950
5f1e6755 5951@item -mno-alignment-traps
cd3bb277 5952@opindex mno-alignment-traps
5f1e6755
NC
5953Generate code that assumes that the MMU will not trap unaligned
5954accesses. This produces better code when the target instruction set
e979f9e8 5955does not have half-word memory operations (i.e.@: implementations prior to
02f52e19 5956ARMv4).
5f1e6755
NC
5957
5958Note that you cannot use this option to access unaligned word objects,
5959since the processor will only fetch one 32-bit aligned object from
02f52e19 5960memory.
5f1e6755 5961
695ac33f 5962The default setting for most targets is @option{-mno-alignment-traps}, since
5f1e6755 5963this produces better code when there are no half-word memory
02f52e19 5964instructions available.
5f1e6755 5965
74291a4b 5966@item -mshort-load-bytes
247f8561 5967@itemx -mno-short-load-words
cd3bb277
JM
5968@opindex mshort-load-bytes
5969@opindex mno-short-load-words
630d3d5a 5970These are deprecated aliases for @option{-malignment-traps}.
74291a4b
MM
5971
5972@item -mno-short-load-bytes
247f8561 5973@itemx -mshort-load-words
cd3bb277
JM
5974@opindex mno-short-load-bytes
5975@opindex mshort-load-words
630d3d5a 5976This are deprecated aliases for @option{-mno-alignment-traps}.
157a620e 5977
74291a4b 5978@item -mbsd
cd3bb277 5979@opindex mbsd
161d7b59 5980This option only applies to RISC iX@. Emulate the native BSD-mode
630d3d5a 5981compiler. This is the default if @option{-ansi} is not specified.
74291a4b
MM
5982
5983@item -mxopen
cd3bb277 5984@opindex mxopen
161d7b59 5985This option only applies to RISC iX@. Emulate the native X/Open-mode
74291a4b
MM
5986compiler.
5987
5988@item -mno-symrename
cd3bb277 5989@opindex mno-symrename
161d7b59 5990This option only applies to RISC iX@. Do not run the assembler
74291a4b
MM
5991post-processor, @samp{symrename}, after code has been assembled.
5992Normally it is necessary to modify some of the standard symbols in
5993preparation for linking with the RISC iX C library; this option
5994suppresses this pass. The post-processor is never run when the
5995compiler is built for cross-compilation.
157a620e 5996
cd3bb277
JM
5997@item -mcpu=@var{name}
5998@opindex mcpu
157a620e 5999This specifies the name of the target ARM processor. GCC uses this name
247f8561 6000to determine what kind of instructions it can emit when generating
aee96fe9
JM
6001assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
6002@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6003@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6004@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6005@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6006@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6007@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6008@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6009@samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi},
6010@samp{arm1020t}, @samp{xscale}.
62b10bbc 6011
cd3bb277
JM
6012@itemx -mtune=@var{name}
6013@opindex mtune
630d3d5a 6014This option is very similar to the @option{-mcpu=} option, except that
62b10bbc
NC
6015instead of specifying the actual target processor type, and hence
6016restricting which instructions can be used, it specifies that GCC should
6017tune the performance of the code as if the target were of the type
6018specified in this option, but still choosing the instructions that it
630d3d5a 6019will generate based on the cpu specified by a @option{-mcpu=} option.
247f8561 6020For some ARM implementations better performance can be obtained by using
62b10bbc 6021this option.
157a620e 6022
cd3bb277
JM
6023@item -march=@var{name}
6024@opindex march
157a620e 6025This specifies the name of the target ARM architecture. GCC uses this
247f8561 6026name to determine what kind of instructions it can emit when generating
157a620e 6027assembly code. This option can be used in conjunction with or instead
aee96fe9
JM
6028of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
6029@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6030@samp{armv5}, @samp{armv5t}, @samp{armv5te}.
157a620e 6031
cd3bb277
JM
6032@item -mfpe=@var{number}
6033@itemx -mfp=@var{number}
6034@opindex mfpe
6035@opindex mfp
b192711e 6036This specifies the version of the floating point emulation available on
630d3d5a 6037the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym
161d7b59 6038for @option{-mfpe=}, for compatibility with older versions of GCC@.
157a620e 6039
cd3bb277
JM
6040@item -mstructure-size-boundary=@var{n}
6041@opindex mstructure-size-boundary
157a620e 6042The size of all structures and unions will be rounded up to a multiple
ed0e6530 6043of the number of bits set by this option. Permissible values are 8 and
157a620e
NC
604432. The default value varies for different toolchains. For the COFF
6045targeted toolchain the default value is 8. Specifying the larger number
ed0e6530 6046can produce faster, more efficient code, but can also increase the size
157a620e
NC
6047of the program. The two values are potentially incompatible. Code
6048compiled with one value cannot necessarily expect to work with code or
6049libraries compiled with the other value, if they exchange information
247f8561 6050using structures or unions.
157a620e 6051
f5a1b0d2 6052@item -mabort-on-noreturn
cd3bb277 6053@opindex mabort-on-noreturn
247f8561
PB
6054Generate a call to the function @code{abort} at the end of a
6055@code{noreturn} function. It will be executed if the function tries to
6056return.
f5a1b0d2 6057
c27ba912
DM
6058@item -mlong-calls
6059@itemx -mno-long-calls
cd3bb277
JM
6060@opindex mlong-calls
6061@opindex mno-long-calls
c27ba912
DM
6062Tells the compiler to perform function calls by first loading the
6063address of the function into a register and then performing a subroutine
6064call on this register. This switch is needed if the target function
6065will lie outside of the 64 megabyte addressing range of the offset based
02f52e19 6066version of subroutine call instruction.
c27ba912
DM
6067
6068Even if this switch is enabled, not all function calls will be turned
6069into long calls. The heuristic is that static functions, functions
6070which have the @samp{short-call} attribute, functions that are inside
6071the scope of a @samp{#pragma no_long_calls} directive and functions whose
6072definitions have already been compiled within the current compilation
6073unit, will not be turned into long calls. The exception to this rule is
b192711e 6074that weak function definitions, functions with the @samp{long-call}
c27ba912
DM
6075attribute or the @samp{section} attribute, and functions that are within
6076the scope of a @samp{#pragma long_calls} directive, will always be
6077turned into long calls.
6078
6079This feature is not enabled by default. Specifying
c21cd8b1 6080@option{-mno-long-calls} will restore the default behavior, as will
c27ba912
DM
6081placing the function calls within the scope of a @samp{#pragma
6082long_calls_off} directive. Note these switches have no effect on how
6083the compiler generates code to handle function calls via function
02f52e19 6084pointers.
c27ba912 6085
62b10bbc 6086@item -mnop-fun-dllimport
cd3bb277 6087@opindex mnop-fun-dllimport
aee96fe9 6088Disable support for the @code{dllimport} attribute.
62b10bbc 6089
ed0e6530 6090@item -msingle-pic-base
cd3bb277 6091@opindex msingle-pic-base
ed0e6530
PB
6092Treat the register used for PIC addressing as read-only, rather than
6093loading it in the prologue for each function. The run-time system is
c21cd8b1 6094responsible for initializing this register with an appropriate value
ed0e6530
PB
6095before execution begins.
6096
cd3bb277
JM
6097@item -mpic-register=@var{reg}
6098@opindex mpic-register
ed0e6530
PB
6099Specify the register to be used for PIC addressing. The default is R10
6100unless stack-checking is enabled, when R9 is used.
6101
247f8561 6102@item -mpoke-function-name
cd3bb277 6103@opindex mpoke-function-name
247f8561
PB
6104Write the name of each function into the text section, directly
6105preceding the function prologue. The generated code is similar to this:
74291a4b 6106
247f8561
PB
6107@smallexample
6108 t0
6109 .ascii "arm_poke_function_name", 0
6110 .align
6111 t1
6112 .word 0xff000000 + (t1 - t0)
6113 arm_poke_function_name
6114 mov ip, sp
6115 stmfd sp!, @{fp, ip, lr, pc@}
6116 sub fp, ip, #4
6117@end smallexample
157a620e 6118
247f8561
PB
6119When performing a stack backtrace, code can inspect the value of
6120@code{pc} stored at @code{fp + 0}. If the trace function then looks at
6121location @code{pc - 12} and the top 8 bits are set, then we know that
6122there is a function name embedded immediately preceding this location
6123and has length @code{((pc[-3]) & 0xff000000)}.
157a620e 6124
247f8561 6125@item -mthumb
cd3bb277 6126@opindex mthumb
247f8561
PB
6127Generate code for the 16-bit Thumb instruction set. The default is to
6128use the 32-bit ARM instruction set.
157a620e
NC
6129
6130@item -mtpcs-frame
cd3bb277 6131@opindex mtpcs-frame
157a620e
NC
6132Generate a stack frame that is compliant with the Thumb Procedure Call
6133Standard for all non-leaf functions. (A leaf function is one that does
630d3d5a 6134not call any other functions.) The default is @option{-mno-tpcs-frame}.
157a620e
NC
6135
6136@item -mtpcs-leaf-frame
cd3bb277 6137@opindex mtpcs-leaf-frame
157a620e
NC
6138Generate a stack frame that is compliant with the Thumb Procedure Call
6139Standard for all leaf functions. (A leaf function is one that does
630d3d5a 6140not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
62b10bbc
NC
6141
6142@item -mcallee-super-interworking
cd3bb277 6143@opindex mcallee-super-interworking
62b10bbc
NC
6144Gives all externally visible functions in the file being compiled an ARM
6145instruction set header which switches to Thumb mode before executing the
6146rest of the function. This allows these functions to be called from
6147non-interworking code.
6148
6149@item -mcaller-super-interworking
cd3bb277 6150@opindex mcaller-super-interworking
62b10bbc
NC
6151Allows calls via function pointers (including virtual functions) to
6152execute correctly regardless of whether the target code has been
6153compiled for interworking or not. There is a small overhead in the cost
4bdc1ac7
PB
6154of executing a function pointer if this option is enabled.
6155
157a620e
NC
6156@end table
6157
ecff22ab
JL
6158@node MN10200 Options
6159@subsection MN10200 Options
6160@cindex MN10200 options
630d3d5a 6161These @option{-m} options are defined for Matsushita MN10200 architectures:
2642624b 6162@table @gcctabopt
ecff22ab
JL
6163
6164@item -mrelax
cd3bb277 6165@opindex mrelax
ecff22ab
JL
6166Indicate to the linker that it should perform a relaxation optimization pass
6167to shorten branches, calls and absolute memory addresses. This option only
6168has an effect when used on the command line for the final link step.
6169
02f52e19 6170This option makes symbolic debugging impossible.
ecff22ab 6171@end table
157a620e 6172
6d6d0fa0
JL
6173@node MN10300 Options
6174@subsection MN10300 Options
6175@cindex MN10300 options
630d3d5a 6176These @option{-m} options are defined for Matsushita MN10300 architectures:
6d6d0fa0 6177
2642624b 6178@table @gcctabopt
6d6d0fa0 6179@item -mmult-bug
cd3bb277 6180@opindex mmult-bug
6d6d0fa0
JL
6181Generate code to avoid bugs in the multiply instructions for the MN10300
6182processors. This is the default.
6183
6184@item -mno-mult-bug
cd3bb277 6185@opindex mno-mult-bug
6d6d0fa0
JL
6186Do not generate code to avoid bugs in the multiply instructions for the
6187MN10300 processors.
ecff22ab 6188
705ac34f 6189@item -mam33
cd3bb277 6190@opindex mam33
705ac34f
JL
6191Generate code which uses features specific to the AM33 processor.
6192
6193@item -mno-am33
cd3bb277 6194@opindex mno-am33
705ac34f
JL
6195Do not generate code which uses features specific to the AM33 processor. This
6196is the default.
6197
c474f76b
AO
6198@item -mno-crt0
6199@opindex mno-crt0
6200Do not link in the C run-time initialization object file.
6201
ecff22ab 6202@item -mrelax
cd3bb277 6203@opindex mrelax
ecff22ab
JL
6204Indicate to the linker that it should perform a relaxation optimization pass
6205to shorten branches, calls and absolute memory addresses. This option only
6206has an effect when used on the command line for the final link step.
6207
02f52e19 6208This option makes symbolic debugging impossible.
6d6d0fa0
JL
6209@end table
6210
ecff22ab 6211
861bb6c1
JL
6212@node M32R/D Options
6213@subsection M32R/D Options
6214@cindex M32R/D options
6215
630d3d5a 6216These @option{-m} options are defined for Mitsubishi M32R/D architectures:
861bb6c1 6217
2642624b 6218@table @gcctabopt
98180123
NC
6219@item -m32rx
6220@opindex m32rx
0bf93a51 6221Generate code for the M32R/X@.
98180123
NC
6222
6223@item -m32r
6224@opindex m32r
0bf93a51 6225Generate code for the M32R@. This is the default.
de41e41c 6226
861bb6c1 6227@item -mcode-model=small
cd3bb277 6228@opindex mcode-model=small
861bb6c1
JL
6229Assume all objects live in the lower 16MB of memory (so that their addresses
6230can be loaded with the @code{ld24} instruction), and assume all subroutines
6231are reachable with the @code{bl} instruction.
6232This is the default.
6233
6234The addressability of a particular object can be set with the
6235@code{model} attribute.
6236
6237@item -mcode-model=medium
cd3bb277 6238@opindex mcode-model=medium
02f52e19 6239Assume objects may be anywhere in the 32-bit address space (the compiler
861bb6c1
JL
6240will generate @code{seth/add3} instructions to load their addresses), and
6241assume all subroutines are reachable with the @code{bl} instruction.
6242
6243@item -mcode-model=large
cd3bb277 6244@opindex mcode-model=large
02f52e19 6245Assume objects may be anywhere in the 32-bit address space (the compiler
861bb6c1
JL
6246will generate @code{seth/add3} instructions to load their addresses), and
6247assume subroutines may not be reachable with the @code{bl} instruction
6248(the compiler will generate the much slower @code{seth/add3/jl}
6249instruction sequence).
6250
6251@item -msdata=none
cd3bb277 6252@opindex msdata=none
861bb6c1
JL
6253Disable use of the small data area. Variables will be put into
6254one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6255@code{section} attribute has been specified).
6256This is the default.
6257
6258The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6259Objects may be explicitly put in the small data area with the
6260@code{section} attribute using one of these sections.
6261
6262@item -msdata=sdata
cd3bb277 6263@opindex msdata=sdata
861bb6c1
JL
6264Put small global and static data in the small data area, but do not
6265generate special code to reference them.
6266
6267@item -msdata=use
cd3bb277 6268@opindex msdata=use
861bb6c1
JL
6269Put small global and static data in the small data area, and generate
6270special instructions to reference them.
6271
6272@item -G @var{num}
cd3bb277 6273@opindex G
861bb6c1
JL
6274@cindex smaller data references
6275Put global and static objects less than or equal to @var{num} bytes
6276into the small data or bss sections instead of the normal data or bss
6277sections. The default value of @var{num} is 8.
630d3d5a 6278The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
861bb6c1
JL
6279for this option to have any effect.
6280
630d3d5a 6281All modules should be compiled with the same @option{-G @var{num}} value.
861bb6c1 6282Compiling with different values of @var{num} may or may not work; if it
695ac33f 6283doesn't the linker will give an error message---incorrect code will not be
861bb6c1
JL
6284generated.
6285
6286@end table
6287
74291a4b
MM
6288@node M88K Options
6289@subsection M88K Options
6290@cindex M88k options
6291
6292These @samp{-m} options are defined for Motorola 88k architectures:
6293
2642624b 6294@table @gcctabopt
74291a4b 6295@item -m88000
cd3bb277 6296@opindex m88000
74291a4b
MM
6297Generate code that works well on both the m88100 and the
6298m88110.
6299
6300@item -m88100
cd3bb277 6301@opindex m88100
74291a4b
MM
6302Generate code that works best for the m88100, but that also
6303runs on the m88110.
6304
6305@item -m88110
cd3bb277 6306@opindex m88110
74291a4b
MM
6307Generate code that works best for the m88110, and may not run
6308on the m88100.
6309
6310@item -mbig-pic
cd3bb277 6311@opindex mbig-pic
74291a4b 6312Obsolete option to be removed from the next revision.
630d3d5a 6313Use @option{-fPIC}.
74291a4b
MM
6314
6315@item -midentify-revision
cd3bb277 6316@opindex midentify-revision
74291a4b
MM
6317@cindex identifying source, compiler (88k)
6318Include an @code{ident} directive in the assembler output recording the
6319source file name, compiler name and version, timestamp, and compilation
6320flags used.
6321
6322@item -mno-underscores
cd3bb277 6323@opindex mno-underscores
74291a4b
MM
6324@cindex underscores, avoiding (88k)
6325In assembler output, emit symbol names without adding an underscore
6326character at the beginning of each name. The default is to use an
6327underscore as prefix on each name.
6328
6329@item -mocs-debug-info
6330@itemx -mno-ocs-debug-info
cd3bb277
JM
6331@opindex mocs-debug-info
6332@opindex mno-ocs-debug-info
74291a4b
MM
6333@cindex OCS (88k)
6334@cindex debugging, 88k OCS
6335Include (or omit) additional debugging information (about registers used
6336in each stack frame) as specified in the 88open Object Compatibility
161d7b59 6337Standard, ``OCS''@. This extra information allows debugging of code that
74291a4b
MM
6338has had the frame pointer eliminated. The default for DG/UX, SVr4, and
6339Delta 88 SVr3.2 is to include this information; other 88k configurations
6340omit this information by default.
6341
6342@item -mocs-frame-position
cd3bb277 6343@opindex mocs-frame-position
74291a4b
MM
6344@cindex register positions in frame (88k)
6345When emitting COFF debugging information for automatic variables and
6346parameters stored on the stack, use the offset from the canonical frame
6347address, which is the stack pointer (register 31) on entry to the
6348function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
630d3d5a
JM
6349@option{-mocs-frame-position}; other 88k configurations have the default
6350@option{-mno-ocs-frame-position}.
74291a4b
MM
6351
6352@item -mno-ocs-frame-position
cd3bb277 6353@opindex mno-ocs-frame-position
74291a4b
MM
6354@cindex register positions in frame (88k)
6355When emitting COFF debugging information for automatic variables and
6356parameters stored on the stack, use the offset from the frame pointer
6357register (register 30). When this option is in effect, the frame
6358pointer is not eliminated when debugging information is selected by the
6359-g switch.
6360
6361@item -moptimize-arg-area
cd3bb277 6362@opindex moptimize-arg-area
74291a4b 6363@cindex arguments in frame (88k)
9c34dbbf
ZW
6364Save space by reorganizing the stack frame. This option generates code
6365that does not agree with the 88open specifications, but uses less
6366memory.
6367
6368@itemx -mno-optimize-arg-area
6369@opindex mno-optimize-arg-area
6370Do not reorganize the stack frame to save space. This is the default.
6371The generated conforms to the specification, but uses more memory.
74291a4b
MM
6372
6373@item -mshort-data-@var{num}
cd3bb277 6374@opindex mshort-data
74291a4b
MM
6375@cindex smaller data references (88k)
6376@cindex r0-relative references (88k)
6377Generate smaller data references by making them relative to @code{r0},
6378which allows loading a value using a single instruction (rather than the
6379usual two). You control which data references are affected by
6380specifying @var{num} with this option. For example, if you specify
630d3d5a 6381@option{-mshort-data-512}, then the data references affected are those
74291a4b 6382involving displacements of less than 512 bytes.
630d3d5a 6383@option{-mshort-data-@var{num}} is not effective for @var{num} greater
74291a4b
MM
6384than 64k.
6385
6386@item -mserialize-volatile
cd3bb277 6387@opindex mserialize-volatile
74291a4b 6388@itemx -mno-serialize-volatile
cd3bb277 6389@opindex mno-serialize-volatile
74291a4b
MM
6390@cindex sequential consistency on 88k
6391Do, or don't, generate code to guarantee sequential consistency
6392of volatile memory references. By default, consistency is
6393guaranteed.
6394
6395The order of memory references made by the MC88110 processor does
6396not always match the order of the instructions requesting those
6397references. In particular, a load instruction may execute before
6398a preceding store instruction. Such reordering violates
6399sequential consistency of volatile memory references, when there
6400are multiple processors. When consistency must be guaranteed,
f0523f02 6401GCC generates special instructions, as needed, to force
74291a4b
MM
6402execution in the proper order.
6403
6404The MC88100 processor does not reorder memory references and so
f0523f02
JM
6405always provides sequential consistency. However, by default, GCC
6406generates the special instructions to guarantee consistency
630d3d5a 6407even when you use @option{-m88100}, so that the code may be run on an
74291a4b 6408MC88110 processor. If you intend to run your code only on the
630d3d5a 6409MC88100 processor, you may use @option{-mno-serialize-volatile}.
74291a4b
MM
6410
6411The extra code generated to guarantee consistency may affect the
6412performance of your application. If you know that you can safely
630d3d5a 6413forgo this guarantee, you may use @option{-mno-serialize-volatile}.
74291a4b
MM
6414
6415@item -msvr4
6416@itemx -msvr3
cd3bb277
JM
6417@opindex msvr4
6418@opindex msvr3
74291a4b
MM
6419@cindex assembler syntax, 88k
6420@cindex SVr4
630d3d5a 6421Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions
74291a4b
MM
6422related to System V release 4 (SVr4). This controls the following:
6423
6424@enumerate
6425@item
6426Which variant of the assembler syntax to emit.
6427@item
630d3d5a 6428@option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
74291a4b
MM
6429that is used on System V release 4.
6430@item
630d3d5a 6431@option{-msvr4} makes GCC issue additional declaration directives used in
74291a4b
MM
6432SVr4.
6433@end enumerate
6434
630d3d5a 6435@option{-msvr4} is the default for the m88k-motorola-sysv4 and
767094dd 6436m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all
74291a4b
MM
6437other m88k configurations.
6438
6439@item -mversion-03.00
cd3bb277 6440@opindex mversion-03.00
74291a4b
MM
6441This option is obsolete, and is ignored.
6442@c ??? which asm syntax better for GAS? option there too?
6443
6444@item -mno-check-zero-division
6445@itemx -mcheck-zero-division
cd3bb277
JM
6446@opindex mno-check-zero-division
6447@opindex mcheck-zero-division
74291a4b
MM
6448@cindex zero division on 88k
6449Do, or don't, generate code to guarantee that integer division by
6450zero will be detected. By default, detection is guaranteed.
6451
6452Some models of the MC88100 processor fail to trap upon integer
6453division by zero under certain conditions. By default, when
f0523f02 6454compiling code that might be run on such a processor, GCC
74291a4b
MM
6455generates code that explicitly checks for zero-valued divisors
6456and traps with exception number 503 when one is detected. Use of
9c34dbbf 6457@option{-mno-check-zero-division} suppresses such checking for code
74291a4b
MM
6458generated to run on an MC88100 processor.
6459
9c34dbbf
ZW
6460GCC assumes that the MC88110 processor correctly detects all instances
6461of integer division by zero. When @option{-m88110} is specified, no
6462explicit checks for zero-valued divisors are generated, and both
6463@option{-mcheck-zero-division} and @option{-mno-check-zero-division} are
6464ignored.
74291a4b
MM
6465
6466@item -muse-div-instruction
cd3bb277 6467@opindex muse-div-instruction
74291a4b
MM
6468@cindex divide instruction, 88k
6469Use the div instruction for signed integer division on the
6470MC88100 processor. By default, the div instruction is not used.
6471
6472On the MC88100 processor the signed integer division instruction
6473div) traps to the operating system on a negative operand. The
6474operating system transparently completes the operation, but at a
6475large cost in execution time. By default, when compiling code
f0523f02 6476that might be run on an MC88100 processor, GCC emulates signed
74291a4b
MM
6477integer division using the unsigned integer division instruction
6478divu), thereby avoiding the large penalty of a trap to the
6479operating system. Such emulation has its own, smaller, execution
6480cost in both time and space. To the extent that your code's
6481important signed integer division operations are performed on two
6482nonnegative operands, it may be desirable to use the div
6483instruction directly.
6484
6485On the MC88110 processor the div instruction (also known as the
6486divs instruction) processes negative operands without trapping to
630d3d5a
JM
6487the operating system. When @option{-m88110} is specified,
6488@option{-muse-div-instruction} is ignored, and the div instruction is used
74291a4b
MM
6489for signed integer division.
6490
630d3d5a 6491Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In
74291a4b 6492particular, the behavior of such a division with and without
630d3d5a 6493@option{-muse-div-instruction} may differ.
74291a4b
MM
6494
6495@item -mtrap-large-shift
6496@itemx -mhandle-large-shift
cd3bb277
JM
6497@opindex mtrap-large-shift
6498@opindex mhandle-large-shift
74291a4b
MM
6499@cindex bit shift overflow (88k)
6500@cindex large bit shifts (88k)
6501Include code to detect bit-shifts of more than 31 bits; respectively,
0c2d1a2a 6502trap such shifts or emit code to handle them properly. By default GCC
74291a4b
MM
6503makes no special provision for large bit shifts.
6504
6505@item -mwarn-passed-structs
cd3bb277 6506@opindex mwarn-passed-structs
74291a4b
MM
6507@cindex structure passing (88k)
6508Warn when a function passes a struct as an argument or result.
6509Structure-passing conventions have changed during the evolution of the C
6510language, and are often the source of portability problems. By default,
0c2d1a2a 6511GCC issues no such warning.
74291a4b
MM
6512@end table
6513
9c34dbbf
ZW
6514@c break page here to avoid unsightly interparagraph stretch.
6515@c -zw, 2001-8-17
6516@page
6517
74291a4b
MM
6518@node RS/6000 and PowerPC Options
6519@subsection IBM RS/6000 and PowerPC Options
6520@cindex RS/6000 and PowerPC Options
6521@cindex IBM RS/6000 and PowerPC Options
6522
6523These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
2642624b 6524@table @gcctabopt
74291a4b
MM
6525@item -mpower
6526@itemx -mno-power
6527@itemx -mpower2
6528@itemx -mno-power2
6529@itemx -mpowerpc
6530@itemx -mno-powerpc
6531@itemx -mpowerpc-gpopt
6532@itemx -mno-powerpc-gpopt
6533@itemx -mpowerpc-gfxopt
6534@itemx -mno-powerpc-gfxopt
7fe90e7b
DE
6535@itemx -mpowerpc64
6536@itemx -mno-powerpc64
cd3bb277
JM
6537@opindex mpower
6538@opindex mno-power
6539@opindex mpower2
6540@opindex mno-power2
6541@opindex mpowerpc
6542@opindex mno-powerpc
6543@opindex mpowerpc-gpopt
6544@opindex mno-powerpc-gpopt
6545@opindex mpowerpc-gfxopt
6546@opindex mno-powerpc-gfxopt
6547@opindex mpowerpc64
6548@opindex mno-powerpc64
0c2d1a2a 6549GCC supports two related instruction set architectures for the
161d7b59 6550RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
74291a4b
MM
6551instructions supported by the @samp{rios} chip set used in the original
6552RS/6000 systems and the @dfn{PowerPC} instruction set is the
6553architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
861bb6c1 6554the IBM 4xx microprocessors.
74291a4b
MM
6555
6556Neither architecture is a subset of the other. However there is a
6557large common subset of instructions supported by both. An MQ
6558register is included in processors supporting the POWER architecture.
6559
6560You use these options to specify which instructions are available on the
6561processor you are using. The default value of these options is
161d7b59 6562determined when configuring GCC@. Specifying the
630d3d5a
JM
6563@option{-mcpu=@var{cpu_type}} overrides the specification of these
6564options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
74291a4b
MM
6565rather than the options listed above.
6566
630d3d5a 6567The @option{-mpower} option allows GCC to generate instructions that
74291a4b 6568are found only in the POWER architecture and to use the MQ register.
630d3d5a 6569Specifying @option{-mpower2} implies @option{-power} and also allows GCC
74291a4b
MM
6570to generate instructions that are present in the POWER2 architecture but
6571not the original POWER architecture.
6572
630d3d5a 6573The @option{-mpowerpc} option allows GCC to generate instructions that
74291a4b 6574are found only in the 32-bit subset of the PowerPC architecture.
630d3d5a 6575Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
0c2d1a2a 6576GCC to use the optional PowerPC architecture instructions in the
74291a4b 6577General Purpose group, including floating-point square root. Specifying
630d3d5a 6578@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
74291a4b
MM
6579use the optional PowerPC architecture instructions in the Graphics
6580group, including floating-point select.
6581
630d3d5a 6582The @option{-mpowerpc64} option allows GCC to generate the additional
7fe90e7b 658364-bit instructions that are found in the full PowerPC64 architecture
0c2d1a2a 6584and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
630d3d5a 6585@option{-mno-powerpc64}.
7fe90e7b 6586
630d3d5a 6587If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
74291a4b
MM
6588will use only the instructions in the common subset of both
6589architectures plus some special AIX common-mode calls, and will not use
630d3d5a 6590the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
0c2d1a2a 6591permits GCC to use any instruction from either architecture and to
74291a4b
MM
6592allow use of the MQ register; specify this for the Motorola MPC601.
6593
6594@item -mnew-mnemonics
6595@itemx -mold-mnemonics
cd3bb277
JM
6596@opindex mnew-mnemonics
6597@opindex mold-mnemonics
9c34dbbf
ZW
6598Select which mnemonics to use in the generated assembler code. With
6599@option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
6600the PowerPC architecture. With @option{-mold-mnemonics} it uses the
6601assembler mnemonics defined for the POWER architecture. Instructions
6602defined in only one architecture have only one mnemonic; GCC uses that
6603mnemonic irrespective of which of these options is specified.
74291a4b 6604
0c2d1a2a 6605GCC defaults to the mnemonics appropriate for the architecture in
630d3d5a 6606use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
7fe90e7b 6607value of these option. Unless you are building a cross-compiler, you
630d3d5a
JM
6608should normally not specify either @option{-mnew-mnemonics} or
6609@option{-mold-mnemonics}, but should instead accept the default.
74291a4b
MM
6610
6611@item -mcpu=@var{cpu_type}
cd3bb277 6612@opindex mcpu
74291a4b
MM
6613Set architecture type, register usage, choice of mnemonics, and
6614instruction scheduling parameters for machine type @var{cpu_type}.
5f59ecb7
DE
6615Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
6616@samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
6617@samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
ed947a96
DJ
6618@samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750},
6619@samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505},
6620@samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
9c34dbbf
ZW
6621
6622@option{-mcpu=common} selects a completely generic processor. Code
6623generated under this option will run on any POWER or PowerPC processor.
6624GCC will use only the instructions in the common subset of both
6625architectures, and will not use the MQ register. GCC assumes a generic
74291a4b
MM
6626processor model for scheduling purposes.
6627
9c34dbbf
ZW
6628@option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
6629@option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
6630PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
6631types, with an appropriate, generic processor model assumed for
6632scheduling purposes.
74291a4b 6633
9c34dbbf
ZW
6634The other options specify a specific processor. Code generated under
6635those options will run best on that processor, and may not run at all on
6636others.
6637
6638The @option{-mcpu} options automatically enable or disable other
6639@option{-m} options as follows:
6640
6641@table @samp
6642@item common
6643@option{-mno-power}, @option{-mno-powerc}
6644
6645@item power
6646@itemx power2
6647@itemx rios1
6648@itemx rios2
6649@itemx rsc
6650@option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics}
6651
6652@item powerpc
6653@itemx rs64a
6654@itemx 602
6655@itemx 603
6656@itemx 603e
6657@itemx 604
6658@itemx 620
6659@itemx 630
6660@itemx 740
ed947a96
DJ
6661@itemx 7400
6662@itemx 7450
9c34dbbf
ZW
6663@itemx 750
6664@itemx 505
6665@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6666
6667@item 601
6668@option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6669
6670@item 403
6671@itemx 821
6672@itemx 860
6673@option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float}
6674@end table
74291a4b
MM
6675
6676@item -mtune=@var{cpu_type}
cd3bb277 6677@opindex mtune
74291a4b 6678Set the instruction scheduling parameters for machine type
9c34dbbf
ZW
6679@var{cpu_type}, but do not set the architecture type, register usage, or
6680choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would. The same
6681values for @var{cpu_type} are used for @option{-mtune} as for
6682@option{-mcpu}. If both are specified, the code generated will use the
6683architecture, registers, and mnemonics set by @option{-mcpu}, but the
6684scheduling parameters set by @option{-mtune}.
74291a4b 6685
0ac081f6
AH
6686@item -maltivec
6687@itemx -mno-altivec
6688@opindex maltivec
6689@opindex mno-altivec
6690These switches enable or disable the use of built-in functions that
6691allow access to the AltiVec instruction set. You may also need to set
6692@option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
6693enhancements.
6694
74291a4b
MM
6695@item -mfull-toc
6696@itemx -mno-fp-in-toc
6697@itemx -mno-sum-in-toc
6698@itemx -mminimal-toc
cd3bb277
JM
6699@opindex mfull-toc
6700@opindex mno-fp-in-toc
6701@opindex mno-sum-in-toc
6702@opindex mminimal-toc
74291a4b 6703Modify generation of the TOC (Table Of Contents), which is created for
630d3d5a 6704every executable file. The @option{-mfull-toc} option is selected by
0c2d1a2a
JB
6705default. In that case, GCC will allocate at least one TOC entry for
6706each unique non-automatic variable reference in your program. GCC
161d7b59
JM
6707will also place floating-point constants in the TOC@. However, only
670816,384 entries are available in the TOC@.
74291a4b
MM
6709
6710If you receive a linker error message that saying you have overflowed
6711the available TOC space, you can reduce the amount of TOC space used
630d3d5a
JM
6712with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
6713@option{-mno-fp-in-toc} prevents GCC from putting floating-point
6714constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
74291a4b 6715generate code to calculate the sum of an address and a constant at
161d7b59 6716run-time instead of putting that sum into the TOC@. You may specify one
0c2d1a2a 6717or both of these options. Each causes GCC to produce very slightly
74291a4b
MM
6718slower and larger code at the expense of conserving TOC space.
6719
6720If you still run out of space in the TOC even when you specify both of
630d3d5a 6721these options, specify @option{-mminimal-toc} instead. This option causes
0c2d1a2a
JB
6722GCC to make only one TOC entry for every file. When you specify this
6723option, GCC will produce code that is slower and larger but which
74291a4b 6724uses extremely little TOC space. You may wish to use this option
bd819a4a 6725only on files that contain less frequently executed code.
74291a4b 6726
fa06229f
GK
6727@item -maix64
6728@itemx -maix32
cd3bb277
JM
6729@opindex maix64
6730@opindex maix32
fa06229f 6731Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7fe90e7b 6732@code{long} type, and the infrastructure needed to support them.
630d3d5a
JM
6733Specifying @option{-maix64} implies @option{-mpowerpc64} and
6734@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
6735implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
7fe90e7b 6736
74291a4b
MM
6737@item -mxl-call
6738@itemx -mno-xl-call
cd3bb277
JM
6739@opindex mxl-call
6740@opindex mno-xl-call
74291a4b
MM
6741On AIX, pass floating-point arguments to prototyped functions beyond the
6742register save area (RSA) on the stack in addition to argument FPRs. The
6743AIX calling convention was extended but not initially documented to
6744handle an obscure K&R C case of calling a function that takes the
6745address of its arguments with fewer arguments than declared. AIX XL
7fe90e7b
DE
6746compilers access floating point arguments which do not fit in the
6747RSA from the stack when a subroutine is compiled without
74291a4b
MM
6748optimization. Because always storing floating-point arguments on the
6749stack is inefficient and rarely needed, this option is not enabled by
6750default and only is necessary when calling subroutines compiled by AIX
6751XL compilers without optimization.
6752
861bb6c1 6753@item -mpe
cd3bb277 6754@opindex mpe
161d7b59 6755Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
861bb6c1
JL
6756application written to use message passing with special startup code to
6757enable the application to run. The system must have PE installed in the
6758standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
630d3d5a 6759must be overridden with the @option{-specs=} option to specify the
861bb6c1 6760appropriate directory location. The Parallel Environment does not
0a379b7a 6761support threads, so the @option{-mpe} option and the @option{-pthread}
861bb6c1
JL
6762option are incompatible.
6763
74291a4b
MM
6764@item -msoft-float
6765@itemx -mhard-float
cd3bb277
JM
6766@opindex msoft-float
6767@opindex mhard-float
74291a4b
MM
6768Generate code that does not use (uses) the floating-point register set.
6769Software floating point emulation is provided if you use the
630d3d5a 6770@option{-msoft-float} option, and pass the option to GCC when linking.
74291a4b
MM
6771
6772@item -mmultiple
6773@itemx -mno-multiple
cd3bb277
JM
6774@opindex mmultiple
6775@opindex mno-multiple
74291a4b
MM
6776Generate code that uses (does not use) the load multiple word
6777instructions and the store multiple word instructions. These
6778instructions are generated by default on POWER systems, and not
630d3d5a 6779generated on PowerPC systems. Do not use @option{-mmultiple} on little
74291a4b 6780endian PowerPC systems, since those instructions do not work when the
bef84347
VM
6781processor is in little endian mode. The exceptions are PPC740 and
6782PPC750 which permit the instructions usage in little endian mode.
74291a4b
MM
6783
6784@item -mstring
6785@itemx -mno-string
cd3bb277
JM
6786@opindex mstring
6787@opindex mno-string
bef84347
VM
6788Generate code that uses (does not use) the load string instructions
6789and the store string word instructions to save multiple registers and
6790do small block moves. These instructions are generated by default on
6791POWER systems, and not generated on PowerPC systems. Do not use
630d3d5a 6792@option{-mstring} on little endian PowerPC systems, since those
bef84347
VM
6793instructions do not work when the processor is in little endian mode.
6794The exceptions are PPC740 and PPC750 which permit the instructions
6795usage in little endian mode.
74291a4b 6796
861bb6c1
JL
6797@item -mupdate
6798@itemx -mno-update
cd3bb277
JM
6799@opindex mupdate
6800@opindex mno-update
861bb6c1
JL
6801Generate code that uses (does not use) the load or store instructions
6802that update the base register to the address of the calculated memory
6803location. These instructions are generated by default. If you use
630d3d5a 6804@option{-mno-update}, there is a small window between the time that the
861bb6c1
JL
6805stack pointer is updated and the address of the previous frame is
6806stored, which means code that walks the stack frame across interrupts or
6807signals may get corrupted data.
6808
6809@item -mfused-madd
6810@itemx -mno-fused-madd
cd3bb277
JM
6811@opindex mfused-madd
6812@opindex mno-fused-madd
861bb6c1
JL
6813Generate code that uses (does not use) the floating point multiply and
6814accumulate instructions. These instructions are generated by default if
6815hardware floating is used.
6816
74291a4b
MM
6817@item -mno-bit-align
6818@itemx -mbit-align
cd3bb277
JM
6819@opindex mno-bit-align
6820@opindex mbit-align
74291a4b 6821On System V.4 and embedded PowerPC systems do not (do) force structures
c771326b
JM
6822and unions that contain bit-fields to be aligned to the base type of the
6823bit-field.
74291a4b
MM
6824
6825For example, by default a structure containing nothing but 8
c771326b 6826@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
630d3d5a 6827boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
74291a4b
MM
6828the structure would be aligned to a 1 byte boundary and be one byte in
6829size.
6830
6831@item -mno-strict-align
6832@itemx -mstrict-align
cd3bb277
JM
6833@opindex mno-strict-align
6834@opindex mstrict-align
74291a4b
MM
6835On System V.4 and embedded PowerPC systems do not (do) assume that
6836unaligned memory references will be handled by the system.
6837
6838@item -mrelocatable
6839@itemx -mno-relocatable
cd3bb277
JM
6840@opindex mrelocatable
6841@opindex mno-relocatable
74291a4b
MM
6842On embedded PowerPC systems generate code that allows (does not allow)
6843the program to be relocated to a different address at runtime. If you
630d3d5a
JM
6844use @option{-mrelocatable} on any module, all objects linked together must
6845be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
74291a4b
MM
6846
6847@item -mrelocatable-lib
6848@itemx -mno-relocatable-lib
cd3bb277
JM
6849@opindex mrelocatable-lib
6850@opindex mno-relocatable-lib
74291a4b
MM
6851On embedded PowerPC systems generate code that allows (does not allow)
6852the program to be relocated to a different address at runtime. Modules
630d3d5a
JM
6853compiled with @option{-mrelocatable-lib} can be linked with either modules
6854compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
6855with modules compiled with the @option{-mrelocatable} options.
74291a4b
MM
6856
6857@item -mno-toc
6858@itemx -mtoc
cd3bb277
JM
6859@opindex mno-toc
6860@opindex mtoc
74291a4b
MM
6861On System V.4 and embedded PowerPC systems do not (do) assume that
6862register 2 contains a pointer to a global area pointing to the addresses
6863used in the program.
6864
74291a4b
MM
6865@item -mlittle
6866@itemx -mlittle-endian
cd3bb277
JM
6867@opindex mlittle
6868@opindex mlittle-endian
74291a4b 6869On System V.4 and embedded PowerPC systems compile code for the
630d3d5a
JM
6870processor in little endian mode. The @option{-mlittle-endian} option is
6871the same as @option{-mlittle}.
74291a4b
MM
6872
6873@item -mbig
6874@itemx -mbig-endian
cd3bb277
JM
6875@opindex mbig
6876@opindex mbig-endian
74291a4b 6877On System V.4 and embedded PowerPC systems compile code for the
630d3d5a
JM
6878processor in big endian mode. The @option{-mbig-endian} option is
6879the same as @option{-mbig}.
74291a4b
MM
6880
6881@item -mcall-sysv
cd3bb277 6882@opindex mcall-sysv
74291a4b
MM
6883On System V.4 and embedded PowerPC systems compile code using calling
6884conventions that adheres to the March 1995 draft of the System V
6885Application Binary Interface, PowerPC processor supplement. This is the
6886default unless you configured GCC using @samp{powerpc-*-eabiaix}.
6887
6888@item -mcall-sysv-eabi
cd3bb277 6889@opindex mcall-sysv-eabi
630d3d5a 6890Specify both @option{-mcall-sysv} and @option{-meabi} options.
74291a4b
MM
6891
6892@item -mcall-sysv-noeabi
cd3bb277 6893@opindex mcall-sysv-noeabi
630d3d5a 6894Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
74291a4b
MM
6895
6896@item -mcall-aix
cd3bb277 6897@opindex mcall-aix
74291a4b 6898On System V.4 and embedded PowerPC systems compile code using calling
161d7b59 6899conventions that are similar to those used on AIX@. This is the
74291a4b
MM
6900default if you configured GCC using @samp{powerpc-*-eabiaix}.
6901
6902@item -mcall-solaris
cd3bb277 6903@opindex mcall-solaris
74291a4b
MM
6904On System V.4 and embedded PowerPC systems compile code for the Solaris
6905operating system.
6906
6907@item -mcall-linux
cd3bb277 6908@opindex mcall-linux
861bb6c1
JL
6909On System V.4 and embedded PowerPC systems compile code for the
6910Linux-based GNU system.
74291a4b 6911
48180d68
RM
6912@item -mcall-gnu
6913@opindex mcall-gnu
6914On System V.4 and embedded PowerPC systems compile code for the
6915Hurd-based GNU system.
6916
edf1b3f3
AC
6917@item -mcall-netbsd
6918@opindex mcall-netbsd
6919On System V.4 and embedded PowerPC systems compile code for the
6920NetBSD operating system.
6921
9904592e
ZW
6922@item -maix-struct-return
6923@opindex maix-struct-return
6924Return all structures in memory (as specified by the AIX ABI)@.
6925
6926@item -msvr4-struct-return
6927@opindex msvr4-struct-return
6928Return structures smaller than 8 bytes in registers (as specified by the
6929SVR4 ABI)@.
6930
0ac081f6
AH
6931@item -mabi=altivec
6932@opindex mabi=altivec
6933Extend the current ABI with AltiVec ABI extensions. This does not
6934change the default ABI, instead it adds the AltiVec ABI extensions to
6935the current ABI@.
6936
74291a4b 6937@item -mprototype
e9a25f70 6938@itemx -mno-prototype
cd3bb277
JM
6939@opindex mprototype
6940@opindex mno-prototype
74291a4b
MM
6941On System V.4 and embedded PowerPC systems assume that all calls to
6942variable argument functions are properly prototyped. Otherwise, the
6943compiler must insert an instruction before every non prototyped call to
6944set or clear bit 6 of the condition code register (@var{CR}) to
6945indicate whether floating point values were passed in the floating point
6946registers in case the function takes a variable arguments. With
630d3d5a 6947@option{-mprototype}, only calls to prototyped variable argument functions
74291a4b
MM
6948will set or clear the bit.
6949
6950@item -msim
cd3bb277 6951@opindex msim
74291a4b
MM
6952On embedded PowerPC systems, assume that the startup module is called
6953@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
6954@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
6955configurations.
6956
6957@item -mmvme
cd3bb277 6958@opindex mmvme
74291a4b 6959On embedded PowerPC systems, assume that the startup module is called
e9a25f70
JL
6960@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
6961@file{libc.a}.
6962
6963@item -mads
cd3bb277 6964@opindex mads
e9a25f70
JL
6965On embedded PowerPC systems, assume that the startup module is called
6966@file{crt0.o} and the standard C libraries are @file{libads.a} and
6967@file{libc.a}.
6968
6969@item -myellowknife
cd3bb277 6970@opindex myellowknife
e9a25f70
JL
6971On embedded PowerPC systems, assume that the startup module is called
6972@file{crt0.o} and the standard C libraries are @file{libyk.a} and
74291a4b
MM
6973@file{libc.a}.
6974
bff46771 6975@item -mvxworks
cd3bb277 6976@opindex mvxworks
bff46771
GK
6977On System V.4 and embedded PowerPC systems, specify that you are
6978compiling for a VxWorks system.
6979
74291a4b 6980@item -memb
cd3bb277 6981@opindex memb
74291a4b
MM
6982On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
6983header to indicate that @samp{eabi} extended relocations are used.
6984
6985@item -meabi
6986@itemx -mno-eabi
cd3bb277
JM
6987@opindex meabi
6988@opindex mno-eabi
74291a4b
MM
6989On System V.4 and embedded PowerPC systems do (do not) adhere to the
6990Embedded Applications Binary Interface (eabi) which is a set of
bedc7537 6991modifications to the System V.4 specifications. Selecting @option{-meabi}
74291a4b
MM
6992means that the stack is aligned to an 8 byte boundary, a function
6993@code{__eabi} is called to from @code{main} to set up the eabi
630d3d5a 6994environment, and the @option{-msdata} option can use both @code{r2} and
74291a4b 6995@code{r13} to point to two separate small data areas. Selecting
bedc7537 6996@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
74291a4b 6997do not call an initialization function from @code{main}, and the
630d3d5a
JM
6998@option{-msdata} option will only use @code{r13} to point to a single
6999small data area. The @option{-meabi} option is on by default if you
74291a4b
MM
7000configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7001
7002@item -msdata=eabi
cd3bb277 7003@opindex msdata=eabi
74291a4b
MM
7004On System V.4 and embedded PowerPC systems, put small initialized
7005@code{const} global and static data in the @samp{.sdata2} section, which
7006is pointed to by register @code{r2}. Put small initialized
7007non-@code{const} global and static data in the @samp{.sdata} section,
7008which is pointed to by register @code{r13}. Put small uninitialized
7009global and static data in the @samp{.sbss} section, which is adjacent to
630d3d5a
JM
7010the @samp{.sdata} section. The @option{-msdata=eabi} option is
7011incompatible with the @option{-mrelocatable} option. The
7012@option{-msdata=eabi} option also sets the @option{-memb} option.
74291a4b
MM
7013
7014@item -msdata=sysv
cd3bb277 7015@opindex msdata=sysv
74291a4b
MM
7016On System V.4 and embedded PowerPC systems, put small global and static
7017data in the @samp{.sdata} section, which is pointed to by register
7018@code{r13}. Put small uninitialized global and static data in the
7019@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
630d3d5a
JM
7020The @option{-msdata=sysv} option is incompatible with the
7021@option{-mrelocatable} option.
74291a4b
MM
7022
7023@item -msdata=default
7024@itemx -msdata
cd3bb277
JM
7025@opindex msdata=default
7026@opindex msdata
630d3d5a
JM
7027On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7028compile code the same as @option{-msdata=eabi}, otherwise compile code the
7029same as @option{-msdata=sysv}.
74291a4b
MM
7030
7031@item -msdata-data
cd3bb277 7032@opindex msdata-data
74291a4b
MM
7033On System V.4 and embedded PowerPC systems, put small global and static
7034data in the @samp{.sdata} section. Put small uninitialized global and
7035static data in the @samp{.sbss} section. Do not use register @code{r13}
7036to address small data however. This is the default behavior unless
630d3d5a 7037other @option{-msdata} options are used.
74291a4b
MM
7038
7039@item -msdata=none
7040@itemx -mno-sdata
cd3bb277
JM
7041@opindex msdata=none
7042@opindex mno-sdata
74291a4b
MM
7043On embedded PowerPC systems, put all initialized global and static data
7044in the @samp{.data} section, and all uninitialized data in the
7045@samp{.bss} section.
7046
7047@item -G @var{num}
cd3bb277 7048@opindex G
74291a4b
MM
7049@cindex smaller data references (PowerPC)
7050@cindex .sdata/.sdata2 references (PowerPC)
956d6950 7051On embedded PowerPC systems, put global and static items less than or
74291a4b
MM
7052equal to @var{num} bytes into the small data or bss sections instead of
7053the normal data or bss section. By default, @var{num} is 8. The
630d3d5a
JM
7054@option{-G @var{num}} switch is also passed to the linker.
7055All modules should be compiled with the same @option{-G @var{num}} value.
74291a4b
MM
7056
7057@item -mregnames
7058@itemx -mno-regnames
cd3bb277
JM
7059@opindex mregnames
7060@opindex mno-regnames
74291a4b
MM
7061On System V.4 and embedded PowerPC systems do (do not) emit register
7062names in the assembly language output using symbolic forms.
f5a1b0d2 7063
0a379b7a
CR
7064@item -pthread
7065@opindex pthread
7066Adds support for multithreading with the @dfn{pthreads} library.
7067This option sets flags for both the preprocessor and linker.
7068
74291a4b 7069@end table
f5a1b0d2 7070
74291a4b
MM
7071@node RT Options
7072@subsection IBM RT Options
7073@cindex RT options
7074@cindex IBM RT options
7075
7076These @samp{-m} options are defined for the IBM RT PC:
7077
2642624b 7078@table @gcctabopt
74291a4b 7079@item -min-line-mul
cd3bb277 7080@opindex min-line-mul
74291a4b
MM
7081Use an in-line code sequence for integer multiplies. This is the
7082default.
7083
7084@item -mcall-lib-mul
cd3bb277 7085@opindex mcall-lib-mul
74291a4b
MM
7086Call @code{lmul$$} for integer multiples.
7087
7088@item -mfull-fp-blocks
cd3bb277 7089@opindex mfull-fp-blocks
74291a4b 7090Generate full-size floating point data blocks, including the minimum
161d7b59 7091amount of scratch space recommended by IBM@. This is the default.
74291a4b
MM
7092
7093@item -mminimum-fp-blocks
cd3bb277 7094@opindex mminimum-fp-blocks
74291a4b
MM
7095Do not include extra scratch space in floating point data blocks. This
7096results in smaller code, but slower execution, since scratch space must
7097be allocated dynamically.
7098
7099@cindex @file{varargs.h} and RT PC
7100@cindex @file{stdarg.h} and RT PC
7101@item -mfp-arg-in-fpregs
cd3bb277 7102@opindex mfp-arg-in-fpregs
74291a4b
MM
7103Use a calling sequence incompatible with the IBM calling convention in
7104which floating point arguments are passed in floating point registers.
c771326b 7105Note that @code{varargs.h} and @code{stdarg.h} will not work with
74291a4b
MM
7106floating point operands if this option is specified.
7107
7108@item -mfp-arg-in-gregs
cd3bb277 7109@opindex mfp-arg-in-gregs
74291a4b
MM
7110Use the normal calling convention for floating point arguments. This is
7111the default.
7112
7113@item -mhc-struct-return
cd3bb277 7114@opindex mhc-struct-return
74291a4b
MM
7115Return structures of more than one word in memory, rather than in a
7116register. This provides compatibility with the MetaWare HighC (hc)
630d3d5a 7117compiler. Use the option @option{-fpcc-struct-return} for compatibility
74291a4b
MM
7118with the Portable C Compiler (pcc).
7119
7120@item -mnohc-struct-return
cd3bb277 7121@opindex mnohc-struct-return
74291a4b
MM
7122Return some structures of more than one word in registers, when
7123convenient. This is the default. For compatibility with the
630d3d5a
JM
7124IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
7125option @option{-mhc-struct-return}.
74291a4b
MM
7126@end table
7127
7128@node MIPS Options
7129@subsection MIPS Options
7130@cindex MIPS options
7131
7132These @samp{-m} options are defined for the MIPS family of computers:
7133
2642624b 7134@table @gcctabopt
7dac2f89
EC
7135
7136@item -march=@var{cpu-type}
7137@opindex march
7138Assume the defaults for the machine type @var{cpu-type} when generating
7139instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000},
7140@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
7141@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
7142and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000},
7143@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
7144@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc.
7145
7146@item -mtune=@var{cpu-type}
7147@opindex mtune
630d3d5a
JM
7148Assume the defaults for the machine type @var{cpu-type} when scheduling
7149instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000},
8b9243df
JJ
7150@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
7151@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
7152and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000},
7153@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
7154@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific
630d3d5a 7155@var{cpu-type} will schedule things appropriately for that particular
8b9243df 7156chip, the compiler will not generate any code that does not meet level 1
630d3d5a
JM
7157of the MIPS ISA (instruction set architecture) without a @option{-mipsX}
7158or @option{-mabi} switch being used.
74291a4b 7159
7dac2f89
EC
7160@item -mcpu=@var{cpu-type}
7161@opindex mcpu
7162This is identical to specifying both @option{-march} and @option{-mtune}.
7163
74291a4b 7164@item -mips1
cd3bb277 7165@opindex mips1
161d7b59 7166Issue instructions from level 1 of the MIPS ISA@. This is the default.
630d3d5a 7167@samp{r3000} is the default @var{cpu-type} at this ISA level.
74291a4b
MM
7168
7169@item -mips2
cd3bb277 7170@opindex mips2
74291a4b 7171Issue instructions from level 2 of the MIPS ISA (branch likely, square
630d3d5a 7172root instructions). @samp{r6000} is the default @var{cpu-type} at this
74291a4b
MM
7173ISA level.
7174
7175@item -mips3
cd3bb277 7176@opindex mips3
02f52e19 7177Issue instructions from level 3 of the MIPS ISA (64-bit instructions).
630d3d5a 7178@samp{r4000} is the default @var{cpu-type} at this ISA level.
74291a4b 7179
3398f47f 7180@item -mips4
cd3bb277 7181@opindex mips4
8b9243df
JJ
7182Issue instructions from level 4 of the MIPS ISA (conditional move,
7183prefetch, enhanced FPU instructions). @samp{r8000} is the default
630d3d5a 7184@var{cpu-type} at this ISA level.
3398f47f 7185
74291a4b 7186@item -mfp32
cd3bb277 7187@opindex mfp32
74291a4b
MM
7188Assume that 32 32-bit floating point registers are available. This is
7189the default.
7190
7191@item -mfp64
cd3bb277 7192@opindex mfp64
74291a4b 7193Assume that 32 64-bit floating point registers are available. This is
630d3d5a 7194the default when the @option{-mips3} option is used.
74291a4b 7195
13fac94a
GK
7196@item -mfused-madd
7197@itemx -mno-fused-madd
7198@opindex mfused-madd
7199@opindex mno-fused-madd
7200Generate code that uses (does not use) the floating point multiply and
7201accumulate instructions, when they are available. These instructions
7202are generated by default if they are available, but this may be
7203undesirable if the extra precision causes problems or on certain chips
7204in the mode where denormals are rounded to zero where denormals
7205generated by multiply and accumulate instructions cause exceptions
7206anyway.
7207
74291a4b 7208@item -mgp32
cd3bb277 7209@opindex mgp32
74291a4b
MM
7210Assume that 32 32-bit general purpose registers are available. This is
7211the default.
7212
7213@item -mgp64
cd3bb277 7214@opindex mgp64
74291a4b 7215Assume that 32 64-bit general purpose registers are available. This is
630d3d5a 7216the default when the @option{-mips3} option is used.
74291a4b
MM
7217
7218@item -mint64
cd3bb277 7219@opindex mint64
630d3d5a 7220Force int and long types to be 64 bits wide. See @option{-mlong32} for an
3ce1ba83 7221explanation of the default, and the width of pointers.
74291a4b
MM
7222
7223@item -mlong64
cd3bb277 7224@opindex mlong64
630d3d5a 7225Force long types to be 64 bits wide. See @option{-mlong32} for an
3ce1ba83 7226explanation of the default, and the width of pointers.
fb1bf66d 7227
3ce1ba83 7228@item -mlong32
cd3bb277 7229@opindex mlong32
3ce1ba83
GRK
7230Force long, int, and pointer types to be 32 bits wide.
7231
630d3d5a 7232If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set,
b192711e 7233the size of ints, longs, and pointers depends on the ABI and ISA chosen.
630d3d5a
JM
7234For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits
7235wide. For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide.
7236For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints
7237and longs are 32 bits wide. For @option{-mabi=eabi} and higher ISAs, ints
3ce1ba83
GRK
7238are 32 bits, and longs are 64 bits wide. The width of pointer types is
7239the smaller of the width of longs or the width of general purpose
161d7b59 7240registers (which in turn depends on the ISA)@.
74291a4b 7241
62a1403d 7242@item -mabi=32
8b9243df 7243@itemx -mabi=o64
3398f47f
MM
7244@itemx -mabi=n32
7245@itemx -mabi=64
7246@itemx -mabi=eabi
cd3bb277
JM
7247@opindex mabi=32
7248@opindex mabi=o64
7249@opindex mabi=n32
7250@opindex mabi=64
7251@opindex mabi=eabi
161d7b59 7252Generate code for the indicated ABI@. The default instruction level is
630d3d5a
JM
7253@option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and
7254@option{-mips4} otherwise. Conversely, with @option{-mips1} or
7255@option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI
8b9243df 7256is @samp{64}.
3398f47f 7257
74291a4b 7258@item -mmips-as
cd3bb277 7259@opindex mmips-as
74291a4b
MM
7260Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
7261add normal debug information. This is the default for all
7262platforms except for the OSF/1 reference platform, using the OSF/rose
630d3d5a 7263object format. If the either of the @option{-gstabs} or @option{-gstabs+}
74291a4b 7264switches are used, the @file{mips-tfile} program will encapsulate the
161d7b59 7265stabs within MIPS ECOFF@.
74291a4b
MM
7266
7267@item -mgas
cd3bb277 7268@opindex mgas
74291a4b 7269Generate code for the GNU assembler. This is the default on the OSF/1
861bb6c1 7270reference platform, using the OSF/rose object format. Also, this is
630d3d5a 7271the default if the configure option @option{--with-gnu-as} is used.
861bb6c1
JL
7272
7273@item -msplit-addresses
7274@itemx -mno-split-addresses
cd3bb277
JM
7275@opindex msplit-addresses
7276@opindex mno-split-addresses
861bb6c1 7277Generate code to load the high and low parts of address constants separately.
aee96fe9 7278This allows GCC to optimize away redundant loads of the high order
861bb6c1
JL
7279bits of addresses. This optimization requires GNU as and GNU ld.
7280This optimization is enabled by default for some embedded targets where
7281GNU as and GNU ld are standard.
74291a4b
MM
7282
7283@item -mrnames
7284@itemx -mno-rnames
cd3bb277
JM
7285@opindex mrnames
7286@opindex mno-rnames
630d3d5a 7287The @option{-mrnames} switch says to output code using the MIPS software
74291a4b
MM
7288names for the registers, instead of the hardware names (ie, @var{a0}
7289instead of @var{$4}). The only known assembler that supports this option
7290is the Algorithmics assembler.
7291
7292@item -mgpopt
7293@itemx -mno-gpopt
cd3bb277
JM
7294@opindex mgpopt
7295@opindex mno-gpopt
630d3d5a 7296The @option{-mgpopt} switch says to write all of the data declarations
74291a4b
MM
7297before the instructions in the text section, this allows the MIPS
7298assembler to generate one word memory references instead of using two
7299words for short global or static data items. This is on by default if
7300optimization is selected.
7301
7302@item -mstats
7303@itemx -mno-stats
cd3bb277
JM
7304@opindex mstats
7305@opindex mno-stats
630d3d5a 7306For each non-inline function processed, the @option{-mstats} switch
74291a4b
MM
7307causes the compiler to emit one line to the standard error file to
7308print statistics about the program (number of registers saved, stack
7309size, etc.).
7310
7311@item -mmemcpy
7312@itemx -mno-memcpy
cd3bb277
JM
7313@opindex mmemcpy
7314@opindex mno-memcpy
630d3d5a 7315The @option{-mmemcpy} switch makes all block moves call the appropriate
74291a4b
MM
7316string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
7317generating inline code.
7318
7319@item -mmips-tfile
7320@itemx -mno-mips-tfile
cd3bb277
JM
7321@opindex mmips-tfile
7322@opindex mno-mips-tfile
630d3d5a 7323The @option{-mno-mips-tfile} switch causes the compiler not
74291a4b
MM
7324postprocess the object file with the @file{mips-tfile} program,
7325after the MIPS assembler has generated it to add debug support. If
7326@file{mips-tfile} is not run, then no local variables will be
7327available to the debugger. In addition, @file{stage2} and
7328@file{stage3} objects will have the temporary file names passed to the
7329assembler embedded in the object file, which means the objects will
630d3d5a 7330not compare the same. The @option{-mno-mips-tfile} switch should only
74291a4b
MM
7331be used when there are bugs in the @file{mips-tfile} program that
7332prevents compilation.
7333
7334@item -msoft-float
cd3bb277 7335@opindex msoft-float
74291a4b 7336Generate output containing library calls for floating point.
161d7b59 7337@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
7338Normally the facilities of the machine's usual C compiler are used, but
7339this can't be done directly in cross-compilation. You must make your
7340own arrangements to provide suitable library functions for
7341cross-compilation.
7342
7343@item -mhard-float
cd3bb277 7344@opindex mhard-float
74291a4b
MM
7345Generate output containing floating point instructions. This is the
7346default if you use the unmodified sources.
7347
7348@item -mabicalls
7349@itemx -mno-abicalls
cd3bb277
JM
7350@opindex mabicalls
7351@opindex mno-abicalls
74291a4b
MM
7352Emit (or do not emit) the pseudo operations @samp{.abicalls},
7353@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
7354position independent code.
7355
7356@item -mlong-calls
7357@itemx -mno-long-calls
cd3bb277
JM
7358@opindex mlong-calls
7359@opindex mno-long-calls
74291a4b
MM
7360Do all calls with the @samp{JALR} instruction, which requires
7361loading up a function's address into a register before the call.
7362You need to use this switch, if you call outside of the current
7363512 megabyte segment to functions that are not through pointers.
7364
7365@item -mhalf-pic
7366@itemx -mno-half-pic
cd3bb277
JM
7367@opindex mhalf-pic
7368@opindex mno-half-pic
74291a4b
MM
7369Put pointers to extern references into the data section and load them
7370up, rather than put the references in the text section.
7371
7372@item -membedded-pic
7373@itemx -mno-embedded-pic
cd3bb277
JM
7374@opindex membedded-pic
7375@opindex mno-embedded-pic
69fa83cf
JW
7376Generate PIC code suitable for some embedded systems. All calls are
7377made using PC relative address, and all data is addressed using the $gp
7378register. No more than 65536 bytes of global data may be used. This
7379requires GNU as and GNU ld which do most of the work. This currently
161d7b59 7380only works on targets which use ECOFF; it does not work with ELF@.
74291a4b
MM
7381
7382@item -membedded-data
7383@itemx -mno-embedded-data
cd3bb277
JM
7384@opindex membedded-data
7385@opindex mno-embedded-data
74291a4b
MM
7386Allocate variables to the read-only data section first if possible, then
7387next in the small data section if possible, otherwise in data. This gives
7388slightly slower code than the default, but reduces the amount of RAM required
7389when executing, and thus may be preferred for some embedded systems.
7390
919509ce
DN
7391@item -muninit-const-in-rodata
7392@itemx -mno-uninit-const-in-rodata
cd3bb277
JM
7393@opindex muninit-const-in-rodata
7394@opindex mno-uninit-const-in-rodata
695ac33f 7395When used together with @option{-membedded-data}, it will always store uninitialized
919509ce 7396const variables in the read-only data section.
02f52e19 7397
74291a4b
MM
7398@item -msingle-float
7399@itemx -mdouble-float
cd3bb277
JM
7400@opindex msingle-float
7401@opindex mdouble-float
630d3d5a 7402The @option{-msingle-float} switch tells gcc to assume that the floating
74291a4b 7403point coprocessor only supports single precision operations, as on the
630d3d5a 7404@samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use
74291a4b
MM
7405double precision operations. This is the default.
7406
7407@item -mmad
7408@itemx -mno-mad
cd3bb277
JM
7409@opindex mmad
7410@opindex mno-mad
74291a4b
MM
7411Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
7412as on the @samp{r4650} chip.
7413
7414@item -m4650
cd3bb277 7415@opindex m4650
630d3d5a
JM
7416Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
7417@option{-mcpu=r4650}.
74291a4b 7418
8b9243df
JJ
7419@item -mips16
7420@itemx -mno-mips16
cd3bb277
JM
7421@opindex mips16
7422@opindex mno-mips16
8b9243df
JJ
7423Enable 16-bit instructions.
7424
7425@item -mentry
cd3bb277 7426@opindex mentry
8b9243df 7427Use the entry and exit pseudo ops. This option can only be used with
630d3d5a 7428@option{-mips16}.
8b9243df 7429
74291a4b 7430@item -EL
cd3bb277 7431@opindex EL
74291a4b
MM
7432Compile code for the processor in little endian mode.
7433The requisite libraries are assumed to exist.
7434
7435@item -EB
cd3bb277 7436@opindex EB
74291a4b
MM
7437Compile code for the processor in big endian mode.
7438The requisite libraries are assumed to exist.
7439
7440@item -G @var{num}
cd3bb277 7441@opindex G
74291a4b
MM
7442@cindex smaller data references (MIPS)
7443@cindex gp-relative references (MIPS)
7444Put global and static items less than or equal to @var{num} bytes into
7445the small data or bss sections instead of the normal data or bss
7446section. This allows the assembler to emit one word memory reference
7447instructions based on the global pointer (@var{gp} or @var{$28}),
7448instead of the normal two words used. By default, @var{num} is 8 when
7449the MIPS assembler is used, and 0 when the GNU assembler is used. The
630d3d5a
JM
7450@option{-G @var{num}} switch is also passed to the assembler and linker.
7451All modules should be compiled with the same @option{-G @var{num}}
74291a4b
MM
7452value.
7453
7454@item -nocpp
cd3bb277 7455@opindex nocpp
9ec36da5 7456Tell the MIPS assembler to not run its preprocessor over user
74291a4b 7457assembler files (with a @samp{.s} suffix) when assembling them.
63357d93 7458
1e387156 7459@item -mfix7000
cd3bb277 7460@opindex mfix7000
1e387156
CM
7461Pass an option to gas which will cause nops to be inserted if
7462the read of the destination register of an mfhi or mflo instruction
7463occurs in the following two instructions.
7464
63357d93 7465@item -no-crt0
cd3bb277 7466@opindex no-crt0
63357d93 7467Do not include the default crt0.
d490e8ad
DD
7468
7469@item -mflush-func=@var{func}
7470@itemx -mno-flush-func
7471@opindex mflush-func
7472Specifies the function to call to flush the I and D caches, or to not
7473call any such function. If called, the function must take the same
7474arguments as the common @code{_flush_func()}, that is, the address of the
7475memory range for which the cache is being flushed, the size of the
7476memory range, and the number 3 (to flush both caches). The default
7477depends on the target gcc was configured for, but commonly is either
7478@samp{_flush_func} or @samp{__cpu_flush}.
74291a4b
MM
7479@end table
7480
74291a4b
MM
7481These options are defined by the macro
7482@code{TARGET_SWITCHES} in the machine description. The default for the
7483options is also defined by that macro, which enables you to change the
7484defaults.
74291a4b 7485
14f73b5a
JH
7486@node i386 and x86-64 Options
7487@subsection Intel 386 and AMD x86-64 Options
74291a4b 7488@cindex i386 Options
14f73b5a 7489@cindex x86-64 Options
74291a4b 7490@cindex Intel 386 Options
14f73b5a 7491@cindex AMD x86-64 Options
74291a4b 7492
14f73b5a
JH
7493These @samp{-m} options are defined for the i386 and x86-64 family of
7494computers:
74291a4b 7495
2642624b 7496@table @gcctabopt
630d3d5a 7497@item -mcpu=@var{cpu-type}
cd3bb277 7498@opindex mcpu
0dd0e980
JH
7499Tune to @var{cpu-type} everything applicable about the generated code, except
7500for the ABI and the set of available instructions. The choices for
7501@var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686},
7502@samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2},
7503@samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3},
7504@samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp}
7505and @samp{athlon-mp}.
6f670fde 7506
630d3d5a 7507While picking a specific @var{cpu-type} will schedule things appropriately
6f670fde 7508for that particular chip, the compiler will not generate any code that
630d3d5a 7509does not run on the i386 without the @option{-march=@var{cpu-type}} option
7001ee2d 7510being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
6ca3ad1b 7511is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the
b4e89e2d 7512AMD chips as opposed to the Intel ones.
a9f3e1a4 7513
630d3d5a 7514@item -march=@var{cpu-type}
cd3bb277 7515@opindex march
630d3d5a
JM
7516Generate instructions for the machine type @var{cpu-type}. The choices
7517for @var{cpu-type} are the same as for @option{-mcpu}. Moreover,
7518specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}.
a9f3e1a4
JL
7519
7520@item -m386
7521@itemx -m486
7522@itemx -mpentium
7523@itemx -mpentiumpro
cd3bb277
JM
7524@opindex m386
7525@opindex m486
7526@opindex mpentium
7527@opindex mpentiumpro
9c34dbbf
ZW
7528These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486},
7529@option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively.
7530These synonyms are deprecated.
74291a4b 7531
965f5423
JH
7532@item -mfpmath=@var{unit}
7533@opindex march
7534generate floating point arithmetics for selected unit @var{unit}. the choices
7535for @var{unit} are:
7536
7537@table @samp
7538@item 387
7539Use the standard 387 floating point coprocessor present majority of chips and
7540emulated otherwise. Code compiled with this option will run almost everywhere.
7541The temporary results are computed in 80bit precesion instead of precision
7542specified by the type resulting in slightly different results compared to most
7543of other chips. See @option{-ffloat-store} for more detailed description.
7544
7545This is the default choice for i386 compiler.
7546
7547@item sse
7548Use scalar floating point instructions present in the SSE instruction set.
7549This instruction set is supported by Pentium3 and newer chips, in the AMD line
7550by Athlon-4, Athlon-xp and Athlon-mp chips. The earlier version of SSE
7551instruction set supports only single precision arithmetics, thus the double and
7552extended precision arithmetics is still done using 387. Later version, present
7553only in Pentium4 and the future AMD x86-64 chips supports double precision
7554arithmetics too.
7555
7556For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
7557@option{-msse2} switches to enable SSE extensions and make this option
7558effective. For x86-64 compiler, these extensions are enabled by default.
7559
7560The resulting code should be considerably faster in majority of cases and avoid
7561the numerical instability problems of 387 code, but may break some existing
7562code that expects temporaries to be 80bit.
7563
7564This is the default choice for x86-64 compiler.
7565
7566@item sse,387
7567Attempt to utilize both instruction sets at once. This effectivly double the
7568amount of available registers and on chips with separate execution units for
7569387 and SSE the execution resources too. Use this option with care, as it is
7570still experimental, because gcc register allocator does not model separate
7571functional units well resulting in instable performance.
7572@end table
7573
c93e80a5
JH
7574@item -masm=@var{dialect}
7575@opindex masm=@var{dialect}
7576Output asm instructions using selected @var{dialect}. Supported choices are
7577@samp{intel} or @samp{att} (the default one).
04e149ab 7578
74291a4b
MM
7579@item -mieee-fp
7580@itemx -mno-ieee-fp
cd3bb277
JM
7581@opindex mieee-fp
7582@opindex mno-ieee-fp
74291a4b
MM
7583Control whether or not the compiler uses IEEE floating point
7584comparisons. These handle correctly the case where the result of a
7585comparison is unordered.
7586
7587@item -msoft-float
cd3bb277 7588@opindex msoft-float
74291a4b 7589Generate output containing library calls for floating point.
161d7b59 7590@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
7591Normally the facilities of the machine's usual C compiler are used, but
7592this can't be done directly in cross-compilation. You must make your
7593own arrangements to provide suitable library functions for
7594cross-compilation.
7595
7596On machines where a function returns floating point results in the 80387
7597register stack, some floating point opcodes may be emitted even if
630d3d5a 7598@option{-msoft-float} is used.
74291a4b
MM
7599
7600@item -mno-fp-ret-in-387
cd3bb277 7601@opindex mno-fp-ret-in-387
74291a4b
MM
7602Do not use the FPU registers for return values of functions.
7603
7604The usual calling convention has functions return values of types
7605@code{float} and @code{double} in an FPU register, even if there
161d7b59
JM
7606is no FPU@. The idea is that the operating system should emulate
7607an FPU@.
74291a4b 7608
630d3d5a 7609The option @option{-mno-fp-ret-in-387} causes such values to be returned
74291a4b
MM
7610in ordinary CPU registers instead.
7611
7612@item -mno-fancy-math-387
cd3bb277 7613@opindex mno-fancy-math-387
74291a4b
MM
7614Some 387 emulators do not support the @code{sin}, @code{cos} and
7615@code{sqrt} instructions for the 387. Specify this option to avoid
161d7b59 7616generating those instructions. This option is the default on FreeBSD@.
74291a4b 7617As of revision 2.6.1, these instructions are not generated unless you
630d3d5a 7618also use the @option{-funsafe-math-optimizations} switch.
74291a4b
MM
7619
7620@item -malign-double
7621@itemx -mno-align-double
cd3bb277
JM
7622@opindex malign-double
7623@opindex mno-align-double
0c2d1a2a 7624Control whether GCC aligns @code{double}, @code{long double}, and
74291a4b
MM
7625@code{long long} variables on a two word boundary or a one word
7626boundary. Aligning @code{double} variables on a two word boundary will
7627produce code that runs somewhat faster on a @samp{Pentium} at the
7628expense of more memory.
7629
2b589241 7630@item -m128bit-long-double
cd3bb277 7631@opindex m128bit-long-double
2b589241
JH
7632Control the size of @code{long double} type. i386 application binary interface
7633specify the size to be 12 bytes, while modern architectures (Pentium and newer)
c771326b 7634prefer @code{long double} aligned to 8 or 16 byte boundary. This is
2b589241
JH
7635impossible to reach with 12 byte long doubles in the array accesses.
7636
630d3d5a 7637@strong{Warning:} if you use the @option{-m128bit-long-double} switch, the
2b589241
JH
7638structures and arrays containing @code{long double} will change their size as
7639well as function calling convention for function taking @code{long double}
02f52e19 7640will be modified.
2b589241
JH
7641
7642@item -m96bit-long-double
cd3bb277 7643@opindex m96bit-long-double
0a75e5c3 7644Set the size of @code{long double} to 96 bits as required by the i386
2b589241 7645application binary interface. This is the default.
74291a4b
MM
7646
7647@item -msvr3-shlib
7648@itemx -mno-svr3-shlib
cd3bb277
JM
7649@opindex msvr3-shlib
7650@opindex mno-svr3-shlib
9c34dbbf
ZW
7651Control whether GCC places uninitialized local variables into the
7652@code{bss} or @code{data} segments. @option{-msvr3-shlib} places them
7653into @code{bss}. These options are meaningful only on System V Release 3.
74291a4b 7654
74291a4b 7655@item -mrtd
cd3bb277 7656@opindex mrtd
74291a4b
MM
7657Use a different function-calling convention, in which functions that
7658take a fixed number of arguments return with the @code{ret} @var{num}
7659instruction, which pops their arguments while returning. This saves one
7660instruction in the caller since there is no need to pop the arguments
7661there.
7662
7663You can specify that an individual function is called with this calling
7664sequence with the function attribute @samp{stdcall}. You can also
630d3d5a 7665override the @option{-mrtd} option by using the function attribute
0b433de6 7666@samp{cdecl}. @xref{Function Attributes}.
74291a4b
MM
7667
7668@strong{Warning:} this calling convention is incompatible with the one
7669normally used on Unix, so you cannot use it if you need to call
7670libraries compiled with the Unix compiler.
7671
7672Also, you must provide function prototypes for all functions that
7673take variable numbers of arguments (including @code{printf});
7674otherwise incorrect code will be generated for calls to those
7675functions.
7676
7677In addition, seriously incorrect code will result if you call a
7678function with too many arguments. (Normally, extra arguments are
7679harmlessly ignored.)
7680
74291a4b 7681@item -mregparm=@var{num}
cd3bb277 7682@opindex mregparm
74291a4b
MM
7683Control how many registers are used to pass integer arguments. By
7684default, no registers are used to pass arguments, and at most 3
7685registers can be used. You can control this behavior for a specific
0b433de6
JL
7686function by using the function attribute @samp{regparm}.
7687@xref{Function Attributes}.
74291a4b
MM
7688
7689@strong{Warning:} if you use this switch, and
7690@var{num} is nonzero, then you must build all modules with the same
7691value, including any libraries. This includes the system libraries and
7692startup modules.
7693
3af4bd89 7694@item -mpreferred-stack-boundary=@var{num}
cd3bb277 7695@opindex mpreferred-stack-boundary
3af4bd89 7696Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
630d3d5a 7697byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
fbb83b43
AO
7698the default is 4 (16 bytes or 128 bits), except when optimizing for code
7699size (@option{-Os}), in which case the default is the minimum correct
7700alignment (4 bytes for x86, and 8 bytes for x86-64).
3af4bd89 7701
fbb83b43
AO
7702On Pentium and PentiumPro, @code{double} and @code{long double} values
7703should be aligned to an 8 byte boundary (see @option{-malign-double}) or
7704suffer significant run time performance penalties. On Pentium III, the
b192711e 7705Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
3af4bd89
JH
7706penalties if it is not 16 byte aligned.
7707
7708To ensure proper alignment of this values on the stack, the stack boundary
02f52e19 7709must be as aligned as that required by any value stored on the stack.
3af4bd89
JH
7710Further, every function must be generated such that it keeps the stack
7711aligned. Thus calling a function compiled with a higher preferred
7712stack boundary from a function compiled with a lower preferred stack
7713boundary will most likely misalign the stack. It is recommended that
7714libraries that use callbacks always use the default setting.
7715
fbb83b43
AO
7716This extra alignment does consume extra stack space, and generally
7717increases code size. Code that is sensitive to stack space usage, such
7718as embedded systems and operating system kernels, may want to reduce the
7719preferred alignment to @option{-mpreferred-stack-boundary=2}.
f22a97d2 7720
1255c85c
BS
7721@item -mmmx
7722@itemx -mno-mmx
7723@item -msse
7724@itemx -mno-sse
965f5423
JH
7725@item -msse2
7726@itemx -mno-sse2
1255c85c
BS
7727@item -m3dnow
7728@itemx -mno-3dnow
7729@opindex mmmx
7730@opindex mno-mmx
7731@opindex msse
7732@opindex mno-sse
7733@opindex m3dnow
7734@opindex mno-3dnow
7735These switches enable or disable the use of built-in functions that allow
7736direct access to the MMX, SSE and 3Dnow extensions of the instruction set.
7737
0975678f
JM
7738@xref{X86 Built-in Functions}, for details of the functions enabled
7739and disabled by these switches.
1255c85c 7740
f73ad30e 7741@item -mpush-args
a7939b1d 7742@itemx -mno-push-args
cd3bb277 7743@opindex mpush-args
a7939b1d 7744@opindex mno-push-args
767094dd 7745Use PUSH operations to store outgoing parameters. This method is shorter
f73ad30e 7746and usually equally fast as method using SUB/MOV operations and is enabled
767094dd 7747by default. In some cases disabling it may improve performance because of
f73ad30e
JH
7748improved scheduling and reduced dependencies.
7749
7750@item -maccumulate-outgoing-args
cd3bb277 7751@opindex maccumulate-outgoing-args
f73ad30e 7752If enabled, the maximum amount of space required for outgoing arguments will be
a7939b1d 7753computed in the function prologue. This is faster on most modern CPUs
b192711e 7754because of reduced dependencies, improved scheduling and reduced stack usage
f73ad30e 7755when preferred stack boundary is not equal to 2. The drawback is a notable
767094dd 7756increase in code size. This switch implies @option{-mno-push-args}.
f73ad30e 7757
f22a97d2 7758@item -mthreads
cd3bb277 7759@opindex mthreads
767094dd 7760Support thread-safe exception handling on @samp{Mingw32}. Code that relies
02f52e19 7761on thread-safe exception handling must compile and link all code with the
767094dd 7762@option{-mthreads} option. When compiling, @option{-mthreads} defines
630d3d5a
JM
7763@option{-D_MT}; when linking, it links in a special thread helper library
7764@option{-lmingwthrd} which cleans up per thread exception handling data.
79f05c19
JH
7765
7766@item -mno-align-stringops
cd3bb277 7767@opindex mno-align-stringops
767094dd 7768Do not align destination of inlined string operations. This switch reduces
79f05c19
JH
7769code size and improves performance in case the destination is already aligned,
7770but gcc don't know about it.
7771
7772@item -minline-all-stringops
cd3bb277 7773@opindex minline-all-stringops
79f05c19 7774By default GCC inlines string operations only when destination is known to be
767094dd 7775aligned at least to 4 byte boundary. This enables more inlining, increase code
79f05c19
JH
7776size, but may improve performance of code that depends on fast memcpy, strlen
7777and memset for short lengths.
762e166b
AJ
7778
7779@item -momit-leaf-frame-pointer
cd3bb277 7780@opindex momit-leaf-frame-pointer
762e166b
AJ
7781Don't keep the frame pointer in a register for leaf functions. This
7782avoids the instructions to save, set up and restore frame pointers and
7783makes an extra register available in leaf functions. The option
630d3d5a 7784@option{-fomit-frame-pointer} removes the frame pointer for all functions
762e166b 7785which might make debugging harder.
3af4bd89
JH
7786@end table
7787
14f73b5a
JH
7788These @samp{-m} switches are supported in addition to the above
7789on AMD x86-64 processors in 64-bit environments.
7790
7791@table @gcctabopt
7792@item -m32
7793@itemx -m64
7794@opindex m32
7795@opindex m64
7796Generate code for a 32-bit or 64-bit environment.
7797The 32-bit environment sets int, long and pointer to 32 bits and
7798generates code that runs on any i386 system.
7799The 64-bit environment sets int to 32 bits and long and pointer
7800to 64 bits and generates code for AMD's x86-64 architecture.
7801
7802@item -mno-red-zone
7803@opindex no-red-zone
7804Do not use a so called red zone for x86-64 code. The red zone is mandated
7805by the x86-64 ABI, it is a 128-byte area beyond the location of the
7806stack pointer that will not be modified by signal or interrupt handlers
7807and therefore can be used for temporary data without adjusting the stack
7808pointer. The flag @option{-mno-red-zone} disables this red zone.
7809@end table
7810
74291a4b
MM
7811@node HPPA Options
7812@subsection HPPA Options
7813@cindex HPPA Options
7814
7815These @samp{-m} options are defined for the HPPA family of computers:
7816
2642624b 7817@table @gcctabopt
630d3d5a 7818@item -march=@var{architecture-type}
cd3bb277 7819@opindex march
ea3bfbfe 7820Generate code for the specified architecture. The choices for
630d3d5a 7821@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
ea3bfbfe
JQ
78221.1, and @samp{2.0} for PA 2.0 processors. Refer to
7823@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
7824architecture option for your machine. Code compiled for lower numbered
7825architectures will run on higher numbered architectures, but not the
7826other way around.
7827
7828PA 2.0 support currently requires gas snapshot 19990413 or later. The
7829next release of binutils (current is 2.9.1) will probably contain PA 2.0
02f52e19 7830support.
74291a4b 7831
ea3bfbfe 7832@item -mpa-risc-1-0
62a1403d
AS
7833@itemx -mpa-risc-1-1
7834@itemx -mpa-risc-2-0
cd3bb277
JM
7835@opindex mpa-risc-1-0
7836@opindex mpa-risc-1-1
7837@opindex mpa-risc-2-0
695ac33f 7838Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
74291a4b 7839
861bb6c1 7840@item -mbig-switch
cd3bb277 7841@opindex mbig-switch
861bb6c1
JL
7842Generate code suitable for big switch tables. Use this option only if
7843the assembler/linker complain about out of range branches within a switch
7844table.
7845
74291a4b 7846@item -mjump-in-delay
cd3bb277 7847@opindex mjump-in-delay
74291a4b
MM
7848Fill delay slots of function calls with unconditional jump instructions
7849by modifying the return pointer for the function call to be the target
7850of the conditional jump.
7851
7852@item -mdisable-fpregs
cd3bb277 7853@opindex mdisable-fpregs
74291a4b
MM
7854Prevent floating point registers from being used in any manner. This is
7855necessary for compiling kernels which perform lazy context switching of
7856floating point registers. If you use this option and attempt to perform
7857floating point operations, the compiler will abort.
7858
7859@item -mdisable-indexing
cd3bb277 7860@opindex mdisable-indexing
74291a4b 7861Prevent the compiler from using indexing address modes. This avoids some
161d7b59 7862rather obscure problems when compiling MIG generated code under MACH@.
74291a4b
MM
7863
7864@item -mno-space-regs
cd3bb277 7865@opindex mno-space-regs
74291a4b
MM
7866Generate code that assumes the target has no space registers. This allows
7867GCC to generate faster indirect calls and use unscaled index address modes.
7868
7869Such code is suitable for level 0 PA systems and kernels.
7870
7871@item -mfast-indirect-calls
cd3bb277 7872@opindex mfast-indirect-calls
74291a4b
MM
7873Generate code that assumes calls never cross space boundaries. This
7874allows GCC to emit code which performs faster indirect calls.
7875
b192711e 7876This option will not work in the presence of shared libraries or nested
74291a4b
MM
7877functions.
7878
74291a4b 7879@item -mlong-load-store
cd3bb277 7880@opindex mlong-load-store
74291a4b
MM
7881Generate 3-instruction load and store sequences as sometimes required by
7882the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
7883the HP compilers.
7884
7885@item -mportable-runtime
cd3bb277 7886@opindex mportable-runtime
74291a4b
MM
7887Use the portable calling conventions proposed by HP for ELF systems.
7888
7889@item -mgas
cd3bb277 7890@opindex mgas
74291a4b
MM
7891Enable the use of assembler directives only GAS understands.
7892
630d3d5a 7893@item -mschedule=@var{cpu-type}
cd3bb277 7894@opindex mschedule
74291a4b 7895Schedule code according to the constraints for the machine type
630d3d5a 7896@var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
02f52e19 7897@samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to
732135bf
JL
7898@file{/usr/lib/sched.models} on an HP-UX system to determine the
7899proper scheduling option for your machine.
74291a4b
MM
7900
7901@item -mlinker-opt
cd3bb277 7902@opindex mlinker-opt
74291a4b
MM
7903Enable the optimization pass in the HPUX linker. Note this makes symbolic
7904debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers
7905in which they give bogus error messages when linking some programs.
7906
7907@item -msoft-float
cd3bb277 7908@opindex msoft-float
74291a4b
MM
7909Generate output containing library calls for floating point.
7910@strong{Warning:} the requisite libraries are not available for all HPPA
7911targets. Normally the facilities of the machine's usual C compiler are
7912used, but this cannot be done directly in cross-compilation. You must make
7913your own arrangements to provide suitable library functions for
7914cross-compilation. The embedded target @samp{hppa1.1-*-pro}
7915does provide software floating point support.
7916
630d3d5a 7917@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
7918therefore, it is only useful if you compile @emph{all} of a program with
7919this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 7920library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
7921this to work.
7922@end table
7923
7924@node Intel 960 Options
7925@subsection Intel 960 Options
7926
7927These @samp{-m} options are defined for the Intel 960 implementations:
7928
2642624b 7929@table @gcctabopt
cd3bb277
JM
7930@item -m@var{cpu-type}
7931@opindex mka
7932@opindex mkb
7933@opindex mmc
7934@opindex mca
7935@opindex mcf
7936@opindex msa
7937@opindex msb
7938Assume the defaults for the machine type @var{cpu-type} for some of
74291a4b 7939the other options, including instruction scheduling, floating point
cd3bb277 7940support, and addressing modes. The choices for @var{cpu-type} are
74291a4b
MM
7941@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
7942@samp{sa}, and @samp{sb}.
7943The default is
7944@samp{kb}.
7945
7946@item -mnumerics
7947@itemx -msoft-float
cd3bb277
JM
7948@opindex mnumerics
7949@opindex msoft-float
630d3d5a
JM
7950The @option{-mnumerics} option indicates that the processor does support
7951floating-point instructions. The @option{-msoft-float} option indicates
74291a4b
MM
7952that floating-point support should not be assumed.
7953
7954@item -mleaf-procedures
7955@itemx -mno-leaf-procedures
cd3bb277
JM
7956@opindex mleaf-procedures
7957@opindex mno-leaf-procedures
74291a4b
MM
7958Do (or do not) attempt to alter leaf procedures to be callable with the
7959@code{bal} instruction as well as @code{call}. This will result in more
7960efficient code for explicit calls when the @code{bal} instruction can be
7961substituted by the assembler or linker, but less efficient code in other
7962cases, such as calls via function pointers, or using a linker that doesn't
7963support this optimization.
7964
7965@item -mtail-call
7966@itemx -mno-tail-call
cd3bb277
JM
7967@opindex mtail-call
7968@opindex mno-tail-call
74291a4b
MM
7969Do (or do not) make additional attempts (beyond those of the
7970machine-independent portions of the compiler) to optimize tail-recursive
7971calls into branches. You may not want to do this because the detection of
7972cases where this is not valid is not totally complete. The default is
630d3d5a 7973@option{-mno-tail-call}.
74291a4b
MM
7974
7975@item -mcomplex-addr
7976@itemx -mno-complex-addr
cd3bb277
JM
7977@opindex mcomplex-addr
7978@opindex mno-complex-addr
74291a4b
MM
7979Assume (or do not assume) that the use of a complex addressing mode is a
7980win on this implementation of the i960. Complex addressing modes may not
7981be worthwhile on the K-series, but they definitely are on the C-series.
630d3d5a 7982The default is currently @option{-mcomplex-addr} for all processors except
161d7b59 7983the CB and CC@.
74291a4b
MM
7984
7985@item -mcode-align
7986@itemx -mno-code-align
cd3bb277
JM
7987@opindex mcode-align
7988@opindex mno-code-align
74291a4b
MM
7989Align code to 8-byte boundaries for faster fetching (or don't bother).
7990Currently turned on by default for C-series implementations only.
7991
7992@ignore
7993@item -mclean-linkage
7994@itemx -mno-clean-linkage
cd3bb277
JM
7995@opindex mclean-linkage
7996@opindex mno-clean-linkage
74291a4b
MM
7997These options are not fully implemented.
7998@end ignore
7999
8000@item -mic-compat
8001@itemx -mic2.0-compat
8002@itemx -mic3.0-compat
cd3bb277
JM
8003@opindex mic-compat
8004@opindex mic2.0-compat
8005@opindex mic3.0-compat
74291a4b
MM
8006Enable compatibility with iC960 v2.0 or v3.0.
8007
8008@item -masm-compat
8009@itemx -mintel-asm
cd3bb277
JM
8010@opindex masm-compat
8011@opindex mintel-asm
74291a4b
MM
8012Enable compatibility with the iC960 assembler.
8013
8014@item -mstrict-align
8015@itemx -mno-strict-align
cd3bb277
JM
8016@opindex mstrict-align
8017@opindex mno-strict-align
74291a4b
MM
8018Do not permit (do permit) unaligned accesses.
8019
8020@item -mold-align
cd3bb277 8021@opindex mold-align
74291a4b 8022Enable structure-alignment compatibility with Intel's gcc release version
630d3d5a 80231.3 (based on gcc 1.37). This option implies @option{-mstrict-align}.
eaa4b44c
VM
8024
8025@item -mlong-double-64
cd3bb277 8026@opindex mlong-double-64
eaa4b44c
VM
8027Implement type @samp{long double} as 64-bit floating point numbers.
8028Without the option @samp{long double} is implemented by 80-bit
8029floating point numbers. The only reason we have it because there is
8030no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it
8031is only useful for people using soft-float targets. Otherwise, we
8032should recommend against use of it.
8033
74291a4b
MM
8034@end table
8035
8036@node DEC Alpha Options
8037@subsection DEC Alpha Options
8038
8039These @samp{-m} options are defined for the DEC Alpha implementations:
8040
2642624b 8041@table @gcctabopt
74291a4b
MM
8042@item -mno-soft-float
8043@itemx -msoft-float
cd3bb277
JM
8044@opindex mno-soft-float
8045@opindex msoft-float
74291a4b 8046Use (do not use) the hardware floating-point instructions for
bedc7537 8047floating-point operations. When @option{-msoft-float} is specified,
7857f134 8048functions in @file{libgcc.a} will be used to perform floating-point
74291a4b
MM
8049operations. Unless they are replaced by routines that emulate the
8050floating-point operations, or compiled in such a way as to call such
8051emulations routines, these routines will issue floating-point
8052operations. If you are compiling for an Alpha without floating-point
8053operations, you must ensure that the library is built so as not to call
8054them.
8055
8056Note that Alpha implementations without floating-point operations are
8057required to have floating-point registers.
8058
8059@item -mfp-reg
8060@itemx -mno-fp-regs
cd3bb277
JM
8061@opindex mfp-reg
8062@opindex mno-fp-regs
74291a4b 8063Generate code that uses (does not use) the floating-point register set.
bedc7537 8064@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
74291a4b
MM
8065register set is not used, floating point operands are passed in integer
8066registers as if they were integers and floating-point results are passed
58605ba0
RH
8067in @code{$0} instead of @code{$f0}. This is a non-standard calling sequence,
8068so any function with a floating-point argument or return value called by code
bedc7537 8069compiled with @option{-mno-fp-regs} must also be compiled with that
74291a4b
MM
8070option.
8071
8072A typical use of this option is building a kernel that does not use,
8073and hence need not save and restore, any floating-point registers.
8074
8075@item -mieee
cd3bb277 8076@opindex mieee
74291a4b
MM
8077The Alpha architecture implements floating-point hardware optimized for
8078maximum performance. It is mostly compliant with the IEEE floating
8079point standard. However, for full compliance, software assistance is
8080required. This option generates code fully IEEE compliant code
630d3d5a 8081@emph{except} that the @var{inexact-flag} is not maintained (see below).
9c34dbbf
ZW
8082If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8083defined during compilation. The resulting code is less efficient but is
8084able to correctly support denormalized numbers and exceptional IEEE
8085values such as not-a-number and plus/minus infinity. Other Alpha
8086compilers call this option @option{-ieee_with_no_inexact}.
74291a4b
MM
8087
8088@item -mieee-with-inexact
cd3bb277 8089@opindex mieee-with-inexact
9c34dbbf
ZW
8090This is like @option{-mieee} except the generated code also maintains
8091the IEEE @var{inexact-flag}. Turning on this option causes the
8092generated code to implement fully-compliant IEEE math. In addition to
8093@code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8094macro. On some Alpha implementations the resulting code may execute
8095significantly slower than the code generated by default. Since there is
8096very little code that depends on the @var{inexact-flag}, you should
74291a4b 8097normally not specify this option. Other Alpha compilers call this
630d3d5a 8098option @option{-ieee_with_inexact}.
74291a4b 8099
630d3d5a 8100@item -mfp-trap-mode=@var{trap-mode}
cd3bb277 8101@opindex mfp-trap-mode
74291a4b 8102This option controls what floating-point related traps are enabled.
630d3d5a 8103Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
74291a4b
MM
8104The trap mode can be set to one of four values:
8105
8106@table @samp
8107@item n
8108This is the default (normal) setting. The only traps that are enabled
8109are the ones that cannot be disabled in software (e.g., division by zero
8110trap).
8111
8112@item u
8113In addition to the traps enabled by @samp{n}, underflow traps are enabled
8114as well.
8115
8116@item su
8117Like @samp{su}, but the instructions are marked to be safe for software
8118completion (see Alpha architecture manual for details).
8119
8120@item sui
8121Like @samp{su}, but inexact traps are enabled as well.
8122@end table
8123
630d3d5a 8124@item -mfp-rounding-mode=@var{rounding-mode}
cd3bb277 8125@opindex mfp-rounding-mode
74291a4b 8126Selects the IEEE rounding mode. Other Alpha compilers call this option
630d3d5a 8127@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
74291a4b
MM
8128of:
8129
8130@table @samp
8131@item n
8132Normal IEEE rounding mode. Floating point numbers are rounded towards
8133the nearest machine number or towards the even machine number in case
8134of a tie.
8135
8136@item m
8137Round towards minus infinity.
8138
8139@item c
8140Chopped rounding mode. Floating point numbers are rounded towards zero.
8141
8142@item d
8143Dynamic rounding mode. A field in the floating point control register
8144(@var{fpcr}, see Alpha architecture reference manual) controls the
8145rounding mode in effect. The C library initializes this register for
8146rounding towards plus infinity. Thus, unless your program modifies the
ec4b2ecb
CB
8147@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8148@end table
74291a4b 8149
630d3d5a 8150@item -mtrap-precision=@var{trap-precision}
cd3bb277 8151@opindex mtrap-precision
74291a4b
MM
8152In the Alpha architecture, floating point traps are imprecise. This
8153means without software assistance it is impossible to recover from a
8154floating trap and program execution normally needs to be terminated.
0c2d1a2a 8155GCC can generate code that can assist operating system trap handlers
74291a4b
MM
8156in determining the exact location that caused a floating point trap.
8157Depending on the requirements of an application, different levels of
8158precisions can be selected:
8159
8160@table @samp
8161@item p
8162Program precision. This option is the default and means a trap handler
8163can only identify which program caused a floating point exception.
8164
8165@item f
8166Function precision. The trap handler can determine the function that
8167caused a floating point exception.
8168
8169@item i
8170Instruction precision. The trap handler can determine the exact
8171instruction that caused a floating point exception.
8172@end table
8173
8174Other Alpha compilers provide the equivalent options called
630d3d5a 8175@option{-scope_safe} and @option{-resumption_safe}.
74291a4b
MM
8176
8177@item -mieee-conformant
cd3bb277 8178@opindex mieee-conformant
74291a4b 8179This option marks the generated code as IEEE conformant. You must not
630d3d5a
JM
8180use this option unless you also specify @option{-mtrap-precision=i} and either
8181@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
74291a4b
MM
8182is to emit the line @samp{.eflag 48} in the function prologue of the
8183generated assembly file. Under DEC Unix, this has the effect that
8184IEEE-conformant math library routines will be linked in.
8185
8186@item -mbuild-constants
cd3bb277 8187@opindex mbuild-constants
0c2d1a2a 8188Normally GCC examines a 32- or 64-bit integer constant to
74291a4b
MM
8189see if it can construct it from smaller constants in two or three
8190instructions. If it cannot, it will output the constant as a literal and
956d6950 8191generate code to load it from the data segment at runtime.
74291a4b 8192
0c2d1a2a 8193Use this option to require GCC to construct @emph{all} integer constants
74291a4b
MM
8194using code, even if it takes more instructions (the maximum is six).
8195
8196You would typically use this option to build a shared library dynamic
8197loader. Itself a shared library, it must relocate itself in memory
8198before it can find the variables and constants in its own data segment.
956d6950
JL
8199
8200@item -malpha-as
8201@itemx -mgas
cd3bb277
JM
8202@opindex malpha-as
8203@opindex mgas
956d6950 8204Select whether to generate code to be assembled by the vendor-supplied
630d3d5a 8205assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
956d6950
JL
8206
8207@item -mbwx
8208@itemx -mno-bwx
8209@itemx -mcix
8210@itemx -mno-cix
58605ba0
RH
8211@itemx -mfix
8212@itemx -mno-fix
956d6950
JL
8213@itemx -mmax
8214@itemx -mno-max
cd3bb277
JM
8215@opindex mbwx
8216@opindex mno-bwx
8217@opindex mcix
8218@opindex mno-cix
58605ba0
RH
8219@opindex mfix
8220@opindex mno-fix
cd3bb277
JM
8221@opindex mmax
8222@opindex mno-max
0c2d1a2a 8223Indicate whether GCC should generate code to use the optional BWX,
58605ba0
RH
8224CIX, FIX and MAX instruction sets. The default is to use the instruction
8225sets supported by the CPU type specified via @option{-mcpu=} option or that
0c2d1a2a 8226of the CPU on which GCC was built if none was specified.
956d6950 8227
58605ba0
RH
8228@item -mfloat-vax
8229@itemx -mfloat-ieee
8230@opindex mfloat-vax
8231@opindex mfloat-ieee
8232Generate code that uses (does not use) VAX F and G floating point
8233arithmetic instead of IEEE single and double precision.
8234
8235@item -mexplicit-relocs
8236@itemx -mno-explicit-relocs
8237@opindex mexplicit-relocs
8238@opindex mno-explicit-relocs
8239Older Alpha assemblers provided no way to generate symbol relocations
8240except via assembler macros. Use of these macros does not allow
8241optimial instruction scheduling. GNU binutils as of version 2.12
8242supports a new syntax that allows the compiler to explicitly mark
8243which relocations should apply to which instructions. This option
8244is mostly useful for debugging, as GCC detects the capabilities of
8245the assembler when it is built and sets the default accordingly.
8246
8247@item -msmall-data
8248@itemx -mlarge-data
8249@opindex msmall-data
8250@opindex mlarge-data
8251When @option{-mexplicit-relocs} is in effect, static data is
8252accessed via @dfn{gp-relative} relocations. When @option{-msmall-data}
8253is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8254(the @code{.sdata} and @code{.sbss} sections) and are accessed via
825516-bit relocations off of the @code{$gp} register. This limits the
8256size of the small data area to 64KB, but allows the variables to be
8257directly accessed via a single instruction.
8258
8259The default is @option{-mlarge-data}. With this option the data area
8260is limited to just below 2GB. Programs that require more than 2GB of
8261data must use @code{malloc} or @code{mmap} to allocate the data in the
8262heap instead of in the program's data segment.
8263
8264When generating code for shared libraries, @option{-fpic} implies
8265@option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8266
956d6950 8267@item -mcpu=@var{cpu_type}
cd3bb277 8268@opindex mcpu
58605ba0
RH
8269Set the instruction set and instruction scheduling parameters for
8270machine type @var{cpu_type}. You can specify either the @samp{EV}
8271style name or the corresponding chip number. GCC supports scheduling
8272parameters for the EV4, EV5 and EV6 family of processors and will
8273choose the default values for the instruction set from the processor
8274you specify. If you do not specify a processor type, GCC will default
8275to the processor on which the compiler was built.
956d6950
JL
8276
8277Supported values for @var{cpu_type} are
8278
8279@table @samp
8280@item ev4
58605ba0 8281@item ev45
956d6950
JL
8282@itemx 21064
8283Schedules as an EV4 and has no instruction set extensions.
8284
8285@item ev5
8286@itemx 21164
8287Schedules as an EV5 and has no instruction set extensions.
8288
8289@item ev56
8290@itemx 21164a
8291Schedules as an EV5 and supports the BWX extension.
8292
8293@item pca56
4f69985c 8294@itemx 21164pc
956d6950
JL
8295@itemx 21164PC
8296Schedules as an EV5 and supports the BWX and MAX extensions.
8297
8298@item ev6
8299@itemx 21264
58605ba0
RH
8300Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8301
8302@item ev67
8303@item 21264a
8304Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
4f69985c
RH
8305@end table
8306
58605ba0
RH
8307@item -mtune=@var{cpu_type}
8308@opindex mtune
8309Set only the instruction scheduling parameters for machine type
8310@var{cpu_type}. The instruction set is not changed.
8311
4f69985c 8312@item -mmemory-latency=@var{time}
cd3bb277 8313@opindex mmemory-latency
4f69985c
RH
8314Sets the latency the scheduler should assume for typical memory
8315references as seen by the application. This number is highly
b192711e 8316dependent on the memory access patterns used by the application
4f69985c
RH
8317and the size of the external cache on the machine.
8318
8319Valid options for @var{time} are
8320
8321@table @samp
8322@item @var{number}
8323A decimal number representing clock cycles.
8324
8325@item L1
8326@itemx L2
8327@itemx L3
8328@itemx main
8329The compiler contains estimates of the number of clock cycles for
8330``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8331(also called Dcache, Scache, and Bcache), as well as to main memory.
8332Note that L3 is only valid for EV5.
8333
956d6950 8334@end table
74291a4b
MM
8335@end table
8336
d7c23cdc
DR
8337@node DEC Alpha/VMS Options
8338@subsection DEC Alpha/VMS Options
8339
8340These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8341
8342@table @gcctabopt
8343@item -mvms-return-codes
8344@opindex mvms-return-codes
bf6cfc5e
RK
8345Return VMS condition codes from main. The default is to return POSIX
8346style condition (e.g.@ error) codes.
d7c23cdc
DR
8347@end table
8348
74291a4b
MM
8349@node Clipper Options
8350@subsection Clipper Options
8351
8352These @samp{-m} options are defined for the Clipper implementations:
8353
2642624b 8354@table @gcctabopt
74291a4b 8355@item -mc300
cd3bb277 8356@opindex mc300
767094dd 8357Produce code for a C300 Clipper processor. This is the default.
74291a4b 8358
62a1403d 8359@item -mc400
cd3bb277 8360@opindex mc400
9c34dbbf
ZW
8361Produce code for a C400 Clipper processor, i.e.@: use floating point
8362registers f8--f15.
74291a4b
MM
8363@end table
8364
8365@node H8/300 Options
8366@subsection H8/300 Options
8367
8368These @samp{-m} options are defined for the H8/300 implementations:
8369
2642624b 8370@table @gcctabopt
74291a4b 8371@item -mrelax
cd3bb277 8372@opindex mrelax
74291a4b 8373Shorten some address references at link time, when possible; uses the
630d3d5a 8374linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
74291a4b
MM
8375ld.info, Using ld}, for a fuller description.
8376
8377@item -mh
cd3bb277 8378@opindex mh
161d7b59 8379Generate code for the H8/300H@.
74291a4b 8380
dcb9d1f0 8381@item -ms
cd3bb277 8382@opindex ms
161d7b59 8383Generate code for the H8/S@.
dcb9d1f0 8384
17f0f8fa 8385@item -ms2600
cd3bb277 8386@opindex ms2600
695ac33f 8387Generate code for the H8/S2600. This switch must be used with @option{-ms}.
17f0f8fa 8388
74291a4b 8389@item -mint32
cd3bb277 8390@opindex mint32
74291a4b
MM
8391Make @code{int} data 32 bits by default.
8392
8393@item -malign-300
cd3bb277 8394@opindex malign-300
2c54abce
KH
8395On the H8/300H and H8/S, use the same alignment rules as for the H8/300.
8396The default for the H8/300H and H8/S is to align longs and floats on 4
8397byte boundaries.
630d3d5a 8398@option{-malign-300} causes them to be aligned on 2 byte boundaries.
2c54abce 8399This option has no effect on the H8/300.
74291a4b
MM
8400@end table
8401
8402@node SH Options
8403@subsection SH Options
8404
8405These @samp{-m} options are defined for the SH implementations:
8406
2642624b 8407@table @gcctabopt
74291a4b 8408@item -m1
cd3bb277 8409@opindex m1
74291a4b
MM
8410Generate code for the SH1.
8411
8412@item -m2
cd3bb277 8413@opindex m2
74291a4b
MM
8414Generate code for the SH2.
8415
8416@item -m3
cd3bb277 8417@opindex m3
74291a4b
MM
8418Generate code for the SH3.
8419
8420@item -m3e
cd3bb277 8421@opindex m3e
74291a4b
MM
8422Generate code for the SH3e.
8423
3cadd778 8424@item -m4-nofpu
cd3bb277 8425@opindex m4-nofpu
3cadd778
AO
8426Generate code for the SH4 without a floating-point unit.
8427
8428@item -m4-single-only
cd3bb277 8429@opindex m4-single-only
3cadd778 8430Generate code for the SH4 with a floating-point unit that only
c771326b 8431supports single-precision arithmetic.
3cadd778
AO
8432
8433@item -m4-single
cd3bb277 8434@opindex m4-single
3cadd778
AO
8435Generate code for the SH4 assuming the floating-point unit is in
8436single-precision mode by default.
8437
8438@item -m4
cd3bb277 8439@opindex m4
3cadd778
AO
8440Generate code for the SH4.
8441
74291a4b 8442@item -mb
cd3bb277 8443@opindex mb
74291a4b
MM
8444Compile code for the processor in big endian mode.
8445
8446@item -ml
cd3bb277 8447@opindex ml
74291a4b
MM
8448Compile code for the processor in little endian mode.
8449
3d5a0820 8450@item -mdalign
cd3bb277 8451@opindex mdalign
02f52e19 8452Align doubles at 64-bit boundaries. Note that this changes the calling
3d5a0820 8453conventions, and thus some functions from the standard C library will
695ac33f 8454not work unless you recompile it first with @option{-mdalign}.
3d5a0820 8455
74291a4b 8456@item -mrelax
cd3bb277 8457@opindex mrelax
74291a4b 8458Shorten some address references at link time, when possible; uses the
630d3d5a 8459linker option @option{-relax}.
3cadd778
AO
8460
8461@item -mbigtable
cd3bb277 8462@opindex mbigtable
3cadd778
AO
8463Use 32-bit offsets in @code{switch} tables. The default is to use
846416-bit offsets.
8465
8466@item -mfmovd
cd3bb277 8467@opindex mfmovd
3cadd778
AO
8468Enable the use of the instruction @code{fmovd}.
8469
8470@item -mhitachi
cd3bb277 8471@opindex mhitachi
3cadd778
AO
8472Comply with the calling conventions defined by Hitachi.
8473
8474@item -mnomacsave
cd3bb277 8475@opindex mnomacsave
3cadd778 8476Mark the @code{MAC} register as call-clobbered, even if
bedc7537 8477@option{-mhitachi} is given.
3cadd778 8478
c474f76b
AO
8479@item -mieee
8480@opindex mieee
8481Increase IEEE-compliance of floating-point code.
8482
3cadd778 8483@item -misize
cd3bb277 8484@opindex misize
3cadd778
AO
8485Dump instruction size and location in the assembly code.
8486
8487@item -mpadstruct
cd3bb277 8488@opindex mpadstruct
3cadd778 8489This option is deprecated. It pads structures to multiple of 4 bytes,
161d7b59 8490which is incompatible with the SH ABI@.
3cadd778
AO
8491
8492@item -mspace
cd3bb277 8493@opindex mspace
bedc7537 8494Optimize for space instead of speed. Implied by @option{-Os}.
1a66cd67
AO
8495
8496@item -mprefergot
cd3bb277 8497@opindex mprefergot
1a66cd67
AO
8498When generating position-independent code, emit function calls using
8499the Global Offset Table instead of the Procedure Linkage Table.
93ca1662
NY
8500
8501@item -musermode
cd3bb277 8502@opindex musermode
93ca1662
NY
8503Generate a library function call to invalidate instruction cache
8504entries, after fixing up a trampoline. This library function call
8505doesn't assume it can write to the whole memory address space. This
8506is the default when the target is @code{sh-*-linux*}.
74291a4b
MM
8507@end table
8508
8509@node System V Options
8510@subsection Options for System V
8511
8512These additional options are available on System V Release 4 for
8513compatibility with other compilers on those systems:
8514
2642624b 8515@table @gcctabopt
74291a4b 8516@item -G
cd3bb277 8517@opindex G
74291a4b 8518Create a shared object.
630d3d5a 8519It is recommended that @option{-symbolic} or @option{-shared} be used instead.
74291a4b
MM
8520
8521@item -Qy
cd3bb277 8522@opindex Qy
74291a4b
MM
8523Identify the versions of each tool used by the compiler, in a
8524@code{.ident} assembler directive in the output.
8525
8526@item -Qn
cd3bb277 8527@opindex Qn
74291a4b
MM
8528Refrain from adding @code{.ident} directives to the output file (this is
8529the default).
8530
aee96fe9 8531@item -YP,@var{dirs}
cd3bb277 8532@opindex YP
74291a4b 8533Search the directories @var{dirs}, and no others, for libraries
630d3d5a 8534specified with @option{-l}.
74291a4b 8535
aee96fe9 8536@item -Ym,@var{dir}
cd3bb277 8537@opindex Ym
bedc7537 8538Look in the directory @var{dir} to find the M4 preprocessor.
74291a4b
MM
8539The assembler uses this option.
8540@c This is supposed to go with a -Yd for predefined M4 macro files, but
8541@c the generic assembler that comes with Solaris takes just -Ym.
8542@end table
8543
282a61e6
MH
8544@node TMS320C3x/C4x Options
8545@subsection TMS320C3x/C4x Options
8546@cindex TMS320C3x/C4x Options
8547
8548These @samp{-m} options are defined for TMS320C3x/C4x implementations:
8549
2642624b 8550@table @gcctabopt
282a61e6
MH
8551
8552@item -mcpu=@var{cpu_type}
cd3bb277 8553@opindex mcpu
282a61e6
MH
8554Set the instruction set, register set, and instruction scheduling
8555parameters for machine type @var{cpu_type}. Supported values for
8556@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
8557@samp{c44}. The default is @samp{c40} to generate code for the
8558TMS320C40.
8559
8560@item -mbig-memory
8561@item -mbig
8562@itemx -msmall-memory
8563@itemx -msmall
cd3bb277
JM
8564@opindex mbig-memory
8565@opindex mbig
8566@opindex msmall-memory
8567@opindex msmall
282a61e6
MH
8568Generates code for the big or small memory model. The small memory
8569model assumed that all data fits into one 64K word page. At run-time
8570the data page (DP) register must be set to point to the 64K page
8571containing the .bss and .data program sections. The big memory model is
8572the default and requires reloading of the DP register for every direct
8573memory access.
8574
8575@item -mbk
8576@itemx -mno-bk
cd3bb277
JM
8577@opindex mbk
8578@opindex mno-bk
282a61e6 8579Allow (disallow) allocation of general integer operands into the block
161d7b59 8580count register BK@.
282a61e6
MH
8581
8582@item -mdb
8583@itemx -mno-db
cd3bb277
JM
8584@opindex mdb
8585@opindex mno-db
282a61e6
MH
8586Enable (disable) generation of code using decrement and branch,
8587DBcond(D), instructions. This is enabled by default for the C4x. To be
8588on the safe side, this is disabled for the C3x, since the maximum
aee96fe9
JM
8589iteration count on the C3x is @math{2^23 + 1} (but who iterates loops more than
8590@math{2^23} times on the C3x?). Note that GCC will try to reverse a loop so
282a61e6
MH
8591that it can utilise the decrement and branch instruction, but will give
8592up if there is more than one memory reference in the loop. Thus a loop
8593where the loop counter is decremented can generate slightly more
8594efficient code, in cases where the RPTB instruction cannot be utilised.
8595
8596@item -mdp-isr-reload
8597@itemx -mparanoid
cd3bb277
JM
8598@opindex mdp-isr-reload
8599@opindex mparanoid
282a61e6
MH
8600Force the DP register to be saved on entry to an interrupt service
8601routine (ISR), reloaded to point to the data section, and restored on
161d7b59 8602exit from the ISR@. This should not be required unless someone has
282a61e6
MH
8603violated the small memory model by modifying the DP register, say within
8604an object library.
8605
8606@item -mmpyi
8607@itemx -mno-mpyi
cd3bb277
JM
8608@opindex mmpyi
8609@opindex mno-mpyi
282a61e6
MH
8610For the C3x use the 24-bit MPYI instruction for integer multiplies
8611instead of a library call to guarantee 32-bit results. Note that if one
8612of the operands is a constant, then the multiplication will be performed
695ac33f 8613using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x,
282a61e6
MH
8614then squaring operations are performed inline instead of a library call.
8615
8616@item -mfast-fix
8617@itemx -mno-fast-fix
cd3bb277
JM
8618@opindex mfast-fix
8619@opindex mno-fast-fix
282a61e6
MH
8620The C3x/C4x FIX instruction to convert a floating point value to an
8621integer value chooses the nearest integer less than or equal to the
8622floating point value rather than to the nearest integer. Thus if the
8623floating point number is negative, the result will be incorrectly
8624truncated an additional code is necessary to detect and correct this
8625case. This option can be used to disable generation of the additional
8626code required to correct the result.
8627
8628@item -mrptb
8629@itemx -mno-rptb
cd3bb277
JM
8630@opindex mrptb
8631@opindex mno-rptb
282a61e6
MH
8632Enable (disable) generation of repeat block sequences using the RPTB
8633instruction for zero overhead looping. The RPTB construct is only used
8634for innermost loops that do not call functions or jump across the loop
8635boundaries. There is no advantage having nested RPTB loops due to the
8636overhead required to save and restore the RC, RS, and RE registers.
695ac33f 8637This is enabled by default with @option{-O2}.
282a61e6
MH
8638
8639@item -mrpts=@var{count}
8640@itemx -mno-rpts
cd3bb277
JM
8641@opindex mrpts
8642@opindex mno-rpts
282a61e6 8643Enable (disable) the use of the single instruction repeat instruction
161d7b59 8644RPTS@. If a repeat block contains a single instruction, and the loop
282a61e6 8645count can be guaranteed to be less than the value @var{count}, GCC will
161d7b59 8646emit a RPTS instruction instead of a RPTB@. If no value is specified,
282a61e6
MH
8647then a RPTS will be emitted even if the loop count cannot be determined
8648at compile time. Note that the repeated instruction following RPTS does
8649not have to be reloaded from memory each iteration, thus freeing up the
b192711e 8650CPU buses for operands. However, since interrupts are blocked by this
282a61e6
MH
8651instruction, it is disabled by default.
8652
8653@item -mloop-unsigned
8654@itemx -mno-loop-unsigned
cd3bb277
JM
8655@opindex mloop-unsigned
8656@opindex mno-loop-unsigned
282a61e6 8657The maximum iteration count when using RPTS and RPTB (and DB on the C40)
aee96fe9 8658is @math{2^31 + 1} since these instructions test if the iteration count is
282a61e6 8659negative to terminate the loop. If the iteration count is unsigned
aee96fe9 8660there is a possibility than the @math{2^31 + 1} maximum iteration count may be
282a61e6
MH
8661exceeded. This switch allows an unsigned iteration count.
8662
8663@item -mti
cd3bb277 8664@opindex mti
282a61e6
MH
8665Try to emit an assembler syntax that the TI assembler (asm30) is happy
8666with. This also enforces compatibility with the API employed by the TI
8667C3x C compiler. For example, long doubles are passed as structures
8668rather than in floating point registers.
8669
8670@item -mregparm
8671@itemx -mmemparm
cd3bb277
JM
8672@opindex mregparm
8673@opindex mmemparm
282a61e6
MH
8674Generate code that uses registers (stack) for passing arguments to functions.
8675By default, arguments are passed in registers where possible rather
8676than by pushing arguments on to the stack.
8677
8678@item -mparallel-insns
8679@itemx -mno-parallel-insns
cd3bb277
JM
8680@opindex mparallel-insns
8681@opindex mno-parallel-insns
282a61e6 8682Allow the generation of parallel instructions. This is enabled by
695ac33f 8683default with @option{-O2}.
282a61e6
MH
8684
8685@item -mparallel-mpy
8686@itemx -mno-parallel-mpy
cd3bb277
JM
8687@opindex mparallel-mpy
8688@opindex mno-parallel-mpy
282a61e6 8689Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
695ac33f 8690provided @option{-mparallel-insns} is also specified. These instructions have
282a61e6
MH
8691tight register constraints which can pessimize the code generation
8692of large functions.
8693
8694@end table
8695
f84271d9
JL
8696@node V850 Options
8697@subsection V850 Options
8698@cindex V850 Options
8699
8700These @samp{-m} options are defined for V850 implementations:
8701
2642624b 8702@table @gcctabopt
f84271d9
JL
8703@item -mlong-calls
8704@itemx -mno-long-calls
cd3bb277
JM
8705@opindex mlong-calls
8706@opindex mno-long-calls
f84271d9
JL
8707Treat all calls as being far away (near). If calls are assumed to be
8708far away, the compiler will always load the functions address up into a
8709register, and call indirect through the pointer.
8710
8711@item -mno-ep
bd762873 8712@itemx -mep
cd3bb277
JM
8713@opindex mno-ep
8714@opindex mep
f84271d9
JL
8715Do not optimize (do optimize) basic blocks that use the same index
8716pointer 4 or more times to copy pointer into the @code{ep} register, and
630d3d5a 8717use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
f84271d9
JL
8718option is on by default if you optimize.
8719
8720@item -mno-prolog-function
8721@itemx -mprolog-function
cd3bb277
JM
8722@opindex mno-prolog-function
8723@opindex mprolog-function
f84271d9
JL
8724Do not use (do use) external functions to save and restore registers at
8725the prolog and epilog of a function. The external functions are slower,
8726but use less code space if more than one function saves the same number
630d3d5a 8727of registers. The @option{-mprolog-function} option is on by default if
f84271d9
JL
8728you optimize.
8729
8730@item -mspace
cd3bb277 8731@opindex mspace
f84271d9 8732Try to make the code as small as possible. At present, this just turns
630d3d5a 8733on the @option{-mep} and @option{-mprolog-function} options.
f84271d9
JL
8734
8735@item -mtda=@var{n}
cd3bb277 8736@opindex mtda
f84271d9
JL
8737Put static or global variables whose size is @var{n} bytes or less into
8738the tiny data area that register @code{ep} points to. The tiny data
8739area can hold up to 256 bytes in total (128 bytes for byte references).
8740
8741@item -msda=@var{n}
cd3bb277 8742@opindex msda
f84271d9
JL
8743Put static or global variables whose size is @var{n} bytes or less into
8744the small data area that register @code{gp} points to. The small data
8745area can hold up to 64 kilobytes.
8746
8747@item -mzda=@var{n}
cd3bb277 8748@opindex mzda
f84271d9
JL
8749Put static or global variables whose size is @var{n} bytes or less into
8750the first 32 kilobytes of memory.
02f52e19 8751
48f0be1b 8752@item -mv850
cd3bb277 8753@opindex mv850
48f0be1b
SC
8754Specify that the target processor is the V850.
8755
e9a25f70 8756@item -mbig-switch
cd3bb277 8757@opindex mbig-switch
e9a25f70
JL
8758Generate code suitable for big switch tables. Use this option only if
8759the assembler/linker complain about out of range branches within a switch
8760table.
f84271d9
JL
8761@end table
8762
56b2d7a7
JL
8763@node ARC Options
8764@subsection ARC Options
8765@cindex ARC Options
8766
8767These options are defined for ARC implementations:
8768
2642624b 8769@table @gcctabopt
56b2d7a7 8770@item -EL
cd3bb277 8771@opindex EL
56b2d7a7
JL
8772Compile code for little endian mode. This is the default.
8773
8774@item -EB
cd3bb277 8775@opindex EB
56b2d7a7
JL
8776Compile code for big endian mode.
8777
8778@item -mmangle-cpu
cd3bb277 8779@opindex mmangle-cpu
56b2d7a7
JL
8780Prepend the name of the cpu to all public symbol names.
8781In multiple-processor systems, there are many ARC variants with different
8782instruction and register set characteristics. This flag prevents code
8783compiled for one cpu to be linked with code compiled for another.
695ac33f 8784No facility exists for handling variants that are ``almost identical''.
56b2d7a7
JL
8785This is an all or nothing option.
8786
8787@item -mcpu=@var{cpu}
cd3bb277 8788@opindex mcpu
56b2d7a7
JL
8789Compile code for ARC variant @var{cpu}.
8790Which variants are supported depend on the configuration.
630d3d5a 8791All variants support @option{-mcpu=base}, this is the default.
56b2d7a7 8792
630d3d5a
JM
8793@item -mtext=@var{text-section}
8794@itemx -mdata=@var{data-section}
8795@itemx -mrodata=@var{readonly-data-section}
cd3bb277
JM
8796@opindex mtext
8797@opindex mdata
8798@opindex mrodata
630d3d5a
JM
8799Put functions, data, and readonly data in @var{text-section},
8800@var{data-section}, and @var{readonly-data-section} respectively
56b2d7a7 8801by default. This can be overridden with the @code{section} attribute.
0b433de6 8802@xref{Variable Attributes}.
56b2d7a7
JL
8803
8804@end table
8805
83575957
ID
8806@node NS32K Options
8807@subsection NS32K Options
8808@cindex NS32K options
8809
8810These are the @samp{-m} options defined for the 32000 series. The default
8811values for these options depends on which style of 32000 was selected when
8812the compiler was configured; the defaults for the most common choices are
8813given below.
8814
2642624b 8815@table @gcctabopt
83575957
ID
8816@item -m32032
8817@itemx -m32032
cd3bb277
JM
8818@opindex m32032
8819@opindex m32032
83575957
ID
8820Generate output for a 32032. This is the default
8821when the compiler is configured for 32032 and 32016 based systems.
8822
8823@item -m32332
8824@itemx -m32332
cd3bb277
JM
8825@opindex m32332
8826@opindex m32332
83575957
ID
8827Generate output for a 32332. This is the default
8828when the compiler is configured for 32332-based systems.
8829
8830@item -m32532
8831@itemx -m32532
cd3bb277
JM
8832@opindex m32532
8833@opindex m32532
83575957
ID
8834Generate output for a 32532. This is the default
8835when the compiler is configured for 32532-based systems.
8836
8837@item -m32081
cd3bb277 8838@opindex m32081
83575957
ID
8839Generate output containing 32081 instructions for floating point.
8840This is the default for all systems.
8841
8842@item -m32381
cd3bb277 8843@opindex m32381
83575957 8844Generate output containing 32381 instructions for floating point. This
767094dd
JM
8845also implies @option{-m32081}. The 32381 is only compatible with the 32332
8846and 32532 cpus. This is the default for the pc532-netbsd configuration.
83575957
ID
8847
8848@item -mmulti-add
cd3bb277 8849@opindex mmulti-add
83575957 8850Try and generate multiply-add floating point instructions @code{polyF}
767094dd 8851and @code{dotF}. This option is only available if the @option{-m32381}
14976c58 8852option is in effect. Using these instructions requires changes to
83575957
ID
8853register allocation which generally has a negative impact on
8854performance. This option should only be enabled when compiling code
8855particularly likely to make heavy use of multiply-add instructions.
8856
8857@item -mnomulti-add
cd3bb277 8858@opindex mnomulti-add
83575957 8859Do not try and generate multiply-add floating point instructions
767094dd 8860@code{polyF} and @code{dotF}. This is the default on all platforms.
83575957
ID
8861
8862@item -msoft-float
cd3bb277 8863@opindex msoft-float
83575957
ID
8864Generate output containing library calls for floating point.
8865@strong{Warning:} the requisite libraries may not be available.
8866
8867@item -mnobitfield
cd3bb277 8868@opindex mnobitfield
767094dd
JM
8869Do not use the bit-field instructions. On some machines it is faster to
8870use shifting and masking operations. This is the default for the pc532.
83575957
ID
8871
8872@item -mbitfield
cd3bb277 8873@opindex mbitfield
767094dd 8874Do use the bit-field instructions. This is the default for all platforms
83575957
ID
8875except the pc532.
8876
8877@item -mrtd
cd3bb277 8878@opindex mrtd
83575957
ID
8879Use a different function-calling convention, in which functions
8880that take a fixed number of arguments return pop their
8881arguments on return with the @code{ret} instruction.
8882
8883This calling convention is incompatible with the one normally
8884used on Unix, so you cannot use it if you need to call libraries
8885compiled with the Unix compiler.
8886
8887Also, you must provide function prototypes for all functions that
8888take variable numbers of arguments (including @code{printf});
8889otherwise incorrect code will be generated for calls to those
8890functions.
8891
8892In addition, seriously incorrect code will result if you call a
8893function with too many arguments. (Normally, extra arguments are
8894harmlessly ignored.)
8895
8896This option takes its name from the 680x0 @code{rtd} instruction.
8897
8898
8899@item -mregparam
cd3bb277 8900@opindex mregparam
83575957
ID
8901Use a different function-calling convention where the first two arguments
8902are passed in registers.
8903
8904This calling convention is incompatible with the one normally
8905used on Unix, so you cannot use it if you need to call libraries
8906compiled with the Unix compiler.
8907
8908@item -mnoregparam
cd3bb277 8909@opindex mnoregparam
767094dd 8910Do not pass any arguments in registers. This is the default for all
83575957
ID
8911targets.
8912
8913@item -msb
cd3bb277 8914@opindex msb
83575957 8915It is OK to use the sb as an index register which is always loaded with
767094dd 8916zero. This is the default for the pc532-netbsd target.
83575957
ID
8917
8918@item -mnosb
cd3bb277 8919@opindex mnosb
83575957 8920The sb register is not available for use or has not been initialized to
767094dd
JM
8921zero by the run time system. This is the default for all targets except
8922the pc532-netbsd. It is also implied whenever @option{-mhimem} or
630d3d5a 8923@option{-fpic} is set.
83575957
ID
8924
8925@item -mhimem
cd3bb277 8926@opindex mhimem
161d7b59 8927Many ns32000 series addressing modes use displacements of up to 512MB@.
83575957 8928If an address is above 512MB then displacements from zero can not be used.
161d7b59 8929This option causes code to be generated which can be loaded above 512MB@.
83575957
ID
8930This may be useful for operating systems or ROM code.
8931
8932@item -mnohimem
cd3bb277 8933@opindex mnohimem
83575957
ID
8934Assume code will be loaded in the first 512MB of virtual address space.
8935This is the default for all platforms.
8936
8937
8938@end table
8939
052a4b28
DC
8940@node AVR Options
8941@subsection AVR Options
8942@cindex AVR Options
8943
8944These options are defined for AVR implementations:
8945
2642624b 8946@table @gcctabopt
052a4b28 8947@item -mmcu=@var{mcu}
cd3bb277 8948@opindex mmcu
3a69a7d5
MM
8949Specify ATMEL AVR instruction set or MCU type.
8950
8951Instruction set avr1 is for the minimal AVR core, not supported by the C
8952compiler, only for assembler programs (MCU types: at90s1200, attiny10,
8953attiny11, attiny12, attiny15, attiny28).
8954
8955Instruction set avr2 (default) is for the classic AVR core with up to
89568K program memory space (MCU types: at90s2313, at90s2323, attiny22,
8957at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
8958at90c8534, at90s8535).
8959
8960Instruction set avr3 is for the classic AVR core with up to 128K program
c7f3e0b0 8961memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
3a69a7d5
MM
8962
8963Instruction set avr4 is for the enhanced AVR core with up to 8K program
c7f3e0b0 8964memory space (MCU types: atmega8, atmega83, atmega85).
3a69a7d5
MM
8965
8966Instruction set avr5 is for the enhanced AVR core with up to 128K program
c7f3e0b0
MM
8967memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
8968atmega64, atmega128, at43usb355, at94k).
052a4b28
DC
8969
8970@item -msize
cd3bb277 8971@opindex msize
3a69a7d5 8972Output instruction sizes to the asm file.
052a4b28
DC
8973
8974@item -minit-stack=@var{N}
cd3bb277 8975@opindex minit-stack
3a69a7d5 8976Specify the initial stack address, which may be a symbol or numeric value,
aee96fe9 8977@samp{__stack} is the default.
052a4b28
DC
8978
8979@item -mno-interrupts
cd3bb277 8980@opindex mno-interrupts
052a4b28
DC
8981Generated code is not compatible with hardware interrupts.
8982Code size will be smaller.
8983
8984@item -mcall-prologues
cd3bb277 8985@opindex mcall-prologues
052a4b28 8986Functions prologues/epilogues expanded as call to appropriate
767094dd 8987subroutines. Code size will be smaller.
3a69a7d5
MM
8988
8989@item -mno-tablejump
cd3bb277 8990@opindex mno-tablejump
3a69a7d5
MM
8991Do not generate tablejump insns which sometimes increase code size.
8992
8993@item -mtiny-stack
cd3bb277 8994@opindex mtiny-stack
3a69a7d5 8995Change only the low 8 bits of the stack pointer.
052a4b28
DC
8996@end table
8997
789a3090
NC
8998@node MCore Options
8999@subsection MCore Options
9000@cindex MCore options
9001
9002These are the @samp{-m} options defined for the Motorola M*Core
02f52e19 9003processors.
789a3090 9004
2642624b 9005@table @gcctabopt
789a3090
NC
9006
9007@item -mhardlit
9008@itemx -mhardlit
9009@itemx -mno-hardlit
cd3bb277
JM
9010@opindex mhardlit
9011@opindex mhardlit
9012@opindex mno-hardlit
789a3090
NC
9013Inline constants into the code stream if it can be done in two
9014instructions or less.
9015
9016@item -mdiv
9017@itemx -mdiv
9018@itemx -mno-div
cd3bb277
JM
9019@opindex mdiv
9020@opindex mdiv
9021@opindex mno-div
789a3090
NC
9022Use the divide instruction. (Enabled by default).
9023
9024@item -mrelax-immediate
9025@itemx -mrelax-immediate
9026@itemx -mno-relax-immediate
cd3bb277
JM
9027@opindex mrelax-immediate
9028@opindex mrelax-immediate
9029@opindex mno-relax-immediate
b192711e 9030Allow arbitrary sized immediates in bit operations.
789a3090
NC
9031
9032@item -mwide-bitfields
9033@itemx -mwide-bitfields
9034@itemx -mno-wide-bitfields
cd3bb277
JM
9035@opindex mwide-bitfields
9036@opindex mwide-bitfields
9037@opindex mno-wide-bitfields
c771326b 9038Always treat bit-fields as int-sized.
789a3090
NC
9039
9040@item -m4byte-functions
9041@itemx -m4byte-functions
9042@itemx -mno-4byte-functions
cd3bb277
JM
9043@opindex m4byte-functions
9044@opindex m4byte-functions
9045@opindex mno-4byte-functions
b192711e 9046Force all functions to be aligned to a four byte boundary.
789a3090
NC
9047
9048@item -mcallgraph-data
9049@itemx -mcallgraph-data
9050@itemx -mno-callgraph-data
cd3bb277
JM
9051@opindex mcallgraph-data
9052@opindex mcallgraph-data
9053@opindex mno-callgraph-data
789a3090
NC
9054Emit callgraph information.
9055
9056@item -mslow-bytes
9057@itemx -mslow-bytes
9058@itemx -mno-slow-bytes
cd3bb277
JM
9059@opindex mslow-bytes
9060@opindex mslow-bytes
9061@opindex mno-slow-bytes
789a3090
NC
9062Prefer word access when reading byte quantities.
9063
9064@item -mlittle-endian
9065@itemx -mlittle-endian
9066@itemx -mbig-endian
cd3bb277
JM
9067@opindex mlittle-endian
9068@opindex mlittle-endian
9069@opindex mbig-endian
b192711e 9070Generate code for a little endian target.
789a3090
NC
9071
9072@item -m210
9073@itemx -m210
9074@itemx -m340
cd3bb277
JM
9075@opindex m210
9076@opindex m210
9077@opindex m340
789a3090 9078Generate code for the 210 processor.
789a3090 9079@end table
83575957 9080
df6194d4
JW
9081@node IA-64 Options
9082@subsection IA-64 Options
9083@cindex IA-64 Options
9084
9085These are the @samp{-m} options defined for the Intel IA-64 architecture.
9086
9087@table @gcctabopt
9088@item -mbig-endian
cd3bb277 9089@opindex mbig-endian
161d7b59 9090Generate code for a big endian target. This is the default for HPUX@.
df6194d4
JW
9091
9092@item -mlittle-endian
cd3bb277 9093@opindex mlittle-endian
df6194d4
JW
9094Generate code for a little endian target. This is the default for AIX5
9095and Linux.
9096
9097@item -mgnu-as
9098@itemx -mno-gnu-as
cd3bb277
JM
9099@opindex mgnu-as
9100@opindex mno-gnu-as
15d3a111 9101Generate (or don't) code for the GNU assembler. This is the default.
630d3d5a 9102@c Also, this is the default if the configure option @option{--with-gnu-as}
15d3a111 9103@c is used.
df6194d4
JW
9104
9105@item -mgnu-ld
9106@itemx -mno-gnu-ld
cd3bb277
JM
9107@opindex mgnu-ld
9108@opindex mno-gnu-ld
15d3a111 9109Generate (or don't) code for the GNU linker. This is the default.
630d3d5a 9110@c Also, this is the default if the configure option @option{--with-gnu-ld}
15d3a111 9111@c is used.
df6194d4
JW
9112
9113@item -mno-pic
cd3bb277 9114@opindex mno-pic
15d3a111 9115Generate code that does not use a global pointer register. The result
161d7b59 9116is not position independent code, and violates the IA-64 ABI@.
df6194d4
JW
9117
9118@item -mvolatile-asm-stop
9119@itemx -mno-volatile-asm-stop
cd3bb277
JM
9120@opindex mvolatile-asm-stop
9121@opindex mno-volatile-asm-stop
15d3a111
JW
9122Generate (or don't) a stop bit immediately before and after volatile asm
9123statements.
df6194d4
JW
9124
9125@item -mb-step
cd3bb277 9126@opindex mb-step
df6194d4
JW
9127Generate code that works around Itanium B step errata.
9128
9129@item -mregister-names
9130@itemx -mno-register-names
cd3bb277
JM
9131@opindex mregister-names
9132@opindex mno-register-names
15d3a111
JW
9133Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9134the stacked registers. This may make assembler output more readable.
df6194d4
JW
9135
9136@item -mno-sdata
9137@itemx -msdata
cd3bb277
JM
9138@opindex mno-sdata
9139@opindex msdata
15d3a111
JW
9140Disable (or enable) optimizations that use the small data section. This may
9141be useful for working around optimizer bugs.
df6194d4
JW
9142
9143@item -mconstant-gp
cd3bb277 9144@opindex mconstant-gp
df6194d4
JW
9145Generate code that uses a single constant global pointer value. This is
9146useful when compiling kernel code.
9147
9148@item -mauto-pic
cd3bb277 9149@opindex mauto-pic
630d3d5a 9150Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
df6194d4
JW
9151This is useful when compiling firmware code.
9152
9153@item -minline-divide-min-latency
cd3bb277 9154@opindex minline-divide-min-latency
df6194d4
JW
9155Generate code for inline divides using the minimum latency algorithm.
9156
9157@item -minline-divide-max-throughput
cd3bb277 9158@opindex minline-divide-max-throughput
df6194d4
JW
9159Generate code for inline divides using the maximum throughput algorithm.
9160
9161@item -mno-dwarf2-asm
9162@itemx -mdwarf2-asm
cd3bb277
JM
9163@opindex mno-dwarf2-asm
9164@opindex mdwarf2-asm
15d3a111
JW
9165Don't (or do) generate assembler code for the DWARF2 line number debugging
9166info. This may be useful when not using the GNU assembler.
df6194d4 9167
630d3d5a 9168@item -mfixed-range=@var{register-range}
cd3bb277 9169@opindex mfixed-range
df6194d4
JW
9170Generate code treating the given register range as fixed registers.
9171A fixed register is one that the register allocator can not use. This is
9172useful when compiling kernel code. A register range is specified as
9173two registers separated by a dash. Multiple register ranges can be
9174specified separated by a comma.
9175@end table
9176
e8ad90e5
MM
9177@node D30V Options
9178@subsection D30V Options
9179@cindex D30V Options
9180
9181These @samp{-m} options are defined for D30V implementations:
9182
2642624b 9183@table @gcctabopt
e8ad90e5 9184@item -mextmem
cd3bb277 9185@opindex mextmem
e8ad90e5
MM
9186Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
9187@samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
9188memory, which starts at location @code{0x80000000}.
9189
9190@item -mextmemory
cd3bb277 9191@opindex mextmemory
630d3d5a 9192Same as the @option{-mextmem} switch.
e8ad90e5
MM
9193
9194@item -monchip
cd3bb277 9195@opindex monchip
e8ad90e5
MM
9196Link the @samp{.text} section into onchip text memory, which starts at
9197location @code{0x0}. Also link @samp{.data}, @samp{.bss},
9198@samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
9199into onchip data memory, which starts at location @code{0x20000000}.
9200
9201@item -mno-asm-optimize
9202@itemx -masm-optimize
cd3bb277
JM
9203@opindex mno-asm-optimize
9204@opindex masm-optimize
630d3d5a
JM
9205Disable (enable) passing @option{-O} to the assembler when optimizing.
9206The assembler uses the @option{-O} option to automatically parallelize
e8ad90e5
MM
9207adjacent short instructions where possible.
9208
9209@item -mbranch-cost=@var{n}
cd3bb277 9210@opindex mbranch-cost
e8ad90e5
MM
9211Increase the internal costs of branches to @var{n}. Higher costs means
9212that the compiler will issue more instructions to avoid doing a branch.
9213The default is 2.
9214
9215@item -mcond-exec=@var{n}
cd3bb277 9216@opindex mcond-exec
e8ad90e5
MM
9217Specify the maximum number of conditionally executed instructions that
9218replace a branch. The default is 4.
9219@end table
56b2d7a7 9220
91abf72d
HP
9221@node S/390 and zSeries Options
9222@subsection S/390 and zSeries Options
9223@cindex S/390 and zSeries Options
9224
9225These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9226
9227@table @gcctabopt
9228@item -mhard-float
9229@itemx -msoft-float
9230@opindex mhard-float
9231@opindex msoft-float
9232Use (do not use) the hardware floating-point instructions and registers
9233for floating-point operations. When @option{-msoft-float} is specified,
9234functions in @file{libgcc.a} will be used to perform floating-point
9235operations. When @option{-mhard-float} is specified, the compiler
9236generates IEEE floating-point instructions. This is the default.
9237
9238@item -mbackchain
9239@itemx -mno-backchain
9240@opindex mbackchain
9241@opindex mno-backchain
9242Generate (or do not generate) code which maintains an explicit
9243backchain within the stack frame that points to the caller's frame.
9244This is currently needed to allow debugging. The default is to
9245generate the backchain.
9246
9247@item -msmall-exec
9248@itemx -mno-small-exec
9249@opindex msmall-exec
9250@opindex mno-small-exec
9251Generate (or do not generate) code using the @code{bras} instruction
9252to do subroutine calls.
9253This only works reliably if the total executable size does not
9254exceed 64k. The default is to use the @code{basr} instruction instead,
9255which does not have this limitation.
9256
9257@item -m64
9258@itemx -m31
9259@opindex m64
9260@opindex m31
9261When @option{-m31} is specified, generate code compliant to the
9262Linux for S/390 ABI@. When @option{-m64} is specified, generate
9263code compliant to the Linux for zSeries ABI@. This allows GCC in
9264particular to generate 64-bit instructions. For the @samp{s390}
9265targets, the default is @option{-m31}, while the @samp{s390x}
9266targets default to @option{-m64}.
9267
9268@item -mmvcle
9269@itemx -mno-mvcle
9270@opindex mmvcle
9271@opindex mno-mvcle
9272Generate (or do not generate) code using the @code{mvcle} instruction
9273to perform block moves. When @option{-mno-mvcle} is specifed,
9274use a @code{mvc} loop instead. This is the default.
9275
9276@item -mdebug
9277@itemx -mno-debug
9278@opindex mdebug
9279@opindex mno-debug
9280Print (or do not print) additional debug information when compiling.
9281The default is to not print debug information.
9282
9283@end table
9284
0b85d816
HPN
9285@node CRIS Options
9286@subsection CRIS Options
9287@cindex CRIS Options
9288
9289These options are defined specifically for the CRIS ports.
9290
9291@table @gcctabopt
9292@item -march=@var{architecture-type}
9293@itemx -mcpu=@var{architecture-type}
9294@opindex march
9295@opindex mcpu
9296Generate code for the specified architecture. The choices for
9297@var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
9298respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
9299Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
9300@samp{v10}.
9301
9302@item -mtune=@var{architecture-type}
9303@opindex mtune
9304Tune to @var{architecture-type} everything applicable about the generated
9305code, except for the ABI and the set of available instructions. The
9306choices for @var{architecture-type} are the same as for
9307@option{-march=@var{architecture-type}}.
9308
9309@item -mmax-stack-frame=@var{n}
9310@opindex mmax-stack-frame
9311Warn when the stack frame of a function exceeds @var{n} bytes.
9312
9313@item -melinux-stacksize=@var{n}
9314@opindex melinux-stacksize
9315Only available with the @samp{cris-axis-aout} target. Arranges for
9316indications in the program to the kernel loader that the stack of the
9317program should be set to @var{n} bytes.
9318
9319@item -metrax4
9320@itemx -metrax100
9321@opindex metrax4
9322@opindex metrax100
9323The options @option{-metrax4} and @option{-metrax100} are synonyms for
9324@option{-march=v3} and @option{-march=v8} respectively.
9325
9326@item -mpdebug
9327@opindex mpdebug
9328Enable CRIS-specific verbose debug-related information in the assembly
9329code. This option also has the effect to turn off the @samp{#NO_APP}
9330formatted-code indicator to the assembler at the beginning of the
9331assembly file.
9332
9333@item -mcc-init
9334@opindex mcc-init
9335Do not use condition-code results from previous instruction; always emit
9336compare and test instructions before use of condition codes.
9337
9338@item -mno-side-effects
9339@opindex mno-side-effects
9340Do not emit instructions with side-effects in addressing modes other than
9341post-increment.
9342
9343@item -mstack-align
9344@itemx -mno-stack-align
9345@itemx -mdata-align
9346@itemx -mno-data-align
9347@itemx -mconst-align
9348@itemx -mno-const-align
9349@opindex mstack-align
9350@opindex mno-stack-align
9351@opindex mdata-align
9352@opindex mno-data-align
9353@opindex mconst-align
9354@opindex mno-const-align
9355These options (no-options) arranges (eliminate arrangements) for the
9356stack-frame, individual data and constants to be aligned for the maximum
9357single data access size for the chosen CPU model. The default is to
9358arrange for 32-bit alignment. ABI details such as structure layout are
9359not affected by these options.
9360
9361@item -m32-bit
9362@itemx -m16-bit
9363@itemx -m8-bit
9364@opindex m32-bit
9365@opindex m16-bit
9366@opindex m8-bit
9367Similar to the stack- data- and const-align options above, these options
9368arrange for stack-frame, writable data and constants to all be 32-bit,
936916-bit or 8-bit aligned. The default is 32-bit alignment.
9370
9371@item -mno-prologue-epilogue
9372@itemx -mprologue-epilogue
9373@opindex mno-prologue-epilogue
9374@opindex mprologue-epilogue
9375With @option{-mno-prologue-epilogue}, the normal function prologue and
9376epilogue that sets up the stack-frame are omitted and no return
9377instructions or return sequences are generated in the code. Use this
9378option only together with visual inspection of the compiled code: no
9379warnings or errors are generated when call-saved registers must be saved,
9380or storage for local variable needs to be allocated.
9381
9382@item -mno-gotplt
9383@itemx -mgotplt
9384@opindex mno-gotplt
9385@opindex mgotplt
9386With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
9387instruction sequences that load addresses for functions from the PLT part
9388of the GOT rather than (traditional on other architectures) calls to the
9389PLT. The default is @option{-mgotplt}.
9390
9391@item -maout
9392@opindex maout
9393Legacy no-op option only recognized with the cris-axis-aout target.
9394
9395@item -melf
9396@opindex melf
9397Legacy no-op option only recognized with the cris-axis-elf and
9398cris-axis-linux-gnu targets.
9399
9400@item -melinux
9401@opindex melinux
9402Only recognized with the cris-axis-aout target, where it selects a
9403GNU/linux-like multilib, include files and instruction set for
9404@option{-march=v8}.
9405
9406@item -mlinux
9407@opindex mlinux
9408Legacy no-op option only recognized with the cris-axis-linux-gnu target.
9409
9410@item -sim
9411@opindex sim
9412This option, recognized for the cris-axis-aout and cris-axis-elf arranges
9413to link with input-output functions from a simulator library. Code,
9414initialized data and zero-initialized data are allocated consecutively.
9415
9416@item -sim2
9417@opindex sim2
9418Like @option{-sim}, but pass linker options to locate initialized data at
94190x40000000 and zero-initialized data at 0x80000000.
9420@end table
9421
bcf684c7
HPN
9422@node MMIX Options
9423@subsection MMIX Options
9424@cindex MMIX Options
9425
9426These options are defined for the MMIX:
9427
5d22c1a5 9428@table @gcctabopt
bcf684c7
HPN
9429@item -mlibfuncs
9430@itemx -mno-libfuncs
5d22c1a5
JM
9431@opindex mlibfuncs
9432@opindex mno-libfuncs
bcf684c7
HPN
9433Specify that intrinsic library functions are being compiled, passing all
9434values in registers, no matter the size.
9435
9436@item -mepsilon
9437@itemx -mno-epsilon
5d22c1a5
JM
9438@opindex mepsilon
9439@opindex mno-epsilon
bcf684c7
HPN
9440Generate floating-point comparison instructions that compare with respect
9441to the @code{rE} epsilon register.
9442
9443@item -mabi=mmixware
9444@itemx -mabi=gnu
5d22c1a5
JM
9445@opindex mabi-mmixware
9446@opindex mabi=gnu
bcf684c7
HPN
9447Generate code that passes function parameters and return values that (in
9448the called function) are seen as registers @code{$0} and up, as opposed to
9449the GNU ABI which uses global registers @code{$231} and up.
9450
9451@item -mzero-extend
3e0f61ac 9452@itemx -mno-zero-extend
5d22c1a5
JM
9453@opindex mzero-extend
9454@opindex mno-zero-extend
bcf684c7
HPN
9455When reading data from memory in sizes shorter than 64 bits, use (do not
9456use) zero-extending load instructions by default, rather than
9457sign-extending ones.
9458
9459@item -mknuthdiv
9460@itemx -mno-knuthdiv
5d22c1a5
JM
9461@opindex mknuthdiv
9462@opindex mno-knuthdiv
bcf684c7
HPN
9463Make the result of a division yielding a remainder have the same sign as
9464the divisor. With the default, @option{-mno-knuthdiv}, the sign of the
7fba3293
HPN
9465remainder follows the sign of the dividend. Both methods are
9466arithmetically valid, the latter being almost exclusively used.
bcf684c7
HPN
9467
9468@item -mtoplevel-symbols
9469@itemx -mno-toplevel-symbols
5d22c1a5
JM
9470@opindex mtoplevel-symbols
9471@opindex mno-toplevel-symbols
7fba3293 9472Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
bcf684c7
HPN
9473code can be used with the @code{PREFIX} assembly directive.
9474
9475@item -melf
5d22c1a5 9476@opindex melf
7fba3293 9477Generate an executable in the ELF format, rather than the default
bcf684c7 9478@samp{mmo} format used by the @command{mmix} simulator.
3e0f61ac
HPN
9479
9480@item -mbranch-predict
9481@itemx -mno-branch-predict
5d22c1a5
JM
9482@opindex mbranch-predict
9483@opindex mno-branch-predict
3e0f61ac
HPN
9484Use (do not use) the probable-branch instructions, when static branch
9485prediction indicates a probable branch.
9486
9487@item -mreg-stack-fill-bug-workaround
9488@itemx -mno-reg-stack-fill-bug-workaround
5d22c1a5
JM
9489@opindex mreg-stack-fill-bug-workaround
9490@opindex mno-reg-stack-fill-bug-workaround
3e0f61ac
HPN
9491Work around (do not work around) an inconsistency in the circular
9492register stack mechanism in the @command{mmix} simulator, which
9493causes entries in the register stack to not be flushed to memory if
9494the instruction causing the fill-up is @code{PUSHJ} or @code{PUSHGO}.
bcf684c7
HPN
9495@end table
9496
9f85bca7
JM
9497@node PDP-11 Options
9498@subsection PDP-11 Options
9499@cindex PDP-11 Options
9500
9501These options are defined for the PDP-11:
9502
9503@table @gcctabopt
9504@item -mfpu
9505@opindex mfpu
9506Use hardware FPP floating point. This is the default. (FIS floating
9507point on the PDP-11/40 is not supported.)
9508
9509@item -msoft-float
9510@opindex msoft-float
9511Do not use hardware floating point.
9512
9513@item -mac0
9514@opindex mac0
9515Return floating-point results in ac0 (fr0 in Unix assembler syntax).
9516
9517@item -mno-ac0
9518@opindex mno-ac0
9519Return floating-point results in memory. This is the default.
9520
9521@item -m40
9522@opindex m40
9523Generate code for a PDP-11/40.
9524
9525@item -m45
9526@opindex m45
9527Generate code for a PDP-11/45. This is the default.
9528
9529@item -m10
9530@opindex m10
9531Generate code for a PDP-11/10.
9532
9533@item -mbcopy-builtin
9534@opindex bcopy-builtin
9535Use inline @code{movstrhi} patterns for copying memory. This is the
9536default.
9537
9538@item -mbcopy
9539@opindex mbcopy
9540Do not use inline @code{movstrhi} patterns for copying memory.
9541
9542@item -mint16
9543@itemx -mno-int32
9544@opindex mint16
9545@opindex mno-int32
9546Use 16-bit @code{int}. This is the default.
9547
9548@item -mint32
9549@itemx -mno-int16
9550@opindex mint32
9551@opindex mno-int16
9552Use 32-bit @code{int}.
9553
9554@item -mfloat64
9555@itemx -mno-float32
9556@opindex mfloat64
9557@opindex mno-float32
9558Use 64-bit @code{float}. This is the default.
9559
9560@item -mfloat32
9561@item -mno-float64
9562@opindex mfloat32
9563@opindex mno-float64
9564Use 32-bit @code{float}.
9565
9566@item -mabshi
9567@opindex mabshi
9568Use @code{abshi2} pattern. This is the default.
9569
9570@item -mno-abshi
9571@opindex mno-abshi
9572Do not use @code{abshi2} pattern.
9573
9574@item -mbranch-expensive
9575@opindex mbranch-expensive
9576Pretend that branches are expensive. This is for experimenting with
9577code generation only.
9578
9579@item -mbranch-cheap
9580@opindex mbranch-cheap
9581Do not pretend that branches are expensive. This is the default.
9582
9583@item -msplit
9584@opindex msplit
9585Generate code for a system with split I&D.
9586
9587@item -mno-split
9588@opindex mno-split
9589Generate code for a system without split I&D. This is the default.
9590
9591@item -munix-asm
9592@opindex munix-asm
9593Use Unix assembler syntax. This is the default when configured for
9594@samp{pdp11-*-bsd}.
9595
9596@item -mdec-asm
9597@opindex mdec-asm
9598Use DEC assembler syntax. This is the default when configured for any
9599PDP-11 target other than @samp{pdp11-*-bsd}.
9600@end table
9601
69a0611f
GK
9602@node Xstormy16 Options
9603@subsection Xstormy16 Options
9604@cindex Xstormy16 Options
9605
9606These options are defined for Xstormy16:
9607
9608@table @gcctabopt
9609@item -msim
9610@opindex msim
9611Choose startup files and linker script suitable for the simulator.
9612@end table
9613
74291a4b
MM
9614@node Code Gen Options
9615@section Options for Code Generation Conventions
9616@cindex code generation conventions
9617@cindex options, code generation
9618@cindex run-time options
9619
9620These machine-independent options control the interface conventions
9621used in code generation.
9622
9623Most of them have both positive and negative forms; the negative form
630d3d5a 9624of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
74291a4b
MM
9625one of the forms is listed---the one which is not the default. You
9626can figure out the other form by either removing @samp{no-} or adding
9627it.
9628
2642624b 9629@table @gcctabopt
956d6950 9630@item -fexceptions
cd3bb277 9631@opindex fexceptions
767094dd 9632Enable exception handling. Generates extra code needed to propagate
f0523f02 9633exceptions. For some targets, this implies GCC will generate frame
c5c76735
JL
9634unwind information for all functions, which can produce significant data
9635size overhead, although it does not affect execution. If you do not
f0523f02 9636specify this option, GCC will enable it by default for languages like
90ecce3e 9637C++ which normally require exception handling, and disable it for
c5c76735
JL
9638languages like C that do not normally require it. However, you may need
9639to enable this option when compiling C code that needs to interoperate
9640properly with exception handlers written in C++. You may also wish to
9641disable this option if you are compiling older C++ programs that don't
9642use exception handling.
956d6950 9643
6cfc0341
RH
9644@item -fnon-call-exceptions
9645@opindex fnon-call-exceptions
9646Generate code that allows trapping instructions to throw exceptions.
9647Note that this requires platform-specific runtime support that does
9648not exist everywhere. Moreover, it only allows @emph{trapping}
e979f9e8 9649instructions to throw exceptions, i.e.@: memory references or floating
6cfc0341
RH
9650point instructions. It does not allow exceptions to be thrown from
9651arbitrary signal handlers such as @code{SIGALRM}.
9652
14a774a9 9653@item -funwind-tables
cd3bb277 9654@opindex funwind-tables
bedc7537 9655Similar to @option{-fexceptions}, except that it will just generate any needed
14a774a9
RK
9656static data, but will not affect the generated code in any other way.
9657You will normally not enable this option; instead, a language processor
9658that needs this handling would enable it on your behalf.
9659
b932f770
JH
9660@item -fasynchronous-unwind-tables
9661@opindex funwind-tables
9662Generate unwind table in dwarf2 format, if supported by target machine. The
9663table is exact at each instruction boundary, so it can be used for stack
9664unwinding from asynchronous events (such as debugger or garbage collector).
9665
74291a4b 9666@item -fpcc-struct-return
cd3bb277 9667@opindex fpcc-struct-return
74291a4b
MM
9668Return ``short'' @code{struct} and @code{union} values in memory like
9669longer ones, rather than in registers. This convention is less
9670efficient, but it has the advantage of allowing intercallability between
0c2d1a2a 9671GCC-compiled files and files compiled with other compilers.
74291a4b
MM
9672
9673The precise convention for returning structures in memory depends
9674on the target configuration macros.
9675
9676Short structures and unions are those whose size and alignment match
9677that of some integer type.
9678
9679@item -freg-struct-return
cd3bb277 9680@opindex freg-struct-return
9c34dbbf
ZW
9681Return @code{struct} and @code{union} values in registers when possible.
9682This is more efficient for small structures than
9683@option{-fpcc-struct-return}.
74291a4b 9684
9c34dbbf 9685If you specify neither @option{-fpcc-struct-return} nor
630d3d5a 9686@option{-freg-struct-return}, GCC defaults to whichever convention is
0c2d1a2a 9687standard for the target. If there is no standard convention, GCC
9c34dbbf
ZW
9688defaults to @option{-fpcc-struct-return}, except on targets where GCC is
9689the principal compiler. In those cases, we can choose the standard, and
9690we chose the more efficient register return alternative.
74291a4b
MM
9691
9692@item -fshort-enums
cd3bb277 9693@opindex fshort-enums
74291a4b
MM
9694Allocate to an @code{enum} type only as many bytes as it needs for the
9695declared range of possible values. Specifically, the @code{enum} type
9696will be equivalent to the smallest integer type which has enough room.
9697
9698@item -fshort-double
cd3bb277 9699@opindex fshort-double
74291a4b
MM
9700Use the same size for @code{double} as for @code{float}.
9701
9702@item -fshared-data
cd3bb277 9703@opindex fshared-data
74291a4b
MM
9704Requests that the data and non-@code{const} variables of this
9705compilation be shared data rather than private data. The distinction
9706makes sense only on certain operating systems, where shared data is
9707shared between processes running the same program, while private data
9708exists in one copy per process.
9709
9710@item -fno-common
cd3bb277 9711@opindex fno-common
90ecce3e 9712In C, allocate even uninitialized global variables in the data section of the
74291a4b
MM
9713object file, rather than generating them as common blocks. This has the
9714effect that if the same variable is declared (without @code{extern}) in
9715two different compilations, you will get an error when you link them.
9716The only reason this might be useful is if you wish to verify that the
9717program will work on other systems which always work this way.
9718
9719@item -fno-ident
cd3bb277 9720@opindex fno-ident
74291a4b
MM
9721Ignore the @samp{#ident} directive.
9722
9723@item -fno-gnu-linker
cd3bb277 9724@opindex fno-gnu-linker
74291a4b
MM
9725Do not output global initializations (such as C++ constructors and
9726destructors) in the form used by the GNU linker (on systems where the GNU
9727linker is the standard method of handling them). Use this option when
9728you want to use a non-GNU linker, which also requires using the
bedc7537
NC
9729@command{collect2} program to make sure the system linker includes
9730constructors and destructors. (@command{collect2} is included in the GCC
9731distribution.) For systems which @emph{must} use @command{collect2}, the
9732compiler driver @command{gcc} is configured to do this automatically.
74291a4b
MM
9733
9734@item -finhibit-size-directive
cd3bb277 9735@opindex finhibit-size-directive
74291a4b
MM
9736Don't output a @code{.size} assembler directive, or anything else that
9737would cause trouble if the function is split in the middle, and the
9738two halves are placed at locations far apart in memory. This option is
9739used when compiling @file{crtstuff.c}; you should not need to use it
9740for anything else.
9741
9742@item -fverbose-asm
cd3bb277 9743@opindex fverbose-asm
74291a4b
MM
9744Put extra commentary information in the generated assembly code to
9745make it more readable. This option is generally only of use to those
9746who actually need to read the generated assembly code (perhaps while
9747debugging the compiler itself).
9748
630d3d5a 9749@option{-fno-verbose-asm}, the default, causes the
74291a4b
MM
9750extra information to be omitted and is useful when comparing two assembler
9751files.
9752
9753@item -fvolatile
cd3bb277 9754@opindex fvolatile
74291a4b
MM
9755Consider all memory references through pointers to be volatile.
9756
9757@item -fvolatile-global
cd3bb277 9758@opindex fvolatile-global
74291a4b 9759Consider all memory references to extern and global data items to
0c2d1a2a 9760be volatile. GCC does not consider static data items to be volatile
ab87f8c8
JL
9761because of this switch.
9762
9763@item -fvolatile-static
cd3bb277 9764@opindex fvolatile-static
ab87f8c8 9765Consider all memory references to static data to be volatile.
74291a4b
MM
9766
9767@item -fpic
cd3bb277 9768@opindex fpic
74291a4b
MM
9769@cindex global offset table
9770@cindex PIC
9771Generate position-independent code (PIC) suitable for use in a shared
9772library, if supported for the target machine. Such code accesses all
161d7b59 9773constant addresses through a global offset table (GOT)@. The dynamic
861bb6c1 9774loader resolves the GOT entries when the program starts (the dynamic
0c2d1a2a 9775loader is not part of GCC; it is part of the operating system). If
861bb6c1
JL
9776the GOT size for the linked executable exceeds a machine-specific
9777maximum size, you get an error message from the linker indicating that
630d3d5a 9778@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
861bb6c1
JL
9779instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
9780on the m68k and RS/6000. The 386 has no such limit.)
74291a4b
MM
9781
9782Position-independent code requires special support, and therefore works
0c2d1a2a 9783only on certain machines. For the 386, GCC supports PIC for System V
74291a4b
MM
9784but not for the Sun 386i. Code generated for the IBM RS/6000 is always
9785position-independent.
9786
74291a4b 9787@item -fPIC
cd3bb277 9788@opindex fPIC
74291a4b
MM
9789If supported for the target machine, emit position-independent code,
9790suitable for dynamic linking and avoiding any limit on the size of the
9791global offset table. This option makes a difference on the m68k, m88k,
9792and the Sparc.
9793
9794Position-independent code requires special support, and therefore works
9795only on certain machines.
9796
9797@item -ffixed-@var{reg}
cd3bb277 9798@opindex ffixed
74291a4b
MM
9799Treat the register named @var{reg} as a fixed register; generated code
9800should never refer to it (except perhaps as a stack pointer, frame
9801pointer or in some other fixed role).
9802
9803@var{reg} must be the name of a register. The register names accepted
9804are machine-specific and are defined in the @code{REGISTER_NAMES}
9805macro in the machine description macro file.
9806
9807This flag does not have a negative form, because it specifies a
9808three-way choice.
9809
9810@item -fcall-used-@var{reg}
cd3bb277 9811@opindex fcall-used
956d6950 9812Treat the register named @var{reg} as an allocable register that is
74291a4b
MM
9813clobbered by function calls. It may be allocated for temporaries or
9814variables that do not live across a call. Functions compiled this way
9815will not save and restore the register @var{reg}.
9816
cb2fdc84
GRK
9817It is an error to used this flag with the frame pointer or stack pointer.
9818Use of this flag for other registers that have fixed pervasive roles in
9819the machine's execution model will produce disastrous results.
74291a4b
MM
9820
9821This flag does not have a negative form, because it specifies a
9822three-way choice.
9823
9824@item -fcall-saved-@var{reg}
cd3bb277 9825@opindex fcall-saved
956d6950 9826Treat the register named @var{reg} as an allocable register saved by
74291a4b
MM
9827functions. It may be allocated even for temporaries or variables that
9828live across a call. Functions compiled this way will save and restore
9829the register @var{reg} if they use it.
9830
cb2fdc84
GRK
9831It is an error to used this flag with the frame pointer or stack pointer.
9832Use of this flag for other registers that have fixed pervasive roles in
9833the machine's execution model will produce disastrous results.
74291a4b
MM
9834
9835A different sort of disaster will result from the use of this flag for
9836a register in which function values may be returned.
9837
9838This flag does not have a negative form, because it specifies a
9839three-way choice.
9840
9841@item -fpack-struct
cd3bb277 9842@opindex fpack-struct
74291a4b
MM
9843Pack all structure members together without holes. Usually you would
9844not want to use this option, since it makes the code suboptimal, and
9845the offsets of structure members won't agree with system libraries.
9846
07417085 9847@item -finstrument-functions
cd3bb277 9848@opindex finstrument-functions
07417085
KR
9849Generate instrumentation calls for entry and exit to functions. Just
9850after function entry and just before function exit, the following
9851profiling functions will be called with the address of the current
9852function and its call site. (On some platforms,
9853@code{__builtin_return_address} does not work beyond the current
9854function, so the call site information may not be available to the
9855profiling functions otherwise.)
9856
9857@example
310668e8
JM
9858void __cyg_profile_func_enter (void *this_fn,
9859 void *call_site);
9860void __cyg_profile_func_exit (void *this_fn,
9861 void *call_site);
07417085
KR
9862@end example
9863
9864The first argument is the address of the start of the current function,
9865which may be looked up exactly in the symbol table.
9866
9867This instrumentation is also done for functions expanded inline in other
9868functions. The profiling calls will indicate where, conceptually, the
9869inline function is entered and exited. This means that addressable
9870versions of such functions must be available. If all your uses of a
9871function are expanded inline, this may mean an additional expansion of
9872code size. If you use @samp{extern inline} in your C code, an
9873addressable version of such functions must be provided. (This is
9874normally the case anyways, but if you get lucky and the optimizer always
9875expands the functions inline, you might have gotten away without
9876providing static copies.)
9877
9878A function may be given the attribute @code{no_instrument_function}, in
9879which case this instrumentation will not be done. This can be used, for
9880example, for the profiling functions listed above, high-priority
9881interrupt routines, and any functions from which the profiling functions
9882cannot safely be called (perhaps signal handlers, if the profiling
9883routines generate output or allocate memory).
9884
861bb6c1 9885@item -fstack-check
cd3bb277 9886@opindex fstack-check
861bb6c1
JL
9887Generate code to verify that you do not go beyond the boundary of the
9888stack. You should specify this flag if you are running in an
9889environment with multiple threads, but only rarely need to specify it in
9890a single-threaded environment since stack overflow is automatically
9891detected on nearly all systems if there is only one stack.
9892
a157febd
GK
9893Note that this switch does not actually cause checking to be done; the
9894operating system must do that. The switch causes generation of code
9895to ensure that the operating system sees the stack being extended.
9896
9897@item -fstack-limit-register=@var{reg}
9898@itemx -fstack-limit-symbol=@var{sym}
9899@itemx -fno-stack-limit
cd3bb277
JM
9900@opindex fstack-limit-register
9901@opindex fstack-limit-symbol
9902@opindex fno-stack-limit
a157febd
GK
9903Generate code to ensure that the stack does not grow beyond a certain value,
9904either the value of a register or the address of a symbol. If the stack
9905would grow beyond the value, a signal is raised. For most targets,
9906the signal is raised before the stack overruns the boundary, so
9907it is possible to catch the signal without taking special precautions.
9908
9c34dbbf
ZW
9909For instance, if the stack starts at absolute address @samp{0x80000000}
9910and grows downwards, you can use the flags
9911@option{-fstack-limit-symbol=__stack_limit} and
9912@option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
9913of 128KB@. Note that this may only work with the GNU linker.
a157febd 9914
e5eb27e5
JL
9915@cindex aliasing of parameters
9916@cindex parameters, aliased
9917@item -fargument-alias
04afd9d6
JL
9918@itemx -fargument-noalias
9919@itemx -fargument-noalias-global
cd3bb277
JM
9920@opindex fargument-alias
9921@opindex fargument-noalias
9922@opindex fargument-noalias-global
e5eb27e5
JL
9923Specify the possible relationships among parameters and between
9924parameters and global data.
9925
630d3d5a 9926@option{-fargument-alias} specifies that arguments (parameters) may
9c34dbbf 9927alias each other and may alias global storage.@*
630d3d5a 9928@option{-fargument-noalias} specifies that arguments do not alias
9c34dbbf 9929each other, but may alias global storage.@*
630d3d5a 9930@option{-fargument-noalias-global} specifies that arguments do not
e5eb27e5
JL
9931alias each other and do not alias global storage.
9932
9933Each language will automatically use whatever option is required by
9934the language standard. You should not need to use these options yourself.
19283265
RH
9935
9936@item -fleading-underscore
cd3bb277 9937@opindex fleading-underscore
695ac33f 9938This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19283265
RH
9939change the way C symbols are represented in the object file. One use
9940is to help link with legacy assembly code.
9941
9942Be warned that you should know what you are doing when invoking this
9943option, and that not all targets provide complete support for it.
74291a4b
MM
9944@end table
9945
ee457005
JM
9946@c man end
9947
74291a4b 9948@node Environment Variables
0c2d1a2a 9949@section Environment Variables Affecting GCC
74291a4b
MM
9950@cindex environment variables
9951
ee457005
JM
9952@c man begin ENVIRONMENT
9953
0c2d1a2a
JB
9954This section describes several environment variables that affect how GCC
9955operates. Some of them work by specifying directories or prefixes to use
767094dd 9956when searching for various kinds of files. Some are used to specify other
46103ab4 9957aspects of the compilation environment.
74291a4b 9958
74291a4b 9959Note that you can also specify places to search using options such as
630d3d5a 9960@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
74291a4b 9961take precedence over places specified using environment variables, which
161d7b59 9962in turn take precedence over those specified by the configuration of GCC@.
b11cc610
JM
9963@xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
9964GNU Compiler Collection (GCC) Internals}.
74291a4b 9965
bedc7537 9966@table @env
ab87f8c8
JL
9967@item LANG
9968@itemx LC_CTYPE
9969@c @itemx LC_COLLATE
9970@itemx LC_MESSAGES
9971@c @itemx LC_MONETARY
9972@c @itemx LC_NUMERIC
9973@c @itemx LC_TIME
9974@itemx LC_ALL
9975@findex LANG
9976@findex LC_CTYPE
9977@c @findex LC_COLLATE
9978@findex LC_MESSAGES
9979@c @findex LC_MONETARY
9980@c @findex LC_NUMERIC
9981@c @findex LC_TIME
9982@findex LC_ALL
9983@cindex locale
0c2d1a2a
JB
9984These environment variables control the way that GCC uses
9985localization information that allow GCC to work with different
9986national conventions. GCC inspects the locale categories
bedc7537 9987@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
ab87f8c8
JL
9988so. These locale categories can be set to any value supported by your
9989installation. A typical value is @samp{en_UK} for English in the United
9990Kingdom.
9991
bedc7537 9992The @env{LC_CTYPE} environment variable specifies character
0c2d1a2a 9993classification. GCC uses it to determine the character boundaries in
ab87f8c8
JL
9994a string; this is needed for some multibyte encodings that contain quote
9995and escape characters that would otherwise be interpreted as a string
9996end or escape.
9997
bedc7537 9998The @env{LC_MESSAGES} environment variable specifies the language to
ab87f8c8
JL
9999use in diagnostic messages.
10000
bedc7537
NC
10001If the @env{LC_ALL} environment variable is set, it overrides the value
10002of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
10003and @env{LC_MESSAGES} default to the value of the @env{LANG}
0c2d1a2a 10004environment variable. If none of these variables are set, GCC
ab87f8c8
JL
10005defaults to traditional C English behavior.
10006
74291a4b
MM
10007@item TMPDIR
10008@findex TMPDIR
bedc7537 10009If @env{TMPDIR} is set, it specifies the directory to use for temporary
0c2d1a2a 10010files. GCC uses temporary files to hold the output of one stage of
74291a4b
MM
10011compilation which is to be used as input to the next stage: for example,
10012the output of the preprocessor, which is the input to the compiler
10013proper.
10014
10015@item GCC_EXEC_PREFIX
10016@findex GCC_EXEC_PREFIX
bedc7537 10017If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
74291a4b
MM
10018names of the subprograms executed by the compiler. No slash is added
10019when this prefix is combined with the name of a subprogram, but you can
10020specify a prefix that ends with a slash if you wish.
10021
f0523f02 10022If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
0deb20df
TT
10023an appropriate prefix to use based on the pathname it was invoked with.
10024
0c2d1a2a 10025If GCC cannot find the subprogram using the specified prefix, it
74291a4b
MM
10026tries looking in the usual places for the subprogram.
10027
bedc7537 10028The default value of @env{GCC_EXEC_PREFIX} is
74291a4b
MM
10029@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
10030of @code{prefix} when you ran the @file{configure} script.
10031
630d3d5a 10032Other prefixes specified with @option{-B} take precedence over this prefix.
74291a4b
MM
10033
10034This prefix is also used for finding files such as @file{crt0.o} that are
10035used for linking.
10036
10037In addition, the prefix is used in an unusual way in finding the
10038directories to search for header files. For each of the standard
10039directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
bedc7537 10040(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
74291a4b 10041replacing that beginning with the specified prefix to produce an
630d3d5a 10042alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
74291a4b
MM
10043@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
10044These alternate directories are searched first; the standard directories
10045come next.
10046
10047@item COMPILER_PATH
10048@findex COMPILER_PATH
bedc7537
NC
10049The value of @env{COMPILER_PATH} is a colon-separated list of
10050directories, much like @env{PATH}. GCC tries the directories thus
74291a4b 10051specified when searching for subprograms, if it can't find the
bedc7537 10052subprograms using @env{GCC_EXEC_PREFIX}.
74291a4b
MM
10053
10054@item LIBRARY_PATH
10055@findex LIBRARY_PATH
bedc7537
NC
10056The value of @env{LIBRARY_PATH} is a colon-separated list of
10057directories, much like @env{PATH}. When configured as a native compiler,
0c2d1a2a 10058GCC tries the directories thus specified when searching for special
bedc7537 10059linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
0c2d1a2a 10060using GCC also uses these directories when searching for ordinary
630d3d5a
JM
10061libraries for the @option{-l} option (but directories specified with
10062@option{-L} come first).
74291a4b
MM
10063
10064@item C_INCLUDE_PATH
10065@itemx CPLUS_INCLUDE_PATH
10066@itemx OBJC_INCLUDE_PATH
10067@findex C_INCLUDE_PATH
10068@findex CPLUS_INCLUDE_PATH
10069@findex OBJC_INCLUDE_PATH
10070@c @itemx OBJCPLUS_INCLUDE_PATH
10071These environment variables pertain to particular languages. Each
10072variable's value is a colon-separated list of directories, much like
bedc7537 10073@env{PATH}. When GCC searches for header files, it tries the
74291a4b 10074directories listed in the variable for the language you are using, after
630d3d5a 10075the directories specified with @option{-I} but before the standard header
74291a4b
MM
10076file directories.
10077
10078@item DEPENDENCIES_OUTPUT
10079@findex DEPENDENCIES_OUTPUT
10080@cindex dependencies for make as output
10081If this variable is set, its value specifies how to output dependencies
10082for Make based on the header files processed by the compiler. This
630d3d5a 10083output looks much like the output from the @option{-M} option
74291a4b
MM
10084(@pxref{Preprocessor Options}), but it goes to a separate file, and is
10085in addition to the usual results of compilation.
10086
bedc7537 10087The value of @env{DEPENDENCIES_OUTPUT} can be just a file name, in
74291a4b
MM
10088which case the Make rules are written to that file, guessing the target
10089name from the source file name. Or the value can have the form
10090@samp{@var{file} @var{target}}, in which case the rules are written to
10091file @var{file} using @var{target} as the target name.
56f48ce9
DB
10092
10093@item LANG
10094@findex LANG
10095@cindex locale definition
767094dd 10096This variable is used to pass locale information to the compiler. One way in
56f48ce9
DB
10097which this information is used is to determine the character set to be used
10098when character literals, string literals and comments are parsed in C and C++.
10099When the compiler is configured to allow multibyte characters,
bedc7537 10100the following values for @env{LANG} are recognized:
56f48ce9 10101
2642624b 10102@table @samp
56f48ce9
DB
10103@item C-JIS
10104Recognize JIS characters.
10105@item C-SJIS
10106Recognize SJIS characters.
10107@item C-EUCJP
10108Recognize EUCJP characters.
10109@end table
10110
bedc7537 10111If @env{LANG} is not defined, or if it has some other value, then the
56f48ce9
DB
10112compiler will use mblen and mbtowc as defined by the default locale to
10113recognize and translate multibyte characters.
74291a4b
MM
10114@end table
10115
9d86bffc
JM
10116@c man end
10117
74291a4b
MM
10118@node Running Protoize
10119@section Running Protoize
10120
161d7b59 10121The program @code{protoize} is an optional part of GCC@. You can use
c1030c7c 10122it to add prototypes to a program, thus converting the program to ISO
74291a4b
MM
10123C in one respect. The companion program @code{unprotoize} does the
10124reverse: it removes argument types from any prototypes that are found.
10125
10126When you run these programs, you must specify a set of source files as
10127command line arguments. The conversion programs start out by compiling
10128these files to see what functions they define. The information gathered
10129about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
10130
10131After scanning comes actual conversion. The specified files are all
10132eligible to be converted; any files they include (whether sources or
10133just headers) are eligible as well.
10134
10135But not all the eligible files are converted. By default,
10136@code{protoize} and @code{unprotoize} convert only source and header
10137files in the current directory. You can specify additional directories
630d3d5a 10138whose files should be converted with the @option{-d @var{directory}}
74291a4b 10139option. You can also specify particular files to exclude with the
630d3d5a 10140@option{-x @var{file}} option. A file is converted if it is eligible, its
74291a4b
MM
10141directory name matches one of the specified directory names, and its
10142name within the directory has not been excluded.
10143
10144Basic conversion with @code{protoize} consists of rewriting most
10145function definitions and function declarations to specify the types of
10146the arguments. The only ones not rewritten are those for varargs
10147functions.
10148
10149@code{protoize} optionally inserts prototype declarations at the
10150beginning of the source file, to make them available for any calls that
10151precede the function's definition. Or it can insert prototype
10152declarations with block scope in the blocks where undeclared functions
10153are called.
10154
10155Basic conversion with @code{unprotoize} consists of rewriting most
10156function declarations to remove any argument types, and rewriting
c1030c7c 10157function definitions to the old-style pre-ISO form.
74291a4b
MM
10158
10159Both conversion programs print a warning for any function declaration or
10160definition that they can't convert. You can suppress these warnings
630d3d5a 10161with @option{-q}.
74291a4b
MM
10162
10163The output from @code{protoize} or @code{unprotoize} replaces the
10164original source file. The original file is renamed to a name ending
02f52e19 10165with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
a7db8bbb
MK
10166without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav}
10167for DOS) file already exists, then the source file is simply discarded.
74291a4b 10168
0c2d1a2a 10169@code{protoize} and @code{unprotoize} both depend on GCC itself to
74291a4b 10170scan the program and collect information about the functions it uses.
0c2d1a2a 10171So neither of these programs will work until GCC is installed.
74291a4b
MM
10172
10173Here is a table of the options you can use with @code{protoize} and
10174@code{unprotoize}. Each option works with both programs unless
10175otherwise stated.
10176
10177@table @code
10178@item -B @var{directory}
10179Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
10180usual directory (normally @file{/usr/local/lib}). This file contains
10181prototype information about standard system functions. This option
10182applies only to @code{protoize}.
10183
10184@item -c @var{compilation-options}
10185Use @var{compilation-options} as the options when running @code{gcc} to
630d3d5a 10186produce the @samp{.X} files. The special option @option{-aux-info} is
74291a4b
MM
10187always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
10188
10189Note that the compilation options must be given as a single argument to
10190@code{protoize} or @code{unprotoize}. If you want to specify several
10191@code{gcc} options, you must quote the entire set of compilation options
10192to make them a single word in the shell.
10193
10194There are certain @code{gcc} arguments that you cannot use, because they
630d3d5a
JM
10195would produce the wrong kind of output. These include @option{-g},
10196@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
74291a4b
MM
10197the @var{compilation-options}, they are ignored.
10198
10199@item -C
a7db8bbb 10200Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
02f52e19 10201systems) instead of @samp{.c}. This is convenient if you are converting
ee77eda5 10202a C program to C++. This option applies only to @code{protoize}.
74291a4b
MM
10203
10204@item -g
10205Add explicit global declarations. This means inserting explicit
10206declarations at the beginning of each source file for each function
10207that is called in the file and was not declared. These declarations
10208precede the first function definition that contains a call to an
10209undeclared function. This option applies only to @code{protoize}.
10210
10211@item -i @var{string}
10212Indent old-style parameter declarations with the string @var{string}.
10213This option applies only to @code{protoize}.
10214
10215@code{unprotoize} converts prototyped function definitions to old-style
10216function definitions, where the arguments are declared between the
10217argument list and the initial @samp{@{}. By default, @code{unprotoize}
10218uses five spaces as the indentation. If you want to indent with just
630d3d5a 10219one space instead, use @option{-i " "}.
74291a4b
MM
10220
10221@item -k
10222Keep the @samp{.X} files. Normally, they are deleted after conversion
10223is finished.
10224
10225@item -l
630d3d5a 10226Add explicit local declarations. @code{protoize} with @option{-l} inserts
74291a4b
MM
10227a prototype declaration for each function in each block which calls the
10228function without any declaration. This option applies only to
10229@code{protoize}.
10230
10231@item -n
10232Make no real changes. This mode just prints information about the conversions
630d3d5a 10233that would have been done without @option{-n}.
74291a4b
MM
10234
10235@item -N
10236Make no @samp{.save} files. The original files are simply deleted.
10237Use this option with caution.
10238
10239@item -p @var{program}
10240Use the program @var{program} as the compiler. Normally, the name
10241@file{gcc} is used.
10242
10243@item -q
10244Work quietly. Most warnings are suppressed.
10245
10246@item -v
630d3d5a 10247Print the version number, just like @option{-v} for @code{gcc}.
74291a4b
MM
10248@end table
10249
10250If you need special compiler options to compile one of your program's
10251source files, then you should generate that file's @samp{.X} file
10252specially, by running @code{gcc} on that source file with the
630d3d5a 10253appropriate options and the option @option{-aux-info}. Then run
74291a4b
MM
10254@code{protoize} on the entire set of files. @code{protoize} will use
10255the existing @samp{.X} file because it is newer than the source file.
10256For example:
10257
10258@example
b1018de6 10259gcc -Dfoo=bar file1.c -aux-info file1.X
74291a4b
MM
10260protoize *.c
10261@end example
10262
10263@noindent
10264You need to include the special files along with the rest in the
10265@code{protoize} command, even though their @samp{.X} files already
10266exist, because otherwise they won't get converted.
10267
10268@xref{Protoize Caveats}, for more information on how to use
10269@code{protoize} successfully.
This page took 2.733554 seconds and 5 git commands to generate.