]> gcc.gnu.org Git - gcc.git/blame - gcc/doc/invoke.texi
m68k.md: Replace all general_operand with nonimmediate_operand for all destinations.
[gcc.git] / gcc / doc / invoke.texi
CommitLineData
d0a5eb32
RK
1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2@c 2000, 2001 Free Software Foundation, Inc.
74291a4b
MM
3@c This is part of the GCC manual.
4@c For copying conditions, see the file gcc.texi.
5
9d86bffc
JM
6@ignore
7@c man begin COPYRIGHT
8Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
21c7361e 91998, 1999, 2000, 2001 Free Software Foundation, Inc.
9d86bffc
JM
10
11Permission is granted to make and distribute verbatim copies of this
12manual provided the copyright notice and this permission notice are
13preserved on all copies.
14
15Permission is granted to copy and distribute modified versions of this
16manual under the conditions for verbatim copying, provided also that the
17entire resulting derived work is distributed under the terms of a
18permission notice identical to this one.
19
20Permission is granted to copy and distribute translations of this manual
21into another language, under the above conditions for modified versions,
22except that this permission notice may be included in translations
23approved by the Free Software Foundation instead of in the original
24English.
25@c man end
26@c Set file name and title for the man page.
27@setfilename gcc
28@settitle GNU project C and C++ compiler
29@c man begin SYNOPSIS
630d3d5a
JM
30gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
31 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
32 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
33 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
34 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
35 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
36 [@option{-o} @var{outfile}] @var{infile}@dots{}
9d86bffc
JM
37
38Only the most useful options are listed here; see below for the
39remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
40@c man end
41@c man begin SEEALSO
42cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
43and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
44@file{ld}, @file{binutils} and @file{gdb}.
45@c man end
2642624b
JM
46@c man begin BUGS
47For instructions on reporting bugs, see
bedc7537 48@w{@uref{http://gcc.gnu.org/bugs.html}}. Use of the @command{gccbug}
2642624b
JM
49script to report bugs is recommended.
50@c man end
51@c man begin AUTHOR
52See the Info entry for @file{gcc}, or
161d7b59 53@w{@uref{http://gcc.gnu.org/thanks.html}}, for contributors to GCC@.
2642624b 54@c man end
9d86bffc
JM
55@end ignore
56
74291a4b 57@node Invoking GCC
0c2d1a2a
JB
58@chapter GCC Command Options
59@cindex GCC command options
74291a4b 60@cindex command options
0c2d1a2a 61@cindex options, GCC command
74291a4b 62
9d86bffc
JM
63@c man begin DESCRIPTION
64
0c2d1a2a 65When you invoke GCC, it normally does preprocessing, compilation,
74291a4b 66assembly and linking. The ``overall options'' allow you to stop this
630d3d5a 67process at an intermediate stage. For example, the @option{-c} option
74291a4b
MM
68says not to run the linker. Then the output consists of object files
69output by the assembler.
70
71Other options are passed on to one stage of processing. Some options
72control the preprocessor and others the compiler itself. Yet other
73options control the assembler and linker; most of these are not
74documented here, since you rarely need to use any of them.
75
76@cindex C compilation options
0c2d1a2a 77Most of the command line options that you can use with GCC are useful
74291a4b
MM
78for C programs; when an option is only useful with another language
79(usually C++), the explanation says so explicitly. If the description
80for a particular option does not mention a source language, you can use
81that option with all supported languages.
82
83@cindex C++ compilation options
84@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
85options for compiling C++ programs.
86
87@cindex grouping options
88@cindex options, grouping
bedc7537 89The @command{gcc} program accepts options and file names as operands. Many
b192711e 90options have multi-letter names; therefore multiple single-letter options
630d3d5a 91may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
74291a4b
MM
92-r}}.
93
94@cindex order of options
95@cindex options, order
96You can mix options and other arguments. For the most part, the order
97you use doesn't matter. Order does matter when you use several options
630d3d5a 98of the same kind; for example, if you specify @option{-L} more than once,
74291a4b
MM
99the directories are searched in the order specified.
100
101Many options have long names starting with @samp{-f} or with
630d3d5a
JM
102@samp{-W}---for example, @option{-fforce-mem},
103@option{-fstrength-reduce}, @option{-Wformat} and so on. Most of
74291a4b 104these have both positive and negative forms; the negative form of
630d3d5a 105@option{-ffoo} would be @option{-fno-foo}. This manual documents
74291a4b
MM
106only one of these two forms, whichever one is not the default.
107
9d86bffc
JM
108@c man end
109
cd3bb277
JM
110@xref{Option Index}, for an index to GCC's options.
111
74291a4b
MM
112@menu
113* Option Summary:: Brief list of all options, without explanations.
114* Overall Options:: Controlling the kind of output:
115 an executable, object files, assembler files,
116 or preprocessed source.
117* Invoking G++:: Compiling C++ programs.
118* C Dialect Options:: Controlling the variant of C language compiled.
119* C++ Dialect Options:: Variations on C++.
60de6385 120* Objective-C Dialect Options:: Variations on Objective-C.
764dbbf2 121* Language Independent Options:: Controlling how diagnostics should be
02f52e19 122 formatted.
74291a4b
MM
123* Warning Options:: How picky should the compiler be?
124* Debugging Options:: Symbol tables, measurements, and debugging dumps.
125* Optimize Options:: How much optimization?
126* Preprocessor Options:: Controlling header files and macro definitions.
127 Also, getting dependency information for Make.
128* Assembler Options:: Passing options to the assembler.
129* Link Options:: Specifying libraries and so on.
130* Directory Options:: Where to find header files and libraries.
131 Where to find the compiler executable files.
a743d340 132* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 133* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
134* Submodel Options:: Specifying minor hardware or convention variations,
135 such as 68010 vs 68020.
136* Code Gen Options:: Specifying conventions for function calls, data layout
137 and register usage.
0c2d1a2a 138* Environment Variables:: Env vars that affect GCC.
74291a4b
MM
139* Running Protoize:: Automatically adding or removing function prototypes.
140@end menu
141
4bc1997b
JM
142@c man begin OPTIONS
143
74291a4b
MM
144@node Option Summary
145@section Option Summary
146
147Here is a summary of all the options, grouped by type. Explanations are
148in the following sections.
149
150@table @emph
151@item Overall Options
152@xref{Overall Options,,Options Controlling the Kind of Output}.
4bc1997b
JM
153@gccoptlist{
154-c -S -E -o @var{file} -pipe -pass-exit-codes -x @var{language} @gol
155-v --target-help --help}
74291a4b
MM
156
157@item C Language Options
158@xref{C Dialect Options,,Options Controlling C Dialect}.
4bc1997b 159@gccoptlist{
b1018de6
AO
160-ansi -std=@var{standard} -aux-info @var{filename} @gol
161-fno-asm -fno-builtin @gol
4bc1997b
JM
162-fhosted -ffreestanding @gol
163-trigraphs -traditional -traditional-cpp @gol
164-fallow-single-precision -fcond-mismatch @gol
165-fsigned-bitfields -fsigned-char @gol
166-funsigned-bitfields -funsigned-char @gol
167-fwritable-strings -fshort-wchar}
74291a4b
MM
168
169@item C++ Language Options
170@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
4bc1997b
JM
171@gccoptlist{
172-fno-access-control -fcheck-new -fconserve-space @gol
aa0cc562
JM
173-fno-const-strings -fdollars-in-identifiers @gol
174-fno-elide-constructors @gol
4bc1997b
JM
175-fno-enforce-eh-specs -fexternal-templates @gol
176-falt-external-templates @gol
25b5b465 177-ffor-scope -fno-for-scope -fno-gnu-keywords -fno-honor-std @gol
90ecce3e 178-fno-implicit-templates @gol
4bc1997b
JM
179-fno-implicit-inline-templates @gol
180-fno-implement-inlines -fms-extensions @gol
aa0cc562 181-fno-nonansi-builtins -fno-operator-names @gol
4bc1997b 182-fno-optional-diags -fpermissive @gol
aa0cc562 183-frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
90ecce3e 184-fuse-cxa-atexit -fvtable-gc -fno-weak -nostdinc++ @gol
4bc1997b
JM
185-fno-default-inline -Wctor-dtor-privacy @gol
186-Wnon-virtual-dtor -Wreorder @gol
187-Weffc++ -Wno-deprecated @gol
188-Wno-non-template-friend -Wold-style-cast @gol
189-Woverloaded-virtual -Wno-pmf-conversions @gol
190-Wsign-promo -Wsynth}
74291a4b 191
60de6385
SS
192@item Objective-C Language Options
193@xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
194@gccoptlist{
630d3d5a 195-fconstant-string-class=@var{class-name} @gol
310668e8 196-fgnu-runtime -fnext-runtime -gen-decls @gol
60de6385
SS
197-Wno-protocol -Wselector}
198
764dbbf2
GDR
199@item Language Independent Options
200@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
4bc1997b
JM
201@gccoptlist{
202-fmessage-length=@var{n} @gol
203-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
764dbbf2 204
74291a4b
MM
205@item Warning Options
206@xref{Warning Options,,Options to Request or Suppress Warnings}.
4bc1997b
JM
207@gccoptlist{
208-fsyntax-only -pedantic -pedantic-errors @gol
209-w -W -Wall -Waggregate-return @gol
210-Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment @gol
feb48bde 211-Wconversion -Wdisabled-optimization -Werror @gol
4bc1997b 212-Wfloat-equal -Wformat -Wformat=2 @gol
feb48bde
JM
213-Wformat-nonliteral -Wformat-security @gol
214-Wimplicit -Wimplicit-int @gol
4bc1997b
JM
215-Wimplicit-function-declaration @gol
216-Werror-implicit-function-declaration @gol
217-Wimport -Winline @gol
218-Wlarger-than-@var{len} -Wlong-long @gol
1f0c3120 219-Wmain -Wmissing-braces -Wmissing-declarations @gol
4bc1997b 220-Wmissing-format-attribute -Wmissing-noreturn @gol
feb48bde 221-Wmultichar -Wno-format-extra-args -Wno-format-y2k @gol
4bc1997b 222-Wno-import -Wpacked -Wpadded @gol
310668e8 223-Wparentheses -Wpointer-arith -Wredundant-decls @gol
4bc1997b
JM
224-Wreturn-type -Wsequence-point -Wshadow @gol
225-Wsign-compare -Wswitch -Wsystem-headers @gol
226-Wtrigraphs -Wundef -Wuninitialized @gol
227-Wunknown-pragmas -Wunreachable-code @gol
228-Wunused -Wunused-function -Wunused-label -Wunused-parameter @gol
229-Wunused-value -Wunused-variable -Wwrite-strings}
74291a4b 230
fe50c0eb 231@item C-only Warning Options
4bc1997b 232@gccoptlist{
310668e8
JM
233-Wbad-function-cast -Wmissing-prototypes -Wnested-externs @gol
234-Wstrict-prototypes -Wtraditional}
fe50c0eb 235
74291a4b
MM
236@item Debugging Options
237@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
4bc1997b 238@gccoptlist{
1f0c3120 239-a -ax -d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
aee96fe9
JM
240-fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
241-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
e76b4820 242-fdump-ast-original@r{[}-@var{n}@r{]} -fdump-ast-optimized@r{[}-@var{n}@r{]} @gol
6be77748 243-fdump-ast-inlined@r{[}-@var{n}@r{]} @gol
e76b4820 244-fmem-report -fpretend-float @gol
1f0c3120 245-fprofile-arcs -ftest-coverage -ftime-report @gol
4bc1997b
JM
246-g -g@var{level} -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 @gol
247-ggdb -gstabs -gstabs+ -gxcoff -gxcoff+ @gol
248-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
b1018de6 249-print-multi-directory -print-multi-lib @gol
4bc1997b
JM
250-print-prog-name=@var{program} -print-search-dirs -Q @gol
251-save-temps -time}
74291a4b
MM
252
253@item Optimization Options
254@xref{Optimize Options,,Options that Control Optimization}.
4bc1997b
JM
255@gccoptlist{
256-falign-functions=@var{n} -falign-jumps=@var{n} @gol
257-falign-labels=@var{n} -falign-loops=@var{n} @gol
258-fbranch-probabilities -fcaller-saves @gol
62d285ff 259-fcse-follow-jumps -fcse-skip-blocks -fdata-sections @gol
4bc1997b
JM
260-fdelayed-branch -fdelete-null-pointer-checks @gol
261-fexpensive-optimizations -ffast-math -ffloat-store @gol
feb48bde
JM
262-fforce-addr -fforce-mem -ffunction-sections @gol
263-fgcse -fgcse-lm -fgcse-sm @gol
4bc1997b
JM
264-finline-functions -finline-limit=@var{n} -fkeep-inline-functions @gol
265-fkeep-static-consts -fmove-all-movables @gol
266-fno-default-inline -fno-defer-pop @gol
feb48bde 267-fno-function-cse -fno-guess-branch-probability @gol
6cfc0341 268-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
de6c5979 269-funsafe-math-optimizations -fno-trapping-math @gol
4bc1997b
JM
270-fomit-frame-pointer -foptimize-register-move @gol
271-foptimize-sibling-calls -freduce-all-givs @gol
272-fregmove -frename-registers @gol
273-frerun-cse-after-loop -frerun-loop-opt @gol
274-fschedule-insns -fschedule-insns2 @gol
0b47e4c1 275-fsingle-precision-constant -fssa -fssa-ccp -fssa-dce @gol
4bc1997b
JM
276-fstrength-reduce -fstrict-aliasing -fthread-jumps -ftrapv @gol
277-funroll-all-loops -funroll-loops @gol
3af64fd6 278--param @var{name}=@var{value}
4bc1997b 279-O -O0 -O1 -O2 -O3 -Os}
74291a4b
MM
280
281@item Preprocessor Options
282@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
4bc1997b
JM
283@gccoptlist{
284-$ -A@var{question}=@var{answer} -A-@var{question}@r{[}=@var{answer}@r{]} @gol
285-C -dD -dI -dM -dN @gol
286-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
287-idirafter @var{dir} @gol
288-include @var{file} -imacros @var{file} @gol
289-iprefix @var{file} -iwithprefix @var{dir} @gol
bdd42dd9 290-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
4bc1997b 291-M -MM -MF -MG -MP -MQ -MT -nostdinc -P -remap @gol
aee96fe9 292-trigraphs -undef -U@var{macro} -Wp,@var{option}}
74291a4b
MM
293
294@item Assembler Option
295@xref{Assembler Options,,Passing Options to the Assembler}.
4bc1997b 296@gccoptlist{
aee96fe9 297-Wa,@var{option}}
74291a4b
MM
298
299@item Linker Options
300@xref{Link Options,,Options for Linking}.
4bc1997b
JM
301@gccoptlist{
302@var{object-file-name} -l@var{library} @gol
303-nostartfiles -nodefaultlibs -nostdlib @gol
304-s -static -static-libgcc -shared -shared-libgcc -symbolic @gol
aee96fe9 305-Wl,@var{option} -Xlinker @var{option} @gol
4bc1997b 306-u @var{symbol}}
74291a4b
MM
307
308@item Directory Options
309@xref{Directory Options,,Options for Directory Search}.
4bc1997b
JM
310@gccoptlist{
311-B@var{prefix} -I@var{dir} -I- -L@var{dir} -specs=@var{file}}
74291a4b
MM
312
313@item Target Options
314@c I wrote this xref this way to avoid overfull hbox. -- rms
315@xref{Target Options}.
4bc1997b
JM
316@gccoptlist{
317-b @var{machine} -V @var{version}}
74291a4b
MM
318
319@item Machine Dependent Options
320@xref{Submodel Options,,Hardware Models and Configurations}.
74291a4b 321@emph{M680x0 Options}
4bc1997b
JM
322@gccoptlist{
323-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
feb48bde 324-m68060 -mcpu32 -m5200 -m68881 -mbitfield -mc68000 -mc68020 @gol
310668e8
JM
325-mfpa -mnobitfield -mrtd -mshort -msoft-float -mpcrel @gol
326-malign-int -mstrict-align}
74291a4b 327
2856c3e3 328@emph{M68hc1x Options}
4bc1997b
JM
329@gccoptlist{
330-m6811 -m6812 -m68hc11 -m68hc12 @gol
331-mauto-incdec -mshort -msoft-reg-count=@var{count}}
2856c3e3 332
74291a4b 333@emph{VAX Options}
4bc1997b
JM
334@gccoptlist{
335-mg -mgnu -munix}
74291a4b
MM
336
337@emph{SPARC Options}
4bc1997b 338@gccoptlist{
630d3d5a
JM
339-mcpu=@var{cpu-type} @gol
340-mtune=@var{cpu-type} @gol
341-mcmodel=@var{code-model} @gol
4bc1997b
JM
342-m32 -m64 @gol
343-mapp-regs -mbroken-saverestore -mcypress @gol
feb48bde 344-mepilogue -mfaster-structs -mflat @gol
4bc1997b
JM
345-mfpu -mhard-float -mhard-quad-float @gol
346-mimpure-text -mlive-g0 -mno-app-regs @gol
310668e8
JM
347-mno-epilogue -mno-faster-structs -mno-flat -mno-fpu @gol
348-mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol
4bc1997b
JM
349-msoft-float -msoft-quad-float -msparclite -mstack-bias @gol
350-msupersparc -munaligned-doubles -mv8}
74291a4b
MM
351
352@emph{Convex Options}
4bc1997b
JM
353@gccoptlist{
354-mc1 -mc2 -mc32 -mc34 -mc38 @gol
355-margcount -mnoargcount @gol
356-mlong32 -mlong64 @gol
357-mvolatile-cache -mvolatile-nocache}
74291a4b
MM
358
359@emph{AMD29K Options}
4bc1997b
JM
360@gccoptlist{
361-m29000 -m29050 -mbw -mnbw -mdw -mndw @gol
362-mlarge -mnormal -msmall @gol
363-mkernel-registers -mno-reuse-arg-regs @gol
364-mno-stack-check -mno-storem-bug @gol
365-mreuse-arg-regs -msoft-float -mstack-check @gol
366-mstorem-bug -muser-registers}
74291a4b
MM
367
368@emph{ARM Options}
4bc1997b 369@gccoptlist{
310668e8
JM
370-mapcs-frame -mno-apcs-frame @gol
371-mapcs-26 -mapcs-32 @gol
372-mapcs-stack-check -mno-apcs-stack-check @gol
373-mapcs-float -mno-apcs-float @gol
374-mapcs-reentrant -mno-apcs-reentrant @gol
375-msched-prolog -mno-sched-prolog @gol
376-mlittle-endian -mbig-endian -mwords-little-endian @gol
377-malignment-traps -mno-alignment-traps @gol
378-msoft-float -mhard-float -mfpe @gol
379-mthumb-interwork -mno-thumb-interwork @gol
380-mcpu=@var{name} -march=@var{name} -mfpe=@var{name} @gol
247f8561 381-mstructure-size-boundary=@var{n} @gol
310668e8 382-mbsd -mxopen -mno-symrename @gol
4bc1997b 383-mabort-on-noreturn @gol
310668e8
JM
384-mlong-calls -mno-long-calls @gol
385-msingle-pic-base -mno-single-pic-base @gol
247f8561
PB
386-mpic-register=@var{reg} @gol
387-mnop-fun-dllimport @gol
388-mpoke-function-name @gol
310668e8
JM
389-mthumb -marm @gol
390-mtpcs-frame -mtpcs-leaf-frame @gol
391-mcaller-super-interworking -mcallee-super-interworking }
74291a4b 392
ecff22ab 393@emph{MN10200 Options}
4bc1997b
JM
394@gccoptlist{
395-mrelax}
ecff22ab 396
6d6d0fa0 397@emph{MN10300 Options}
4bc1997b 398@gccoptlist{
c474f76b
AO
399-mmult-bug -mno-mult-bug @gol
400-mam33 -mno-am33 @gol
401-mno-crt0 -mrelax}
6d6d0fa0 402
861bb6c1 403@emph{M32R/D Options}
4bc1997b 404@gccoptlist{
630d3d5a 405-mcode-model=@var{model-type} -msdata=@var{sdata-type} @gol
4bc1997b 406-G @var{num}}
861bb6c1 407
74291a4b 408@emph{M88K Options}
4bc1997b
JM
409@gccoptlist{
410-m88000 -m88100 -m88110 -mbig-pic @gol
411-mcheck-zero-division -mhandle-large-shift @gol
412-midentify-revision -mno-check-zero-division @gol
413-mno-ocs-debug-info -mno-ocs-frame-position @gol
414-mno-optimize-arg-area -mno-serialize-volatile @gol
415-mno-underscores -mocs-debug-info @gol
416-mocs-frame-position -moptimize-arg-area @gol
417-mserialize-volatile -mshort-data-@var{num} -msvr3 @gol
418-msvr4 -mtrap-large-shift -muse-div-instruction @gol
419-mversion-03.00 -mwarn-passed-structs}
74291a4b
MM
420
421@emph{RS/6000 and PowerPC Options}
4bc1997b 422@gccoptlist{
630d3d5a
JM
423-mcpu=@var{cpu-type} @gol
424-mtune=@var{cpu-type} @gol
4bc1997b
JM
425-mpower -mno-power -mpower2 -mno-power2 @gol
426-mpowerpc -mpowerpc64 -mno-powerpc @gol
427-mpowerpc-gpopt -mno-powerpc-gpopt @gol
428-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
429-mnew-mnemonics -mold-mnemonics @gol
430-mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc @gol
431-m64 -m32 -mxl-call -mno-xl-call -mthreads -mpe @gol
432-msoft-float -mhard-float -mmultiple -mno-multiple @gol
433-mstring -mno-string -mupdate -mno-update @gol
434-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
435-mstrict-align -mno-strict-align -mrelocatable @gol
436-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
437-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
438-mcall-aix -mcall-sysv -mprototype -mno-prototype @gol
439-msim -mmvme -mads -myellowknife -memb -msdata @gol
440-msdata=@var{opt} -mvxworks -G @var{num}}
74291a4b
MM
441
442@emph{RT Options}
4bc1997b
JM
443@gccoptlist{
444-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs @gol
445-mfull-fp-blocks -mhc-struct-return -min-line-mul @gol
446-mminimum-fp-blocks -mnohc-struct-return}
74291a4b
MM
447
448@emph{MIPS Options}
4bc1997b 449@gccoptlist{
7dac2f89
EC
450-mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol
451-mcpu=@var{cpu-type} -membedded-data -muninit-const-in-rodata @gol
4bc1997b
JM
452-membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 @gol
453-mgpopt -mhalf-pic -mhard-float -mint64 -mips1 @gol
feb48bde 454-mips2 -mips3 -mips4 -mlong64 -mlong32 -mlong-calls -mmemcpy @gol
4bc1997b 455-mmips-as -mmips-tfile -mno-abicalls @gol
feb48bde
JM
456-mno-embedded-data -mno-uninit-const-in-rodata @gol
457-mno-embedded-pic -mno-gpopt -mno-long-calls @gol
4bc1997b
JM
458-mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats @gol
459-mrnames -msoft-float @gol
460-m4650 -msingle-float -mmad @gol
461-mstats -EL -EB -G @var{num} -nocpp @gol
feb48bde
JM
462-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi @gol
463-mfix7000 -mno-crt0}
74291a4b
MM
464
465@emph{i386 Options}
4bc1997b 466@gccoptlist{
630d3d5a 467-mcpu=@var{cpu-type} -march=@var{cpu-type} @gol
4bc1997b
JM
468-mintel-syntax -mieee-fp -mno-fancy-math-387 @gol
469-mno-fp-ret-in-387 -msoft-float -msvr3-shlib @gol
470-mno-wide-multiply -mrtd -malign-double @gol
3e18fdf6 471-mpreferred-stack-boundary=@var{num} @gol
feb48bde
JM
472-mthreads -mno-align-stringops -minline-all-stringops @gol
473-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
474-m96bit-long-double -mregparm=@var{num} -momit-leaf-frame-pointer}
74291a4b
MM
475
476@emph{HPPA Options}
4bc1997b 477@gccoptlist{
630d3d5a 478-march=@var{architecture-type} @gol
feb48bde
JM
479-mbig-switch -mdisable-fpregs -mdisable-indexing @gol
480-mfast-indirect-calls -mgas -mjump-in-delay @gol
4bc1997b
JM
481-mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
482-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
feb48bde 483-mno-jump-in-delay -mno-long-load-store @gol
4bc1997b 484-mno-portable-runtime -mno-soft-float @gol
feb48bde
JM
485-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
486-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
630d3d5a 487-mschedule=@var{cpu-type} -mspace-regs}
74291a4b
MM
488
489@emph{Intel 960 Options}
4bc1997b 490@gccoptlist{
630d3d5a 491-m@var{cpu-type} -masm-compat -mclean-linkage @gol
4bc1997b
JM
492-mcode-align -mcomplex-addr -mleaf-procedures @gol
493-mic-compat -mic2.0-compat -mic3.0-compat @gol
494-mintel-asm -mno-clean-linkage -mno-code-align @gol
495-mno-complex-addr -mno-leaf-procedures @gol
496-mno-old-align -mno-strict-align -mno-tail-call @gol
497-mnumerics -mold-align -msoft-float -mstrict-align @gol
498-mtail-call}
74291a4b
MM
499
500@emph{DEC Alpha Options}
4bc1997b 501@gccoptlist{
310668e8
JM
502-mfp-regs -mno-fp-regs -mno-soft-float -msoft-float @gol
503-malpha-as -mgas @gol
4bc1997b
JM
504-mieee -mieee-with-inexact -mieee-conformant @gol
505-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
506-mtrap-precision=@var{mode} -mbuild-constants @gol
630d3d5a 507-mcpu=@var{cpu-type} @gol
310668e8 508-mbwx -mno-bwx -mcix -mno-cix -mmax -mno-max @gol
4bc1997b 509-mmemory-latency=@var{time}}
74291a4b
MM
510
511@emph{Clipper Options}
4bc1997b
JM
512@gccoptlist{
513-mc300 -mc400}
74291a4b
MM
514
515@emph{H8/300 Options}
4bc1997b 516@gccoptlist{
310668e8 517-mrelax -mh -ms -mint32 -malign-300}
74291a4b
MM
518
519@emph{SH Options}
4bc1997b
JM
520@gccoptlist{
521-m1 -m2 -m3 -m3e @gol
522-m4-nofpu -m4-single-only -m4-single -m4 @gol
523-mb -ml -mdalign -mrelax @gol
524-mbigtable -mfmovd -mhitachi -mnomacsave @gol
c474f76b
AO
525-mieee -misize -mpadstruct -mspace @gol
526-mprefergot -musermode}
74291a4b
MM
527
528@emph{System V Options}
4bc1997b 529@gccoptlist{
aee96fe9 530-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
74291a4b 531
56b2d7a7 532@emph{ARC Options}
4bc1997b
JM
533@gccoptlist{
534-EB -EL @gol
630d3d5a
JM
535-mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
536-mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
56b2d7a7 537
282a61e6 538@emph{TMS320C3x/C4x Options}
4bc1997b 539@gccoptlist{
310668e8
JM
540-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm @gol
541-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload @gol
542-mrpts=@var{count} -mrptb -mdb -mloop-unsigned @gol
543-mparallel-insns -mparallel-mpy -mpreserve-float}
282a61e6 544
f84271d9 545@emph{V850 Options}
4bc1997b 546@gccoptlist{
310668e8
JM
547-mlong-calls -mno-long-calls -mep -mno-ep @gol
548-mprolog-function -mno-prolog-function -mspace @gol
549-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
550-mv850 -mbig-switch}
83575957
ID
551
552@emph{NS32K Options}
4bc1997b 553@gccoptlist{
310668e8 554-m32032 -m32332 -m32532 -m32081 -m32381 @gol
feb48bde 555-mmult-add -mnomult-add -msoft-float -mrtd -mnortd @gol
310668e8
JM
556-mregparam -mnoregparam -msb -mnosb @gol
557-mbitfield -mnobitfield -mhimem -mnohimem}
789a3090 558
052a4b28 559@emph{AVR Options}
4bc1997b 560@gccoptlist{
310668e8
JM
561-mmcu=@var{mcu} -msize -minit-stack=@var{n} -mno-interrupts @gol
562-mcall-prologues -mno-tablejump -mtiny-stack}
052a4b28 563
789a3090 564@emph{MCore Options}
4bc1997b 565@gccoptlist{
feb48bde 566-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
310668e8
JM
567-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
568-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
569-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
570-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
f84271d9 571
df6194d4
JW
572@emph{IA-64 Options}
573@gccoptlist{
310668e8
JM
574-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
575-mvolatile-asm-stop -mb-step -mregister-names -mno-sdata @gol
576-mconstant-gp -mauto-pic -minline-divide-min-latency @gol
577-minline-divide-max-throughput -mno-dwarf2-asm @gol
630d3d5a 578-mfixed-range=@var{register-range}}
df6194d4 579
74291a4b
MM
580@item Code Generation Options
581@xref{Code Gen Options,,Options for Code Generation Conventions}.
4bc1997b
JM
582@gccoptlist{
583-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
6cfc0341
RH
584-ffixed-@var{reg} -fexceptions @gol
585-fnon-call-exceptions -funwind-tables @gol
4bc1997b
JM
586-finhibit-size-directive -finstrument-functions @gol
587-fcheck-memory-usage -fprefix-function-name @gol
588-fno-common -fno-ident -fno-gnu-linker @gol
589-fpcc-struct-return -fpic -fPIC @gol
590-freg-struct-return -fshared-data -fshort-enums @gol
310668e8
JM
591-fshort-double -fvolatile @gol
592-fvolatile-global -fvolatile-static @gol
4bc1997b
JM
593-fverbose-asm -fpack-struct -fstack-check @gol
594-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
595-fargument-alias -fargument-noalias @gol
310668e8 596-fargument-noalias-global -fleading-underscore}
74291a4b
MM
597@end table
598
599@menu
600* Overall Options:: Controlling the kind of output:
601 an executable, object files, assembler files,
602 or preprocessed source.
603* C Dialect Options:: Controlling the variant of C language compiled.
604* C++ Dialect Options:: Variations on C++.
60de6385 605* Objective-C Dialect Options:: Variations on Objective-C.
764dbbf2 606* Language Independent Options:: Controlling how diagnostics should be
02f52e19 607 formatted.
74291a4b
MM
608* Warning Options:: How picky should the compiler be?
609* Debugging Options:: Symbol tables, measurements, and debugging dumps.
610* Optimize Options:: How much optimization?
611* Preprocessor Options:: Controlling header files and macro definitions.
612 Also, getting dependency information for Make.
613* Assembler Options:: Passing options to the assembler.
614* Link Options:: Specifying libraries and so on.
615* Directory Options:: Where to find header files and libraries.
616 Where to find the compiler executable files.
a743d340 617* Spec Files:: How to pass switches to sub-processes.
0c2d1a2a 618* Target Options:: Running a cross-compiler, or an old version of GCC.
74291a4b
MM
619@end menu
620
621@node Overall Options
622@section Options Controlling the Kind of Output
623
624Compilation can involve up to four stages: preprocessing, compilation
625proper, assembly and linking, always in that order. The first three
626stages apply to an individual source file, and end by producing an
627object file; linking combines all the object files (those newly
628compiled, and those specified as input) into an executable file.
629
630@cindex file name suffix
631For any given input file, the file name suffix determines what kind of
632compilation is done:
633
2642624b 634@table @gcctabopt
74291a4b
MM
635@item @var{file}.c
636C source code which must be preprocessed.
637
638@item @var{file}.i
639C source code which should not be preprocessed.
640
641@item @var{file}.ii
642C++ source code which should not be preprocessed.
643
644@item @var{file}.m
645Objective-C source code. Note that you must link with the library
646@file{libobjc.a} to make an Objective-C program work.
647
b9265ec1
JM
648@item @var{file}.mi
649Objective-C source code which should not be preprocessed.
650
74291a4b
MM
651@item @var{file}.h
652C header file (not to be compiled or linked).
653
654@item @var{file}.cc
b9265ec1 655@itemx @var{file}.cp
74291a4b
MM
656@itemx @var{file}.cxx
657@itemx @var{file}.cpp
b9265ec1 658@itemx @var{file}.c++
74291a4b
MM
659@itemx @var{file}.C
660C++ source code which must be preprocessed. Note that in @samp{.cxx},
661the last two letters must both be literally @samp{x}. Likewise,
161d7b59 662@samp{.C} refers to a literal capital C@.
74291a4b 663
b9265ec1
JM
664@item @var{file}.f
665@itemx @var{file}.for
666@itemx @var{file}.FOR
667Fortran source code which should not be preprocessed.
668
669@item @var{file}.F
670@itemx @var{file}.fpp
671@itemx @var{file}.FPP
672Fortran source code which must be preprocessed (with the traditional
673preprocessor).
674
675@item @var{file}.r
676Fortran source code which must be preprocessed with a RATFOR
161d7b59 677preprocessor (not included with GCC)@.
b9265ec1
JM
678
679@xref{Overall Options,,Options Controlling the Kind of Output, g77,
680Using and Porting GNU Fortran}, for more details of the handling of
681Fortran input files.
682
683@c FIXME: Descriptions of Java file types.
684@c @var{file}.java
685@c @var{file}.class
686@c @var{file}.zip
687@c @var{file}.jar
688
689@c GCC also knows about some suffixes for languages not yet included:
690@c Ada:
691@c @var{file}.ads
692@c @var{file}.adb
693@c @var{file}.ada
694@c Pascal:
695@c @var{file}.p
696@c @var{file}.pas
697
698@item @var{file}.ch
699@itemx @var{file}.chi
700CHILL source code (preprocessed with the traditional preprocessor).
701
74291a4b
MM
702@item @var{file}.s
703Assembler code.
704
705@item @var{file}.S
706Assembler code which must be preprocessed.
707
708@item @var{other}
709An object file to be fed straight into linking.
710Any file name with no recognized suffix is treated this way.
711@end table
712
cd3bb277 713@opindex x
630d3d5a 714You can specify the input language explicitly with the @option{-x} option:
74291a4b 715
2642624b 716@table @gcctabopt
74291a4b
MM
717@item -x @var{language}
718Specify explicitly the @var{language} for the following input files
719(rather than letting the compiler choose a default based on the file
720name suffix). This option applies to all following input files until
630d3d5a 721the next @option{-x} option. Possible values for @var{language} are:
74291a4b 722@example
b9265ec1
JM
723c c-header cpp-output
724c++ c++-cpp-output
725objective-c objc-cpp-output
74291a4b 726assembler assembler-with-cpp
b9265ec1
JM
727f77 f77-cpp-input ratfor
728java chill
74291a4b 729@end example
b9265ec1 730@c Also f77-version, for internal use only.
74291a4b
MM
731
732@item -x none
733Turn off any specification of a language, so that subsequent files are
630d3d5a 734handled according to their file name suffixes (as they are if @option{-x}
74291a4b 735has not been used at all).
14a774a9
RK
736
737@item -pass-exit-codes
cd3bb277 738@opindex pass-exit-codes
bedc7537 739Normally the @command{gcc} program will exit with the code of 1 if any
14a774a9 740phase of the compiler returns a non-success return code. If you specify
630d3d5a 741@option{-pass-exit-codes}, the @command{gcc} program will instead return with
14a774a9
RK
742numerically highest error produced by any phase that returned an error
743indication.
74291a4b
MM
744@end table
745
746If you only want some of the stages of compilation, you can use
630d3d5a
JM
747@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
748one of the options @option{-c}, @option{-S}, or @option{-E} to say where
bedc7537
NC
749@command{gcc} is to stop. Note that some combinations (for example,
750@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
74291a4b 751
2642624b 752@table @gcctabopt
74291a4b 753@item -c
cd3bb277 754@opindex c
74291a4b
MM
755Compile or assemble the source files, but do not link. The linking
756stage simply is not done. The ultimate output is in the form of an
757object file for each source file.
758
759By default, the object file name for a source file is made by replacing
760the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
761
762Unrecognized input files, not requiring compilation or assembly, are
763ignored.
764
765@item -S
cd3bb277 766@opindex S
74291a4b
MM
767Stop after the stage of compilation proper; do not assemble. The output
768is in the form of an assembler code file for each non-assembler input
769file specified.
770
771By default, the assembler file name for a source file is made by
772replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
773
774Input files that don't require compilation are ignored.
775
776@item -E
cd3bb277 777@opindex E
74291a4b
MM
778Stop after the preprocessing stage; do not run the compiler proper. The
779output is in the form of preprocessed source code, which is sent to the
780standard output.
781
782Input files which don't require preprocessing are ignored.
783
784@cindex output file option
785@item -o @var{file}
cd3bb277 786@opindex o
74291a4b
MM
787Place output in file @var{file}. This applies regardless to whatever
788sort of output is being produced, whether it be an executable file,
789an object file, an assembler file or preprocessed C code.
790
791Since only one output file can be specified, it does not make sense to
630d3d5a 792use @option{-o} when compiling more than one input file, unless you are
74291a4b
MM
793producing an executable file as output.
794
630d3d5a 795If @option{-o} is not specified, the default is to put an executable file
74291a4b
MM
796in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
797@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
bd819a4a 798all preprocessed C source on standard output.
74291a4b
MM
799
800@item -v
cd3bb277 801@opindex v
74291a4b
MM
802Print (on standard error output) the commands executed to run the stages
803of compilation. Also print the version number of the compiler driver
804program and of the preprocessor and the compiler proper.
805
806@item -pipe
cd3bb277 807@opindex pipe
74291a4b
MM
808Use pipes rather than temporary files for communication between the
809various stages of compilation. This fails to work on some systems where
810the assembler is unable to read from a pipe; but the GNU assembler has
811no trouble.
844642e6
NC
812
813@item --help
cd3bb277 814@opindex help
844642e6 815Print (on the standard output) a description of the command line options
bedc7537
NC
816understood by @command{gcc}. If the @option{-v} option is also specified
817then @option{--help} will also be passed on to the various processes
818invoked by @command{gcc}, so that they can display the command line options
819they accept. If the @option{-W} option is also specified then command
844642e6
NC
820line options which have no documentation associated with them will also
821be displayed.
10501d8f
CC
822
823@item --target-help
cd3bb277 824@opindex target-help
10501d8f
CC
825Print (on the standard output) a description of target specific command
826line options for each tool.
74291a4b
MM
827@end table
828
829@node Invoking G++
830@section Compiling C++ Programs
831
832@cindex suffixes for C++ source
833@cindex C++ source file suffixes
834C++ source files conventionally use one of the suffixes @samp{.C},
bba975d4 835@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
0c2d1a2a 836preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
bba975d4
JM
837files with these names and compiles them as C++ programs even if you
838call the compiler the same way as for compiling C programs (usually with
bedc7537 839the name @command{gcc}).
74291a4b
MM
840
841@findex g++
842@findex c++
843However, C++ programs often require class libraries as well as a
844compiler that understands the C++ language---and under some
845circumstances, you might want to compile programs from standard input,
846or otherwise without a suffix that flags them as C++ programs.
bedc7537 847@command{g++} is a program that calls GCC with the default language
e5e809f4 848set to C++, and automatically specifies linking against the C++
bedc7537
NC
849library. On many systems, @command{g++} is also
850installed with the name @command{c++}.
74291a4b 851
bedc7537 852@cindex invoking @command{g++}
74291a4b
MM
853When you compile C++ programs, you may specify many of the same
854command-line options that you use for compiling programs in any
855language; or command-line options meaningful for C and related
856languages; or options that are meaningful only for C++ programs.
857@xref{C Dialect Options,,Options Controlling C Dialect}, for
161d7b59 858explanations of options for languages related to C@.
74291a4b
MM
859@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
860explanations of options that are meaningful only for C++ programs.
861
862@node C Dialect Options
863@section Options Controlling C Dialect
864@cindex dialect options
865@cindex language dialect options
866@cindex options, dialect
867
868The following options control the dialect of C (or languages derived
2147b154 869from C, such as C++ and Objective-C) that the compiler accepts:
74291a4b 870
2642624b 871@table @gcctabopt
74291a4b 872@cindex ANSI support
c1030c7c 873@cindex ISO support
74291a4b 874@item -ansi
cd3bb277 875@opindex ansi
c1030c7c 876In C mode, support all ISO C89 programs. In C++ mode,
775afb25 877remove GNU extensions that conflict with ISO C++.
74291a4b 878
c1030c7c 879This turns off certain features of GCC that are incompatible with ISO
aee96fe9 880C89 (when compiling C code), or of standard C++ (when compiling C++ code),
0c2d1a2a 881such as the @code{asm} and @code{typeof} keywords, and
74291a4b
MM
882predefined macros such as @code{unix} and @code{vax} that identify the
883type of system you are using. It also enables the undesirable and
02f52e19 884rarely used ISO trigraph feature. For the C compiler,
0c2d1a2a 885it disables recognition of C++ style @samp{//} comments as well as
775afb25 886the @code{inline} keyword.
74291a4b
MM
887
888The alternate keywords @code{__asm__}, @code{__extension__},
889@code{__inline__} and @code{__typeof__} continue to work despite
630d3d5a 890@option{-ansi}. You would not want to use them in an ISO C program, of
74291a4b 891course, but it is useful to put them in header files that might be included
630d3d5a 892in compilations done with @option{-ansi}. Alternate predefined macros
74291a4b 893such as @code{__unix__} and @code{__vax__} are also available, with or
630d3d5a 894without @option{-ansi}.
74291a4b 895
630d3d5a
JM
896The @option{-ansi} option does not cause non-ISO programs to be
897rejected gratuitously. For that, @option{-pedantic} is required in
898addition to @option{-ansi}. @xref{Warning Options}.
74291a4b 899
630d3d5a 900The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
74291a4b
MM
901option is used. Some header files may notice this macro and refrain
902from declaring certain functions or defining certain macros that the
c1030c7c 903ISO standard doesn't call for; this is to avoid interfering with any
74291a4b
MM
904programs that might use these names for other things.
905
c771326b
JM
906Functions which would normally be built in but do not have semantics
907defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
630d3d5a 908functions with @option{-ansi} is used. @xref{Other Builtins,,Other
f0523f02 909built-in functions provided by GCC}, for details of the functions
01702459 910affected.
74291a4b 911
49419c8f 912@item -std=
cd3bb277 913@opindex std
aee96fe9
JM
914Determine the language standard. This option is currently only
915supported when compiling C@. A value for this option must be provided;
02f52e19 916possible values are
3932261a 917
ee457005 918@table @samp
aee96fe9
JM
919@item c89
920@itemx iso9899:1990
921ISO C89 (same as @option{-ansi}).
3043b30e
ML
922
923@item iso9899:199409
aee96fe9 924ISO C89 as modified in amendment 1.
3043b30e 925
49419c8f 926@item c99
aee96fe9
JM
927@itemx c9x
928@itemx iso9899:1999
929@itemx iso9899:199x
930ISO C99. Note that this standard is not yet fully supported; see
931@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
932names @samp{c9x} and @samp{iso9899:199x} are deprecated.
3043b30e
ML
933
934@item gnu89
aee96fe9 935Default, ISO C89 plus GNU extensions (including some C99 features).
3043b30e 936
49419c8f 937@item gnu99
7dac2f89 938@item gnu9x
d15a05b3
EC
939ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC,
940this will become the default. The name @samp{gnu9x} is deprecated.
49419c8f 941
ee457005 942@end table
3043b30e
ML
943
944Even when this option is not specified, you can still use some of the
945features of newer standards in so far as they do not conflict with
946previous C standards. For example, you may use @code{__restrict__} even
bedc7537 947when @option{-std=c99} is not specified.
3932261a 948
5490d604
JM
949The @option{-std} options specifying some version of ISO C have the same
950effects as @option{-ansi}, except that features that were not in ISO C89
951but are in the specified version (for example, @samp{//} comments and
952the @code{inline} keyword in ISO C99) are not disabled.
953
c1030c7c
JM
954@xref{Standards,,Language Standards Supported by GCC}, for details of
955these standard versions.
956
b1018de6
AO
957@item -aux-info @var{filename}
958@opindex aux-info
959Output to the given filename prototyped declarations for all functions
960declared and/or defined in a translation unit, including those in header
161d7b59 961files. This option is silently ignored in any language other than C@.
b1018de6
AO
962
963Besides declarations, the file indicates, in comments, the origin of
964each declaration (source file and line), whether the declaration was
965implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
966@samp{O} for old, respectively, in the first character after the line
967number and the colon), and whether it came from a declaration or a
968definition (@samp{C} or @samp{F}, respectively, in the following
969character). In the case of function definitions, a K&R-style list of
970arguments followed by their declarations is also provided, inside
971comments, after the declaration.
972
74291a4b 973@item -fno-asm
cd3bb277 974@opindex fno-asm
74291a4b
MM
975Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
976keyword, so that code can use these words as identifiers. You can use
977the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
630d3d5a 978instead. @option{-ansi} implies @option{-fno-asm}.
74291a4b
MM
979
980In C++, this switch only affects the @code{typeof} keyword, since
981@code{asm} and @code{inline} are standard keywords. You may want to
630d3d5a 982use the @option{-fno-gnu-keywords} flag instead, which has the same
5490d604
JM
983effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
984switch only affects the @code{asm} and @code{typeof} keywords, since
985@code{inline} is a standard keyword in ISO C99.
74291a4b
MM
986
987@item -fno-builtin
cd3bb277 988@opindex fno-builtin
c771326b
JM
989@cindex built-in functions
990Don't recognize built-in functions that do not begin with
01702459 991@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
f0523f02 992functions provided by GCC}, for details of the functions affected,
c771326b 993including those which are not built-in functions when @option{-ansi} or
5490d604
JM
994@option{-std} options for strict ISO C conformance are used because they
995do not have an ISO standard meaning.
74291a4b 996
c771326b 997GCC normally generates special code to handle certain built-in functions
74291a4b
MM
998more efficiently; for instance, calls to @code{alloca} may become single
999instructions that adjust the stack directly, and calls to @code{memcpy}
1000may become inline copy loops. The resulting code is often both smaller
1001and faster, but since the function calls no longer appear as such, you
1002cannot set a breakpoint on those calls, nor can you change the behavior
1003of the functions by linking with a different library.
1004
630d3d5a 1005In C++, @option{-fno-builtin} is always in effect. The @option{-fbuiltin}
0b1161fc 1006option has no effect. Therefore, in C++, the only way to get the
c771326b 1007optimization benefits of built-in functions is to call the function
0b1161fc 1008using the @samp{__builtin_} prefix. The GNU C++ Standard Library uses
c771326b 1009built-in functions to implement many functions (like
0b1161fc
MM
1010@code{std::strchr}), so that you automatically get efficient code.
1011
861bb6c1 1012@item -fhosted
cd3bb277 1013@opindex fhosted
861bb6c1
JL
1014@cindex hosted environment
1015
1016Assert that compilation takes place in a hosted environment. This implies
630d3d5a 1017@option{-fbuiltin}. A hosted environment is one in which the
861bb6c1
JL
1018entire standard library is available, and in which @code{main} has a return
1019type of @code{int}. Examples are nearly everything except a kernel.
630d3d5a 1020This is equivalent to @option{-fno-freestanding}.
861bb6c1
JL
1021
1022@item -ffreestanding
cd3bb277 1023@opindex ffreestanding
861bb6c1
JL
1024@cindex hosted environment
1025
1026Assert that compilation takes place in a freestanding environment. This
630d3d5a 1027implies @option{-fno-builtin}. A freestanding environment
861bb6c1
JL
1028is one in which the standard library may not exist, and program startup may
1029not necessarily be at @code{main}. The most obvious example is an OS kernel.
630d3d5a 1030This is equivalent to @option{-fno-hosted}.
861bb6c1 1031
c1030c7c
JM
1032@xref{Standards,,Language Standards Supported by GCC}, for details of
1033freestanding and hosted environments.
1034
74291a4b 1035@item -trigraphs
cd3bb277 1036@opindex trigraphs
3bce8a01
NB
1037Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1038options for strict ISO C conformance) implies @option{-trigraphs}.
74291a4b
MM
1039
1040@cindex traditional C language
1041@cindex C language, traditional
1042@item -traditional
cd3bb277 1043@opindex traditional
74291a4b
MM
1044Attempt to support some aspects of traditional C compilers.
1045Specifically:
1046
1047@itemize @bullet
1048@item
1049All @code{extern} declarations take effect globally even if they
1050are written inside of a function definition. This includes implicit
1051declarations of functions.
1052
1053@item
1054The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
1055and @code{volatile} are not recognized. (You can still use the
1056alternative keywords such as @code{__typeof__}, @code{__inline__}, and
1057so on.)
1058
1059@item
1060Comparisons between pointers and integers are always allowed.
1061
1062@item
1063Integer types @code{unsigned short} and @code{unsigned char} promote
1064to @code{unsigned int}.
1065
1066@item
1067Out-of-range floating point literals are not an error.
1068
1069@item
c1030c7c 1070Certain constructs which ISO regards as a single invalid preprocessing
74291a4b
MM
1071number, such as @samp{0xe-0xd}, are treated as expressions instead.
1072
1073@item
1074String ``constants'' are not necessarily constant; they are stored in
1075writable space, and identical looking constants are allocated
1076separately. (This is the same as the effect of
630d3d5a 1077@option{-fwritable-strings}.)
74291a4b
MM
1078
1079@cindex @code{longjmp} and automatic variables
1080@item
1081All automatic variables not declared @code{register} are preserved by
c1030c7c 1082@code{longjmp}. Ordinarily, GNU C follows ISO C: automatic variables
74291a4b
MM
1083not declared @code{volatile} may be clobbered.
1084
1085@item
cd3bb277
JM
1086@cindex @samp{\x}
1087@cindex @samp{\a}
74291a4b
MM
1088@cindex escape sequences, traditional
1089The character escape sequences @samp{\x} and @samp{\a} evaluate as the
1090literal characters @samp{x} and @samp{a} respectively. Without
630d3d5a 1091@w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal
74291a4b 1092representation of a character, and @samp{\a} produces a bell.
ad299d9b 1093@end itemize
74291a4b 1094
630d3d5a 1095You may wish to use @option{-fno-builtin} as well as @option{-traditional}
c771326b 1096if your program uses names that are normally GNU C built-in functions for
74291a4b
MM
1097other purposes of its own.
1098
630d3d5a 1099You cannot use @option{-traditional} if you include any header files that
c1030c7c 1100rely on ISO C features. Some vendors are starting to ship systems with
630d3d5a 1101ISO C header files and you cannot use @option{-traditional} on such
74291a4b
MM
1102systems to compile files that include any system headers.
1103
630d3d5a 1104The @option{-traditional} option also enables @option{-traditional-cpp},
e5e809f4 1105which is described next.
74291a4b
MM
1106
1107@item -traditional-cpp
cd3bb277 1108@opindex traditional-cpp
74291a4b
MM
1109Attempt to support some aspects of traditional C preprocessors.
1110Specifically:
1111
1112@itemize @bullet
1113@item
1114Comments convert to nothing at all, rather than to a space. This allows
1115traditional token concatenation.
1116
1117@item
1118In a preprocessing directive, the @samp{#} symbol must appear as the first
1119character of a line.
1120
1121@item
1122Macro arguments are recognized within string constants in a macro
1123definition (and their values are stringified, though without additional
1124quote marks, when they appear in such a context). The preprocessor
1125always considers a string constant to end at a newline.
1126
1127@item
630d3d5a 1128@cindex detecting @w{@option{-traditional}}
74291a4b 1129The predefined macro @code{__STDC__} is not defined when you use
630d3d5a 1130@option{-traditional}, but @code{__GNUC__} is (since the GNU extensions
74291a4b 1131which @code{__GNUC__} indicates are not affected by
630d3d5a
JM
1132@option{-traditional}). If you need to write header files that work
1133differently depending on whether @option{-traditional} is in use, by
74291a4b 1134testing both of these predefined macros you can distinguish four
c1030c7c 1135situations: GNU C, traditional GNU C, other ISO C compilers, and other
74291a4b 1136old C compilers. The predefined macro @code{__STDC_VERSION__} is also
630d3d5a 1137not defined when you use @option{-traditional}. @xref{Standard
74291a4b
MM
1138Predefined,,Standard Predefined Macros,cpp.info,The C Preprocessor},
1139for more discussion of these and other predefined macros.
1140
1141@item
1142@cindex string constants vs newline
1143@cindex newline vs string constants
1144The preprocessor considers a string constant to end at a newline (unless
630d3d5a 1145the newline is escaped with @samp{\}). (Without @w{@option{-traditional}},
74291a4b
MM
1146string constants can contain the newline character as typed.)
1147@end itemize
1148
1149@item -fcond-mismatch
cd3bb277 1150@opindex fcond-mismatch
74291a4b 1151Allow conditional expressions with mismatched types in the second and
a7537031
JM
1152third arguments. The value of such an expression is void. This option
1153is not supported for C++.
74291a4b
MM
1154
1155@item -funsigned-char
cd3bb277 1156@opindex funsigned-char
74291a4b
MM
1157Let the type @code{char} be unsigned, like @code{unsigned char}.
1158
1159Each kind of machine has a default for what @code{char} should
1160be. It is either like @code{unsigned char} by default or like
1161@code{signed char} by default.
1162
1163Ideally, a portable program should always use @code{signed char} or
1164@code{unsigned char} when it depends on the signedness of an object.
1165But many programs have been written to use plain @code{char} and
1166expect it to be signed, or expect it to be unsigned, depending on the
1167machines they were written for. This option, and its inverse, let you
1168make such a program work with the opposite default.
1169
1170The type @code{char} is always a distinct type from each of
1171@code{signed char} or @code{unsigned char}, even though its behavior
1172is always just like one of those two.
1173
1174@item -fsigned-char
cd3bb277 1175@opindex fsigned-char
74291a4b
MM
1176Let the type @code{char} be signed, like @code{signed char}.
1177
630d3d5a
JM
1178Note that this is equivalent to @option{-fno-unsigned-char}, which is
1179the negative form of @option{-funsigned-char}. Likewise, the option
1180@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
74291a4b 1181
74291a4b
MM
1182@item -fsigned-bitfields
1183@itemx -funsigned-bitfields
1184@itemx -fno-signed-bitfields
1185@itemx -fno-unsigned-bitfields
cd3bb277
JM
1186@opindex fsigned-bitfields
1187@opindex funsigned-bitfields
1188@opindex fno-signed-bitfields
1189@opindex fno-unsigned-bitfields
c771326b 1190These options control whether a bit-field is signed or unsigned, when the
74291a4b 1191declaration does not use either @code{signed} or @code{unsigned}. By
c771326b 1192default, such a bit-field is signed, because this is consistent: the
74291a4b
MM
1193basic integer types such as @code{int} are signed types.
1194
c771326b 1195However, when @option{-traditional} is used, bit-fields are all unsigned
74291a4b
MM
1196no matter what.
1197
1198@item -fwritable-strings
cd3bb277 1199@opindex fwritable-strings
74291a4b
MM
1200Store string constants in the writable data segment and don't uniquize
1201them. This is for compatibility with old programs which assume they can
630d3d5a 1202write into string constants. The option @option{-traditional} also has
74291a4b
MM
1203this effect.
1204
1205Writing into string constants is a very bad idea; ``constants'' should
1206be constant.
1207
1208@item -fallow-single-precision
cd3bb277 1209@opindex fallow-single-precision
74291a4b 1210Do not promote single precision math operations to double precision,
630d3d5a 1211even when compiling with @option{-traditional}.
74291a4b
MM
1212
1213Traditional K&R C promotes all floating point operations to double
1214precision, regardless of the sizes of the operands. On the
1215architecture for which you are compiling, single precision may be faster
630d3d5a 1216than double precision. If you must use @option{-traditional}, but want
74291a4b
MM
1217to use single precision operations when the operands are single
1218precision, use this option. This option has no effect when compiling
c1030c7c 1219with ISO or GNU C conventions (the default).
74291a4b 1220
3e37bef5 1221@item -fshort-wchar
cd3bb277 1222@opindex fshort-wchar
3e37bef5
JM
1223Override the underlying type for @samp{wchar_t} to be @samp{short
1224unsigned int} instead of the default for the target. This option is
161d7b59 1225useful for building programs to run under WINE@.
74291a4b
MM
1226@end table
1227
1228@node C++ Dialect Options
1229@section Options Controlling C++ Dialect
1230
1231@cindex compiler options, C++
1232@cindex C++ options, command line
1233@cindex options, C++
1234This section describes the command-line options that are only meaningful
1235for C++ programs; but you can also use most of the GNU compiler options
1236regardless of what language your program is in. For example, you
1237might compile a file @code{firstClass.C} like this:
1238
1239@example
1dc5fc4b 1240g++ -g -frepo -O -c firstClass.C
74291a4b
MM
1241@end example
1242
1243@noindent
630d3d5a 1244In this example, only @option{-frepo} is an option meant
74291a4b 1245only for C++ programs; you can use the other options with any
161d7b59 1246language supported by GCC@.
74291a4b
MM
1247
1248Here is a list of options that are @emph{only} for compiling C++ programs:
1249
2642624b 1250@table @gcctabopt
74291a4b 1251@item -fno-access-control
cd3bb277 1252@opindex fno-access-control
74291a4b
MM
1253Turn off all access checking. This switch is mainly useful for working
1254around bugs in the access control code.
1255
74291a4b 1256@item -fcheck-new
cd3bb277 1257@opindex fcheck-new
74291a4b
MM
1258Check that the pointer returned by @code{operator new} is non-null
1259before attempting to modify the storage allocated. The current Working
1260Paper requires that @code{operator new} never return a null pointer, so
1261this check is normally unnecessary.
1262
1dc5fc4b
JM
1263An alternative to using this option is to specify that your
1264@code{operator new} does not throw any exceptions; if you declare it
aee96fe9 1265@samp{throw()}, G++ will check the return value. See also @samp{new
1dc5fc4b
JM
1266(nothrow)}.
1267
74291a4b 1268@item -fconserve-space
cd3bb277 1269@opindex fconserve-space
74291a4b
MM
1270Put uninitialized or runtime-initialized global variables into the
1271common segment, as C does. This saves space in the executable at the
1272cost of not diagnosing duplicate definitions. If you compile with this
1273flag and your program mysteriously crashes after @code{main()} has
1274completed, you may have an object that is being destroyed twice because
1275two definitions were merged.
1276
1dc5fc4b
JM
1277This option is no longer useful on most targets, now that support has
1278been added for putting variables into BSS without making them common.
1279
02f52e19 1280@item -fno-const-strings
cd3bb277 1281@opindex fno-const-strings
fcca588c
MM
1282Give string constants type @code{char *} instead of type @code{const
1283char *}. By default, G++ uses type @code{const char *} as required by
630d3d5a 1284the standard. Even if you use @option{-fno-const-strings}, you cannot
fcca588c 1285actually modify the value of a string constant, unless you also use
630d3d5a 1286@option{-fwritable-strings}.
fcca588c
MM
1287
1288This option might be removed in a future release of G++. For maximum
1289portability, you should structure your code so that it works with
1290string constants that have type @code{const char *}.
1291
74291a4b 1292@item -fdollars-in-identifiers
cd3bb277 1293@opindex fdollars-in-identifiers
74291a4b 1294Accept @samp{$} in identifiers. You can also explicitly prohibit use of
630d3d5a 1295@samp{$} with the option @option{-fno-dollars-in-identifiers}. (GNU C allows
eb795509 1296@samp{$} by default on most target systems, but there are a few exceptions.)
74291a4b 1297Traditional C allowed the character @samp{$} to form part of
c1030c7c 1298identifiers. However, ISO C and C++ forbid @samp{$} in identifiers.
74291a4b 1299
1dc5fc4b 1300@item -fno-elide-constructors
cd3bb277 1301@opindex fno-elide-constructors
1dc5fc4b
JM
1302The C++ standard allows an implementation to omit creating a temporary
1303which is only used to initialize another object of the same type.
aee96fe9 1304Specifying this option disables that optimization, and forces G++ to
1dc5fc4b 1305call the copy constructor in all cases.
74291a4b 1306
dd1ba632 1307@item -fno-enforce-eh-specs
cd3bb277 1308@opindex fno-enforce-eh-specs
dd1ba632
JM
1309Don't check for violation of exception specifications at runtime. This
1310option violates the C++ standard, but may be useful for reducing code
1311size in production builds, much like defining @samp{NDEBUG}. The compiler
1312will still optimize based on the exception specifications.
1313
74291a4b 1314@item -fexternal-templates
cd3bb277 1315@opindex fexternal-templates
74291a4b
MM
1316Cause template instantiations to obey @samp{#pragma interface} and
1317@samp{implementation}; template instances are emitted or not according
1318to the location of the template definition. @xref{Template
1319Instantiation}, for more information.
1320
37f6b6bf
MM
1321This option is deprecated.
1322
74291a4b 1323@item -falt-external-templates
cd3bb277 1324@opindex falt-external-templates
695ac33f 1325Similar to @option{-fexternal-templates}, but template instances are emitted or
74291a4b
MM
1326not according to the place where they are first instantiated.
1327@xref{Template Instantiation}, for more information.
1328
37f6b6bf
MM
1329This option is deprecated.
1330
74291a4b 1331@item -ffor-scope
8c81598d 1332@itemx -fno-for-scope
cd3bb277
JM
1333@opindex ffor-scope
1334@opindex fno-for-scope
695ac33f 1335If @option{-ffor-scope} is specified, the scope of variables declared in
74291a4b 1336a @i{for-init-statement} is limited to the @samp{for} loop itself,
34527c47 1337as specified by the C++ standard.
695ac33f 1338If @option{-fno-for-scope} is specified, the scope of variables declared in
74291a4b 1339a @i{for-init-statement} extends to the end of the enclosing scope,
aee96fe9 1340as was the case in old versions of G++, and other (traditional)
74291a4b
MM
1341implementations of C++.
1342
1343The default if neither flag is given to follow the standard,
1344but to allow and give a warning for old-style code that would
1345otherwise be invalid, or have different behavior.
1346
1347@item -fno-gnu-keywords
cd3bb277 1348@opindex fno-gnu-keywords
9762e8a4 1349Do not recognize @code{typeof} as a keyword, so that code can use this
767094dd 1350word as an identifier. You can use the keyword @code{__typeof__} instead.
630d3d5a 1351@option{-ansi} implies @option{-fno-gnu-keywords}.
74291a4b 1352
25b5b465
MM
1353@item -fno-honor-std
1354@opindex fno-honor-std
1355Ignore @code{namespace std}, instead of treating it as a real namespace.
1356With this switch, the compiler will ignore
1357@code{namespace-declarations}, @code{using-declarations},
1358@code{using-directives}, and @code{namespace-names}, if they involve
f9047ed3 1359@code{std}.
25b5b465
MM
1360
1361This option is only useful if you have manually compiled the C++
1362run-time library with the same switch. Otherwise, your programs will
1363not link. The use of this option is not recommended, and the option may
1364be removed from a future version of G++.
95c81fb8 1365
1dc5fc4b 1366@item -fno-implicit-templates
cd3bb277 1367@opindex fno-implicit-templates
bba975d4 1368Never emit code for non-inline templates which are instantiated
e979f9e8 1369implicitly (i.e.@: by use); only emit code for explicit instantiations.
bba975d4
JM
1370@xref{Template Instantiation}, for more information.
1371
1372@item -fno-implicit-inline-templates
cd3bb277 1373@opindex fno-implicit-inline-templates
bba975d4
JM
1374Don't emit code for implicit instantiations of inline templates, either.
1375The default is to handle inlines differently so that compiles with and
1376without optimization will need the same set of explicit instantiations.
1dc5fc4b 1377
74291a4b 1378@item -fno-implement-inlines
cd3bb277 1379@opindex fno-implement-inlines
74291a4b
MM
1380To save space, do not emit out-of-line copies of inline functions
1381controlled by @samp{#pragma implementation}. This will cause linker
1382errors if these functions are not inlined everywhere they are called.
1383
631cf95d 1384@item -fms-extensions
cd3bb277 1385@opindex fms-extensions
32fb1fb2
PE
1386Disable pedantic warnings about constructs used in MFC, such as implicit
1387int and getting a pointer to member function via non-standard syntax.
631cf95d 1388
fcca588c 1389@item -fno-nonansi-builtins
cd3bb277 1390@opindex fno-nonansi-builtins
c771326b 1391Disable built-in declarations of functions that are not mandated by
161d7b59 1392ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
fcca588c
MM
1393@code{index}, @code{bzero}, @code{conjf}, and other related functions.
1394
775afb25 1395@item -fno-operator-names
cd3bb277 1396@opindex fno-operator-names
775afb25 1397Do not treat the operator name keywords @code{and}, @code{bitand},
74291a4b 1398@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
775afb25 1399synonyms as keywords.
74291a4b 1400
4f8b4fd9 1401@item -fno-optional-diags
cd3bb277 1402@opindex fno-optional-diags
4f8b4fd9 1403Disable diagnostics that the standard says a compiler does not need to
aee96fe9 1404issue. Currently, the only such diagnostic issued by G++ is the one for
bba975d4 1405a name having multiple meanings within a class.
4f8b4fd9 1406
8c7707b0 1407@item -fpermissive
cd3bb277 1408@opindex fpermissive
8c7707b0 1409Downgrade messages about nonconformant code from errors to warnings. By
aee96fe9 1410default, G++ effectively sets @option{-pedantic-errors} without
630d3d5a 1411@option{-pedantic}; this option reverses that. This behavior and this
161d7b59 1412option are superseded by @option{-pedantic}, which works as it does for GNU C@.
8c7707b0 1413
8c81598d 1414@item -frepo
cd3bb277 1415@opindex frepo
8c81598d 1416Enable automatic template instantiation. This option also implies
630d3d5a 1417@option{-fno-implicit-templates}. @xref{Template Instantiation}, for more
8c81598d
JM
1418information.
1419
8c7707b0 1420@item -fno-rtti
cd3bb277 1421@opindex fno-rtti
a7fbfcf9
JM
1422Disable generation of information about every class with virtual
1423functions for use by the C++ runtime type identification features
1424(@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1425of the language, you can save some space by using this flag. Note that
1426exception handling uses the same information, but it will generate it as
1427needed.
8c7707b0 1428
fcca588c 1429@item -fstats
cd3bb277 1430@opindex fstats
fcca588c
MM
1431Emit statistics about front-end processing at the end of the compilation.
1432This information is generally only useful to the G++ development team.
1433
1dc5fc4b 1434@item -ftemplate-depth-@var{n}
cd3bb277 1435@opindex ftemplate-depth
1dc5fc4b
JM
1436Set the maximum instantiation depth for template classes to @var{n}.
1437A limit on the template instantiation depth is needed to detect
767094dd 1438endless recursions during template class instantiation. ANSI/ISO C++
1dc5fc4b
JM
1439conforming programs must not rely on a maximum depth greater than 17.
1440
fc693822 1441@item -fuse-cxa-atexit
cd3bb277 1442@opindex fuse-cxa-atexit
fc693822
MM
1443Register destructors for objects with static storage duration with the
1444@code{__cxa_atexit} function rather than the @code{atexit} function.
1445This option is required for fully standards-compliant handling of static
1446destructors, but will only work if your C library supports
1447@code{__cxa_atexit}.
1448
90ecce3e 1449@item -fvtable-gc
cd3bb277 1450@opindex fvtable-gc
90ecce3e
JM
1451Emit special relocations for vtables and virtual function references
1452so that the linker can identify unused virtual functions and zero out
1453vtable slots that refer to them. This is most useful with
630d3d5a 1454@option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
90ecce3e 1455also discard the functions themselves.
f5a1b0d2 1456
90ecce3e 1457This optimization requires GNU as and GNU ld. Not all systems support
630d3d5a 1458this option. @option{-Wl,--gc-sections} is ignored without @option{-static}.
861bb6c1 1459
02f52e19 1460@item -fno-weak
cd3bb277 1461@opindex fno-weak
90ecce3e 1462Do not use weak symbol support, even if it is provided by the linker.
fcca588c
MM
1463By default, G++ will use weak symbols if they are available. This
1464option exists only for testing, and should not be used by end-users;
1465it will result in inferior code and has no benefits. This option may
1466be removed in a future release of G++.
1467
74291a4b 1468@item -nostdinc++
cd3bb277 1469@opindex nostdinc++
74291a4b
MM
1470Do not search for header files in the standard directories specific to
1471C++, but do still search the other standard directories. (This option
e5e809f4 1472is used when building the C++ library.)
74291a4b
MM
1473@end table
1474
1475In addition, these optimization, warning, and code generation options
1476have meanings only for C++ programs:
1477
2642624b 1478@table @gcctabopt
74291a4b 1479@item -fno-default-inline
cd3bb277 1480@opindex fno-default-inline
74291a4b 1481Do not assume @samp{inline} for functions defined inside a class scope.
1dc5fc4b
JM
1482@xref{Optimize Options,,Options That Control Optimization}. Note that these
1483functions will have linkage like inline functions; they just won't be
1484inlined by default.
74291a4b 1485
aee96fe9 1486@item -Wctor-dtor-privacy @r{(C++ only)}
cd3bb277 1487@opindex Wctor-dtor-privacy
bba975d4
JM
1488Warn when a class seems unusable, because all the constructors or
1489destructors in a class are private and the class has no friends or
1490public static member functions.
1491
aee96fe9 1492@item -Wnon-virtual-dtor @r{(C++ only)}
cd3bb277 1493@opindex Wnon-virtual-dtor
bba975d4
JM
1494Warn when a class declares a non-virtual destructor that should probably
1495be virtual, because it looks like the class will be used polymorphically.
1496
aee96fe9 1497@item -Wreorder @r{(C++ only)}
cd3bb277 1498@opindex Wreorder
bba975d4
JM
1499@cindex reordering, warning
1500@cindex warning for reordering of member initializers
1501Warn when the order of member initializers given in the code does not
1502match the order in which they must be executed. For instance:
1503
1504@smallexample
1505struct A @{
1506 int i;
1507 int j;
1508 A(): j (0), i (1) @{ @}
1509@};
1510@end smallexample
1511
1512Here the compiler will warn that the member initializers for @samp{i}
1513and @samp{j} will be rearranged to match the declaration order of the
1514members.
1515@end table
1516
630d3d5a 1517The following @option{-W@dots{}} options are not affected by @option{-Wall}.
bba975d4 1518
2642624b 1519@table @gcctabopt
aee96fe9 1520@item -Weffc++ @r{(C++ only)}
cd3bb277 1521@opindex Weffc++
bba975d4
JM
1522Warn about violations of various style guidelines from Scott Meyers'
1523@cite{Effective C++} books. If you use this option, you should be aware
1524that the standard library headers do not obey all of these guidelines;
1525you can use @samp{grep -v} to filter out those warnings.
1526
aee96fe9 1527@item -Wno-deprecated @r{(C++ only)}
cd3bb277 1528@opindex Wno-deprecated
767094dd 1529Do not warn about usage of deprecated features. @xref{Deprecated Features}.
2de45c06 1530
aee96fe9 1531@item -Wno-non-template-friend @r{(C++ only)}
cd3bb277 1532@opindex Wno-non-template-friend
bba975d4 1533Disable warnings when non-templatized friend functions are declared
767094dd 1534within a template. With the advent of explicit template specification
aee96fe9 1535support in G++, if the name of the friend is an unqualified-id (i.e.,
bba975d4 1536@samp{friend foo(int)}), the C++ language specification demands that the
767094dd 1537friend declare or define an ordinary, nontemplate function. (Section
aee96fe9 153814.5.3). Before G++ implemented explicit specification, unqualified-ids
bba975d4 1539could be interpreted as a particular specialization of a templatized
767094dd 1540function. Because this non-conforming behavior is no longer the default
aee96fe9 1541behavior for G++, @option{-Wnon-template-friend} allows the compiler to
bba975d4 1542check existing code for potential trouble spots, and is on by default.
2228d450 1543This new compiler behavior can be turned off with
630d3d5a 1544@option{-Wno-non-template-friend} which keeps the conformant compiler code
2228d450 1545but disables the helpful warning.
bba975d4 1546
aee96fe9 1547@item -Wold-style-cast @r{(C++ only)}
cd3bb277 1548@opindex Wold-style-cast
bba975d4
JM
1549Warn if an old-style (C-style) cast is used within a C++ program. The
1550new-style casts (@samp{static_cast}, @samp{reinterpret_cast}, and
90ecce3e
JM
1551@samp{const_cast}) are less vulnerable to unintended effects, and much
1552easier to grep for.
bba975d4 1553
aee96fe9 1554@item -Woverloaded-virtual @r{(C++ only)}
cd3bb277 1555@opindex Woverloaded-virtual
bba975d4
JM
1556@cindex overloaded virtual fn, warning
1557@cindex warning for overloaded virtual fn
3747f3dc
MM
1558Warn when a function declaration hides virtual functions from a
1559base class. For example, in:
1560
1561@smallexample
1562struct A @{
1563 virtual void f();
1564@};
1565
1566struct B: public A @{
1567 void f(int);
1568@};
1569@end smallexample
1570
1571the @code{A} class version of @code{f} is hidden in @code{B}, and code
1572like this:
1573
1574@smallexample
1575B* b;
1576b->f();
1577@end smallexample
1578
1579will fail to compile.
bba975d4 1580
aee96fe9 1581@item -Wno-pmf-conversions @r{(C++ only)}
cd3bb277 1582@opindex Wno-pmf-conversions
bba975d4
JM
1583Disable the diagnostic for converting a bound pointer to member function
1584to a plain pointer.
1585
aee96fe9 1586@item -Wsign-promo @r{(C++ only)}
cd3bb277 1587@opindex Wsign-promo
bba975d4
JM
1588Warn when overload resolution chooses a promotion from unsigned or
1589enumeral type to a signed type over a conversion to an unsigned type of
aee96fe9 1590the same size. Previous versions of G++ would try to preserve
bba975d4
JM
1591unsignedness, but the standard mandates the current behavior.
1592
aee96fe9 1593@item -Wsynth @r{(C++ only)}
cd3bb277 1594@opindex Wsynth
bba975d4
JM
1595@cindex warning for synthesized methods
1596@cindex synthesized methods, warning
aee96fe9 1597Warn when G++'s synthesis behavior does not match that of cfront. For
bba975d4
JM
1598instance:
1599
1600@smallexample
1601struct A @{
1602 operator int ();
1603 A& operator = (int);
1604@};
1605
1606main ()
1607@{
1608 A a,b;
1609 a = b;
1610@}
1611@end smallexample
74291a4b 1612
aee96fe9 1613In this example, G++ will synthesize a default @samp{A& operator =
bba975d4 1614(const A&);}, while cfront will use the user-defined @samp{operator =}.
74291a4b
MM
1615@end table
1616
60de6385
SS
1617@node Objective-C Dialect Options
1618@section Options Controlling Objective-C Dialect
1619
1620@cindex compiler options, Objective-C
1621@cindex Objective-C options, command line
1622@cindex options, Objective-C
1623This section describes the command-line options that are only meaningful
1624for Objective-C programs; but you can also use most of the GNU compiler
1625options regardless of what language your program is in. For example,
1626you might compile a file @code{some_class.m} like this:
1627
1628@example
1629gcc -g -fgnu-runtime -O -c some_class.m
1630@end example
1631
1632@noindent
630d3d5a 1633In this example, only @option{-fgnu-runtime} is an option meant only for
60de6385 1634Objective-C programs; you can use the other options with any language
161d7b59 1635supported by GCC@.
60de6385
SS
1636
1637Here is a list of options that are @emph{only} for compiling Objective-C
1638programs:
1639
1640@table @gcctabopt
630d3d5a 1641@item -fconstant-string-class=@var{class-name}
cd3bb277 1642@opindex fconstant-string-class
630d3d5a 1643Use @var{class-name} as the name of the class to instantiate for each
695ac33f 1644literal string specified with the syntax @code{@@"@dots{}"}. The default
60de6385
SS
1645class name is @code{NXConstantString}.
1646
1647@item -fgnu-runtime
cd3bb277 1648@opindex fgnu-runtime
60de6385
SS
1649Generate object code compatible with the standard GNU Objective-C
1650runtime. This is the default for most types of systems.
1651
1652@item -fnext-runtime
cd3bb277 1653@opindex fnext-runtime
60de6385 1654Generate output compatible with the NeXT runtime. This is the default
161d7b59 1655for NeXT-based systems, including Darwin and Mac OS X@.
60de6385
SS
1656
1657@item -gen-decls
cd3bb277 1658@opindex gen-decls
60de6385
SS
1659Dump interface declarations for all classes seen in the source file to a
1660file named @file{@var{sourcename}.decl}.
1661
1662@item -Wno-protocol
cd3bb277 1663@opindex Wno-protocol
60de6385
SS
1664Do not warn if methods required by a protocol are not implemented
1665in the class adopting it.
1666
1667@item -Wselector
cd3bb277 1668@opindex Wselector
60de6385
SS
1669Warn if a selector has multiple methods of different types defined.
1670
1671@c not documented because only avail via -Wp
1672@c @item -print-objc-runtime-info
1673
1674@end table
1675
764dbbf2
GDR
1676@node Language Independent Options
1677@section Options to Control Diagnostic Messages Formatting
1678@cindex options to control diagnostics formatting
1679@cindex diagnostic messages
1680@cindex message formatting
1681
b192711e 1682Traditionally, diagnostic messages have been formatted irrespective of
e979f9e8 1683the output device's aspect (e.g.@: its width, @dots{}). The options described
764dbbf2 1684below can be used to control the diagnostic messages formatting
e979f9e8 1685algorithm, e.g.@: how many characters per line, how often source location
6c0a4eab 1686information should be reported. Right now, only the C++ front end can
764dbbf2 1687honor these options. However it is expected, in the near future, that
6c0a4eab 1688the remaining front ends would be able to digest them correctly.
764dbbf2 1689
2642624b 1690@table @gcctabopt
764dbbf2 1691@item -fmessage-length=@var{n}
cd3bb277 1692@opindex fmessage-length
764dbbf2 1693Try to format error messages so that they fit on lines of about @var{n}
aee96fe9 1694characters. The default is 72 characters for @command{g++} and 0 for the rest of
161d7b59 1695the front ends supported by GCC@. If @var{n} is zero, then no
02f52e19 1696line-wrapping will be done; each error message will appear on a single
764dbbf2
GDR
1697line.
1698
cd3bb277 1699@opindex fdiagnostics-show-location
764dbbf2 1700@item -fdiagnostics-show-location=once
b192711e 1701Only meaningful in line-wrapping mode. Instructs the diagnostic messages
764dbbf2
GDR
1702reporter to emit @emph{once} source location information; that is, in
1703case the message is too long to fit on a single physical line and has to
1704be wrapped, the source location won't be emitted (as prefix) again,
1705over and over, in subsequent continuation lines. This is the default
02f52e19 1706behaviour.
764dbbf2
GDR
1707
1708@item -fdiagnostics-show-location=every-line
1709Only meaningful in line-wrapping mode. Instructs the diagnostic
1710messages reporter to emit the same source location information (as
1711prefix) for physical lines that result from the process of breaking a
b192711e 1712a message which is too long to fit on a single line.
764dbbf2
GDR
1713
1714@end table
1715
74291a4b
MM
1716@node Warning Options
1717@section Options to Request or Suppress Warnings
1718@cindex options to control warnings
1719@cindex warning messages
1720@cindex messages, warning
1721@cindex suppressing warnings
1722
1723Warnings are diagnostic messages that report constructions which
1724are not inherently erroneous but which are risky or suggest there
1725may have been an error.
1726
1727You can request many specific warnings with options beginning @samp{-W},
630d3d5a 1728for example @option{-Wimplicit} to request warnings on implicit
74291a4b
MM
1729declarations. Each of these specific warning options also has a
1730negative form beginning @samp{-Wno-} to turn off warnings;
630d3d5a 1731for example, @option{-Wno-implicit}. This manual lists only one of the
74291a4b
MM
1732two forms, whichever is not the default.
1733
0c2d1a2a 1734These options control the amount and kinds of warnings produced by GCC:
74291a4b 1735
2642624b 1736@table @gcctabopt
74291a4b
MM
1737@cindex syntax checking
1738@item -fsyntax-only
cd3bb277 1739@opindex fsyntax-only
74291a4b
MM
1740Check the code for syntax errors, but don't do anything beyond that.
1741
1742@item -pedantic
cd3bb277 1743@opindex pedantic
074e95e3
JM
1744Issue all the warnings demanded by strict ISO C and ISO C++;
1745reject all programs that use forbidden extensions, and some other
1746programs that do not follow ISO C and ISO C++. For ISO C, follows the
630d3d5a 1747version of the ISO C standard specified by any @option{-std} option used.
74291a4b 1748
074e95e3 1749Valid ISO C and ISO C++ programs should compile properly with or without
5490d604 1750this option (though a rare few will require @option{-ansi} or a
161d7b59 1751@option{-std} option specifying the required version of ISO C)@. However,
b1d16193
JL
1752without this option, certain GNU extensions and traditional C and C++
1753features are supported as well. With this option, they are rejected.
74291a4b 1754
630d3d5a 1755@option{-pedantic} does not cause warning messages for use of the
74291a4b
MM
1756alternate keywords whose names begin and end with @samp{__}. Pedantic
1757warnings are also disabled in the expression that follows
1758@code{__extension__}. However, only system header files should use
1759these escape routes; application programs should avoid them.
1760@xref{Alternate Keywords}.
1761
630d3d5a 1762Some users try to use @option{-pedantic} to check programs for strict ISO
74291a4b 1763C conformance. They soon find that it does not do quite what they want:
c1030c7c 1764it finds some non-ISO practices, but not all---only those for which
074e95e3
JM
1765ISO C @emph{requires} a diagnostic, and some others for which
1766diagnostics have been added.
74291a4b 1767
074e95e3 1768A feature to report any failure to conform to ISO C might be useful in
74291a4b 1769some instances, but would require considerable additional work and would
630d3d5a 1770be quite different from @option{-pedantic}. We don't have plans to
892d0a6d 1771support such a feature in the near future.
74291a4b 1772
91ea548a
JM
1773Where the standard specified with @option{-std} represents a GNU
1774extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
1775corresponding @dfn{base standard}, the version of ISO C on which the GNU
1776extended dialect is based. Warnings from @option{-pedantic} are given
1777where they are required by the base standard. (It would not make sense
1778for such warnings to be given only for features not in the specified GNU
1779C dialect, since by definition the GNU dialects of C include all
1780features the compiler supports with the given option, and there would be
1781nothing to warn about.)
1782
74291a4b 1783@item -pedantic-errors
cd3bb277 1784@opindex pedantic-errors
630d3d5a 1785Like @option{-pedantic}, except that errors are produced rather than
74291a4b
MM
1786warnings.
1787
1788@item -w
cd3bb277 1789@opindex w
74291a4b
MM
1790Inhibit all warning messages.
1791
1792@item -Wno-import
cd3bb277 1793@opindex Wno-import
74291a4b
MM
1794Inhibit warning messages about the use of @samp{#import}.
1795
1796@item -Wchar-subscripts
cd3bb277 1797@opindex Wchar-subscripts
74291a4b
MM
1798Warn if an array subscript has type @code{char}. This is a common cause
1799of error, as programmers often forget that this type is signed on some
1800machines.
1801
1802@item -Wcomment
cd3bb277 1803@opindex Wcomment
74291a4b
MM
1804Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1805comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1806
1807@item -Wformat
cd3bb277 1808@opindex Wformat
74291a4b
MM
1809Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1810the arguments supplied have types appropriate to the format string
26f6672d
JM
1811specified, and that the conversions specified in the format string make
1812sense. This includes standard functions, and others specified by format
1813attributes (@pxref{Function Attributes}), in the @code{printf},
1814@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
1815not in the C standard) families.
74291a4b 1816
8308e0b7
JM
1817The formats are checked against the format features supported by GNU
1818libc version 2.2. These include all ISO C89 and C99 features, as well
1819as features from the Single Unix Specification and some BSD and GNU
1820extensions. Other library implementations may not support all these
1821features; GCC does not support warning about features that go beyond a
630d3d5a
JM
1822particular library's limitations. However, if @option{-pedantic} is used
1823with @option{-Wformat}, warnings will be given about format features not
26f6672d
JM
1824in the selected standard version (but not for @code{strfmon} formats,
1825since those are not in any version of the C standard). @xref{C Dialect
1826Options,,Options Controlling C Dialect}.
8308e0b7 1827
630d3d5a
JM
1828@option{-Wformat} is included in @option{-Wall}. For more control over some
1829aspects of format checking, the options @option{-Wno-format-y2k},
1830@option{-Wno-format-extra-args}, @option{-Wformat-nonliteral},
1831@option{-Wformat-security} and @option{-Wformat=2} are available, but are
1832not included in @option{-Wall}.
4d808927
JM
1833
1834@item -Wno-format-y2k
cd3bb277 1835@opindex Wno-format-y2k
630d3d5a 1836If @option{-Wformat} is specified, do not warn about @code{strftime}
4d808927
JM
1837formats which may yield only a two-digit year.
1838
1839@item -Wno-format-extra-args
cd3bb277 1840@opindex Wno-format-extra-args
630d3d5a 1841If @option{-Wformat} is specified, do not warn about excess arguments to a
4d808927
JM
1842@code{printf} or @code{scanf} format function. The C standard specifies
1843that such arguments are ignored.
1844
1845@item -Wformat-nonliteral
cd3bb277 1846@opindex Wformat-nonliteral
630d3d5a 1847If @option{-Wformat} is specified, also warn if the format string is not a
4d808927
JM
1848string literal and so cannot be checked, unless the format function
1849takes its format arguments as a @code{va_list}.
1850
c907e684 1851@item -Wformat-security
cd3bb277 1852@opindex Wformat-security
630d3d5a 1853If @option{-Wformat} is specified, also warn about uses of format
c907e684
JM
1854functions that represent possible security problems. At present, this
1855warns about calls to @code{printf} and @code{scanf} functions where the
1856format string is not a string literal and there are no format arguments,
1857as in @code{printf (foo);}. This may be a security hole if the format
1858string came from untrusted input and contains @samp{%n}. (This is
630d3d5a
JM
1859currently a subset of what @option{-Wformat-nonliteral} warns about, but
1860in future warnings may be added to @option{-Wformat-security} that are not
1861included in @option{-Wformat-nonliteral}.)
c907e684 1862
4d808927 1863@item -Wformat=2
cd3bb277 1864@opindex Wformat=2
630d3d5a
JM
1865Enable @option{-Wformat} plus format checks not included in
1866@option{-Wformat}. Currently equivalent to @samp{-Wformat
c907e684 1867-Wformat-nonliteral -Wformat-security}.
4d808927 1868
e9a25f70 1869@item -Wimplicit-int
cd3bb277 1870@opindex Wimplicit-int
e9a25f70
JL
1871Warn when a declaration does not specify a type.
1872
f5963e61
JL
1873@item -Wimplicit-function-declaration
1874@itemx -Werror-implicit-function-declaration
cd3bb277
JM
1875@opindex Wimplicit-function-declaration
1876@opindex Werror-implicit-function-declaration
f5963e61
JL
1877Give a warning (or error) whenever a function is used before being
1878declared.
e9a25f70 1879
74291a4b 1880@item -Wimplicit
cd3bb277 1881@opindex Wimplicit
630d3d5a 1882Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
861bb6c1
JL
1883
1884@item -Wmain
cd3bb277 1885@opindex Wmain
861bb6c1
JL
1886Warn if the type of @samp{main} is suspicious. @samp{main} should be a
1887function with external linkage, returning int, taking either zero
1888arguments, two, or three arguments of appropriate types.
4a870dba 1889
1f0c3120 1890@item -Wmissing-braces
cd3bb277 1891@opindex Wmissing-braces
1f0c3120
JM
1892Warn if an aggregate or union initializer is not fully bracketed. In
1893the following example, the initializer for @samp{a} is not fully
1894bracketed, but that for @samp{b} is fully bracketed.
1895
1896@smallexample
1897int a[2][2] = @{ 0, 1, 2, 3 @};
1898int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
1899@end smallexample
1900
4a870dba 1901@item -Wmultichar
cd3bb277 1902@opindex Wmultichar
4a870dba
JM
1903Warn if a multicharacter constant (@samp{'FOOF'}) is used. Usually they
1904indicate a typo in the user's code, as they have implementation-defined
1905values, and should not be used in portable code.
3c12fcc2 1906
74291a4b 1907@item -Wparentheses
cd3bb277 1908@opindex Wparentheses
74291a4b
MM
1909Warn if parentheses are omitted in certain contexts, such
1910as when there is an assignment in a context where a truth value
1911is expected, or when operators are nested whose precedence people
1912often get confused about.
1913
e9a25f70
JL
1914Also warn about constructions where there may be confusion to which
1915@code{if} statement an @code{else} branch belongs. Here is an example of
1916such a case:
1917
1918@smallexample
aee96fe9 1919@group
e9a25f70
JL
1920@{
1921 if (a)
1922 if (b)
1923 foo ();
1924 else
1925 bar ();
1926@}
aee96fe9 1927@end group
e9a25f70
JL
1928@end smallexample
1929
1930In C, every @code{else} branch belongs to the innermost possible @code{if}
1931statement, which in this example is @code{if (b)}. This is often not
1932what the programmer expected, as illustrated in the above example by
1933indentation the programmer chose. When there is the potential for this
f0523f02 1934confusion, GCC will issue a warning when this flag is specified.
e9a25f70
JL
1935To eliminate the warning, add explicit braces around the innermost
1936@code{if} statement so there is no way the @code{else} could belong to
1937the enclosing @code{if}. The resulting code would look like this:
1938
1939@smallexample
aee96fe9 1940@group
e9a25f70
JL
1941@{
1942 if (a)
1943 @{
1944 if (b)
1945 foo ();
1946 else
1947 bar ();
1948 @}
1949@}
aee96fe9 1950@end group
e9a25f70
JL
1951@end smallexample
1952
bb58bec5 1953@item -Wsequence-point
cd3bb277 1954@opindex Wsequence-point
bb58bec5
JM
1955Warn about code that may have undefined semantics because of violations
1956of sequence point rules in the C standard.
1957
1958The C standard defines the order in which expressions in a C program are
1959evaluated in terms of @dfn{sequence points}, which represent a partial
1960ordering between the execution of parts of the program: those executed
1961before the sequence point, and those executed after it. These occur
1962after the evaluation of a full expression (one which is not part of a
1963larger expression), after the evaluation of the first operand of a
1964@code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
1965function is called (but after the evaluation of its arguments and the
1966expression denoting the called function), and in certain other places.
1967Other than as expressed by the sequence point rules, the order of
1968evaluation of subexpressions of an expression is not specified. All
1969these rules describe only a partial order rather than a total order,
1970since, for example, if two functions are called within one expression
1971with no sequence point between them, the order in which the functions
1972are called is not specified. However, the standards committee have
1973ruled that function calls do not overlap.
1974
1975It is not specified when between sequence points modifications to the
1976values of objects take effect. Programs whose behavior depends on this
1977have undefined behavior; the C standard specifies that ``Between the
1978previous and next sequence point an object shall have its stored value
1979modified at most once by the evaluation of an expression. Furthermore,
1980the prior value shall be read only to determine the value to be
1981stored.''. If a program breaks these rules, the results on any
1982particular implementation are entirely unpredictable.
1983
1984Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
1985= b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
1986diagnosed by this option, and it may give an occasional false positive
1987result, but in general it has been found fairly effective at detecting
1988this sort of problem in programs.
1989
1990The present implementation of this option only works for C programs. A
1991future implementation may also work for C++ programs.
1992
1993There is some controversy over the precise meaning of the sequence point
c5122d75
JM
1994rules in subtle cases. Links to papers with alternative formal definitions
1995and other related discussions may be found on our readings page
1996@w{@uref{http://gcc.gnu.org/readings.html}}.
bb58bec5 1997
74291a4b 1998@item -Wreturn-type
cd3bb277 1999@opindex Wreturn-type
32c4c36c
ML
2000Warn whenever a function is defined with a return-type that defaults to
2001@code{int}. Also warn about any @code{return} statement with no
02f52e19 2002return-value in a function whose return-type is not @code{void}.
32c4c36c
ML
2003
2004For C++, a function without return type always produces a diagnostic
767094dd 2005message, even when @option{-Wno-return-type} is specified. The only
32c4c36c 2006exceptions are @samp{main} and functions defined in system headers.
74291a4b
MM
2007
2008@item -Wswitch
cd3bb277 2009@opindex Wswitch
74291a4b
MM
2010Warn whenever a @code{switch} statement has an index of enumeral type
2011and lacks a @code{case} for one or more of the named codes of that
2012enumeration. (The presence of a @code{default} label prevents this
2013warning.) @code{case} labels outside the enumeration range also
2014provoke warnings when this option is used.
2015
2016@item -Wtrigraphs
cd3bb277 2017@opindex Wtrigraphs
f2ecb02d
JM
2018Warn if any trigraphs are encountered that might change the meaning of
2019the program (trigraphs within comments are not warned about).
74291a4b 2020
078721e1 2021@item -Wunused-function
cd3bb277 2022@opindex Wunused-function
078721e1
AC
2023Warn whenever a static function is declared but not defined or a
2024non\-inline static function is unused.
74291a4b 2025
078721e1 2026@item -Wunused-label
cd3bb277 2027@opindex Wunused-label
078721e1
AC
2028Warn whenever a label is declared but not used.
2029
2030To suppress this warning use the @samp{unused} attribute
2031(@pxref{Variable Attributes}).
2032
2033@item -Wunused-parameter
cd3bb277 2034@opindex Wunused-parameter
078721e1
AC
2035Warn whenever a function parameter is unused aside from its declaration.
2036
2037To suppress this warning use the @samp{unused} attribute
2038(@pxref{Variable Attributes}).
956d6950 2039
078721e1 2040@item -Wunused-variable
cd3bb277 2041@opindex Wunused-variable
078721e1
AC
2042Warn whenever a local variable or non-constant static variable is unused
2043aside from its declaration
2044
2045To suppress this warning use the @samp{unused} attribute
74291a4b
MM
2046(@pxref{Variable Attributes}).
2047
078721e1 2048@item -Wunused-value
cd3bb277 2049@opindex Wunused-value
078721e1
AC
2050Warn whenever a statement computes a result that is explicitly not used.
2051
2052To suppress this warning cast the expression to @samp{void}.
2053
2054@item -Wunused
cd3bb277 2055@opindex Wunused
630d3d5a 2056All all the above @option{-Wunused} options combined.
078721e1
AC
2057
2058In order to get a warning about an unused function parameter, you must
b192711e 2059either specify @samp{-W -Wunused} or separately specify
630d3d5a 2060@option{-Wunused-parameter}.
078721e1 2061
74291a4b 2062@item -Wuninitialized
cd3bb277 2063@opindex Wuninitialized
c5c76735
JL
2064Warn if an automatic variable is used without first being initialized or
2065if a variable may be clobbered by a @code{setjmp} call.
74291a4b
MM
2066
2067These warnings are possible only in optimizing compilation,
2068because they require data flow information that is computed only
630d3d5a 2069when optimizing. If you don't specify @option{-O}, you simply won't
74291a4b
MM
2070get these warnings.
2071
2072These warnings occur only for variables that are candidates for
2073register allocation. Therefore, they do not occur for a variable that
2074is declared @code{volatile}, or whose address is taken, or whose size
2075is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
2076structures, unions or arrays, even when they are in registers.
2077
2078Note that there may be no warning about a variable that is used only
2079to compute a value that itself is never used, because such
2080computations may be deleted by data flow analysis before the warnings
2081are printed.
2082
0c2d1a2a 2083These warnings are made optional because GCC is not smart
74291a4b
MM
2084enough to see all the reasons why the code might be correct
2085despite appearing to have an error. Here is one example of how
2086this can happen:
2087
2088@smallexample
aee96fe9 2089@group
74291a4b
MM
2090@{
2091 int x;
2092 switch (y)
2093 @{
2094 case 1: x = 1;
2095 break;
2096 case 2: x = 4;
2097 break;
2098 case 3: x = 5;
2099 @}
2100 foo (x);
2101@}
aee96fe9 2102@end group
74291a4b
MM
2103@end smallexample
2104
2105@noindent
2106If the value of @code{y} is always 1, 2 or 3, then @code{x} is
0c2d1a2a 2107always initialized, but GCC doesn't know this. Here is
74291a4b
MM
2108another common case:
2109
2110@smallexample
2111@{
2112 int save_y;
2113 if (change_y) save_y = y, y = new_y;
2114 @dots{}
2115 if (change_y) y = save_y;
2116@}
2117@end smallexample
2118
2119@noindent
2120This has no bug because @code{save_y} is used only if it is set.
2121
20300b05 2122@cindex @code{longjmp} warnings
b192711e 2123This option also warns when a non-volatile automatic variable might be
c5c76735
JL
2124changed by a call to @code{longjmp}. These warnings as well are possible
2125only in optimizing compilation.
20300b05
GK
2126
2127The compiler sees only the calls to @code{setjmp}. It cannot know
2128where @code{longjmp} will be called; in fact, a signal handler could
2129call it at any point in the code. As a result, you may get a warning
2130even when there is in fact no problem because @code{longjmp} cannot
2131in fact be called at the place which would cause a problem.
2132
74291a4b
MM
2133Some spurious warnings can be avoided if you declare all the functions
2134you use that never return as @code{noreturn}. @xref{Function
2135Attributes}.
2136
aee96fe9 2137@item -Wreorder @r{(C++ only)}
cd3bb277 2138@opindex Wreorder
c5c76735
JL
2139@cindex reordering, warning
2140@cindex warning for reordering of member initializers
2141Warn when the order of member initializers given in the code does not
2142match the order in which they must be executed. For instance:
2143
d300e551 2144@item -Wunknown-pragmas
cd3bb277 2145@opindex Wunknown-pragmas
d300e551
NC
2146@cindex warning for unknown pragmas
2147@cindex unknown pragmas, warning
2148@cindex pragmas, warning of unknown
2149Warn when a #pragma directive is encountered which is not understood by
161d7b59 2150GCC@. If this command line option is used, warnings will even be issued
d300e551 2151for unknown pragmas in system header files. This is not the case if
630d3d5a 2152the warnings were only enabled by the @option{-Wall} command line option.
d300e551 2153
74291a4b 2154@item -Wall
cd3bb277 2155@opindex Wall
74291a4b
MM
2156All of the above @samp{-W} options combined. This enables all the
2157warnings about constructions that some users consider questionable, and
2158that are easy to avoid (or modify to prevent the warning), even in
2159conjunction with macros.
317639a8
BC
2160
2161@item -Wsystem-headers
cd3bb277 2162@opindex Wsystem-headers
317639a8
BC
2163@cindex warnings from system headers
2164@cindex system headers, warnings from
2165Print warning messages for constructs found in system header files.
2166Warnings from system headers are normally suppressed, on the assumption
2167that they usually do not indicate real problems and would only make the
2168compiler output harder to read. Using this command line option tells
2169GCC to emit warnings from system headers as if they occurred in user
630d3d5a 2170code. However, note that using @option{-Wall} in conjunction with this
317639a8 2171option will @emph{not} warn about unknown pragmas in system
630d3d5a 2172headers---for that, @option{-Wunknown-pragmas} must also be used.
74291a4b
MM
2173@end table
2174
630d3d5a 2175The following @option{-W@dots{}} options are not implied by @option{-Wall}.
74291a4b
MM
2176Some of them warn about constructions that users generally do not
2177consider questionable, but which occasionally you might wish to check
2178for; others warn about constructions that are necessary or hard to avoid
2179in some cases, and there is no simple way to modify the code to suppress
2180the warning.
2181
2642624b 2182@table @gcctabopt
74291a4b 2183@item -W
cd3bb277 2184@opindex W
74291a4b
MM
2185Print extra warning messages for these events:
2186
2187@itemize @bullet
74291a4b
MM
2188@item
2189A function can return either with or without a value. (Falling
2190off the end of the function body is considered returning without
2191a value.) For example, this function would evoke such a
2192warning:
2193
2194@smallexample
2195@group
2196foo (a)
2197@{
2198 if (a > 0)
2199 return a;
2200@}
2201@end group
2202@end smallexample
2203
2204@item
2205An expression-statement or the left-hand side of a comma expression
2206contains no side effects.
2207To suppress the warning, cast the unused expression to void.
2208For example, an expression such as @samp{x[i,j]} will cause a warning,
2209but @samp{x[(void)i,j]} will not.
2210
2211@item
2212An unsigned value is compared against zero with @samp{<} or @samp{<=}.
2213
2214@item
2215A comparison like @samp{x<=y<=z} appears; this is equivalent to
2216@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2217that of ordinary mathematical notation.
2218
2219@item
2220Storage-class specifiers like @code{static} are not the first things in
2221a declaration. According to the C Standard, this usage is obsolescent.
2222
e0c9fbb7
JM
2223@item
2224The return type of a function has a type qualifier such as @code{const}.
2225Such a type qualifier has no effect, since the value returned by a
2226function is not an lvalue. (But don't warn about the GNU extension of
2227@code{volatile void} return types. That extension will be warned about
630d3d5a 2228if @option{-pedantic} is specified.)
e0c9fbb7 2229
74291a4b 2230@item
630d3d5a 2231If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
74291a4b
MM
2232arguments.
2233
e9a25f70
JL
2234@item
2235A comparison between signed and unsigned values could produce an
2236incorrect result when the signed value is converted to unsigned.
630d3d5a 2237(But don't warn if @option{-Wno-sign-compare} is also specified.)
e9a25f70 2238
74291a4b
MM
2239@item
2240An aggregate has a partly bracketed initializer.
2241For example, the following code would evoke such a warning,
2242because braces are missing around the initializer for @code{x.h}:
2243
2244@smallexample
2245struct s @{ int f, g; @};
2246struct t @{ struct s h; int i; @};
2247struct t x = @{ 1, 2, 3 @};
2248@end smallexample
dbde0d5d
BH
2249
2250@item
2251An aggregate has an initializer which does not initialize all members.
2252For example, the following code would cause such a warning, because
2253@code{x.h} would be implicitly initialized to zero:
2254
2255@smallexample
2256struct s @{ int f, g, h; @};
2257struct s x = @{ 3, 4 @};
2258@end smallexample
74291a4b
MM
2259@end itemize
2260
f793a95e 2261@item -Wfloat-equal
cd3bb277 2262@opindex Wfloat-equal
f793a95e
JL
2263Warn if floating point values are used in equality comparisons.
2264
488d3985
GK
2265The idea behind this is that sometimes it is convenient (for the
2266programmer) to consider floating-point values as approximations to
2267infinitely precise real numbers. If you are doing this, then you need
2268to compute (by analysing the code, or in some other way) the maximum or
2269likely maximum error that the computation introduces, and allow for it
2270when performing comparisons (and when producing output, but that's a
2271different problem). In particular, instead of testing for equality, you
2272would check to see whether the two values have ranges that overlap; and
2273this is done with the relational operators, so equality comparisons are
2274probably mistaken.
2275
aee96fe9 2276@item -Wtraditional @r{(C only)}
cd3bb277 2277@opindex Wtraditional
74291a4b 2278Warn about certain constructs that behave differently in traditional and
161d7b59 2279ISO C@. Also warn about ISO C constructs that have no traditional C
c8abc684 2280equivalent, and/or problematic constructs which should be avoided.
74291a4b
MM
2281
2282@itemize @bullet
2283@item
da312b55
NB
2284Macro parameters that appear within string literals in the macro body.
2285In traditional C macro replacement takes place within string literals,
161d7b59 2286but does not in ISO C@.
da312b55
NB
2287
2288@item
2289In traditional C, some preprocessor directives did not exist.
2290Traditional preprocessors would only consider a line to be a directive
2291if the @samp{#} appeared in column 1 on the line. Therefore
630d3d5a 2292@option{-Wtraditional} warns about directives that traditional C
da312b55
NB
2293understands but would ignore because the @samp{#} does not appear as the
2294first character on the line. It also suggests you hide directives like
2295@samp{#pragma} not understood by traditional C by indenting them. Some
2296traditional implementations would not recognise @samp{#elif}, so it
2297suggests avoiding it altogether.
2298
2299@item
2300A function-like macro that appears without arguments.
2301
2302@item
2303The unary plus operator.
2304
2305@item
c771326b
JM
2306The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2307constant suffixes. (Traditional C does support the @samp{L} suffix on integer
da312b55 2308constants.) Note, these suffixes appear in macros defined in the system
e979f9e8 2309headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
c8abc684
KG
2310Use of these macros in user code might normally lead to spurious
2311warnings, however gcc's integrated preprocessor has enough context to
2312avoid warning in these cases.
74291a4b
MM
2313
2314@item
2315A function declared external in one block and then used after the end of
2316the block.
2317
2318@item
2319A @code{switch} statement has an operand of type @code{long}.
db838bb8
KG
2320
2321@item
2322A non-@code{static} function declaration follows a @code{static} one.
2323This construct is not accepted by some traditional C compilers.
48776cde
KG
2324
2325@item
c1030c7c 2326The ISO type of an integer constant has a different width or
48776cde 2327signedness from its traditional type. This warning is only issued if
e979f9e8 2328the base of the constant is ten. I.e.@: hexadecimal or octal values, which
48776cde 2329typically represent bit patterns, are not warned about.
bb66adca
KG
2330
2331@item
c1030c7c 2332Usage of ISO string concatenation is detected.
7f094a94 2333
895ea614
KG
2334@item
2335Initialization of automatic aggregates.
2336
2337@item
2338Identifier conflicts with labels. Traditional C lacks a separate
2339namespace for labels.
253b6b82
KG
2340
2341@item
2342Initialization of unions. If the initializer is zero, the warning is
2343omitted. This is done under the assumption that the zero initializer in
e979f9e8 2344user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
253b6b82
KG
2345initializer warnings and relies on default initialization to zero in the
2346traditional C case.
03829ad2
KG
2347
2348@item
3ed56f8a
KG
2349Conversions by prototypes between fixed/floating point values and vice
2350versa. The absence of these prototypes when compiling with traditional
2351C would cause serious problems. This is a subset of the possible
630d3d5a 2352conversion warnings, for the full set use @option{-Wconversion}.
74291a4b
MM
2353@end itemize
2354
861bb6c1 2355@item -Wundef
cd3bb277 2356@opindex Wundef
861bb6c1
JL
2357Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2358
74291a4b 2359@item -Wshadow
cd3bb277 2360@opindex Wshadow
d773df5a
DB
2361Warn whenever a local variable shadows another local variable, parameter or
2362global variable or whenever a built-in function is shadowed.
74291a4b 2363
74291a4b 2364@item -Wlarger-than-@var{len}
cd3bb277 2365@opindex Wlarger-than
74291a4b
MM
2366Warn whenever an object of larger than @var{len} bytes is defined.
2367
2368@item -Wpointer-arith
cd3bb277 2369@opindex Wpointer-arith
74291a4b
MM
2370Warn about anything that depends on the ``size of'' a function type or
2371of @code{void}. GNU C assigns these types a size of 1, for
2372convenience in calculations with @code{void *} pointers and pointers
2373to functions.
2374
aee96fe9 2375@item -Wbad-function-cast @r{(C only)}
cd3bb277 2376@opindex Wbad-function-cast
74291a4b
MM
2377Warn whenever a function call is cast to a non-matching type.
2378For example, warn if @code{int malloc()} is cast to @code{anything *}.
2379
2380@item -Wcast-qual
cd3bb277 2381@opindex Wcast-qual
74291a4b
MM
2382Warn whenever a pointer is cast so as to remove a type qualifier from
2383the target type. For example, warn if a @code{const char *} is cast
2384to an ordinary @code{char *}.
2385
2386@item -Wcast-align
cd3bb277 2387@opindex Wcast-align
74291a4b
MM
2388Warn whenever a pointer is cast such that the required alignment of the
2389target is increased. For example, warn if a @code{char *} is cast to
2390an @code{int *} on machines where integers can only be accessed at
2391two- or four-byte boundaries.
2392
2393@item -Wwrite-strings
cd3bb277 2394@opindex Wwrite-strings
aee96fe9
JM
2395When compiling C, give string constants the type @code{const
2396char[@var{length}]} so that
74291a4b 2397copying the address of one into a non-@code{const} @code{char *}
aee96fe9
JM
2398pointer will get a warning; when compiling C++, warn about the
2399deprecated conversion from string constants to @code{char *}.
2400These warnings will help you find at
74291a4b
MM
2401compile time code that can try to write into a string constant, but
2402only if you have been very careful about using @code{const} in
2403declarations and prototypes. Otherwise, it will just be a nuisance;
630d3d5a 2404this is why we did not make @option{-Wall} request these warnings.
74291a4b
MM
2405
2406@item -Wconversion
cd3bb277 2407@opindex Wconversion
74291a4b
MM
2408Warn if a prototype causes a type conversion that is different from what
2409would happen to the same argument in the absence of a prototype. This
2410includes conversions of fixed point to floating and vice versa, and
2411conversions changing the width or signedness of a fixed point argument
2412except when the same as the default promotion.
2413
2414Also, warn if a negative integer constant expression is implicitly
2415converted to an unsigned type. For example, warn about the assignment
2416@code{x = -1} if @code{x} is unsigned. But do not warn about explicit
2417casts like @code{(unsigned) -1}.
2418
e9a25f70 2419@item -Wsign-compare
cd3bb277 2420@opindex Wsign-compare
e9a25f70
JL
2421@cindex warning for comparison of signed and unsigned values
2422@cindex comparison of signed and unsigned values, warning
2423@cindex signed and unsigned values, comparison warning
2424Warn when a comparison between signed and unsigned values could produce
2425an incorrect result when the signed value is converted to unsigned.
630d3d5a
JM
2426This warning is also enabled by @option{-W}; to get the other warnings
2427of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}.
e9a25f70 2428
74291a4b 2429@item -Waggregate-return
cd3bb277 2430@opindex Waggregate-return
74291a4b
MM
2431Warn if any functions that return structures or unions are defined or
2432called. (In languages where you can return an array, this also elicits
2433a warning.)
2434
aee96fe9 2435@item -Wstrict-prototypes @r{(C only)}
cd3bb277 2436@opindex Wstrict-prototypes
74291a4b
MM
2437Warn if a function is declared or defined without specifying the
2438argument types. (An old-style function definition is permitted without
2439a warning if preceded by a declaration which specifies the argument
2440types.)
2441
aee96fe9 2442@item -Wmissing-prototypes @r{(C only)}
cd3bb277 2443@opindex Wmissing-prototypes
74291a4b
MM
2444Warn if a global function is defined without a previous prototype
2445declaration. This warning is issued even if the definition itself
2446provides a prototype. The aim is to detect global functions that fail
2447to be declared in header files.
2448
2449@item -Wmissing-declarations
cd3bb277 2450@opindex Wmissing-declarations
74291a4b
MM
2451Warn if a global function is defined without a previous declaration.
2452Do so even if the definition itself provides a prototype.
2453Use this option to detect global functions that are not declared in
2454header files.
2455
0ca3fb0a 2456@item -Wmissing-noreturn
cd3bb277 2457@opindex Wmissing-noreturn
0ca3fb0a
KG
2458Warn about functions which might be candidates for attribute @code{noreturn}.
2459Note these are only possible candidates, not absolute ones. Care should
2460be taken to manually verify functions actually do not ever return before
2461adding the @code{noreturn} attribute, otherwise subtle code generation
21c7361e
AJ
2462bugs could be introduced. You will not get a warning for @code{main} in
2463hosted C environments.
0ca3fb0a 2464
74ff4629 2465@item -Wmissing-format-attribute
cd3bb277
JM
2466@opindex Wmissing-format-attribute
2467@opindex Wformat
630d3d5a 2468If @option{-Wformat} is enabled, also warn about functions which might be
74ff4629
JM
2469candidates for @code{format} attributes. Note these are only possible
2470candidates, not absolute ones. GCC will guess that @code{format}
2471attributes might be appropriate for any function that calls a function
2472like @code{vprintf} or @code{vscanf}, but this might not always be the
2473case, and some functions for which @code{format} attributes are
2474appropriate may not be detected. This option has no effect unless
630d3d5a 2475@option{-Wformat} is enabled (possibly by @option{-Wall}).
74ff4629 2476
3c12fcc2 2477@item -Wpacked
cd3bb277 2478@opindex Wpacked
3c12fcc2 2479Warn if a structure is given the packed attribute, but the packed
02f52e19 2480attribute has no effect on the layout or size of the structure.
3c12fcc2
GM
2481Such structures may be mis-aligned for little benefit. For
2482instance, in this code, the variable @code{f.x} in @code{struct bar}
2483will be misaligned even though @code{struct bar} does not itself
2484have the packed attribute:
2485
2486@smallexample
2487@group
2488struct foo @{
2489 int x;
2490 char a, b, c, d;
2491@} __attribute__((packed));
2492struct bar @{
2493 char z;
2494 struct foo f;
2495@};
2496@end group
2497@end smallexample
2498
2499@item -Wpadded
cd3bb277 2500@opindex Wpadded
3c12fcc2
GM
2501Warn if padding is included in a structure, either to align an element
2502of the structure or to align the whole structure. Sometimes when this
2503happens it is possible to rearrange the fields of the structure to
2504reduce the padding and so make the structure smaller.
2505
74291a4b 2506@item -Wredundant-decls
cd3bb277 2507@opindex Wredundant-decls
74291a4b
MM
2508Warn if anything is declared more than once in the same scope, even in
2509cases where multiple declaration is valid and changes nothing.
2510
aee96fe9 2511@item -Wnested-externs @r{(C only)}
cd3bb277 2512@opindex Wnested-externs
252215a7 2513Warn if an @code{extern} declaration is encountered within a function.
74291a4b 2514
312f6255 2515@item -Wunreachable-code
cd3bb277 2516@opindex Wunreachable-code
312f6255
GK
2517Warn if the compiler detects that code will never be executed.
2518
2519This option is intended to warn when the compiler detects that at
2520least a whole line of source code will never be executed, because
2521some condition is never satisfied or because it is after a
2522procedure that never returns.
2523
2524It is possible for this option to produce a warning even though there
2525are circumstances under which part of the affected line can be executed,
2526so care should be taken when removing apparently-unreachable code.
2527
2528For instance, when a function is inlined, a warning may mean that the
02f52e19 2529line is unreachable in only one inlined copy of the function.
312f6255 2530
630d3d5a 2531This option is not made part of @option{-Wall} because in a debugging
312f6255
GK
2532version of a program there is often substantial code which checks
2533correct functioning of the program and is, hopefully, unreachable
2534because the program does work. Another common use of unreachable
2535code is to provide behaviour which is selectable at compile-time.
2536
74291a4b 2537@item -Winline
cd3bb277 2538@opindex Winline
c5c76735 2539Warn if a function can not be inlined and it was declared as inline.
74291a4b 2540
795add94 2541@item -Wlong-long
cd3bb277
JM
2542@opindex Wlong-long
2543@opindex Wno-long-long
795add94 2544Warn if @samp{long long} type is used. This is default. To inhibit
630d3d5a
JM
2545the warning messages, use @option{-Wno-long-long}. Flags
2546@option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2547only when @option{-pedantic} flag is used.
795add94 2548
18424ae1 2549@item -Wdisabled-optimization
cd3bb277 2550@opindex Wdisabled-optimization
18424ae1
BL
2551Warn if a requested optimization pass is disabled. This warning does
2552not generally indicate that there is anything wrong with your code; it
2553merely indicates that GCC's optimizers were unable to handle the code
2554effectively. Often, the problem is that your code is too big or too
2555complex; GCC will refuse to optimize programs when the optimization
2556itself is likely to take inordinate amounts of time.
2557
74291a4b 2558@item -Werror
cd3bb277 2559@opindex Werror
74291a4b
MM
2560Make all warnings into errors.
2561@end table
2562
2563@node Debugging Options
0c2d1a2a 2564@section Options for Debugging Your Program or GCC
74291a4b
MM
2565@cindex options, debugging
2566@cindex debugging information options
2567
0c2d1a2a 2568GCC has various special options that are used for debugging
74291a4b
MM
2569either your program or GCC:
2570
2642624b 2571@table @gcctabopt
74291a4b 2572@item -g
cd3bb277 2573@opindex g
74291a4b 2574Produce debugging information in the operating system's native format
161d7b59 2575(stabs, COFF, XCOFF, or DWARF)@. GDB can work with this debugging
74291a4b
MM
2576information.
2577
630d3d5a 2578On most systems that use stabs format, @option{-g} enables use of extra
74291a4b
MM
2579debugging information that only GDB can use; this extra information
2580makes debugging work better in GDB but will probably make other debuggers
2581crash or
2582refuse to read the program. If you want to control for certain whether
630d3d5a
JM
2583to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
2584@option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, or @option{-gdwarf-1}
74291a4b
MM
2585(see below).
2586
630d3d5a
JM
2587Unlike most other C compilers, GCC allows you to use @option{-g} with
2588@option{-O}. The shortcuts taken by optimized code may occasionally
74291a4b
MM
2589produce surprising results: some variables you declared may not exist
2590at all; flow of control may briefly move where you did not expect it;
2591some statements may not be executed because they compute constant
2592results or their values were already at hand; some statements may
2593execute in different places because they were moved out of loops.
2594
2595Nevertheless it proves possible to debug optimized output. This makes
2596it reasonable to use the optimizer for programs that might have bugs.
2597
0c2d1a2a 2598The following options are useful when GCC is generated with the
74291a4b
MM
2599capability for more than one debugging format.
2600
2601@item -ggdb
cd3bb277 2602@opindex ggdb
161d7b59 2603Produce debugging information for use by GDB@. This means to use the
861bb6c1
JL
2604most expressive format available (DWARF 2, stabs, or the native format
2605if neither of those are supported), including GDB extensions if at all
2606possible.
74291a4b
MM
2607
2608@item -gstabs
cd3bb277 2609@opindex gstabs
74291a4b
MM
2610Produce debugging information in stabs format (if that is supported),
2611without GDB extensions. This is the format used by DBX on most BSD
2612systems. On MIPS, Alpha and System V Release 4 systems this option
161d7b59 2613produces stabs debugging output which is not understood by DBX or SDB@.
74291a4b
MM
2614On System V Release 4 systems this option requires the GNU assembler.
2615
2616@item -gstabs+
cd3bb277 2617@opindex gstabs+
74291a4b 2618Produce debugging information in stabs format (if that is supported),
161d7b59 2619using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
2620use of these extensions is likely to make other debuggers crash or
2621refuse to read the program.
2622
2623@item -gcoff
cd3bb277 2624@opindex gcoff
74291a4b
MM
2625Produce debugging information in COFF format (if that is supported).
2626This is the format used by SDB on most System V systems prior to
2627System V Release 4.
2628
2629@item -gxcoff
cd3bb277 2630@opindex gxcoff
74291a4b
MM
2631Produce debugging information in XCOFF format (if that is supported).
2632This is the format used by the DBX debugger on IBM RS/6000 systems.
2633
2634@item -gxcoff+
cd3bb277 2635@opindex gxcoff+
74291a4b 2636Produce debugging information in XCOFF format (if that is supported),
161d7b59 2637using GNU extensions understood only by the GNU debugger (GDB)@. The
74291a4b
MM
2638use of these extensions is likely to make other debuggers crash or
2639refuse to read the program, and may cause assemblers other than the GNU
2640assembler (GAS) to fail with an error.
2641
2642@item -gdwarf
cd3bb277 2643@opindex gdwarf
861bb6c1
JL
2644Produce debugging information in DWARF version 1 format (if that is
2645supported). This is the format used by SDB on most System V Release 4
2646systems.
74291a4b
MM
2647
2648@item -gdwarf+
cd3bb277 2649@opindex gdwarf+
861bb6c1
JL
2650Produce debugging information in DWARF version 1 format (if that is
2651supported), using GNU extensions understood only by the GNU debugger
161d7b59 2652(GDB)@. The use of these extensions is likely to make other debuggers
861bb6c1
JL
2653crash or refuse to read the program.
2654
2655@item -gdwarf-2
cd3bb277 2656@opindex gdwarf-2
861bb6c1
JL
2657Produce debugging information in DWARF version 2 format (if that is
2658supported). This is the format used by DBX on IRIX 6.
74291a4b
MM
2659
2660@item -g@var{level}
2661@itemx -ggdb@var{level}
2662@itemx -gstabs@var{level}
2663@itemx -gcoff@var{level}
2664@itemx -gxcoff@var{level}
2665@itemx -gdwarf@var{level}
861bb6c1 2666@itemx -gdwarf-2@var{level}
74291a4b
MM
2667Request debugging information and also use @var{level} to specify how
2668much information. The default level is 2.
2669
2670Level 1 produces minimal information, enough for making backtraces in
2671parts of the program that you don't plan to debug. This includes
2672descriptions of functions and external variables, but no information
2673about local variables and no line numbers.
2674
2675Level 3 includes extra information, such as all the macro definitions
2676present in the program. Some debuggers support macro expansion when
630d3d5a 2677you use @option{-g3}.
74291a4b
MM
2678
2679@cindex @code{prof}
2680@item -p
cd3bb277 2681@opindex p
74291a4b
MM
2682Generate extra code to write profile information suitable for the
2683analysis program @code{prof}. You must use this option when compiling
2684the source files you want data about, and you must also use it when
2685linking.
2686
2687@cindex @code{gprof}
2688@item -pg
cd3bb277 2689@opindex pg
74291a4b
MM
2690Generate extra code to write profile information suitable for the
2691analysis program @code{gprof}. You must use this option when compiling
2692the source files you want data about, and you must also use it when
2693linking.
2694
2695@cindex @code{tcov}
2696@item -a
cd3bb277 2697@opindex a
74291a4b
MM
2698Generate extra code to write profile information for basic blocks, which will
2699record the number of times each basic block is executed, the basic block start
630d3d5a 2700address, and the function name containing the basic block. If @option{-g} is
74291a4b
MM
2701used, the line number and filename of the start of the basic block will also be
2702recorded. If not overridden by the machine description, the default action is
2703to append to the text file @file{bb.out}.
2704
2705This data could be analyzed by a program like @code{tcov}. Note,
2706however, that the format of the data is not what @code{tcov} expects.
2707Eventually GNU @code{gprof} should be extended to process this data.
2708
898f531b 2709@item -Q
cd3bb277 2710@opindex Q
898f531b
JL
2711Makes the compiler print out each function name as it is compiled, and
2712print some statistics about each pass when it finishes.
2713
1f0c3120 2714@item -ftime-report
cd3bb277 2715@opindex ftime-report
1f0c3120
JM
2716Makes the compiler print some statistics about the time consumed by each
2717pass when it finishes.
2718
2719@item -fmem-report
cd3bb277 2720@opindex fmem-report
1f0c3120
JM
2721Makes the compiler print some statistics about permanent memory
2722allocation when it finishes.
2723
74291a4b 2724@item -ax
cd3bb277 2725@opindex ax
74291a4b 2726Generate extra code to profile basic blocks. Your executable will
630d3d5a 2727produce output that is a superset of that produced when @option{-a} is
74291a4b
MM
2728used. Additional output is the source and target address of the basic
2729blocks where a jump takes place, the number of times a jump is executed,
2730and (optionally) the complete sequence of basic blocks being executed.
2731The output is appended to file @file{bb.out}.
2732
2733You can examine different profiling aspects without recompilation. Your
956d6950 2734executable will read a list of function names from file @file{bb.in}.
74291a4b
MM
2735Profiling starts when a function on the list is entered and stops when
2736that invocation is exited. To exclude a function from profiling, prefix
c771326b 2737its name with @samp{-}. If a function name is not unique, you can
74291a4b
MM
2738disambiguate it by writing it in the form
2739@samp{/path/filename.d:functionname}. Your executable will write the
2740available paths and filenames in file @file{bb.out}.
2741
2742Several function names have a special meaning:
2743@table @code
2744@item __bb_jumps__
2745Write source, target and frequency of jumps to file @file{bb.out}.
2746@item __bb_hidecall__
2747Exclude function calls from frequency count.
2748@item __bb_showret__
2749Include function returns in frequency count.
2750@item __bb_trace__
2751Write the sequence of basic blocks executed to file @file{bbtrace.gz}.
2752The file will be compressed using the program @samp{gzip}, which must
bedc7537 2753exist in your @env{PATH}. On systems without the @samp{popen}
74291a4b
MM
2754function, the file will be named @file{bbtrace} and will not be
2755compressed. @strong{Profiling for even a few seconds on these systems
2756will produce a very large file.} Note: @code{__bb_hidecall__} and
2757@code{__bb_showret__} will not affect the sequence written to
2758@file{bbtrace.gz}.
2759@end table
2760
2761Here's a short example using different profiling parameters
2762in file @file{bb.in}. Assume function @code{foo} consists of basic blocks
27631 and 2 and is called twice from block 3 of function @code{main}. After
2764the calls, block 3 transfers control to block 4 of @code{main}.
2765
2766With @code{__bb_trace__} and @code{main} contained in file @file{bb.in},
2767the following sequence of blocks is written to file @file{bbtrace.gz}:
27680 3 1 2 1 2 4. The return from block 2 to block 3 is not shown, because
2769the return is to a point inside the block and not to the top. The
2770block address 0 always indicates, that control is transferred
2771to the trace from somewhere outside the observed functions. With
2772@samp{-foo} added to @file{bb.in}, the blocks of function
2773@code{foo} are removed from the trace, so only 0 3 4 remains.
2774
2775With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in},
2776jump frequencies will be written to file @file{bb.out}. The
2777frequencies are obtained by constructing a trace of blocks
2778and incrementing a counter for every neighbouring pair of blocks
2779in the trace. The trace 0 3 1 2 1 2 4 displays the following
2780frequencies:
2781
2782@example
2783Jump from block 0x0 to block 0x3 executed 1 time(s)
2784Jump from block 0x3 to block 0x1 executed 1 time(s)
2785Jump from block 0x1 to block 0x2 executed 2 time(s)
2786Jump from block 0x2 to block 0x1 executed 1 time(s)
2787Jump from block 0x2 to block 0x4 executed 1 time(s)
2788@end example
2789
2790With @code{__bb_hidecall__}, control transfer due to call instructions
2791is removed from the trace, that is the trace is cut into three parts: 0
27923 4, 0 1 2 and 0 1 2. With @code{__bb_showret__}, control transfer due
2793to return instructions is added to the trace. The trace becomes: 0 3 1
27942 3 1 2 3 4. Note, that this trace is not the same, as the sequence
2795written to @file{bbtrace.gz}. It is solely used for counting jump
2796frequencies.
2797
861bb6c1 2798@item -fprofile-arcs
cd3bb277 2799@opindex fprofile-arcs
861bb6c1 2800Instrument @dfn{arcs} during compilation. For each function of your
0c2d1a2a 2801program, GCC creates a program flow graph, then finds a spanning tree
861bb6c1
JL
2802for the graph. Only arcs that are not on the spanning tree have to be
2803instrumented: the compiler adds code to count the number of times that these
2804arcs are executed. When an arc is the only exit or only entrance to a
2805block, the instrumentation code can be added to the block; otherwise, a
2806new basic block must be created to hold the instrumentation code.
2807
2808Since not every arc in the program must be instrumented, programs
2809compiled with this option run faster than programs compiled with
630d3d5a 2810@option{-a}, which adds instrumentation code to every basic block in the
861bb6c1
JL
2811program. The tradeoff: since @code{gcov} does not have
2812execution counts for all branches, it must start with the execution
2813counts for the instrumented branches, and then iterate over the program
2814flow graph until the entire graph has been solved. Hence, @code{gcov}
2815runs a little more slowly than a program which uses information from
630d3d5a 2816@option{-a}.
861bb6c1 2817
630d3d5a 2818@option{-fprofile-arcs} also makes it possible to estimate branch
861bb6c1
JL
2819probabilities, and to calculate basic block execution counts. In
2820general, basic block execution counts do not give enough information to
2821estimate all branch probabilities. When the compiled program exits, it
2822saves the arc execution counts to a file called
2823@file{@var{sourcename}.da}. Use the compiler option
630d3d5a 2824@option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
861bb6c1
JL
2825Control Optimization}) when recompiling, to optimize using estimated
2826branch probabilities.
2827
2828@need 2000
2829@item -ftest-coverage
cd3bb277 2830@opindex ftest-coverage
861bb6c1 2831Create data files for the @code{gcov} code-coverage utility
0c2d1a2a 2832(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}).
861bb6c1
JL
2833The data file names begin with the name of your source file:
2834
2642624b 2835@table @gcctabopt
861bb6c1
JL
2836@item @var{sourcename}.bb
2837A mapping from basic blocks to line numbers, which @code{gcov} uses to
2838associate basic block execution counts with line numbers.
2839
2840@item @var{sourcename}.bbg
2841A list of all arcs in the program flow graph. This allows @code{gcov}
2842to reconstruct the program flow graph, so that it can compute all basic
2843block and arc execution counts from the information in the
2844@code{@var{sourcename}.da} file (this last file is the output from
630d3d5a 2845@option{-fprofile-arcs}).
861bb6c1
JL
2846@end table
2847
74291a4b 2848@item -d@var{letters}
cd3bb277 2849@opindex d
74291a4b
MM
2850Says to make debugging dumps during compilation at times specified by
2851@var{letters}. This is used for debugging the compiler. The file names
375e2d5c 2852for most of the dumps are made by appending a pass number and a word to
02f52e19 2853the source file name (e.g. @file{foo.c.00.rtl} or @file{foo.c.01.sibling}).
375e2d5c 2854Here are the possible letters for use in @var{letters}, and their meanings:
74291a4b
MM
2855
2856@table @samp
375e2d5c 2857@item A
cd3bb277 2858@opindex dA
375e2d5c 2859Annotate the assembler output with miscellaneous debugging information.
956d6950 2860@item b
cd3bb277 2861@opindex db
0b47e4c1 2862Dump after computing branch probabilities, to @file{@var{file}.14.bp}.
48d9ade5 2863@item B
cd3bb277 2864@opindex dB
0b47e4c1 2865Dump after block reordering, to @file{@var{file}.28.bbro}.
032713aa 2866@item c
cd3bb277 2867@opindex dc
0b47e4c1 2868Dump after instruction combination, to the file @file{@var{file}.16.combine}.
470fc13d 2869@item C
cd3bb277 2870@opindex dC
0b47e4c1 2871Dump after the first if conversion, to the file @file{@var{file}.17.ce}.
032713aa 2872@item d
cd3bb277 2873@opindex dd
0b47e4c1 2874Dump after delayed branch scheduling, to @file{@var{file}.31.dbr}.
032713aa 2875@item D
cd3bb277 2876@opindex dD
f5963e61
JL
2877Dump all macro definitions, at the end of preprocessing, in addition to
2878normal output.
48d9ade5 2879@item e
cd3bb277 2880@opindex de
0826f1d8 2881Dump after SSA optimizations, to @file{@var{file}.04.ssa} and
0b47e4c1 2882@file{@var{file}.07.ussa}.
470fc13d 2883@item E
cd3bb277 2884@opindex dE
0b47e4c1 2885Dump after the second if conversion, to @file{@var{file}.26.ce2}.
74291a4b 2886@item f
cd3bb277 2887@opindex df
0b47e4c1 2888Dump after life analysis, to @file{@var{file}.15.life}.
48d9ade5 2889@item F
cd3bb277 2890@opindex dF
0b47e4c1 2891Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.09.addressof}.
74291a4b 2892@item g
cd3bb277 2893@opindex dg
0b47e4c1 2894Dump after global register allocation, to @file{@var{file}.21.greg}.
0826f1d8
JL
2895@item h
2896@opindex dh
2897Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
2898@item o
8bb16620 2899@item o
cd3bb277 2900@opindex do
0b47e4c1 2901Dump after post-reload CSE and other optimizations, to @file{@var{file}.22.postreload}.
02f52e19 2902@item G
cd3bb277 2903@opindex dG
0b47e4c1 2904Dump after GCSE, to @file{@var{file}.10.gcse}.
48d9ade5 2905@item i
cd3bb277 2906@opindex di
48d9ade5 2907Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
032713aa 2908@item j
cd3bb277 2909@opindex dj
0826f1d8 2910Dump after the first jump optimization, to @file{@var{file}.03.jump}.
74291a4b 2911@item k
cd3bb277 2912@opindex dk
0b47e4c1 2913Dump after conversion from registers to stack, to @file{@var{file}.32.stack}.
032713aa 2914@item l
cd3bb277 2915@opindex dl
0b47e4c1 2916Dump after local register allocation, to @file{@var{file}.20.lreg}.
032713aa 2917@item L
cd3bb277 2918@opindex dL
0b47e4c1 2919Dump after loop optimization, to @file{@var{file}.11.loop}.
032713aa 2920@item M
cd3bb277 2921@opindex dM
032713aa 2922Dump after performing the machine dependent reorganisation pass, to
0b47e4c1 2923@file{@var{file}.30.mach}.
48d9ade5 2924@item n
cd3bb277 2925@opindex dn
0b47e4c1 2926Dump after register renumbering, to @file{@var{file}.25.rnreg}.
032713aa 2927@item N
cd3bb277 2928@opindex dN
0b47e4c1 2929Dump after the register move pass, to @file{@var{file}.18.regmove}.
032713aa 2930@item r
cd3bb277 2931@opindex dr
375e2d5c 2932Dump after RTL generation, to @file{@var{file}.00.rtl}.
032713aa 2933@item R
cd3bb277 2934@opindex dR
375e2d5c 2935Dump after the second instruction scheduling pass, to
0b47e4c1 2936@file{@var{file}.27.sched2}.
032713aa 2937@item s
cd3bb277 2938@opindex ds
032713aa 2939Dump after CSE (including the jump optimization that sometimes follows
0b47e4c1 2940CSE), to @file{@var{file}.08.cse}.
032713aa 2941@item S
cd3bb277 2942@opindex dS
375e2d5c 2943Dump after the first instruction scheduling pass, to
0b47e4c1 2944@file{@var{file}.19.sched}.
032713aa 2945@item t
cd3bb277 2946@opindex dt
032713aa 2947Dump after the second CSE pass (including the jump optimization that
0b47e4c1 2948sometimes follows CSE), to @file{@var{file}.12.cse2}.
48d9ade5 2949@item w
cd3bb277 2950@opindex dw
0b47e4c1 2951Dump after the second flow pass, to @file{@var{file}.23.flow2}.
470fc13d 2952@item X
cd3bb277 2953@opindex dX
0b47e4c1 2954Dump after SSA aggressive dead code elimination, to @file{@var{file}.06.ssadce}.
48d9ade5 2955@item z
cd3bb277 2956@opindex dz
0b47e4c1 2957Dump after the peephole pass, to @file{@var{file}.24.peephole2}.
74291a4b 2958@item a
cd3bb277 2959@opindex da
74291a4b
MM
2960Produce all the dumps listed above.
2961@item m
cd3bb277 2962@opindex dm
74291a4b
MM
2963Print statistics on memory usage, at the end of the run, to
2964standard error.
2965@item p
cd3bb277 2966@opindex dp
74291a4b 2967Annotate the assembler output with a comment indicating which
f20b5577
MM
2968pattern and alternative was used. The length of each instruction is
2969also printed.
2856c3e3 2970@item P
cd3bb277 2971@opindex dP
2856c3e3 2972Dump the RTL in the assembler output as a comment before each instruction.
630d3d5a 2973Also turns on @option{-dp} annotation.
375e2d5c 2974@item v
cd3bb277 2975@opindex dv
375e2d5c
RH
2976For each of the other indicated dump files (except for
2977@file{@var{file}.00.rtl}), dump a representation of the control flow graph
b192711e 2978suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
62a1403d 2979@item x
cd3bb277 2980@opindex dx
62a1403d
AS
2981Just generate RTL for a function instead of compiling it. Usually used
2982with @samp{r}.
032713aa 2983@item y
cd3bb277 2984@opindex dy
032713aa 2985Dump debugging information during parsing, to standard error.
74291a4b
MM
2986@end table
2987
b707b450 2988@item -fdump-unnumbered
cd3bb277 2989@opindex fdump-unnumbered
695ac33f 2990When doing debugging dumps (see @option{-d} option above), suppress instruction
b707b450 2991numbers and line number note output. This makes it more feasible to
b192711e 2992use diff on debugging dumps for compiler invocations with different
695ac33f 2993options, in particular with and without @option{-g}.
b707b450 2994
aee96fe9
JM
2995@item -fdump-translation-unit @r{(C and C++ only)}
2996@itemx -fdump-translation-unit-@var{number} @r{(C and C++ only)}
cd3bb277 2997@opindex fdump-translation-unit
f71f87f9 2998Dump a representation of the tree structure for the entire translation
767094dd
JM
2999unit to a file. The file name is made by appending @file{.tu} to the
3000source file name. If the @samp{-@var{number}} form is used, @var{number}
695ac33f 3001controls the details of the dump as described for the @option{-fdump-tree} options.
e76b4820 3002
aee96fe9
JM
3003@item -fdump-class-hierarchy @r{(C++ only)}
3004@itemx -fdump-class-hierarchy-@var{number} @r{(C++ only)}
cd3bb277 3005@opindex fdump-class-hierarchy
e76b4820 3006Dump a representation of each class's hierarchy and virtual function
767094dd
JM
3007table layout to a file. The file name is made by appending @file{.class}
3008to the source file name. If the @samp{-@var{number}} form is used, @var{number}
695ac33f 3009controls the details of the dump as described for the @option{-fdump-tree}
e76b4820
NS
3010options.
3011
aee96fe9
JM
3012@item -fdump-ast-@var{switch} @r{(C++ only)}
3013@itemx -fdump-ast-@var{switch}-@var{number} @r{(C++ only)}
cd3bb277 3014@opindex fdump-ast
e76b4820 3015Control the dumping at various stages of processing the abstract syntax
767094dd
JM
3016tree to a file. The file name is generated by appending a switch
3017specific suffix to the source file name. If the @samp{-@var{number}} form is
e76b4820 3018used, @var{number} is a bit mask which controls the details of the
767094dd 3019dump. The following bits are meaningful (these are not set symbolically,
e76b4820 3020as the primary function of these dumps is for debugging gcc itself):
f71f87f9 3021
e76b4820
NS
3022@table @samp
3023@item bit0 (1)
767094dd 3024Print the address of each node. Usually this is not meaningful as it
e76b4820
NS
3025changes according to the environment and source file.
3026@item bit1 (2)
3027Inhibit dumping of members of a scope or body of a function, unless they
3028are reachable by some other path.
3029@end table
3030
3031The following tree dumps are possible:
3032@table @samp
3033@item original
3034Dump before any tree based optimization, to @file{@var{file}.original}.
3035@item optimized
3036Dump after all tree based optimization, to @file{@var{file}.optimized}.
6be77748
NS
3037@item inlined
3038Dump after inlining within the body of the function, to
3039@file{@var{file}.inlined}.
e76b4820 3040@end table
9965d119 3041
74291a4b 3042@item -fpretend-float
cd3bb277 3043@opindex fpretend-float
74291a4b
MM
3044When running a cross-compiler, pretend that the target machine uses the
3045same floating point format as the host machine. This causes incorrect
3046output of the actual floating constants, but the actual instruction
0c2d1a2a 3047sequence will probably be the same as GCC would make when running on
74291a4b
MM
3048the target machine.
3049
3050@item -save-temps
cd3bb277 3051@opindex save-temps
74291a4b
MM
3052Store the usual ``temporary'' intermediate files permanently; place them
3053in the current directory and name them based on the source file. Thus,
3054compiling @file{foo.c} with @samp{-c -save-temps} would produce files
f2ecb02d
JM
3055@file{foo.i} and @file{foo.s}, as well as @file{foo.o}. This creates a
3056preprocessed @file{foo.i} output file even though the compiler now
3057normally uses an integrated preprocessor.
74291a4b 3058
03c41c05 3059@item -time
cd3bb277 3060@opindex time
03c41c05 3061Report the CPU time taken by each subprocess in the compilation
f2ecb02d
JM
3062sequence. For C source files, this is the compiler proper and assembler
3063(plus the linker if linking is done). The output looks like this:
03c41c05
ZW
3064
3065@smallexample
03c41c05
ZW
3066# cc1 0.12 0.01
3067# as 0.00 0.01
3068@end smallexample
3069
3070The first number on each line is the ``user time,'' that is time spent
3071executing the program itself. The second number is ``system time,''
3072time spent executing operating system routines on behalf of the program.
3073Both numbers are in seconds.
3074
74291a4b 3075@item -print-file-name=@var{library}
cd3bb277 3076@opindex print-file-name
74291a4b
MM
3077Print the full absolute name of the library file @var{library} that
3078would be used when linking---and don't do anything else. With this
0c2d1a2a 3079option, GCC does not compile or link anything; it just prints the
74291a4b
MM
3080file name.
3081
b1018de6
AO
3082@item -print-multi-directory
3083@opindex print-multi-directory
3084Print the directory name corresponding to the multilib selected by any
3085other switches present in the command line. This directory is supposed
3086to exist in @env{GCC_EXEC_PREFIX}.
3087
3088@item -print-multi-lib
3089@opindex print-multi-lib
3090Print the mapping from multilib directory names to compiler switches
3091that enable them. The directory name is separated from the switches by
3092@samp{;}, and each switch starts with an @samp{@@} instead of the
3093@samp{-}, without spaces between multiple switches. This is supposed to
3094ease shell-processing.
3095
74291a4b 3096@item -print-prog-name=@var{program}
cd3bb277 3097@opindex print-prog-name
630d3d5a 3098Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
74291a4b
MM
3099
3100@item -print-libgcc-file-name
cd3bb277 3101@opindex print-libgcc-file-name
630d3d5a 3102Same as @option{-print-file-name=libgcc.a}.
74291a4b 3103
630d3d5a 3104This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
74291a4b
MM
3105but you do want to link with @file{libgcc.a}. You can do
3106
3107@example
3108gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3109@end example
3110
3111@item -print-search-dirs
cd3bb277 3112@opindex print-search-dirs
74291a4b
MM
3113Print the name of the configured installation directory and a list of
3114program and library directories gcc will search---and don't do anything else.
3115
3116This is useful when gcc prints the error message
3c0b7970
JM
3117@samp{installation problem, cannot exec cpp0: No such file or directory}.
3118To resolve this you either need to put @file{cpp0} and the other compiler
74291a4b 3119components where gcc expects to find them, or you can set the environment
bedc7537 3120variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
74291a4b
MM
3121Don't forget the trailing '/'.
3122@xref{Environment Variables}.
1f0c3120
JM
3123
3124@item -dumpmachine
cd3bb277 3125@opindex dumpmachine
1f0c3120
JM
3126Print the compiler's target machine (for example,
3127@samp{i686-pc-linux-gnu})---and don't do anything else.
3128
3129@item -dumpversion
cd3bb277 3130@opindex dumpversion
1f0c3120
JM
3131Print the compiler version (for example, @samp{3.0})---and don't do
3132anything else.
3133
3134@item -dumpspecs
cd3bb277 3135@opindex dumpspecs
1f0c3120
JM
3136Print the compiler's built-in specs---and don't do anything else. (This
3137is used when GCC itself is being built.) @xref{Spec Files}.
74291a4b
MM
3138@end table
3139
3140@node Optimize Options
3141@section Options That Control Optimization
3142@cindex optimize options
3143@cindex options, optimization
3144
3145These options control various sorts of optimizations:
3146
2642624b 3147@table @gcctabopt
74291a4b
MM
3148@item -O
3149@itemx -O1
cd3bb277
JM
3150@opindex O
3151@opindex O1
74291a4b
MM
3152Optimize. Optimizing compilation takes somewhat more time, and a lot
3153more memory for a large function.
3154
630d3d5a 3155Without @option{-O}, the compiler's goal is to reduce the cost of
74291a4b
MM
3156compilation and to make debugging produce the expected results.
3157Statements are independent: if you stop the program with a breakpoint
3158between statements, you can then assign a new value to any variable or
3159change the program counter to any other statement in the function and
3160get exactly the results you would expect from the source code.
3161
630d3d5a 3162Without @option{-O}, the compiler only allocates variables declared
74291a4b 3163@code{register} in registers. The resulting compiled code is a little
630d3d5a 3164worse than produced by PCC without @option{-O}.
74291a4b 3165
630d3d5a 3166With @option{-O}, the compiler tries to reduce code size and execution
74291a4b
MM
3167time.
3168
630d3d5a
JM
3169When you specify @option{-O}, the compiler turns on @option{-fthread-jumps}
3170and @option{-fdefer-pop} on all machines. The compiler turns on
3171@option{-fdelayed-branch} on machines that have delay slots, and
3172@option{-fomit-frame-pointer} on machines that can support debugging even
74291a4b 3173without a frame pointer. On some machines the compiler also turns
bd819a4a 3174on other flags.
74291a4b
MM
3175
3176@item -O2
cd3bb277 3177@opindex O2
0c2d1a2a 3178Optimize even more. GCC performs nearly all supported optimizations
74291a4b 3179that do not involve a space-speed tradeoff. The compiler does not
630d3d5a
JM
3180perform loop unrolling or function inlining when you specify @option{-O2}.
3181As compared to @option{-O}, this option increases both compilation time
74291a4b
MM
3182and the performance of the generated code.
3183
630d3d5a 3184@option{-O2} turns on all optional optimizations except for loop unrolling,
2b2a8f1f 3185function inlining, and register renaming. It also turns on the
630d3d5a 3186@option{-fforce-mem} option on all machines and frame pointer elimination
2b2a8f1f 3187on machines where doing so does not interfere with debugging.
74291a4b 3188
081ca317
BL
3189Please note the warning under @option{-fgcse} about
3190invoking @option{-O2} on programs that use computed gotos.
3191
74291a4b 3192@item -O3
cd3bb277 3193@opindex O3
630d3d5a
JM
3194Optimize yet more. @option{-O3} turns on all optimizations specified by
3195@option{-O2} and also turns on the @option{-finline-functions} and
3196@option{-frename-registers} options.
74291a4b
MM
3197
3198@item -O0
cd3bb277 3199@opindex O0
74291a4b
MM
3200Do not optimize.
3201
c6aded7c 3202@item -Os
cd3bb277 3203@opindex Os
630d3d5a 3204Optimize for size. @option{-Os} enables all @option{-O2} optimizations that
c6aded7c
AG
3205do not typically increase code size. It also performs further
3206optimizations designed to reduce code size.
3207
630d3d5a 3208If you use multiple @option{-O} options, with or without level numbers,
74291a4b
MM
3209the last such option is the one that is effective.
3210@end table
3211
630d3d5a 3212Options of the form @option{-f@var{flag}} specify machine-independent
74291a4b 3213flags. Most flags have both positive and negative forms; the negative
630d3d5a 3214form of @option{-ffoo} would be @option{-fno-foo}. In the table below,
74291a4b
MM
3215only one of the forms is listed---the one which is not the default.
3216You can figure out the other form by either removing @samp{no-} or
3217adding it.
3218
2642624b 3219@table @gcctabopt
74291a4b 3220@item -ffloat-store
cd3bb277 3221@opindex ffloat-store
74291a4b
MM
3222Do not store floating point variables in registers, and inhibit other
3223options that might change whether a floating point value is taken from a
3224register or memory.
3225
3226@cindex floating point precision
3227This option prevents undesirable excess precision on machines such as
3228the 68000 where the floating registers (of the 68881) keep more
3229precision than a @code{double} is supposed to have. Similarly for the
3230x86 architecture. For most programs, the excess precision does only
3231good, but a few programs rely on the precise definition of IEEE floating
630d3d5a 3232point. Use @option{-ffloat-store} for such programs, after modifying
6fd74494 3233them to store all pertinent intermediate computations into variables.
74291a4b
MM
3234
3235@item -fno-default-inline
cd3bb277 3236@opindex fno-default-inline
74291a4b
MM
3237Do not make member functions inline by default merely because they are
3238defined inside the class scope (C++ only). Otherwise, when you specify
630d3d5a 3239@w{@option{-O}}, member functions defined inside class scope are compiled
74291a4b
MM
3240inline by default; i.e., you don't need to add @samp{inline} in front of
3241the member function name.
3242
3243@item -fno-defer-pop
cd3bb277 3244@opindex fno-defer-pop
74291a4b
MM
3245Always pop the arguments to each function call as soon as that function
3246returns. For machines which must pop arguments after a function call,
3247the compiler normally lets arguments accumulate on the stack for several
3248function calls and pops them all at once.
3249
3250@item -fforce-mem
cd3bb277 3251@opindex fforce-mem
74291a4b
MM
3252Force memory operands to be copied into registers before doing
3253arithmetic on them. This produces better code by making all memory
3254references potential common subexpressions. When they are not common
3255subexpressions, instruction combination should eliminate the separate
630d3d5a 3256register-load. The @option{-O2} option turns on this option.
74291a4b
MM
3257
3258@item -fforce-addr
cd3bb277 3259@opindex fforce-addr
74291a4b
MM
3260Force memory address constants to be copied into registers before
3261doing arithmetic on them. This may produce better code just as
630d3d5a 3262@option{-fforce-mem} may.
74291a4b
MM
3263
3264@item -fomit-frame-pointer
cd3bb277 3265@opindex fomit-frame-pointer
74291a4b
MM
3266Don't keep the frame pointer in a register for functions that
3267don't need one. This avoids the instructions to save, set up and
3268restore frame pointers; it also makes an extra register available
3269in many functions. @strong{It also makes debugging impossible on
3270some machines.}
3271
3272@ifset INTERNALS
3273On some machines, such as the Vax, this flag has no effect, because
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
bd819a4a 3277whether a target machine supports this flag. @xref{Registers}.
74291a4b
MM
3278@end ifset
3279@ifclear INTERNALS
3280On some machines, such as the Vax, this flag has no effect, because
3281the standard calling sequence automatically handles the frame pointer
3282and nothing is saved by pretending it doesn't exist. The
3283machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3284whether a target machine supports this flag. @xref{Registers,,Register
bd819a4a 3285Usage, gcc.info, Using and Porting GCC}.
74291a4b
MM
3286@end ifclear
3287
1aaef9c1 3288@item -foptimize-sibling-calls
cd3bb277 3289@opindex foptimize-sibling-calls
1aaef9c1
JH
3290Optimize sibling and tail recursive calls.
3291
91ce572a 3292@item -ftrapv
cd3bb277 3293@opindex ftrapv
91ce572a
CC
3294This option generates traps for signed overflow on addition, subtraction,
3295multiplication operations.
3296
74291a4b 3297@item -fno-inline
cd3bb277 3298@opindex fno-inline
74291a4b
MM
3299Don't pay attention to the @code{inline} keyword. Normally this option
3300is used to keep the compiler from expanding any functions inline.
3301Note that if you are not optimizing, no functions can be expanded inline.
3302
3303@item -finline-functions
cd3bb277 3304@opindex finline-functions
74291a4b
MM
3305Integrate all simple functions into their callers. The compiler
3306heuristically decides which functions are simple enough to be worth
3307integrating in this way.
3308
3309If all calls to a given function are integrated, and the function is
3310declared @code{static}, then the function is normally not output as
3311assembler code in its own right.
3312
efa3896a 3313@item -finline-limit=@var{n}
cd3bb277 3314@opindex finline-limit
f9e814f1
TP
3315By default, gcc limits the size of functions that can be inlined. This flag
3316allows the control of this limit for functions that are explicitly marked as
02f52e19
AJ
3317inline (ie marked with the inline keyword or defined within the class
3318definition in c++). @var{n} is the size of functions that can be inlined in
f9e814f1 3319number of pseudo instructions (not counting parameter handling). The default
aee96fe9 3320value of @var{n} is 10000. Increasing this value can result in more inlined code at
f9e814f1 3321the cost of compilation time and memory consumption. Decreasing usually makes
02f52e19
AJ
3322the compilation faster and less code will be inlined (which presumably
3323means slower programs). This option is particularly useful for programs that
aee96fe9 3324use inlining heavily such as those based on recursive templates with C++.
f9e814f1
TP
3325
3326@emph{Note:} pseudo instruction represents, in this particular context, an
3327abstract measurement of function's size. In no way, it represents a count
3328of assembly instructions and as such its exact meaning might change from one
3329release to an another.
3330
74291a4b 3331@item -fkeep-inline-functions
cd3bb277 3332@opindex fkeep-inline-functions
74291a4b
MM
3333Even if all calls to a given function are integrated, and the function
3334is declared @code{static}, nevertheless output a separate run-time
3335callable version of the function. This switch does not affect
3336@code{extern inline} functions.
3337
3338@item -fkeep-static-consts
cd3bb277 3339@opindex fkeep-static-consts
74291a4b
MM
3340Emit variables declared @code{static const} when optimization isn't turned
3341on, even if the variables aren't referenced.
3342
0c2d1a2a 3343GCC enables this option by default. If you want to force the compiler to
74291a4b 3344check if the variable was referenced, regardless of whether or not
630d3d5a 3345optimization is turned on, use the @option{-fno-keep-static-consts} option.
74291a4b
MM
3346
3347@item -fno-function-cse
cd3bb277 3348@opindex fno-function-cse
74291a4b
MM
3349Do not put function addresses in registers; make each instruction that
3350calls a constant function contain the function's address explicitly.
3351
3352This option results in less efficient code, but some strange hacks
3353that alter the assembler output may be confused by the optimizations
3354performed when this option is not used.
3355
3356@item -ffast-math
cd3bb277 3357@opindex ffast-math
630d3d5a
JM
3358Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
3359and @option{-fno-trapping-math}.
de6c5979 3360
630d3d5a 3361This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
74291a4b 3362
630d3d5a 3363This option should never be turned on by any @option{-O} option since
74291a4b 3364it can result in incorrect output for programs which depend on
c1030c7c 3365an exact implementation of IEEE or ISO rules/specifications for
74291a4b 3366math functions.
9605da8a
BL
3367
3368@item -fno-math-errno
cd3bb277 3369@opindex fno-math-errno
9605da8a
BL
3370Do not set ERRNO after calling math functions that are executed
3371with a single instruction, e.g., sqrt. A program that relies on
3372IEEE exceptions for math error handling may want to use this flag
3373for speed while maintaining IEEE arithmetic compatibility.
3374
630d3d5a 3375This option should never be turned on by any @option{-O} option since
de6c5979
BL
3376it can result in incorrect output for programs which depend on
3377an exact implementation of IEEE or ISO rules/specifications for
3378math functions.
3379
630d3d5a
JM
3380The default is @option{-fmath-errno}. The @option{-ffast-math} option
3381sets @option{-fno-math-errno}.
de6c5979
BL
3382
3383@item -funsafe-math-optimizations
cd3bb277 3384@opindex funsafe-math-optimizations
de6c5979
BL
3385Allow optimizations for floating-point arithmetic that (a) assume
3386that arguments and results are valid and (b) may violate IEEE or
237b14f7
RH
3387ANSI standards. When used at link-time, it may include libraries
3388or startup files that change the default FPU control word or other
3389similar optimizations.
de6c5979 3390
630d3d5a 3391This option should never be turned on by any @option{-O} option since
de6c5979
BL
3392it can result in incorrect output for programs which depend on
3393an exact implementation of IEEE or ISO rules/specifications for
3394math functions.
3395
630d3d5a
JM
3396The default is @option{-fno-unsafe-math-optimizations}. The
3397@option{-ffast-math} option sets @option{-funsafe-math-optimizations}.
de6c5979
BL
3398
3399@item -fno-trapping-math
cd3bb277 3400@opindex fno-trapping-math
de6c5979
BL
3401Compile code assuming that floating-point operations cannot generate
3402user-visible traps. Setting this option may allow faster code
3403if one relies on ``non-stop'' IEEE arithmetic, for example.
3404
630d3d5a 3405This option should never be turned on by any @option{-O} option since
de6c5979
BL
3406it can result in incorrect output for programs which depend on
3407an exact implementation of IEEE or ISO rules/specifications for
3408math functions.
3409
630d3d5a
JM
3410The default is @option{-ftrapping-math}. The @option{-ffast-math}
3411option sets @option{-fno-trapping-math}.
74291a4b
MM
3412@end table
3413
3414@c following causes underfulls.. they don't look great, but we deal.
3415@c --mew 26jan93
630d3d5a
JM
3416The following options control specific optimizations. The @option{-O2}
3417option turns on all of these optimizations except @option{-funroll-loops}
3418and @option{-funroll-all-loops}. On most machines, the @option{-O} option
3419turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options,
74291a4b
MM
3420but specific machines may handle it differently.
3421
3422You can use the following flags in the rare cases when ``fine-tuning''
3423of optimizations to be performed is desired.
3424
2642624b 3425@table @gcctabopt
74291a4b 3426@item -fstrength-reduce
cd3bb277 3427@opindex fstrength-reduce
74291a4b
MM
3428Perform the optimizations of loop strength reduction and
3429elimination of iteration variables.
3430
3431@item -fthread-jumps
cd3bb277 3432@opindex fthread-jumps
74291a4b
MM
3433Perform optimizations where we check to see if a jump branches to a
3434location where another comparison subsumed by the first is found. If
3435so, the first branch is redirected to either the destination of the
3436second branch or a point immediately following it, depending on whether
3437the condition is known to be true or false.
3438
3439@item -fcse-follow-jumps
cd3bb277 3440@opindex fcse-follow-jumps
74291a4b
MM
3441In common subexpression elimination, scan through jump instructions
3442when the target of the jump is not reached by any other path. For
3443example, when CSE encounters an @code{if} statement with an
3444@code{else} clause, CSE will follow the jump when the condition
3445tested is false.
3446
3447@item -fcse-skip-blocks
cd3bb277 3448@opindex fcse-skip-blocks
630d3d5a 3449This is similar to @option{-fcse-follow-jumps}, but causes CSE to
74291a4b
MM
3450follow jumps which conditionally skip over blocks. When CSE
3451encounters a simple @code{if} statement with no else clause,
630d3d5a 3452@option{-fcse-skip-blocks} causes CSE to follow the jump around the
74291a4b
MM
3453body of the @code{if}.
3454
3455@item -frerun-cse-after-loop
cd3bb277 3456@opindex frerun-cse-after-loop
74291a4b
MM
3457Re-run common subexpression elimination after loop optimizations has been
3458performed.
3459
6d6d0fa0 3460@item -frerun-loop-opt
cd3bb277 3461@opindex frerun-loop-opt
6d6d0fa0
JL
3462Run the loop optimizer twice.
3463
7506f491 3464@item -fgcse
cd3bb277 3465@opindex fgcse
7506f491
DE
3466Perform a global common subexpression elimination pass.
3467This pass also performs global constant and copy propagation.
3468
081ca317
BL
3469@emph{Note:} When compiling a program using computed gotos, a GCC
3470extension, you may get better runtime performance if you disable
3471the global common subexpression elmination pass by adding
3472@option{-fno-gcse} to the command line.
3473
a13d4ebf 3474@item -fgcse-lm
cd3bb277 3475@opindex fgcse-lm
695ac33f 3476When @option{-fgcse-lm} is enabled, global common subexpression elimination will
767094dd 3477attempt to move loads which are only killed by stores into themselves. This
a13d4ebf 3478allows a loop containing a load/store sequence to be changed to a load outside
02f52e19 3479the loop, and a copy/store within the loop.
a13d4ebf
AM
3480
3481@item -fgcse-sm
cd3bb277 3482@opindex fgcse-sm
695ac33f 3483When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
767094dd 3484subexpression elimination. This pass will attempt to move stores out of loops.
695ac33f 3485When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
a13d4ebf
AM
3486can be changed to a load before the loop and a store after the loop.
3487
b6d24183 3488@item -fdelete-null-pointer-checks
cd3bb277 3489@opindex fdelete-null-pointer-checks
b6d24183
JL
3490Use global dataflow analysis to identify and eliminate useless null
3491pointer checks. Programs which rely on NULL pointer dereferences @emph{not}
3492halting the program may not work properly with this option. Use
aee96fe9 3493@option{-fno-delete-null-pointer-checks} to disable this optimizing for programs
b6d24183
JL
3494which depend on that behavior.
3495
74291a4b 3496@item -fexpensive-optimizations
cd3bb277 3497@opindex fexpensive-optimizations
74291a4b
MM
3498Perform a number of minor optimizations that are relatively expensive.
3499
639726ba 3500@item -foptimize-register-move
59d40964 3501@itemx -fregmove
cd3bb277
JM
3502@opindex foptimize-register-move
3503@opindex fregmove
9ec36da5
JL
3504Attempt to reassign register numbers in move instructions and as
3505operands of other simple instructions in order to maximize the amount of
56159047 3506register tying. This is especially helpful on machines with two-operand
630d3d5a 3507instructions. GCC enables this optimization by default with @option{-O2}
9ec36da5
JL
3508or higher.
3509
bedc7537 3510Note @option{-fregmove} and @option{-foptimize-register-move} are the same
9ec36da5
JL
3511optimization.
3512
74291a4b 3513@item -fdelayed-branch
cd3bb277 3514@opindex fdelayed-branch
74291a4b
MM
3515If supported for the target machine, attempt to reorder instructions
3516to exploit instruction slots available after delayed branch
3517instructions.
3518
3519@item -fschedule-insns
cd3bb277 3520@opindex fschedule-insns
74291a4b
MM
3521If supported for the target machine, attempt to reorder instructions to
3522eliminate execution stalls due to required data being unavailable. This
3523helps machines that have slow floating point or memory load instructions
3524by allowing other instructions to be issued until the result of the load
3525or floating point instruction is required.
3526
3527@item -fschedule-insns2
cd3bb277 3528@opindex fschedule-insns2
630d3d5a 3529Similar to @option{-fschedule-insns}, but requests an additional pass of
74291a4b
MM
3530instruction scheduling after register allocation has been done. This is
3531especially useful on machines with a relatively small number of
3532registers and where memory load instructions take more than one cycle.
3533
3534@item -ffunction-sections
59d40964 3535@itemx -fdata-sections
cd3bb277
JM
3536@opindex ffunction-sections
3537@opindex fdata-sections
7d0756fb
CM
3538Place each function or data item into its own section in the output
3539file if the target supports arbitrary sections. The name of the
3540function or the name of the data item determines the section's name
3541in the output file.
74291a4b 3542
7d0756fb 3543Use these options on systems where the linker can perform optimizations
74291a4b
MM
3544to improve locality of reference in the instruction space. HPPA
3545processors running HP-UX and Sparc processors running Solaris 2 have
3546linkers with such optimizations. Other systems using the ELF object format
3547as well as AIX may have these optimizations in the future.
3548
7d0756fb
CM
3549Only use these options when there are significant benefits from doing
3550so. When you specify these options, the assembler and linker will
74291a4b
MM
3551create larger object and executable files and will also be slower.
3552You will not be able to use @code{gprof} on all systems if you
3553specify this option and you may have problems with debugging if
630d3d5a 3554you specify both this option and @option{-g}.
74291a4b
MM
3555
3556@item -fcaller-saves
cd3bb277 3557@opindex fcaller-saves
74291a4b
MM
3558Enable values to be allocated in registers that will be clobbered by
3559function calls, by emitting extra instructions to save and restore the
3560registers around such calls. Such allocation is done only when it
3561seems to result in better code than would otherwise be produced.
3562
81610a0d
HPN
3563This option is always enabled by default on certain machines, usually
3564those which have no call-preserved registers to use instead.
3565
3566For all machines, optimization level 2 and higher enables this flag by
3567default.
74291a4b
MM
3568
3569@item -funroll-loops
cd3bb277 3570@opindex funroll-loops
74291a4b
MM
3571Perform the optimization of loop unrolling. This is only done for loops
3572whose number of iterations can be determined at compile time or run time.
630d3d5a
JM
3573@option{-funroll-loops} implies both @option{-fstrength-reduce} and
3574@option{-frerun-cse-after-loop}.
74291a4b
MM
3575
3576@item -funroll-all-loops
cd3bb277 3577@opindex funroll-all-loops
74291a4b 3578Perform the optimization of loop unrolling. This is done for all loops
630d3d5a
JM
3579and usually makes programs run more slowly. @option{-funroll-all-loops}
3580implies @option{-fstrength-reduce} as well as @option{-frerun-cse-after-loop}.
74291a4b 3581
e5eb27e5 3582@item -fmove-all-movables
cd3bb277 3583@opindex fmove-all-movables
e5eb27e5
JL
3584Forces all invariant computations in loops to be moved
3585outside the loop.
3586
3587@item -freduce-all-givs
cd3bb277 3588@opindex freduce-all-givs
e5eb27e5
JL
3589Forces all general-induction variables in loops to be
3590strength-reduced.
3591
3592@emph{Note:} When compiling programs written in Fortran,
630d3d5a 3593@option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
e5eb27e5
JL
3594by default when you use the optimizer.
3595
3596These options may generate better or worse code; results are highly
3597dependent on the structure of loops within the source code.
3598
3599These two options are intended to be removed someday, once
3600they have helped determine the efficacy of various
3601approaches to improving loop optimizations.
3602
2642624b 3603Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
e5eb27e5
JL
3604know how use of these options affects
3605the performance of your production code.
3606We're very interested in code that runs @emph{slower}
3607when these options are @emph{enabled}.
3608
74291a4b 3609@item -fno-peephole
6cfc0341 3610@itemx -fno-peephole2
cd3bb277 3611@opindex fno-peephole
6cfc0341
RH
3612@opindex fno-peephole2
3613Disable any machine-specific peephole optimizations. The difference
630d3d5a 3614between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
6cfc0341
RH
3615are implemented in the compiler; some targets use one, some use the
3616other, a few use both.
861bb6c1
JL
3617
3618@item -fbranch-probabilities
cd3bb277 3619@opindex fbranch-probabilities
630d3d5a 3620After running a program compiled with @option{-fprofile-arcs}
861bb6c1 3621(@pxref{Debugging Options,, Options for Debugging Your Program or
bedc7537 3622@command{gcc}}), you can compile it a second time using
630d3d5a 3623@option{-fbranch-probabilities}, to improve optimizations based on
861bb6c1
JL
3624guessing the path a branch might take.
3625
3626@ifset INTERNALS
630d3d5a 3627With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
861bb6c1
JL
3628note on the first instruction of each basic block, and a
3629@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
3630These can be used to improve optimization. Currently, they are only
3631used in one place: in @file{reorg.c}, instead of guessing which path a
3632branch is mostly to take, the @samp{REG_BR_PROB} values are used to
3633exactly determine which path is taken more often.
3634@end ifset
8c660648 3635
454d0cc7 3636@item -fno-guess-branch-probability
cd3bb277 3637@opindex fno-guess-branch-probability
454d0cc7 3638Sometimes gcc will opt to guess branch probabilities when none are
630d3d5a 3639available from either profile directed feedback (@option{-fprofile-arcs})
2bab2366 3640or @samp{__builtin_expect}. In a hard real-time system, people don't
454d0cc7
AH
3641want different runs of the compiler to produce code that has different
3642behavior; minimizing non-determinism is of paramount import. This
3643switch allows users to reduce non-determinism, possibly at the expense
3644of inferior optimization.
3645
41472af8 3646@item -fstrict-aliasing
cd3bb277 3647@opindex fstrict-aliasing
41472af8
MM
3648Allows the compiler to assume the strictest aliasing rules applicable to
3649the language being compiled. For C (and C++), this activates
3650optimizations based on the type of expressions. In particular, an
3651object of one type is assumed never to reside at the same address as an
3652object of a different type, unless the types are almost the same. For
3653example, an @code{unsigned int} can alias an @code{int}, but not a
3654@code{void*} or a @code{double}. A character type may alias any other
02f52e19 3655type.
41472af8
MM
3656
3657Pay special attention to code like this:
3658@example
02f52e19 3659union a_union @{
41472af8
MM
3660 int i;
3661 double d;
3662@};
3663
3664int f() @{
3665 a_union t;
3666 t.d = 3.0;
3667 return t.i;
3668@}
3669@end example
3670The practice of reading from a different union member than the one most
3671recently written to (called ``type-punning'') is common. Even with
630d3d5a 3672@option{-fstrict-aliasing}, type-punning is allowed, provided the memory
41472af8
MM
3673is accessed through the union type. So, the code above will work as
3674expected. However, this code might not:
3675@example
02f52e19 3676int f() @{
41472af8
MM
3677 a_union t;
3678 int* ip;
3679 t.d = 3.0;
3680 ip = &t.i;
3681 return *ip;
3682@}
3683@end example
3684
41472af8
MM
3685@ifset INTERNALS
3686Every language that wishes to perform language-specific alias analysis
3687should define a function that computes, given an @code{tree}
3688node, an alias set for the node. Nodes in different alias sets are not
3689allowed to alias. For an example, see the C front-end function
3690@code{c_get_alias_set}.
3691@end ifset
3692
efa3896a
GK
3693@item -falign-functions
3694@itemx -falign-functions=@var{n}
cd3bb277 3695@opindex falign-functions
efa3896a
GK
3696Align the start of functions to the next power-of-two greater than
3697@var{n}, skipping up to @var{n} bytes. For instance,
630d3d5a
JM
3698@option{-falign-functions=32} aligns functions to the next 32-byte
3699boundary, but @option{-falign-functions=24} would align to the next
efa3896a
GK
370032-byte boundary only if this can be done by skipping 23 bytes or less.
3701
630d3d5a 3702@option{-fno-align-functions} and @option{-falign-functions=1} are
efa3896a
GK
3703equivalent and mean that functions will not be aligned.
3704
3705Some assemblers only support this flag when @var{n} is a power of two;
3706in that case, it is rounded up.
3707
3708If @var{n} is not specified, use a machine-dependent default.
3709
3710@item -falign-labels
3711@itemx -falign-labels=@var{n}
cd3bb277 3712@opindex falign-labels
efa3896a 3713Align all branch targets to a power-of-two boundary, skipping up to
630d3d5a 3714@var{n} bytes like @option{-falign-functions}. This option can easily
efa3896a
GK
3715make code slower, because it must insert dummy operations for when the
3716branch target is reached in the usual flow of the code.
3717
630d3d5a 3718If @option{-falign-loops} or @option{-falign-jumps} are applicable and
efa3896a
GK
3719are greater than this value, then their values are used instead.
3720
3721If @var{n} is not specified, use a machine-dependent default which is
3722very likely to be @samp{1}, meaning no alignment.
3723
3724@item -falign-loops
3725@itemx -falign-loops=@var{n}
cd3bb277 3726@opindex falign-loops
efa3896a 3727Align loops to a power-of-two boundary, skipping up to @var{n} bytes
630d3d5a 3728like @option{-falign-functions}. The hope is that the loop will be
efa3896a
GK
3729executed many times, which will make up for any execution of the dummy
3730operations.
3731
3732If @var{n} is not specified, use a machine-dependent default.
3733
3734@item -falign-jumps
3735@itemx -falign-jumps=@var{n}
cd3bb277 3736@opindex falign-jumps
efa3896a
GK
3737Align branch targets to a power-of-two boundary, for branch targets
3738where the targets can only be reached by jumping, skipping up to @var{n}
630d3d5a 3739bytes like @option{-falign-functions}. In this case, no dummy operations
efa3896a
GK
3740need be executed.
3741
3742If @var{n} is not specified, use a machine-dependent default.
3743
4bae0b47 3744@item -fssa
cd3bb277 3745@opindex fssa
4bae0b47
AS
3746Perform optimizations in static single assignment form. Each function's
3747flow graph is translated into SSA form, optimizations are performed, and
90ecce3e 3748the flow graph is translated back from SSA form. Users should not
b53978a3
JO
3749specify this option, since it is not yet ready for production use.
3750
0b47e4c1
JL
3751@item -fssa-ccp
3752@opindex fssa-ccp
3753Perform Sparse Conditional Constant Propagation in SSA form. Requires
3754@option{-fssa}. Like @option{-fssa}, this is an experimental feature.
3755
62d285ff
JL
3756@item -fssa-dce
3757@opindex fssa-dce
3758Perform aggressive dead-code elimination in SSA form. Requires @option{-fssa}.
3759Like @option{-fssa}, this is an experimental feature.
4bae0b47 3760
46d3a873 3761@item -fsingle-precision-constant
cd3bb277 3762@opindex fsingle-precision-constant
46d3a873
CC
3763Treat floating point constant as single precision constant instead of
3764implicitly converting it to double precision constant.
3765
2b2a8f1f 3766@item -frename-registers
cd3bb277 3767@opindex frename-registers
c771326b 3768Attempt to avoid false dependencies in scheduled code by making use
2b2a8f1f
RH
3769of registers left over after register allocation. This optimization
3770will most benefit processors with lots of registers. It can, however,
3771make debugging impossible, since variables will no longer stay in
3772a ``home register''.
3af64fd6
MM
3773
3774@item --param @var{name}=@var{value}
cd3bb277 3775@opindex param
3af64fd6
MM
3776In some places, GCC uses various constants to control the amount of
3777optimization that is done. For example, GCC will not inline functions
3778that contain more that a certain number of instructions. You can
3779control some of these constants on the command-line using the
630d3d5a 3780@option{--param} option.
3af64fd6
MM
3781
3782In each case, the @var{value} is a integer. The allowable choices for
3783@var{name} are given in the following table:
3784
3785@table @gcctabopt
1c4c47db
JO
3786@item max-delay-slot-insn-search
3787The maximum number of instructions to consider when looking for an
3788instruction to fill a delay slot. If more than this arbitrary number of
3789instructions is searched, the time savings from filling the delay slot
3790will be minimal so stop searching. Increasing values mean more
3791aggressive optimization, making the compile time increase with probably
3792small improvement in executable run time.
3793
3794@item max-delay-slot-live-search
3795When trying to fill delay slots, the maximum number of instructions to
3796consider when searching for a block with valid live register
3797information. Increasing this arbitrarily chosen value means more
3798aggressive optimization, increasing the compile time. This parameter
3799should be removed when the delay slot code is rewritten to maintain the
3800control-flow graph.
33d3b05b
MM
3801
3802@item max-gcse-memory
3803The approximate maximum amount of memory that will be allocated in
3804order to perform the global common subexpression elimination
3805optimization. If more memory than specified is required, the
3806optimization will not be done.
3af64fd6 3807
740f35a0 3808@item max-gcse-passes
7dac2f89 3809The maximum number of passes of GCSE to run.
740f35a0 3810
4a121cc3
AM
3811@item max-pending-list-length
3812The maximum number of pending dependancies scheduling will allow
3813before flushing the current state and starting over. Large functions
3814with few branches or calls can create excessively large lists which
3815needlessly consume memory and resources.
3816
1c4c47db
JO
3817@item max-inline-insns
3818If an function contains more than this many instructions, it
3819will not be inlined. This option is precisely equivalent to
630d3d5a 3820@option{-finline-limit}.
1c4c47db
JO
3821
3822@end table
74291a4b
MM
3823@end table
3824
3825@node Preprocessor Options
3826@section Options Controlling the Preprocessor
3827@cindex preprocessor options
3828@cindex options, preprocessor
3829
3830These options control the C preprocessor, which is run on each C source
3831file before actual compilation.
3832
630d3d5a
JM
3833If you use the @option{-E} option, nothing is done except preprocessing.
3834Some of these options make sense only together with @option{-E} because
74291a4b
MM
3835they cause the preprocessor output to be unsuitable for actual
3836compilation.
3837
2642624b 3838@table @gcctabopt
74291a4b 3839@item -include @var{file}
cd3bb277 3840@opindex include
74291a4b 3841Process @var{file} as input before processing the regular input file.
630d3d5a
JM
3842In effect, the contents of @var{file} are compiled first. Any @option{-D}
3843and @option{-U} options on the command line are always processed before
3844@option{-include @var{file}}, regardless of the order in which they are
3845written. All the @option{-include} and @option{-imacros} options are
74291a4b
MM
3846processed in the order in which they are written.
3847
3848@item -imacros @var{file}
cd3bb277 3849@opindex imacros
74291a4b
MM
3850Process @var{file} as input, discarding the resulting output, before
3851processing the regular input file. Because the output generated from
630d3d5a 3852@var{file} is discarded, the only effect of @option{-imacros @var{file}}
74291a4b 3853is to make the macros defined in @var{file} available for use in the
630d3d5a 3854main input. All the @option{-include} and @option{-imacros} options are
e582248c 3855processed in the order in which they are written.
74291a4b
MM
3856
3857@item -idirafter @var{dir}
cd3bb277 3858@opindex idirafter
74291a4b
MM
3859@cindex second include path
3860Add the directory @var{dir} to the second include path. The directories
3861on the second include path are searched when a header file is not found
3862in any of the directories in the main include path (the one that
630d3d5a 3863@option{-I} adds to).
74291a4b
MM
3864
3865@item -iprefix @var{prefix}
cd3bb277 3866@opindex iprefix
630d3d5a 3867Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
74291a4b
MM
3868options.
3869
3870@item -iwithprefix @var{dir}
cd3bb277 3871@opindex iwithprefix
74291a4b
MM
3872Add a directory to the second include path. The directory's name is
3873made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
630d3d5a 3874specified previously with @option{-iprefix}. If you have not specified a
74291a4b
MM
3875prefix yet, the directory containing the installed passes of the
3876compiler is used as the default.
3877
3878@item -iwithprefixbefore @var{dir}
cd3bb277 3879@opindex iwithprefixbefore
74291a4b
MM
3880Add a directory to the main include path. The directory's name is made
3881by concatenating @var{prefix} and @var{dir}, as in the case of
630d3d5a 3882@option{-iwithprefix}.
74291a4b
MM
3883
3884@item -isystem @var{dir}
cd3bb277 3885@opindex isystem
74291a4b
MM
3886Add a directory to the beginning of the second include path, marking it
3887as a system directory, so that it gets the same special treatment as
3888is applied to the standard system directories.
3889
3890@item -nostdinc
cd3bb277 3891@opindex nostdinc
74291a4b 3892Do not search the standard system directories for header files. Only
630d3d5a 3893the directories you have specified with @option{-I} options (and the
74291a4b 3894current directory, if appropriate) are searched. @xref{Directory
630d3d5a 3895Options}, for information on @option{-I}.
74291a4b 3896
dfb5868d
NS
3897By using both @option{-nostdinc} and @option{-I-}, you can limit the include-file
3898search path to only those directories you specify explicitly.
74291a4b 3899
e582248c 3900@item -remap
cd3bb277 3901@opindex remap
e582248c
NB
3902When searching for a header file in a directory, remap file names if a
3903file named @file{header.gcc} exists in that directory. This can be used
3904to work around limitations of file systems with file name restrictions.
3905The @file{header.gcc} file should contain a series of lines with two
3906tokens on each line: the first token is the name to map, and the second
3907token is the actual name to use.
3908
74291a4b 3909@item -undef
cd3bb277 3910@opindex undef
74291a4b
MM
3911Do not predefine any nonstandard macros. (Including architecture flags).
3912
3913@item -E
cd3bb277 3914@opindex E
74291a4b
MM
3915Run only the C preprocessor. Preprocess all the C source files
3916specified and output the results to standard output or to the
3917specified output file.
3918
3919@item -C
cd3bb277 3920@opindex C
74291a4b 3921Tell the preprocessor not to discard comments. Used with the
630d3d5a 3922@option{-E} option.
74291a4b
MM
3923
3924@item -P
cd3bb277 3925@opindex P
74291a4b 3926Tell the preprocessor not to generate @samp{#line} directives.
630d3d5a 3927Used with the @option{-E} option.
74291a4b
MM
3928
3929@cindex make
3930@cindex dependencies, make
3931@item -M
cd3bb277 3932@opindex M
e582248c
NB
3933Instead of outputting the result of preprocessing, output a rule
3934suitable for @code{make} describing the dependencies of the main source
3935file. The preprocessor outputs one @code{make} rule containing the
3936object file name for that source file, a colon, and the names of all the
48ce6bbb
NS
3937included files. Unless overridden explicitly, the object file name
3938consists of the basename of the source file with any suffix replaced with
767094dd 3939object file suffix. If there are many included files then the
48ce6bbb 3940rule is split into several lines using @samp{\}-newline.
74291a4b 3941
630d3d5a 3942@option{-M} implies @option{-E}.
74291a4b 3943
e582248c 3944@item -MM
cd3bb277 3945@opindex MM
630d3d5a 3946Like @option{-M}, but mention only the files included with @samp{#include
e582248c
NB
3947"@var{file}"}. System header files included with @samp{#include
3948<@var{file}>} are omitted.
3949
7da723ef 3950@item -MD
cd3bb277 3951@opindex MD
630d3d5a 3952Like @option{-M} but the dependency information is written to a file
7da723ef 3953rather than stdout. @code{gcc} will use the same file name and
695ac33f 3954directory as the object file, but with the suffix @file{.d} instead.
7da723ef 3955
630d3d5a
JM
3956This is in addition to compiling the main file as specified---@option{-MD}
3957does not inhibit ordinary compilation the way @option{-M} does,
3958unless you also specify @option{-MG}.
7da723ef
NB
3959
3960With Mach, you can use the utility @code{md} to merge multiple
3961dependency files into a single dependency file suitable for using with
3962the @samp{make} command.
3963
d396403a 3964@item -MMD
cd3bb277 3965@opindex MMD
630d3d5a 3966Like @option{-MD} except mention only user header files, not system
7da723ef
NB
3967-header files.
3968
e582248c 3969@item -MF @var{file}
cd3bb277 3970@opindex MF
630d3d5a 3971When used with @option{-M} or @option{-MM}, specifies a file to write the
e582248c 3972dependencies to. This allows the preprocessor to write the preprocessed
630d3d5a 3973file to stdout normally. If no @option{-MF} switch is given, CPP sends
e582248c
NB
3974the rules to stdout and suppresses normal preprocessed output.
3975
74291a4b 3976Another way to specify output of a @code{make} rule is by setting
bedc7537 3977the environment variable @env{DEPENDENCIES_OUTPUT} (@pxref{Environment
74291a4b
MM
3978Variables}).
3979
74291a4b 3980@item -MG
cd3bb277 3981@opindex MG
630d3d5a 3982When used with @option{-M} or @option{-MM}, @option{-MG} says to treat missing
e582248c
NB
3983header files as generated files and assume they live in the same
3984directory as the source file. It suppresses preprocessed output, as a
3985missing header file is ordinarily an error.
3986
3987This feature is used in automatic updating of makefiles.
3988
3989@item -MP
cd3bb277 3990@opindex MP
e582248c
NB
3991This option instructs CPP to add a phony target for each dependency
3992other than the main file, causing each to depend on nothing. These
3993dummy rules work around errors @code{make} gives if you remove header
3994files without updating the @code{Makefile} to match.
3995
3996This is typical output:-
3997
3998@smallexample
3999/tmp/test.o: /tmp/test.c /tmp/test.h
4000
4001/tmp/test.h:
4002@end smallexample
4003
4004@item -MQ @var{target}
4005@item -MT @var{target}
cd3bb277
JM
4006@opindex MQ
4007@opindex MT
e582248c
NB
4008By default CPP uses the main file name, including any path, and appends
4009the object suffix, normally ``.o'', to it to obtain the name of the
630d3d5a 4010target for dependency generation. With @option{-MT} you can specify a
e582248c
NB
4011target yourself, overriding the default one.
4012
4013If you want multiple targets, you can specify them as a single argument
630d3d5a 4014to @option{-MT}, or use multiple @option{-MT} options.
e582248c
NB
4015
4016The targets you specify are output in the order they appear on the
630d3d5a
JM
4017command line. @option{-MQ} is identical to @option{-MT}, except that the
4018target name is quoted for Make, but with @option{-MT} it isn't. For
4019example, @option{-MT '$(objpfx)foo.o'} gives
e582248c
NB
4020
4021@smallexample
4022$(objpfx)foo.o: /tmp/foo.c
4023@end smallexample
4024
630d3d5a 4025but @option{-MQ '$(objpfx)foo.o'} gives
e582248c
NB
4026
4027@smallexample
4028$$(objpfx)foo.o: /tmp/foo.c
4029@end smallexample
4030
4031The default target is automatically quoted, as if it were given with
630d3d5a 4032@option{-MQ}.
74291a4b
MM
4033
4034@item -H
cd3bb277 4035@opindex H
74291a4b
MM
4036Print the name of each header file used, in addition to other normal
4037activities.
4038
4039@item -A@var{question}(@var{answer})
cd3bb277 4040@opindex A
74291a4b
MM
4041Assert the answer @var{answer} for @var{question}, in case it is tested
4042with a preprocessing conditional such as @samp{#if
630d3d5a 4043#@var{question}(@var{answer})}. @option{-A-} disables the standard
74291a4b
MM
4044assertions that normally describe the target machine.
4045
4046@item -D@var{macro}
cd3bb277 4047@opindex D
74291a4b
MM
4048Define macro @var{macro} with the string @samp{1} as its definition.
4049
4050@item -D@var{macro}=@var{defn}
630d3d5a
JM
4051Define macro @var{macro} as @var{defn}. All instances of @option{-D} on
4052the command line are processed before any @option{-U} options.
74291a4b 4053
630d3d5a
JM
4054Any @option{-D} and @option{-U} options on the command line are processed in
4055order, and always before @option{-imacros @var{file}}, regardless of the
e582248c
NB
4056order in which they are written.
4057
74291a4b 4058@item -U@var{macro}
cd3bb277 4059@opindex U
630d3d5a
JM
4060Undefine macro @var{macro}. @option{-U} options are evaluated after all
4061@option{-D} options, but before any @option{-include} and @option{-imacros}
74291a4b
MM
4062options.
4063
630d3d5a
JM
4064Any @option{-D} and @option{-U} options on the command line are processed in
4065order, and always before @option{-imacros @var{file}}, regardless of the
e582248c
NB
4066order in which they are written.
4067
74291a4b 4068@item -dM
cd3bb277 4069@opindex dM
74291a4b 4070Tell the preprocessor to output only a list of the macro definitions
630d3d5a 4071that are in effect at the end of preprocessing. Used with the @option{-E}
74291a4b
MM
4072option.
4073
4074@item -dD
cd3bb277 4075@opindex dD
74291a4b
MM
4076Tell the preprocessing to pass all macro definitions into the output, in
4077their proper sequence in the rest of the output.
4078
4079@item -dN
cd3bb277 4080@opindex dN
630d3d5a 4081Like @option{-dD} except that the macro arguments and contents are omitted.
74291a4b
MM
4082Only @samp{#define @var{name}} is included in the output.
4083
e582248c 4084@item -dI
cd3bb277 4085@opindex dI
e582248c
NB
4086Output @samp{#include} directives in addition to the result of
4087preprocessing.
4088
3bce8a01
NB
4089@item -fpreprocessed
4090@opindex fpreprocessed
4091Indicate to the preprocessor that the input file has already been
4092preprocessed. This suppresses things like macro expansion, trigraph
4093conversion, escaped newline splicing, and processing of most directives.
6d34c1c4
NB
4094The preprocessor still recognizes and removes comments, so that you can
4095pass a file preprocessed with @option{-C} to the compiler without
4096problems. In this mode the integrated preprocessor is little more than
4097a tokenizer for the front ends.
3bce8a01 4098
630d3d5a 4099@option{-fpreprocessed} is implicit if the input file has one of the
6d34c1c4
NB
4100extensions @samp{i}, @samp{ii} or @samp{mi}. These are the extensions
4101that GCC uses for preprocessed files created by @option{-save-temps}.
3bce8a01 4102
74291a4b 4103@item -trigraphs
cd3bb277 4104@opindex trigraphs
e582248c
NB
4105Process ISO standard trigraph sequences. These are three-character
4106sequences, all starting with @samp{??}, that are defined by ISO C to
4107stand for single characters. For example, @samp{??/} stands for
4108@samp{\}, so @samp{'??/n'} is a character constant for a newline. By
4109default, GCC ignores trigraphs, but in standard-conforming modes it
630d3d5a 4110converts them. See the @option{-std} and @option{-ansi} options.
e582248c
NB
4111
4112The nine trigraph sequences are
4113@table @samp
4114@item ??(
aee96fe9 4115@expansion{} @samp{[}
e582248c
NB
4116
4117@item ??)
aee96fe9 4118@expansion{} @samp{]}
e582248c
NB
4119
4120@item ??<
aee96fe9 4121@expansion{} @samp{@{}
e582248c
NB
4122
4123@item ??>
aee96fe9 4124@expansion{} @samp{@}}
e582248c
NB
4125
4126@item ??=
aee96fe9 4127@expansion{} @samp{#}
e582248c
NB
4128
4129@item ??/
aee96fe9 4130@expansion{} @samp{\}
e582248c
NB
4131
4132@item ??'
aee96fe9 4133@expansion{} @samp{^}
e582248c
NB
4134
4135@item ??!
aee96fe9 4136@expansion{} @samp{|}
e582248c
NB
4137
4138@item ??-
aee96fe9 4139@expansion{} @samp{~}
e582248c
NB
4140
4141@end table
4142
4143Trigraph support is not popular, so many compilers do not implement it
4144properly. Portable code should not rely on trigraphs being either
4145converted or ignored.
74291a4b 4146
aee96fe9 4147@item -Wp,@var{option}
cd3bb277 4148@opindex Wp
bedc7537 4149Pass @var{option} as an option to the preprocessor. If @var{option}
74291a4b
MM
4150contains commas, it is split into multiple options at the commas.
4151@end table
4152
4153@node Assembler Options
4154@section Passing Options to the Assembler
4155
4156@c prevent bad page break with this line
4157You can pass options to the assembler.
4158
2642624b 4159@table @gcctabopt
aee96fe9 4160@item -Wa,@var{option}
cd3bb277 4161@opindex Wa
74291a4b
MM
4162Pass @var{option} as an option to the assembler. If @var{option}
4163contains commas, it is split into multiple options at the commas.
4164@end table
4165
4166@node Link Options
4167@section Options for Linking
4168@cindex link options
4169@cindex options, linking
4170
4171These options come into play when the compiler links object files into
4172an executable output file. They are meaningless if the compiler is
4173not doing a link step.
4174
2642624b 4175@table @gcctabopt
74291a4b
MM
4176@cindex file names
4177@item @var{object-file-name}
4178A file name that does not end in a special recognized suffix is
4179considered to name an object file or library. (Object files are
4180distinguished from libraries by the linker according to the file
4181contents.) If linking is done, these object files are used as input
4182to the linker.
4183
4184@item -c
4185@itemx -S
4186@itemx -E
cd3bb277
JM
4187@opindex c
4188@opindex S
4189@opindex E
74291a4b
MM
4190If any of these options is used, then the linker is not run, and
4191object file names should not be used as arguments. @xref{Overall
4192Options}.
4193
4194@cindex Libraries
4195@item -l@var{library}
4275c4c4 4196@itemx -l @var{library}
cd3bb277 4197@opindex l
4275c4c4
JS
4198Search the library named @var{library} when linking. (The second
4199alternative with the library as a separate argument is only for
4200POSIX compliance and is not recommended.)
74291a4b
MM
4201
4202It makes a difference where in the command you write this option; the
4275c4c4 4203linker searches and processes libraries and object files in the order they
74291a4b
MM
4204are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4205after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
4206to functions in @samp{z}, those functions may not be loaded.
4207
4208The linker searches a standard list of directories for the library,
4209which is actually a file named @file{lib@var{library}.a}. The linker
4210then uses this file as if it had been specified precisely by name.
4211
4212The directories searched include several standard system directories
630d3d5a 4213plus any that you specify with @option{-L}.
74291a4b
MM
4214
4215Normally the files found this way are library files---archive files
4216whose members are object files. The linker handles an archive file by
4217scanning through it for members which define symbols that have so far
4218been referenced but not defined. But if the file that is found is an
4219ordinary object file, it is linked in the usual fashion. The only
630d3d5a
JM
4220difference between using an @option{-l} option and specifying a file name
4221is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
74291a4b
MM
4222and searches several directories.
4223
4224@item -lobjc
cd3bb277 4225@opindex lobjc
630d3d5a 4226You need this special case of the @option{-l} option in order to
2147b154 4227link an Objective-C program.
74291a4b
MM
4228
4229@item -nostartfiles
cd3bb277 4230@opindex nostartfiles
74291a4b 4231Do not use the standard system startup files when linking.
bedc7537
NC
4232The standard system libraries are used normally, unless @option{-nostdlib}
4233or @option{-nodefaultlibs} is used.
74291a4b
MM
4234
4235@item -nodefaultlibs
cd3bb277 4236@opindex nodefaultlibs
74291a4b
MM
4237Do not use the standard system libraries when linking.
4238Only the libraries you specify will be passed to the linker.
bedc7537 4239The standard startup files are used normally, unless @option{-nostartfiles}
4754172c 4240is used. The compiler may generate calls to memcmp, memset, and memcpy
c1030c7c 4241for System V (and ISO C) environments or to bcopy and bzero for
4754172c
CM
4242BSD environments. These entries are usually resolved by entries in
4243libc. These entry points should be supplied through some other
4244mechanism when this option is specified.
74291a4b
MM
4245
4246@item -nostdlib
cd3bb277 4247@opindex nostdlib
74291a4b
MM
4248Do not use the standard system startup files or libraries when linking.
4249No startup files and only the libraries you specify will be passed to
767094dd 4250the linker. The compiler may generate calls to memcmp, memset, and memcpy
c1030c7c 4251for System V (and ISO C) environments or to bcopy and bzero for
4754172c
CM
4252BSD environments. These entries are usually resolved by entries in
4253libc. These entry points should be supplied through some other
4254mechanism when this option is specified.
74291a4b 4255
630d3d5a
JM
4256@cindex @option{-lgcc}, use with @option{-nostdlib}
4257@cindex @option{-nostdlib} and unresolved references
4258@cindex unresolved references and @option{-nostdlib}
4259@cindex @option{-lgcc}, use with @option{-nodefaultlibs}
4260@cindex @option{-nodefaultlibs} and unresolved references
4261@cindex unresolved references and @option{-nodefaultlibs}
4262One of the standard libraries bypassed by @option{-nostdlib} and
4263@option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
0c2d1a2a 4264that GCC uses to overcome shortcomings of particular machines, or special
74291a4b
MM
4265needs for some languages.
4266@ifset INTERNALS
0c2d1a2a 4267(@xref{Interface,,Interfacing to GCC Output}, for more discussion of
74291a4b
MM
4268@file{libgcc.a}.)
4269@end ifset
4270@ifclear INTERNALS
0c2d1a2a 4271(@xref{Interface,,Interfacing to GCC Output,gcc.info,Porting GCC},
74291a4b
MM
4272for more discussion of @file{libgcc.a}.)
4273@end ifclear
4274In most cases, you need @file{libgcc.a} even when you want to avoid
630d3d5a
JM
4275other standard libraries. In other words, when you specify @option{-nostdlib}
4276or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
0c2d1a2a 4277This ensures that you have no unresolved references to internal GCC
74291a4b 4278library subroutines. (For example, @samp{__main}, used to ensure C++
bedc7537 4279constructors will be called; @pxref{Collect2,,@command{collect2}}.)
74291a4b
MM
4280
4281@item -s
cd3bb277 4282@opindex s
74291a4b
MM
4283Remove all symbol table and relocation information from the executable.
4284
4285@item -static
cd3bb277 4286@opindex static
74291a4b
MM
4287On systems that support dynamic linking, this prevents linking with the shared
4288libraries. On other systems, this option has no effect.
4289
4290@item -shared
cd3bb277 4291@opindex shared
74291a4b 4292Produce a shared object which can then be linked with other objects to
1d3b0e2c 4293form an executable. Not all systems support this option. For predictable
02f52e19 4294results, you must also specify the same set of options that were used to
630d3d5a 4295generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
2642624b 4296when you specify this option.@footnote{On some systems, @samp{gcc -shared}
767094dd 4297needs to build supplementary stub code for constructors to work. On
2642624b 4298multi-libbed systems, @samp{gcc -shared} must select the correct support
1d3b0e2c 4299libraries to link against. Failing to supply the correct flags may lead
767094dd 4300to subtle defects. Supplying them in cases where they are not necessary
1d3b0e2c 4301is innocuous.}
74291a4b 4302
9db0819e
RH
4303@item -shared-libgcc
4304@itemx -static-libgcc
cd3bb277
JM
4305@opindex shared-libgcc
4306@opindex static-libgcc
9db0819e
RH
4307On systems that provide @file{libgcc} as a shared library, these options
4308force the use of either the shared or static version respectively.
4309If no shared version of @file{libgcc} was built when the compiler was
4310configured, these options have no effect.
4311
4312There are several situations in which an application should use the
4313shared @file{libgcc} instead of the static version. The most common
4314of these is when the application wishes to throw and catch exceptions
4315across different shared libraries. In that case, each of the libraries
4316as well as the application itself should use the shared @file{libgcc}.
4317
630d3d5a
JM
4318Therefore, whenever you specify the @option{-shared} option, the GCC
4319driver automatically adds @option{-shared-libgcc}, unless you explicitly
4320specify @option{-static-libgcc}. The G++ driver automatically adds
4321@option{-shared-libgcc} when you build a main executable as well because
049f6ec9
MM
4322for C++ programs that is typically the right thing to do.
4323(Exception-handling will not work reliably otherwise.)
4324
4325However, when linking a main executable written in C, you must
630d3d5a 4326explicitly say @option{-shared-libgcc} if you want to use the shared
049f6ec9 4327@file{libgcc}.
9db0819e 4328
74291a4b 4329@item -symbolic
cd3bb277 4330@opindex symbolic
74291a4b
MM
4331Bind references to global symbols when building a shared object. Warn
4332about any unresolved references (unless overridden by the link editor
4333option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
4334this option.
4335
4336@item -Xlinker @var{option}
cd3bb277 4337@opindex Xlinker
74291a4b 4338Pass @var{option} as an option to the linker. You can use this to
0c2d1a2a 4339supply system-specific linker options which GCC does not know how to
74291a4b
MM
4340recognize.
4341
4342If you want to pass an option that takes an argument, you must use
630d3d5a
JM
4343@option{-Xlinker} twice, once for the option and once for the argument.
4344For example, to pass @option{-assert definitions}, you must write
74291a4b 4345@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
630d3d5a 4346@option{-Xlinker "-assert definitions"}, because this passes the entire
74291a4b
MM
4347string as a single argument, which is not what the linker expects.
4348
aee96fe9 4349@item -Wl,@var{option}
cd3bb277 4350@opindex Wl
74291a4b
MM
4351Pass @var{option} as an option to the linker. If @var{option} contains
4352commas, it is split into multiple options at the commas.
4353
4354@item -u @var{symbol}
cd3bb277 4355@opindex u
74291a4b 4356Pretend the symbol @var{symbol} is undefined, to force linking of
630d3d5a 4357library modules to define it. You can use @option{-u} multiple times with
74291a4b
MM
4358different symbols to force loading of additional library modules.
4359@end table
4360
4361@node Directory Options
4362@section Options for Directory Search
4363@cindex directory options
4364@cindex options, directory search
4365@cindex search path
4366
4367These options specify directories to search for header files, for
4368libraries and for parts of the compiler:
4369
2642624b 4370@table @gcctabopt
74291a4b 4371@item -I@var{dir}
cd3bb277 4372@opindex I
861bb6c1
JL
4373Add the directory @var{dir} to the head of the list of directories to be
4374searched for header files. This can be used to override a system header
4375file, substituting your own version, since these directories are
d0a5eb32
RK
4376searched before the system header file directories. However, you should
4377not use this option to add directories that contain vendor-supplied
767094dd 4378system header files (use @option{-isystem} for that). If you use more than
630d3d5a 4379one @option{-I} option, the directories are scanned in left-to-right
74291a4b
MM
4380order; the standard system directories come after.
4381
dbead49c
NS
4382If a standard system include directory, or a directory specified with
4383@option{-isystem}, is also specified with @option{-I}, it will be
4384searched only in the position requested by @option{-I}. Also, it will
4385not be considered a system include directory. If that directory really
4386does contain system headers, there is a good chance that they will
4387break. For instance, if GCC's installation procedure edited the headers
4388in @file{/usr/include} to fix bugs, @samp{-I/usr/include} will cause the
4389original, buggy headers to be found instead of the corrected ones. GCC
4390will issue a warning when a system include directory is hidden in this
4391way.
4392
74291a4b 4393@item -I-
cd3bb277 4394@opindex I-
630d3d5a 4395Any directories you specify with @option{-I} options before the @option{-I-}
74291a4b
MM
4396option are searched only for the case of @samp{#include "@var{file}"};
4397they are not searched for @samp{#include <@var{file}>}.
4398
630d3d5a
JM
4399If additional directories are specified with @option{-I} options after
4400the @option{-I-}, these directories are searched for all @samp{#include}
4401directives. (Ordinarily @emph{all} @option{-I} directories are used
74291a4b
MM
4402this way.)
4403
630d3d5a 4404In addition, the @option{-I-} option inhibits the use of the current
74291a4b
MM
4405directory (where the current input file came from) as the first search
4406directory for @samp{#include "@var{file}"}. There is no way to
630d3d5a 4407override this effect of @option{-I-}. With @option{-I.} you can specify
74291a4b
MM
4408searching the directory which was current when the compiler was
4409invoked. That is not exactly the same as what the preprocessor does
4410by default, but it is often satisfactory.
4411
630d3d5a
JM
4412@option{-I-} does not inhibit the use of the standard system directories
4413for header files. Thus, @option{-I-} and @option{-nostdinc} are
74291a4b
MM
4414independent.
4415
4416@item -L@var{dir}
cd3bb277 4417@opindex L
74291a4b 4418Add directory @var{dir} to the list of directories to be searched
630d3d5a 4419for @option{-l}.
74291a4b
MM
4420
4421@item -B@var{prefix}
cd3bb277 4422@opindex B
74291a4b
MM
4423This option specifies where to find the executables, libraries,
4424include files, and data files of the compiler itself.
4425
4426The compiler driver program runs one or more of the subprograms
4427@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
4428@var{prefix} as a prefix for each program it tries to run, both with and
4429without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
4430
4431For each subprogram to be run, the compiler driver first tries the
630d3d5a 4432@option{-B} prefix, if any. If that name is not found, or if @option{-B}
74291a4b
MM
4433was not specified, the driver tries two standard prefixes, which are
4434@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of
4435those results in a file name that is found, the unmodified program
4436name is searched for using the directories specified in your
bedc7537 4437@env{PATH} environment variable.
74291a4b 4438
07804c3b
NC
4439The compiler will check to see if the path provided by the @option{-B}
4440refers to a directory, and if necessary it will add a directory
4441separator character at the end of the path.
4442
630d3d5a 4443@option{-B} prefixes that effectively specify directory names also apply
74291a4b 4444to libraries in the linker, because the compiler translates these
630d3d5a 4445options into @option{-L} options for the linker. They also apply to
74291a4b 4446includes files in the preprocessor, because the compiler translates these
630d3d5a 4447options into @option{-isystem} options for the preprocessor. In this case,
74291a4b
MM
4448the compiler appends @samp{include} to the prefix.
4449
4450The run-time support file @file{libgcc.a} can also be searched for using
630d3d5a 4451the @option{-B} prefix, if needed. If it is not found there, the two
74291a4b
MM
4452standard prefixes above are tried, and that is all. The file is left
4453out of the link if it is not found by those means.
4454
630d3d5a 4455Another way to specify a prefix much like the @option{-B} prefix is to use
bedc7537 4456the environment variable @env{GCC_EXEC_PREFIX}. @xref{Environment
74291a4b 4457Variables}.
861bb6c1 4458
07804c3b 4459As a special kludge, if the path provided by @option{-B} is
bf4eebe0
NC
4460@file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
44619, then it will be replaced by @file{[dir/]include}. This is to help
7dac2f89 4462with boot-strapping the compiler.
07804c3b 4463
861bb6c1 4464@item -specs=@var{file}
cd3bb277 4465@opindex specs
861bb6c1
JL
4466Process @var{file} after the compiler reads in the standard @file{specs}
4467file, in order to override the defaults that the @file{gcc} driver
4468program uses when determining what switches to pass to @file{cc1},
4469@file{cc1plus}, @file{as}, @file{ld}, etc. More than one
630d3d5a 4470@option{-specs=@var{file}} can be specified on the command line, and they
861bb6c1 4471are processed in order, from left to right.
74291a4b
MM
4472@end table
4473
ee457005
JM
4474@c man end
4475
a743d340
NC
4476@node Spec Files
4477@section Specifying subprocesses and the switches to pass to them
4478@cindex Spec Files
bedc7537 4479@command{gcc} is a driver program. It performs its job by invoking a
a743d340
NC
4480sequence of other programs to do the work of compiling, assembling and
4481linking. GCC interprets its command-line parameters and uses these to
4482deduce which programs it should invoke, and which command-line options
4483it ought to place on their command lines. This behaviour is controlled
4484by @dfn{spec strings}. In most cases there is one spec string for each
4485program that GCC can invoke, but a few programs have multiple spec
4486strings to control their behaviour. The spec strings built into GCC can
630d3d5a 4487be overridden by using the @option{-specs=} command-line switch to specify
a743d340
NC
4488a spec file.
4489
4490@dfn{Spec files} are plaintext files that are used to construct spec
4491strings. They consist of a sequence of directives separated by blank
4492lines. The type of directive is determined by the first non-whitespace
4493character on the line and it can be one of the following:
4494
4495@table @code
4496@item %@var{command}
4497Issues a @var{command} to the spec file processor. The commands that can
02f52e19 4498appear here are:
a743d340
NC
4499
4500@table @code
4501@item %include <@var{file}>
4502@cindex %include
4503Search for @var{file} and insert its text at the current point in the
4504specs file.
4505
4506@item %include_noerr <@var{file}>
4507@cindex %include_noerr
4508Just like @samp{%include}, but do not generate an error message if the include
4509file cannot be found.
4510
4511@item %rename @var{old_name} @var{new_name}
4512@cindex %rename
4513Rename the spec string @var{old_name} to @var{new_name}.
4514
4515@end table
4516
4517@item *[@var{spec_name}]:
4518This tells the compiler to create, override or delete the named spec
4519string. All lines after this directive up to the next directive or
4520blank line are considered to be the text for the spec string. If this
4521results in an empty string then the spec will be deleted. (Or, if the
4522spec did not exist, then nothing will happened.) Otherwise, if the spec
4523does not currently exist a new spec will be created. If the spec does
4524exist then its contents will be overridden by the text of this
4525directive, unless the first character of that text is the @samp{+}
4526character, in which case the text will be appended to the spec.
4527
4528@item [@var{suffix}]:
4529Creates a new @samp{[@var{suffix}] spec} pair. All lines after this directive
4530and up to the next directive or blank line are considered to make up the
02f52e19 4531spec string for the indicated suffix. When the compiler encounters an
a743d340
NC
4532input file with the named suffix, it will processes the spec string in
4533order to work out how to compile that file. For example:
4534
4535@smallexample
4536.ZZ:
4537z-compile -input %i
4538@end smallexample
4539
4540This says that any input file whose name ends in @samp{.ZZ} should be
4541passed to the program @samp{z-compile}, which should be invoked with the
630d3d5a 4542command-line switch @option{-input} and with the result of performing the
a743d340
NC
4543@samp{%i} substitution. (See below.)
4544
4545As an alternative to providing a spec string, the text that follows a
4546suffix directive can be one of the following:
4547
4548@table @code
4549@item @@@var{language}
4550This says that the suffix is an alias for a known @var{language}. This is
bedc7537 4551similar to using the @option{-x} command-line switch to GCC to specify a
a743d340
NC
4552language explicitly. For example:
4553
4554@smallexample
4555.ZZ:
4556@@c++
4557@end smallexample
4558
4559Says that .ZZ files are, in fact, C++ source files.
4560
4561@item #@var{name}
4562This causes an error messages saying:
4563
4564@smallexample
4565@var{name} compiler not installed on this system.
4566@end smallexample
4567@end table
4568
4569GCC already has an extensive list of suffixes built into it.
4570This directive will add an entry to the end of the list of suffixes, but
4571since the list is searched from the end backwards, it is effectively
4572possible to override earlier entries using this technique.
4573
4574@end table
4575
4576GCC has the following spec strings built into it. Spec files can
4577override these strings or create their own. Note that individual
02f52e19 4578targets can also add their own spec strings to this list.
a743d340
NC
4579
4580@smallexample
4581asm Options to pass to the assembler
4582asm_final Options to pass to the assembler post-processor
4583cpp Options to pass to the C preprocessor
4584cc1 Options to pass to the C compiler
4585cc1plus Options to pass to the C++ compiler
4586endfile Object files to include at the end of the link
4587link Options to pass to the linker
4588lib Libraries to include on the command line to the linker
4589libgcc Decides which GCC support library to pass to the linker
4590linker Sets the name of the linker
4591predefines Defines to be passed to the C preprocessor
310668e8
JM
4592signed_char Defines to pass to CPP to say whether @code{char} is signed
4593 by default
a743d340
NC
4594startfile Object files to include at the start of the link
4595@end smallexample
4596
4597Here is a small example of a spec file:
4598
4599@smallexample
4600%rename lib old_lib
4601
4602*lib:
4603--start-group -lgcc -lc -leval1 --end-group %(old_lib)
4604@end smallexample
4605
4606This example renames the spec called @samp{lib} to @samp{old_lib} and
4607then overrides the previous definition of @samp{lib} with a new one.
4608The new definition adds in some extra command-line options before
4609including the text of the old definition.
4610
4611@dfn{Spec strings} are a list of command-line options to be passed to their
4612corresponding program. In addition, the spec strings can contain
4613@samp{%}-prefixed sequences to substitute variable text or to
4614conditionally insert text into the command line. Using these constructs
4615it is possible to generate quite complex command lines.
4616
4617Here is a table of all defined @samp{%}-sequences for spec
4618strings. Note that spaces are not generated automatically around the
4619results of expanding these sequences. Therefore you can concatenate them
02f52e19 4620together or combine them with constant text in a single argument.
a743d340
NC
4621
4622@table @code
4623@item %%
4624Substitute one @samp{%} into the program name or argument.
4625
4626@item %i
4627Substitute the name of the input file being processed.
4628
4629@item %b
4630Substitute the basename of the input file being processed.
4631This is the substring up to (and not including) the last period
4632and not including the directory.
4633
371e300b
NC
4634@item %B
4635This is the same as @samp{%b}, but include the file suffix (text after
4636the last period).
4637
a743d340
NC
4638@item %d
4639Marks the argument containing or following the @samp{%d} as a
4640temporary file name, so that that file will be deleted if GCC exits
4641successfully. Unlike @samp{%g}, this contributes no text to the
02f52e19 4642argument.
a743d340
NC
4643
4644@item %g@var{suffix}
4645Substitute a file name that has suffix @var{suffix} and is chosen
4646once per compilation, and mark the argument in the same way as
4647@samp{%d}. To reduce exposure to denial-of-service attacks, the file
02f52e19 4648name is now chosen in a way that is hard to predict even when previously
695ac33f 4649chosen file names are known. For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
a743d340
NC
4650might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}. @var{suffix} matches
4651the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
4652treated exactly as if @samp{%O} had been preprocessed. Previously, @samp{%g}
4653was simply substituted with a file name chosen once per compilation,
4654without regard to any appended suffix (which was therefore treated
4655just like ordinary text), making such attacks more likely to succeed.
4656
4657@item %u@var{suffix}
4658Like @samp{%g}, but generates a new temporary file name even if
4659@samp{%u@var{suffix}} was already seen.
4660
4661@item %U@var{suffix}
4662Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
4663new one if there is no such last file name. In the absence of any
4664@samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
695ac33f 4665the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
a743d340
NC
4666would involve the generation of two distinct file names, one
4667for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} was
4668simply substituted with a file name chosen for the previous @samp{%u},
4669without regard to any appended suffix.
4670
371e300b 4671@item %j@var{SUFFIX}
aee96fe9 4672Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
371e300b
NC
4673writable, and if save-temps is off; otherwise, substitute the name
4674of a temporary file, just like @samp{%u}. This temporary file is not
4675meant for communication between processes, but rather as a junk
4676disposal mechanism.
4677
4678@item %.@var{SUFFIX}
4679Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
767094dd 4680when it is subsequently output with @samp{%*}. @var{SUFFIX} is
371e300b
NC
4681terminated by the next space or %.
4682
a743d340
NC
4683@item %w
4684Marks the argument containing or following the @samp{%w} as the
4685designated output file of this compilation. This puts the argument
4686into the sequence of arguments that @samp{%o} will substitute later.
4687
4688@item %o
4689Substitutes the names of all the output files, with spaces
4690automatically placed around them. You should write spaces
4691around the @samp{%o} as well or the results are undefined.
4692@samp{%o} is for use in the specs for running the linker.
4693Input files whose names have no recognized suffix are not compiled
4694at all, but they are included among the output files, so they will
4695be linked.
4696
4697@item %O
4698Substitutes the suffix for object files. Note that this is
4699handled specially when it immediately follows @samp{%g, %u, or %U},
4700because of the need for those to form complete file names. The
4701handling is such that @samp{%O} is treated exactly as if it had already
4702been substituted, except that @samp{%g, %u, and %U} do not currently
4703support additional @var{suffix} characters following @samp{%O} as they would
4704following, for example, @samp{.o}.
4705
4706@item %p
4707Substitutes the standard macro predefinitions for the
4708current target machine. Use this when running @code{cpp}.
4709
4710@item %P
4711Like @samp{%p}, but puts @samp{__} before and after the name of each
4712predefined macro, except for macros that start with @samp{__} or with
c1030c7c 4713@samp{_@var{L}}, where @var{L} is an uppercase letter. This is for ISO
161d7b59 4714C@.
a743d340
NC
4715
4716@item %I
aee96fe9 4717Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}.
a743d340
NC
4718
4719@item %s
4720Current argument is the name of a library or startup file of some sort.
4721Search for that file in a standard list of directories and substitute
02f52e19 4722the full name found.
a743d340
NC
4723
4724@item %e@var{str}
4725Print @var{str} as an error message. @var{str} is terminated by a newline.
4726Use this when inconsistent options are detected.
4727
4728@item %|
4729Output @samp{-} if the input for the current command is coming from a pipe.
4730
4731@item %(@var{name})
4732Substitute the contents of spec string @var{name} at this point.
4733
4734@item %[@var{name}]
630d3d5a 4735Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
a743d340
NC
4736
4737@item %x@{@var{option}@}
4738Accumulate an option for @samp{%X}.
4739
4740@item %X
630d3d5a 4741Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
a743d340
NC
4742spec string.
4743
4744@item %Y
630d3d5a 4745Output the accumulated assembler options specified by @option{-Wa}.
a743d340
NC
4746
4747@item %Z
630d3d5a 4748Output the accumulated preprocessor options specified by @option{-Wp}.
a743d340
NC
4749
4750@item %v1
161d7b59 4751Substitute the major version number of GCC@.
a743d340
NC
4752(For version 2.9.5, this is 2.)
4753
4754@item %v2
161d7b59 4755Substitute the minor version number of GCC@.
a743d340
NC
4756(For version 2.9.5, this is 9.)
4757
371e300b 4758@item %v3
161d7b59 4759Substitute the patch level number of GCC@.
371e300b
NC
4760(For version 2.9.5, this is 5.)
4761
a743d340
NC
4762@item %a
4763Process the @code{asm} spec. This is used to compute the
4764switches to be passed to the assembler.
4765
4766@item %A
4767Process the @code{asm_final} spec. This is a spec string for
4768passing switches to an assembler post-processor, if such a program is
4769needed.
4770
4771@item %l
4772Process the @code{link} spec. This is the spec for computing the
4773command line passed to the linker. Typically it will make use of the
4774@samp{%L %G %S %D and %E} sequences.
4775
4776@item %D
630d3d5a 4777Dump out a @option{-L} option for each directory that GCC believes might
a743d340 4778contain startup files. If the target supports multilibs then the
02f52e19 4779current multilib directory will be prepended to each of these paths.
a743d340 4780
371e300b 4781@item %M
c771326b 4782Output the multilib directory with directory separators replaced with
695ac33f
JM
4783@samp{_}. If multilib directories are not set, or the multilib directory is
4784@file{.} then this option emits nothing.
371e300b 4785
a743d340
NC
4786@item %L
4787Process the @code{lib} spec. This is a spec string for deciding which
02f52e19 4788libraries should be included on the command line to the linker.
a743d340
NC
4789
4790@item %G
4791Process the @code{libgcc} spec. This is a spec string for deciding
02f52e19 4792which GCC support library should be included on the command line to the linker.
a743d340
NC
4793
4794@item %S
4795Process the @code{startfile} spec. This is a spec for deciding which
4796object files should be the first ones passed to the linker. Typically
02f52e19 4797this might be a file named @file{crt0.o}.
a743d340
NC
4798
4799@item %E
4800Process the @code{endfile} spec. This is a spec string that specifies
02f52e19 4801the last object files that will be passed to the linker.
a743d340
NC
4802
4803@item %C
4804Process the @code{cpp} spec. This is used to construct the arguments
4805to be passed to the C preprocessor.
4806
4807@item %c
4808Process the @code{signed_char} spec. This is intended to be used
02f52e19 4809to tell cpp whether a char is signed. It typically has the definition:
a743d340
NC
4810@smallexample
4811%@{funsigned-char:-D__CHAR_UNSIGNED__@}
4812@end smallexample
4813
4814@item %1
4815Process the @code{cc1} spec. This is used to construct the options to be
4816passed to the actual C compiler (@samp{cc1}).
4817
4818@item %2
4819Process the @code{cc1plus} spec. This is used to construct the options to be
4820passed to the actual C++ compiler (@samp{cc1plus}).
4821
4822@item %*
4823Substitute the variable part of a matched option. See below.
4824Note that each comma in the substituted string is replaced by
4825a single space.
4826
4827@item %@{@code{S}@}
161d7b59 4828Substitutes the @code{-S} switch, if that switch was given to GCC@.
a743d340
NC
4829If that switch was not specified, this substitutes nothing. Note that
4830the leading dash is omitted when specifying this option, and it is
4831automatically inserted if the substitution is performed. Thus the spec
630d3d5a
JM
4832string @samp{%@{foo@}} would match the command-line option @option{-foo}
4833and would output the command line option @option{-foo}.
a743d340
NC
4834
4835@item %W@{@code{S}@}
4836Like %@{@code{S}@} but mark last argument supplied within as a file to be
02f52e19 4837deleted on failure.
a743d340
NC
4838
4839@item %@{@code{S}*@}
4840Substitutes all the switches specified to GCC whose names start
4841with @code{-S}, but which also take an argument. This is used for
695ac33f 4842switches like @option{-o}, @option{-D}, @option{-I}, etc.
630d3d5a 4843GCC considers @option{-o foo} as being
a743d340 4844one switch whose names starts with @samp{o}. %@{o*@} would substitute this
02f52e19 4845text, including the space. Thus two arguments would be generated.
a743d340
NC
4846
4847@item %@{^@code{S}*@}
4848Like %@{@code{S}*@}, but don't put a blank between a switch and its
4849argument. Thus %@{^o*@} would only generate one argument, not two.
4850
371e300b
NC
4851@item %@{@code{S}*&@code{T}*@}
4852Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
4853(the order of @code{S} and @code{T} in the spec is not significant).
4854There can be any number of ampersand-separated variables; for each the
4855wild card is optional. Useful for CPP as @samp{%@{D*&U*&A*@}}.
4856
d630442f 4857@item %@{<@code{S}@}
695ac33f 4858Remove all occurrences of @code{-S} from the command line. Note---this
d630442f 4859command is position dependent. @samp{%} commands in the spec string
50c57e7b 4860before this option will see @code{-S}, @samp{%} commands in the spec
d630442f
NC
4861string after this option will not.
4862
a743d340
NC
4863@item %@{@code{S}*:@code{X}@}
4864Substitutes @code{X} if one or more switches whose names start with
161d7b59 4865@code{-S} are specified to GCC@. Note that the tail part of the
e979f9e8 4866@code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted
02f52e19 4867for each occurrence of @samp{%*} within @code{X}.
a743d340
NC
4868
4869@item %@{@code{S}:@code{X}@}
161d7b59 4870Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@.
a743d340
NC
4871
4872@item %@{!@code{S}:@code{X}@}
161d7b59 4873Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@.
a743d340
NC
4874
4875@item %@{|@code{S}:@code{X}@}
4876Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}.
4877
4878@item %@{|!@code{S}:@code{X}@}
4879Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}.
4880
4881@item %@{.@code{S}:@code{X}@}
4882Substitutes @code{X}, but only if processing a file with suffix @code{S}.
4883
4884@item %@{!.@code{S}:@code{X}@}
4885Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}.
4886
4887@item %@{@code{S}|@code{P}:@code{X}@}
161d7b59 4888Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@. This may be
a743d340
NC
4889combined with @samp{!} and @samp{.} sequences as well, although they
4890have a stronger binding than the @samp{|}. For example a spec string
4891like this:
4892
4893@smallexample
4894%@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
4895@end smallexample
4896
4897will output the following command-line options from the following input
4898command-line options:
4899
4900@smallexample
4901fred.c -foo -baz
4902jim.d -bar -boggle
4903-d fred.c -foo -baz -boggle
4904-d jim.d -bar -baz -boggle
4905@end smallexample
4906
4907@end table
4908
4909The conditional text @code{X} in a %@{@code{S}:@code{X}@} or
4910%@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs
4911or spaces, or even newlines. They are processed as usual, as described
02f52e19 4912above.
a743d340 4913
695ac33f
JM
4914The @option{-O}, @option{-f}, @option{-m}, and @option{-W}
4915switches are handled specifically in these
630d3d5a
JM
4916constructs. If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or
4917@option{-W} switch is found later in the command line, the earlier switch
a743d340
NC
4918value is ignored, except with @{@code{S}*@} where @code{S} is just one
4919letter, which passes all matching options.
4920
4921The character @samp{|} at the beginning of the predicate text is used to indicate
630d3d5a 4922that a command should be piped to the following command, but only if @option{-pipe}
a743d340
NC
4923is specified.
4924
4925It is built into GCC which switches take arguments and which do not.
4926(You might think it would be useful to generalize this to allow each
4927compiler's spec to say which switches take arguments. But this cannot
4928be done in a consistent fashion. GCC cannot even decide which input
4929files have been specified without knowing which switches take arguments,
4930and it must know which input files to compile in order to tell which
02f52e19 4931compilers to run).
a743d340 4932
630d3d5a 4933GCC also knows implicitly that arguments starting in @option{-l} are to be
a743d340
NC
4934treated as compiler output files, and passed to the linker in their
4935proper position among the other output files.
4936
ee457005
JM
4937@c man begin OPTIONS
4938
74291a4b
MM
4939@node Target Options
4940@section Specifying Target Machine and Compiler Version
4941@cindex target options
4942@cindex cross compiling
4943@cindex specifying machine version
4944@cindex specifying compiler version and target machine
4945@cindex compiler version, specifying
4946@cindex target machine, specifying
4947
0c2d1a2a 4948By default, GCC compiles code for the same type of machine that you
74291a4b
MM
4949are using. However, it can also be installed as a cross-compiler, to
4950compile for some other type of machine. In fact, several different
0c2d1a2a 4951configurations of GCC, for different target machines, can be
74291a4b 4952installed side by side. Then you specify which one to use with the
630d3d5a 4953@option{-b} option.
74291a4b 4954
0c2d1a2a 4955In addition, older and newer versions of GCC can be installed side
74291a4b
MM
4956by side. One of them (probably the newest) will be the default, but
4957you may sometimes wish to use another.
4958
2642624b 4959@table @gcctabopt
74291a4b 4960@item -b @var{machine}
cd3bb277 4961@opindex b
74291a4b 4962The argument @var{machine} specifies the target machine for compilation.
0c2d1a2a 4963This is useful when you have installed GCC as a cross-compiler.
74291a4b
MM
4964
4965The value to use for @var{machine} is the same as was specified as the
0c2d1a2a 4966machine type when configuring GCC as a cross-compiler. For
74291a4b
MM
4967example, if a cross-compiler was configured with @samp{configure
4968i386v}, meaning to compile for an 80386 running System V, then you
630d3d5a 4969would specify @option{-b i386v} to run that cross compiler.
74291a4b 4970
630d3d5a 4971When you do not specify @option{-b}, it normally means to compile for
74291a4b
MM
4972the same type of machine that you are using.
4973
4974@item -V @var{version}
cd3bb277 4975@opindex V
0c2d1a2a 4976The argument @var{version} specifies which version of GCC to run.
74291a4b 4977This is useful when multiple versions are installed. For example,
0c2d1a2a 4978@var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
74291a4b 4979
630d3d5a 4980The default version, when you do not specify @option{-V}, is the last
0c2d1a2a 4981version of GCC that you installed.
74291a4b
MM
4982@end table
4983
630d3d5a 4984The @option{-b} and @option{-V} options actually work by controlling part of
74291a4b 4985the file name used for the executable files and libraries used for
0c2d1a2a 4986compilation. A given version of GCC, for a given target machine, is
bd819a4a 4987normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.
74291a4b 4988
630d3d5a 4989Thus, sites can customize the effect of @option{-b} or @option{-V} either by
74291a4b
MM
4990changing the names of these directories or adding alternate names (or
4991symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the
630d3d5a
JM
4992file @file{80386} is a link to the file @file{i386v}, then @option{-b
499380386} becomes an alias for @option{-b i386v}.
74291a4b 4994
630d3d5a 4995In one respect, the @option{-b} or @option{-V} do not completely change
bedc7537 4996to a different compiler: the top-level driver program @command{gcc}
74291a4b
MM
4997that you originally invoked continues to run and invoke the other
4998executables (preprocessor, compiler per se, assembler and linker)
4999that do the real work. However, since no real work is done in the
5000driver program, it usually does not matter that the driver program
8c7b74b9
JM
5001in use is not the one for the specified target. It is common for the
5002interface to the other executables to change incompatibly between
5003compiler versions, so unless the version specified is very close to that
630d3d5a
JM
5004of the driver (for example, @option{-V 3.0} with a driver program from GCC
5005version 3.0.1), use of @option{-V} may not work; for example, using
5006@option{-V 2.95.2} will not work with a driver program from GCC 3.0.
74291a4b
MM
5007
5008The only way that the driver program depends on the target machine is
5009in the parsing and handling of special machine-specific options.
5010However, this is controlled by a file which is found, along with the
5011other executables, in the directory for the specified version and
5012target machine. As a result, a single installed driver program adapts
8c7b74b9
JM
5013to any specified target machine, and sufficiently similar compiler
5014versions.
74291a4b
MM
5015
5016The driver program executable does control one significant thing,
5017however: the default version and target machine. Therefore, you can
5018install different instances of the driver program, compiled for
5019different targets or versions, under different names.
5020
bedc7537
NC
5021For example, if the driver for version 2.0 is installed as @command{ogcc}
5022and that for version 2.1 is installed as @command{gcc}, then the command
5023@command{gcc} will use version 2.1 by default, while @command{ogcc} will use
74291a4b 50242.0 by default. However, you can choose either version with either
630d3d5a 5025command with the @option{-V} option.
74291a4b
MM
5026
5027@node Submodel Options
5028@section Hardware Models and Configurations
5029@cindex submodel options
5030@cindex specifying hardware config
5031@cindex hardware models and configurations, specifying
5032@cindex machine dependent options
5033
630d3d5a 5034Earlier we discussed the standard option @option{-b} which chooses among
74291a4b 5035different installed compilers for completely different target
e979f9e8 5036machines, such as Vax vs.@: 68000 vs.@: 80386.
74291a4b
MM
5037
5038In addition, each of these target machine types can have its own
5039special options, starting with @samp{-m}, to choose among various
5040hardware models or configurations---for example, 68010 vs 68020,
5041floating coprocessor or none. A single installed version of the
5042compiler can compile for any model or configuration, according to the
5043options specified.
5044
5045Some configurations of the compiler also support additional special
5046options, usually for compatibility with other compilers on the same
5047platform.
5048
5049@ifset INTERNALS
5050These options are defined by the macro @code{TARGET_SWITCHES} in the
5051machine description. The default for the options is also defined by
5052that macro, which enables you to change the defaults.
5053@end ifset
5054
5055@menu
5056* M680x0 Options::
2856c3e3 5057* M68hc1x Options::
74291a4b
MM
5058* VAX Options::
5059* SPARC Options::
5060* Convex Options::
5061* AMD29K Options::
5062* ARM Options::
ecff22ab 5063* MN10200 Options::
6d6d0fa0 5064* MN10300 Options::
861bb6c1 5065* M32R/D Options::
74291a4b
MM
5066* M88K Options::
5067* RS/6000 and PowerPC Options::
5068* RT Options::
5069* MIPS Options::
5070* i386 Options::
5071* HPPA Options::
5072* Intel 960 Options::
5073* DEC Alpha Options::
5074* Clipper Options::
5075* H8/300 Options::
5076* SH Options::
5077* System V Options::
282a61e6 5078* TMS320C3x/C4x Options::
f84271d9 5079* V850 Options::
56b2d7a7 5080* ARC Options::
83575957 5081* NS32K Options::
052a4b28
DC
5082* AVR Options::
5083* MCore Options::
df6194d4 5084* IA-64 Options::
e8ad90e5 5085* D30V Options::
74291a4b
MM
5086@end menu
5087
5088@node M680x0 Options
5089@subsection M680x0 Options
5090@cindex M680x0 options
5091
5092These are the @samp{-m} options defined for the 68000 series. The default
5093values for these options depends on which style of 68000 was selected when
5094the compiler was configured; the defaults for the most common choices are
5095given below.
5096
2642624b 5097@table @gcctabopt
74291a4b
MM
5098@item -m68000
5099@itemx -mc68000
cd3bb277
JM
5100@opindex m68000
5101@opindex mc68000
74291a4b
MM
5102Generate output for a 68000. This is the default
5103when the compiler is configured for 68000-based systems.
5104
74cf1c6d
RK
5105Use this option for microcontrollers with a 68000 or EC000 core,
5106including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5107
74291a4b
MM
5108@item -m68020
5109@itemx -mc68020
cd3bb277
JM
5110@opindex m68020
5111@opindex mc68020
74291a4b
MM
5112Generate output for a 68020. This is the default
5113when the compiler is configured for 68020-based systems.
5114
5115@item -m68881
cd3bb277 5116@opindex m68881
74291a4b 5117Generate output containing 68881 instructions for floating point.
630d3d5a 5118This is the default for most 68020 systems unless @option{--nfp} was
74291a4b
MM
5119specified when the compiler was configured.
5120
5121@item -m68030
cd3bb277 5122@opindex m68030
74291a4b
MM
5123Generate output for a 68030. This is the default when the compiler is
5124configured for 68030-based systems.
5125
5126@item -m68040
cd3bb277 5127@opindex m68040
74291a4b
MM
5128Generate output for a 68040. This is the default when the compiler is
5129configured for 68040-based systems.
5130
5131This option inhibits the use of 68881/68882 instructions that have to be
74cf1c6d
RK
5132emulated by software on the 68040. Use this option if your 68040 does not
5133have code to emulate those instructions.
74291a4b
MM
5134
5135@item -m68060
cd3bb277 5136@opindex m68060
74291a4b
MM
5137Generate output for a 68060. This is the default when the compiler is
5138configured for 68060-based systems.
5139
5140This option inhibits the use of 68020 and 68881/68882 instructions that
74cf1c6d
RK
5141have to be emulated by software on the 68060. Use this option if your 68060
5142does not have code to emulate those instructions.
5143
5144@item -mcpu32
cd3bb277 5145@opindex mcpu32
767094dd 5146Generate output for a CPU32. This is the default
74cf1c6d
RK
5147when the compiler is configured for CPU32-based systems.
5148
5149Use this option for microcontrollers with a
5150CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
515168336, 68340, 68341, 68349 and 68360.
74291a4b
MM
5152
5153@item -m5200
cd3bb277 5154@opindex m5200
695ac33f 5155Generate output for a 520X ``coldfire'' family cpu. This is the default
74291a4b
MM
5156when the compiler is configured for 520X-based systems.
5157
02f52e19 5158Use this option for microcontroller with a 5200 core, including
74cf1c6d
RK
5159the MCF5202, MCF5203, MCF5204 and MCF5202.
5160
74291a4b
MM
5161
5162@item -m68020-40
cd3bb277 5163@opindex m68020-40
74291a4b
MM
5164Generate output for a 68040, without using any of the new instructions.
5165This results in code which can run relatively efficiently on either a
516668020/68881 or a 68030 or a 68040. The generated code does use the
516768881 instructions that are emulated on the 68040.
5168
861bb6c1 5169@item -m68020-60
cd3bb277 5170@opindex m68020-60
861bb6c1
JL
5171Generate output for a 68060, without using any of the new instructions.
5172This results in code which can run relatively efficiently on either a
517368020/68881 or a 68030 or a 68040. The generated code does use the
517468881 instructions that are emulated on the 68060.
5175
74291a4b 5176@item -mfpa
cd3bb277 5177@opindex mfpa
74291a4b
MM
5178Generate output containing Sun FPA instructions for floating point.
5179
5180@item -msoft-float
cd3bb277 5181@opindex msoft-float
74291a4b
MM
5182Generate output containing library calls for floating point.
5183@strong{Warning:} the requisite libraries are not available for all m68k
5184targets. Normally the facilities of the machine's usual C compiler are
5185used, but this can't be done directly in cross-compilation. You must
5186make your own arrangements to provide suitable library functions for
5187cross-compilation. The embedded targets @samp{m68k-*-aout} and
5188@samp{m68k-*-coff} do provide software floating point support.
5189
5190@item -mshort
cd3bb277 5191@opindex mshort
74291a4b
MM
5192Consider type @code{int} to be 16 bits wide, like @code{short int}.
5193
5194@item -mnobitfield
cd3bb277 5195@opindex mnobitfield
630d3d5a
JM
5196Do not use the bit-field instructions. The @option{-m68000}, @option{-mcpu32}
5197and @option{-m5200} options imply @w{@option{-mnobitfield}}.
74291a4b
MM
5198
5199@item -mbitfield
cd3bb277 5200@opindex mbitfield
630d3d5a
JM
5201Do use the bit-field instructions. The @option{-m68020} option implies
5202@option{-mbitfield}. This is the default if you use a configuration
74291a4b
MM
5203designed for a 68020.
5204
5205@item -mrtd
cd3bb277 5206@opindex mrtd
74291a4b
MM
5207Use a different function-calling convention, in which functions
5208that take a fixed number of arguments return with the @code{rtd}
5209instruction, which pops their arguments while returning. This
5210saves one instruction in the caller since there is no need to pop
5211the arguments there.
5212
5213This calling convention is incompatible with the one normally
5214used on Unix, so you cannot use it if you need to call libraries
5215compiled with the Unix compiler.
5216
5217Also, you must provide function prototypes for all functions that
5218take variable numbers of arguments (including @code{printf});
5219otherwise incorrect code will be generated for calls to those
5220functions.
5221
5222In addition, seriously incorrect code will result if you call a
5223function with too many arguments. (Normally, extra arguments are
5224harmlessly ignored.)
5225
5226The @code{rtd} instruction is supported by the 68010, 68020, 68030,
74cf1c6d 522768040, 68060 and CPU32 processors, but not by the 68000 or 5200.
861bb6c1
JL
5228
5229@item -malign-int
5230@itemx -mno-align-int
cd3bb277
JM
5231@opindex malign-int
5232@opindex mno-align-int
02f52e19 5233Control whether GCC aligns @code{int}, @code{long}, @code{long long},
861bb6c1 5234@code{float}, @code{double}, and @code{long double} variables on a 32-bit
630d3d5a 5235boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
861bb6c1
JL
5236Aligning variables on 32-bit boundaries produces code that runs somewhat
5237faster on processors with 32-bit busses at the expense of more memory.
5238
630d3d5a 5239@strong{Warning:} if you use the @option{-malign-int} switch, GCC will
861bb6c1
JL
5240align structures containing the above types differently than
5241most published application binary interface specifications for the m68k.
5242
fb868474 5243@item -mpcrel
cd3bb277 5244@opindex mpcrel
fb868474 5245Use the pc-relative addressing mode of the 68000 directly, instead of
695ac33f
JM
5246using a global offset table. At present, this option implies @option{-fpic},
5247allowing at most a 16-bit offset for pc-relative addressing. @option{-fPIC} is
5248not presently supported with @option{-mpcrel}, though this could be supported for
fb868474
DL
524968020 and higher processors.
5250
b71733d5
GM
5251@item -mno-strict-align
5252@itemx -mstrict-align
cd3bb277
JM
5253@opindex mno-strict-align
5254@opindex mstrict-align
b71733d5
GM
5255Do not (do) assume that unaligned memory references will be handled by
5256the system.
5257
74291a4b
MM
5258@end table
5259
2856c3e3
SC
5260@node M68hc1x Options
5261@subsection M68hc1x Options
5262@cindex M68hc1x options
5263
5264These are the @samp{-m} options defined for the 68hc11 and 68hc12
02f52e19 5265microcontrollers. The default values for these options depends on
2856c3e3
SC
5266which style of microcontroller was selected when the compiler was configured;
5267the defaults for the most common choices are given below.
5268
2642624b 5269@table @gcctabopt
2856c3e3
SC
5270@item -m6811
5271@itemx -m68hc11
cd3bb277
JM
5272@opindex m6811
5273@opindex m68hc11
2856c3e3
SC
5274Generate output for a 68HC11. This is the default
5275when the compiler is configured for 68HC11-based systems.
5276
5277@item -m6812
5278@itemx -m68hc12
cd3bb277
JM
5279@opindex m6812
5280@opindex m68hc12
2856c3e3
SC
5281Generate output for a 68HC12. This is the default
5282when the compiler is configured for 68HC12-based systems.
5283
5284@item -mauto-incdec
cd3bb277 5285@opindex mauto-incdec
2856c3e3
SC
5286Enable the use of 68HC12 pre and post auto-increment and auto-decrement
5287addressing modes.
5288
5289@item -mshort
cd3bb277 5290@opindex mshort
2856c3e3
SC
5291Consider type @code{int} to be 16 bits wide, like @code{short int}.
5292
5293@item -msoft-reg-count=@var{count}
cd3bb277 5294@opindex msoft-reg-count
2856c3e3
SC
5295Specify the number of pseudo-soft registers which are used for the
5296code generation. The maximum number is 32. Using more pseudo-soft
5297register may or may not result in better code depending on the program.
5298The default is 4 for 68HC11 and 2 for 68HC12.
5299
5300@end table
5301
74291a4b
MM
5302@node VAX Options
5303@subsection VAX Options
5304@cindex VAX options
5305
5306These @samp{-m} options are defined for the Vax:
5307
2642624b 5308@table @gcctabopt
74291a4b 5309@item -munix
cd3bb277 5310@opindex munix
74291a4b
MM
5311Do not output certain jump instructions (@code{aobleq} and so on)
5312that the Unix assembler for the Vax cannot handle across long
5313ranges.
5314
5315@item -mgnu
cd3bb277 5316@opindex mgnu
74291a4b
MM
5317Do output those jump instructions, on the assumption that you
5318will assemble with the GNU assembler.
5319
5320@item -mg
cd3bb277 5321@opindex mg
74291a4b
MM
5322Output code for g-format floating point numbers instead of d-format.
5323@end table
5324
5325@node SPARC Options
5326@subsection SPARC Options
5327@cindex SPARC options
5328
5329These @samp{-m} switches are supported on the SPARC:
5330
2642624b 5331@table @gcctabopt
74291a4b
MM
5332@item -mno-app-regs
5333@itemx -mapp-regs
cd3bb277
JM
5334@opindex mno-app-regs
5335@opindex mapp-regs
630d3d5a 5336Specify @option{-mapp-regs} to generate output using the global registers
74291a4b
MM
53372 through 4, which the SPARC SVR4 ABI reserves for applications. This
5338is the default.
5339
5340To be fully SVR4 ABI compliant at the cost of some performance loss,
630d3d5a 5341specify @option{-mno-app-regs}. You should compile libraries and system
74291a4b
MM
5342software with this option.
5343
5344@item -mfpu
5345@itemx -mhard-float
cd3bb277
JM
5346@opindex mfpu
5347@opindex mhard-float
74291a4b
MM
5348Generate output containing floating point instructions. This is the
5349default.
5350
5351@item -mno-fpu
5352@itemx -msoft-float
cd3bb277
JM
5353@opindex mno-fpu
5354@opindex msoft-float
74291a4b
MM
5355Generate output containing library calls for floating point.
5356@strong{Warning:} the requisite libraries are not available for all SPARC
5357targets. Normally the facilities of the machine's usual C compiler are
5358used, but this cannot be done directly in cross-compilation. You must make
5359your own arrangements to provide suitable library functions for
5360cross-compilation. The embedded targets @samp{sparc-*-aout} and
5361@samp{sparclite-*-*} do provide software floating point support.
5362
630d3d5a 5363@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
5364therefore, it is only useful if you compile @emph{all} of a program with
5365this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 5366library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
5367this to work.
5368
5369@item -mhard-quad-float
cd3bb277 5370@opindex mhard-quad-float
74291a4b
MM
5371Generate output containing quad-word (long double) floating point
5372instructions.
5373
5374@item -msoft-quad-float
cd3bb277 5375@opindex msoft-quad-float
74291a4b
MM
5376Generate output containing library calls for quad-word (long double)
5377floating point instructions. The functions called are those specified
161d7b59 5378in the SPARC ABI@. This is the default.
74291a4b
MM
5379
5380As of this writing, there are no sparc implementations that have hardware
5381support for the quad-word floating point instructions. They all invoke
5382a trap handler for one of these instructions, and then the trap handler
5383emulates the effect of the instruction. Because of the trap handler overhead,
5384this is much slower than calling the ABI library routines. Thus the
630d3d5a 5385@option{-msoft-quad-float} option is the default.
74291a4b
MM
5386
5387@item -mno-epilogue
5388@itemx -mepilogue
cd3bb277
JM
5389@opindex mno-epilogue
5390@opindex mepilogue
630d3d5a 5391With @option{-mepilogue} (the default), the compiler always emits code for
74291a4b
MM
5392function exit at the end of each function. Any function exit in
5393the middle of the function (such as a return statement in C) will
5394generate a jump to the exit code at the end of the function.
5395
630d3d5a 5396With @option{-mno-epilogue}, the compiler tries to emit exit code inline
74291a4b
MM
5397at every function exit.
5398
5399@item -mno-flat
5400@itemx -mflat
cd3bb277
JM
5401@opindex mno-flat
5402@opindex mflat
630d3d5a 5403With @option{-mflat}, the compiler does not generate save/restore instructions
695ac33f 5404and will use a ``flat'' or single register window calling convention.
74291a4b
MM
5405This model uses %i7 as the frame pointer and is compatible with the normal
5406register window model. Code from either may be intermixed.
aee96fe9 5407The local registers and the input registers (0--5) are still treated as
695ac33f 5408``call saved'' registers and will be saved on the stack as necessary.
74291a4b 5409
630d3d5a 5410With @option{-mno-flat} (the default), the compiler emits save/restore
74291a4b
MM
5411instructions (except for leaf functions) and is the normal mode of operation.
5412
5413@item -mno-unaligned-doubles
5414@itemx -munaligned-doubles
cd3bb277
JM
5415@opindex mno-unaligned-doubles
5416@opindex munaligned-doubles
74291a4b
MM
5417Assume that doubles have 8 byte alignment. This is the default.
5418
630d3d5a 5419With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
74291a4b
MM
5420alignment only if they are contained in another type, or if they have an
5421absolute address. Otherwise, it assumes they have 4 byte alignment.
5422Specifying this option avoids some rare compatibility problems with code
5423generated by other compilers. It is not the default because it results
5424in a performance loss, especially for floating point code.
5425
c219ddf7
BK
5426@item -mno-faster-structs
5427@itemx -mfaster-structs
cd3bb277
JM
5428@opindex mno-faster-structs
5429@opindex mfaster-structs
630d3d5a 5430With @option{-mfaster-structs}, the compiler assumes that structures
c219ddf7
BK
5431should have 8 byte alignment. This enables the use of pairs of
5432@code{ldd} and @code{std} instructions for copies in structure
5433assignment, in place of twice as many @code{ld} and @code{st} pairs.
5434However, the use of this changed alignment directly violates the Sparc
161d7b59 5435ABI@. Thus, it's intended only for use on targets where the developer
c219ddf7 5436acknowledges that their resulting code will not be directly in line with
161d7b59 5437the rules of the ABI@.
c219ddf7 5438
74291a4b
MM
5439@item -mv8
5440@itemx -msparclite
cd3bb277
JM
5441@opindex mv8
5442@opindex msparclite
74291a4b
MM
5443These two options select variations on the SPARC architecture.
5444
5445By default (unless specifically configured for the Fujitsu SPARClite),
5446GCC generates code for the v7 variant of the SPARC architecture.
5447
630d3d5a 5448@option{-mv8} will give you SPARC v8 code. The only difference from v7
74291a4b
MM
5449code is that the compiler emits the integer multiply and integer
5450divide instructions which exist in SPARC v8 but not in SPARC v7.
5451
630d3d5a 5452@option{-msparclite} will give you SPARClite code. This adds the integer
74291a4b
MM
5453multiply, integer divide step and scan (@code{ffs}) instructions which
5454exist in SPARClite but not in SPARC v7.
5455
0c2d1a2a 5456These options are deprecated and will be deleted in a future GCC release.
630d3d5a 5457They have been replaced with @option{-mcpu=xxx}.
74291a4b
MM
5458
5459@item -mcypress
5460@itemx -msupersparc
cd3bb277
JM
5461@opindex mcypress
5462@opindex msupersparc
74291a4b
MM
5463These two options select the processor for which the code is optimised.
5464
630d3d5a 5465With @option{-mcypress} (the default), the compiler optimizes code for the
74291a4b
MM
5466Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
5467This is also appropriate for the older SparcStation 1, 2, IPX etc.
5468
630d3d5a 5469With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
767094dd 5470used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
74291a4b
MM
5471of the full SPARC v8 instruction set.
5472
0c2d1a2a 5473These options are deprecated and will be deleted in a future GCC release.
630d3d5a 5474They have been replaced with @option{-mcpu=xxx}.
74291a4b
MM
5475
5476@item -mcpu=@var{cpu_type}
cd3bb277 5477@opindex mcpu
c0498f43
DE
5478Set the instruction set, register set, and instruction scheduling parameters
5479for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
5480@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
ad6843d7
RH
5481@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
5482@samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}.
c0498f43
DE
5483
5484Default instruction scheduling parameters are used for values that select
5485an architecture and not an implementation. These are @samp{v7}, @samp{v8},
5486@samp{sparclite}, @samp{sparclet}, @samp{v9}.
5487
5488Here is a list of each supported architecture and their supported
5489implementations.
5490
5491@smallexample
5492 v7: cypress
ad6843d7
RH
5493 v8: supersparc, hypersparc
5494 sparclite: f930, f934, sparclite86x
c0498f43
DE
5495 sparclet: tsc701
5496 v9: ultrasparc
5497@end smallexample
74291a4b
MM
5498
5499@item -mtune=@var{cpu_type}
cd3bb277 5500@opindex mtune
74291a4b 5501Set the instruction scheduling parameters for machine type
c0498f43 5502@var{cpu_type}, but do not set the instruction set or register set that the
630d3d5a 5503option @option{-mcpu=@var{cpu_type}} would.
c0498f43 5504
630d3d5a
JM
5505The same values for @option{-mcpu=@var{cpu_type}} are used for
5506@option{-mtune=@var{cpu_type}}, though the only useful values are those that
c0498f43 5507select a particular cpu implementation: @samp{cypress}, @samp{supersparc},
ad6843d7
RH
5508@samp{hypersparc}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
5509@samp{tsc701}, @samp{ultrasparc}.
74291a4b
MM
5510
5511@end table
5512
5513These @samp{-m} switches are supported in addition to the above
5514on the SPARCLET processor.
5515
2642624b 5516@table @gcctabopt
74291a4b 5517@item -mlittle-endian
cd3bb277 5518@opindex mlittle-endian
74291a4b
MM
5519Generate code for a processor running in little-endian mode.
5520
5521@item -mlive-g0
cd3bb277 5522@opindex mlive-g0
74291a4b
MM
5523Treat register @code{%g0} as a normal register.
5524GCC will continue to clobber it as necessary but will not assume
5525it always reads as 0.
5526
5527@item -mbroken-saverestore
cd3bb277 5528@opindex mbroken-saverestore
74291a4b
MM
5529Generate code that does not use non-trivial forms of the @code{save} and
5530@code{restore} instructions. Early versions of the SPARCLET processor do
5531not correctly handle @code{save} and @code{restore} instructions used with
5532arguments. They correctly handle them used without arguments. A @code{save}
5533instruction used without arguments increments the current window pointer
5534but does not allocate a new stack frame. It is assumed that the window
5535overflow trap handler will properly handle this case as will interrupt
5536handlers.
5537@end table
5538
5539These @samp{-m} switches are supported in addition to the above
02f52e19 5540on SPARC V9 processors in 64-bit environments.
74291a4b 5541
2642624b 5542@table @gcctabopt
74291a4b 5543@item -mlittle-endian
cd3bb277 5544@opindex mlittle-endian
74291a4b
MM
5545Generate code for a processor running in little-endian mode.
5546
ded17aad
DE
5547@item -m32
5548@itemx -m64
cd3bb277
JM
5549@opindex m32
5550@opindex m64
02f52e19
AJ
5551Generate code for a 32-bit or 64-bit environment.
5552The 32-bit environment sets int, long and pointer to 32 bits.
5553The 64-bit environment sets int to 32 bits and long and pointer
ded17aad
DE
5554to 64 bits.
5555
5556@item -mcmodel=medlow
cd3bb277 5557@opindex mcmodel=medlow
ded17aad
DE
5558Generate code for the Medium/Low code model: the program must be linked
5559in the low 32 bits of the address space. Pointers are 64 bits.
5560Programs can be statically or dynamically linked.
5561
5562@item -mcmodel=medmid
cd3bb277 5563@opindex mcmodel=medmid
ded17aad
DE
5564Generate code for the Medium/Middle code model: the program must be linked
5565in the low 44 bits of the address space, the text segment must be less than
55662G bytes, and data segment must be within 2G of the text segment.
5567Pointers are 64 bits.
5568
5569@item -mcmodel=medany
cd3bb277 5570@opindex mcmodel=medany
ded17aad
DE
5571Generate code for the Medium/Anywhere code model: the program may be linked
5572anywhere in the address space, the text segment must be less than
55732G bytes, and data segment must be within 2G of the text segment.
5574Pointers are 64 bits.
5575
5576@item -mcmodel=embmedany
cd3bb277 5577@opindex mcmodel=embmedany
ded17aad 5578Generate code for the Medium/Anywhere code model for embedded systems:
02f52e19 5579assume a 32-bit text and a 32-bit data segment, both starting anywhere
ded17aad 5580(determined at link time). Register %g4 points to the base of the
02f52e19 5581data segment. Pointers are still 64 bits.
ded17aad 5582Programs are statically linked, PIC is not supported.
74291a4b
MM
5583
5584@item -mstack-bias
5585@itemx -mno-stack-bias
cd3bb277
JM
5586@opindex mstack-bias
5587@opindex mno-stack-bias
630d3d5a
JM
5588With @option{-mstack-bias}, GCC assumes that the stack pointer, and
5589frame pointer if present, are offset by @minus{}2047 which must be added back
74291a4b
MM
5590when making stack frame references.
5591Otherwise, assume no such offset is present.
5592@end table
5593
5594@node Convex Options
5595@subsection Convex Options
5596@cindex Convex options
5597
5598These @samp{-m} options are defined for Convex:
5599
2642624b 5600@table @gcctabopt
74291a4b 5601@item -mc1
cd3bb277 5602@opindex mc1
74291a4b
MM
5603Generate output for C1. The code will run on any Convex machine.
5604The preprocessor symbol @code{__convex__c1__} is defined.
5605
5606@item -mc2
cd3bb277 5607@opindex mc2
74291a4b
MM
5608Generate output for C2. Uses instructions not available on C1.
5609Scheduling and other optimizations are chosen for max performance on C2.
5610The preprocessor symbol @code{__convex_c2__} is defined.
5611
5612@item -mc32
cd3bb277 5613@opindex mc32
74291a4b
MM
5614Generate output for C32xx. Uses instructions not available on C1.
5615Scheduling and other optimizations are chosen for max performance on C32.
5616The preprocessor symbol @code{__convex_c32__} is defined.
5617
5618@item -mc34
cd3bb277 5619@opindex mc34
74291a4b
MM
5620Generate output for C34xx. Uses instructions not available on C1.
5621Scheduling and other optimizations are chosen for max performance on C34.
5622The preprocessor symbol @code{__convex_c34__} is defined.
5623
5624@item -mc38
cd3bb277 5625@opindex mc38
74291a4b
MM
5626Generate output for C38xx. Uses instructions not available on C1.
5627Scheduling and other optimizations are chosen for max performance on C38.
5628The preprocessor symbol @code{__convex_c38__} is defined.
5629
5630@item -margcount
cd3bb277 5631@opindex margcount
74291a4b
MM
5632Generate code which puts an argument count in the word preceding each
5633argument list. This is compatible with regular CC, and a few programs
5634may need the argument count word. GDB and other source-level debuggers
5635do not need it; this info is in the symbol table.
5636
5637@item -mnoargcount
cd3bb277 5638@opindex mnoargcount
74291a4b
MM
5639Omit the argument count word. This is the default.
5640
5641@item -mvolatile-cache
cd3bb277 5642@opindex mvolatile-cache
74291a4b
MM
5643Allow volatile references to be cached. This is the default.
5644
5645@item -mvolatile-nocache
cd3bb277 5646@opindex mvolatile-nocache
74291a4b
MM
5647Volatile references bypass the data cache, going all the way to memory.
5648This is only needed for multi-processor code that does not use standard
5649synchronization instructions. Making non-volatile references to volatile
5650locations will not necessarily work.
5651
5652@item -mlong32
cd3bb277 5653@opindex mlong32
74291a4b
MM
5654Type long is 32 bits, the same as type int. This is the default.
5655
5656@item -mlong64
cd3bb277 5657@opindex mlong64
74291a4b
MM
5658Type long is 64 bits, the same as type long long. This option is useless,
5659because no library support exists for it.
5660@end table
5661
5662@node AMD29K Options
5663@subsection AMD29K Options
5664@cindex AMD29K options
5665
5666These @samp{-m} options are defined for the AMD Am29000:
5667
2642624b 5668@table @gcctabopt
74291a4b 5669@item -mdw
cd3bb277 5670@opindex mdw
74291a4b
MM
5671@cindex DW bit (29k)
5672Generate code that assumes the @code{DW} bit is set, i.e., that byte and
5673halfword operations are directly supported by the hardware. This is the
5674default.
5675
5676@item -mndw
cd3bb277 5677@opindex mndw
74291a4b
MM
5678Generate code that assumes the @code{DW} bit is not set.
5679
5680@item -mbw
cd3bb277 5681@opindex mbw
74291a4b
MM
5682@cindex byte writes (29k)
5683Generate code that assumes the system supports byte and halfword write
5684operations. This is the default.
5685
5686@item -mnbw
cd3bb277 5687@opindex mnbw
74291a4b 5688Generate code that assumes the systems does not support byte and
630d3d5a 5689halfword write operations. @option{-mnbw} implies @option{-mndw}.
74291a4b
MM
5690
5691@item -msmall
cd3bb277 5692@opindex msmall
74291a4b
MM
5693@cindex memory model (29k)
5694Use a small memory model that assumes that all function addresses are
5695either within a single 256 KB segment or at an absolute address of less
5696than 256k. This allows the @code{call} instruction to be used instead
5697of a @code{const}, @code{consth}, @code{calli} sequence.
5698
5699@item -mnormal
cd3bb277 5700@opindex mnormal
74291a4b
MM
5701Use the normal memory model: Generate @code{call} instructions only when
5702calling functions in the same file and @code{calli} instructions
5703otherwise. This works if each file occupies less than 256 KB but allows
161d7b59 5704the entire executable to be larger than 256 KB@. This is the default.
74291a4b
MM
5705
5706@item -mlarge
cd3bb277 5707@opindex mlarge
74291a4b
MM
5708Always use @code{calli} instructions. Specify this option if you expect
5709a single file to compile into more than 256 KB of code.
5710
5711@item -m29050
cd3bb277 5712@opindex m29050
74291a4b
MM
5713@cindex processor selection (29k)
5714Generate code for the Am29050.
5715
5716@item -m29000
cd3bb277 5717@opindex m29000
74291a4b
MM
5718Generate code for the Am29000. This is the default.
5719
5720@item -mkernel-registers
cd3bb277 5721@opindex mkernel-registers
74291a4b
MM
5722@cindex kernel and user registers (29k)
5723Generate references to registers @code{gr64-gr95} instead of to
5724registers @code{gr96-gr127}. This option can be used when compiling
5725kernel code that wants a set of global registers disjoint from that used
5726by user-mode code.
5727
5728Note that when this option is used, register names in @samp{-f} flags
5729must use the normal, user-mode, names.
5730
5731@item -muser-registers
cd3bb277 5732@opindex muser-registers
74291a4b
MM
5733Use the normal set of global registers, @code{gr96-gr127}. This is the
5734default.
5735
5736@item -mstack-check
5737@itemx -mno-stack-check
cd3bb277
JM
5738@opindex mstack-check
5739@opindex mno-stack-check
74291a4b
MM
5740@cindex stack checks (29k)
5741Insert (or do not insert) a call to @code{__msp_check} after each stack
5742adjustment. This is often used for kernel code.
5743
5744@item -mstorem-bug
5745@itemx -mno-storem-bug
cd3bb277
JM
5746@opindex mstorem-bug
5747@opindex mno-storem-bug
74291a4b 5748@cindex storem bug (29k)
630d3d5a 5749@option{-mstorem-bug} handles 29k processors which cannot handle the
74291a4b
MM
5750separation of a mtsrim insn and a storem instruction (most 29000 chips
5751to date, but not the 29050).
5752
5753@item -mno-reuse-arg-regs
5754@itemx -mreuse-arg-regs
cd3bb277
JM
5755@opindex mno-reuse-arg-regs
5756@opindex mreuse-arg-regs
630d3d5a 5757@option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
74291a4b
MM
5758registers for copying out arguments. This helps detect calling a function
5759with fewer arguments than it was declared with.
5760
861bb6c1
JL
5761@item -mno-impure-text
5762@itemx -mimpure-text
cd3bb277
JM
5763@opindex mno-impure-text
5764@opindex mimpure-text
630d3d5a
JM
5765@option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to
5766not pass @option{-assert pure-text} to the linker when linking a shared object.
861bb6c1 5767
74291a4b 5768@item -msoft-float
cd3bb277 5769@opindex msoft-float
74291a4b 5770Generate output containing library calls for floating point.
161d7b59 5771@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
5772Normally the facilities of the machine's usual C compiler are used, but
5773this can't be done directly in cross-compilation. You must make your
5774own arrangements to provide suitable library functions for
5775cross-compilation.
4e8d7ddc
JW
5776
5777@item -mno-multm
cd3bb277 5778@opindex mno-multm
4e8d7ddc
JW
5779Do not generate multm or multmu instructions. This is useful for some embedded
5780systems which do not have trap handlers for these instructions.
74291a4b
MM
5781@end table
5782
5783@node ARM Options
5784@subsection ARM Options
5785@cindex ARM options
5786
5787These @samp{-m} options are defined for Advanced RISC Machines (ARM)
5788architectures:
5789
2642624b 5790@table @gcctabopt
74291a4b 5791@item -mapcs-frame
cd3bb277 5792@opindex mapcs-frame
74291a4b
MM
5793Generate a stack frame that is compliant with the ARM Procedure Call
5794Standard for all functions, even if this is not strictly necessary for
630d3d5a 5795correct execution of the code. Specifying @option{-fomit-frame-pointer}
157a620e 5796with this option will cause the stack frames not to be generated for
630d3d5a 5797leaf functions. The default is @option{-mno-apcs-frame}.
157a620e
NC
5798
5799@item -mapcs
cd3bb277 5800@opindex mapcs
630d3d5a 5801This is a synonym for @option{-mapcs-frame}.
74291a4b
MM
5802
5803@item -mapcs-26
cd3bb277 5804@opindex mapcs-26
74291a4b
MM
5805Generate code for a processor running with a 26-bit program counter,
5806and conforming to the function calling standards for the APCS 26-bit
630d3d5a 5807option. This option replaces the @option{-m2} and @option{-m3} options
74291a4b
MM
5808of previous releases of the compiler.
5809
5810@item -mapcs-32
cd3bb277 5811@opindex mapcs-32
74291a4b
MM
5812Generate code for a processor running with a 32-bit program counter,
5813and conforming to the function calling standards for the APCS 32-bit
630d3d5a 5814option. This option replaces the @option{-m6} option of previous releases
74291a4b
MM
5815of the compiler.
5816
247f8561
PB
5817@ignore
5818@c not currently implemented
157a620e 5819@item -mapcs-stack-check
cd3bb277 5820@opindex mapcs-stack-check
157a620e
NC
5821Generate code to check the amount of stack space available upon entry to
5822every function (that actually uses some stack space). If there is
5823insufficient space available then either the function
5824@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
5825called, depending upon the amount of stack space required. The run time
5826system is required to provide these functions. The default is
630d3d5a 5827@option{-mno-apcs-stack-check}, since this produces smaller code.
157a620e 5828
247f8561 5829@c not currently implemented
157a620e 5830@item -mapcs-float
cd3bb277 5831@opindex mapcs-float
157a620e 5832Pass floating point arguments using the float point registers. This is
161d7b59 5833one of the variants of the APCS@. This option is recommended if the
157a620e
NC
5834target hardware has a floating point unit or if a lot of floating point
5835arithmetic is going to be performed by the code. The default is
630d3d5a
JM
5836@option{-mno-apcs-float}, since integer only code is slightly increased in
5837size if @option{-mapcs-float} is used.
157a620e 5838
247f8561 5839@c not currently implemented
157a620e 5840@item -mapcs-reentrant
cd3bb277 5841@opindex mapcs-reentrant
247f8561 5842Generate reentrant, position independent code. The default is
630d3d5a 5843@option{-mno-apcs-reentrant}.
247f8561 5844@end ignore
157a620e
NC
5845
5846@item -mthumb-interwork
cd3bb277 5847@opindex mthumb-interwork
247f8561 5848Generate code which supports calling between the ARM and Thumb
157a620e
NC
5849instruction sets. Without this option the two instruction sets cannot
5850be reliably used inside one program. The default is
630d3d5a
JM
5851@option{-mno-thumb-interwork}, since slightly larger code is generated
5852when @option{-mthumb-interwork} is specified.
157a620e
NC
5853
5854@item -mno-sched-prolog
cd3bb277 5855@opindex mno-sched-prolog
157a620e
NC
5856Prevent the reordering of instructions in the function prolog, or the
5857merging of those instruction with the instructions in the function's
ed0e6530
PB
5858body. This means that all functions will start with a recognizable set
5859of instructions (or in fact one of a choice from a small set of
157a620e
NC
5860different function prologues), and this information can be used to
5861locate the start if functions inside an executable piece of code. The
630d3d5a 5862default is @option{-msched-prolog}.
157a620e 5863
74291a4b 5864@item -mhard-float
cd3bb277 5865@opindex mhard-float
74291a4b
MM
5866Generate output containing floating point instructions. This is the
5867default.
5868
5869@item -msoft-float
cd3bb277 5870@opindex msoft-float
74291a4b
MM
5871Generate output containing library calls for floating point.
5872@strong{Warning:} the requisite libraries are not available for all ARM
5873targets. Normally the facilities of the machine's usual C compiler are
5874used, but this cannot be done directly in cross-compilation. You must make
5875your own arrangements to provide suitable library functions for
5876cross-compilation.
5877
630d3d5a 5878@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
5879therefore, it is only useful if you compile @emph{all} of a program with
5880this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 5881library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
5882this to work.
5883
5884@item -mlittle-endian
cd3bb277 5885@opindex mlittle-endian
74291a4b
MM
5886Generate code for a processor running in little-endian mode. This is
5887the default for all standard configurations.
5888
5889@item -mbig-endian
cd3bb277 5890@opindex mbig-endian
74291a4b
MM
5891Generate code for a processor running in big-endian mode; the default is
5892to compile code for a little-endian processor.
5893
5894@item -mwords-little-endian
cd3bb277 5895@opindex mwords-little-endian
74291a4b
MM
5896This option only applies when generating code for big-endian processors.
5897Generate code for a little-endian word order but a big-endian byte
5898order. That is, a byte order of the form @samp{32107654}. Note: this
5899option should only be used if you require compatibility with code for
5900big-endian ARM processors generated by versions of the compiler prior to
59012.8.
5902
5f1e6755 5903@item -malignment-traps
cd3bb277 5904@opindex malignment-traps
5f1e6755
NC
5905Generate code that will not trap if the MMU has alignment traps enabled.
5906On ARM architectures prior to ARMv4, there were no instructions to
5907access half-word objects stored in memory. However, when reading from
5908memory a feature of the ARM architecture allows a word load to be used,
5909even if the address is unaligned, and the processor core will rotate the
5910data as it is being loaded. This option tells the compiler that such
5911misaligned accesses will cause a MMU trap and that it should instead
5912synthesise the access as a series of byte accesses. The compiler can
5913still use word accesses to load half-word data if it knows that the
5914address is aligned to a word boundary.
5915
5916This option is ignored when compiling for ARM architecture 4 or later,
5917since these processors have instructions to directly access half-word
02f52e19
AJ
5918objects in memory.
5919
5f1e6755 5920@item -mno-alignment-traps
cd3bb277 5921@opindex mno-alignment-traps
5f1e6755
NC
5922Generate code that assumes that the MMU will not trap unaligned
5923accesses. This produces better code when the target instruction set
e979f9e8 5924does not have half-word memory operations (i.e.@: implementations prior to
02f52e19 5925ARMv4).
5f1e6755
NC
5926
5927Note that you cannot use this option to access unaligned word objects,
5928since the processor will only fetch one 32-bit aligned object from
02f52e19 5929memory.
5f1e6755 5930
695ac33f 5931The default setting for most targets is @option{-mno-alignment-traps}, since
5f1e6755 5932this produces better code when there are no half-word memory
02f52e19 5933instructions available.
5f1e6755 5934
74291a4b 5935@item -mshort-load-bytes
247f8561 5936@itemx -mno-short-load-words
cd3bb277
JM
5937@opindex mshort-load-bytes
5938@opindex mno-short-load-words
630d3d5a 5939These are deprecated aliases for @option{-malignment-traps}.
74291a4b
MM
5940
5941@item -mno-short-load-bytes
247f8561 5942@itemx -mshort-load-words
cd3bb277
JM
5943@opindex mno-short-load-bytes
5944@opindex mshort-load-words
630d3d5a 5945This are deprecated aliases for @option{-mno-alignment-traps}.
157a620e 5946
74291a4b 5947@item -mbsd
cd3bb277 5948@opindex mbsd
161d7b59 5949This option only applies to RISC iX@. Emulate the native BSD-mode
630d3d5a 5950compiler. This is the default if @option{-ansi} is not specified.
74291a4b
MM
5951
5952@item -mxopen
cd3bb277 5953@opindex mxopen
161d7b59 5954This option only applies to RISC iX@. Emulate the native X/Open-mode
74291a4b
MM
5955compiler.
5956
5957@item -mno-symrename
cd3bb277 5958@opindex mno-symrename
161d7b59 5959This option only applies to RISC iX@. Do not run the assembler
74291a4b
MM
5960post-processor, @samp{symrename}, after code has been assembled.
5961Normally it is necessary to modify some of the standard symbols in
5962preparation for linking with the RISC iX C library; this option
5963suppresses this pass. The post-processor is never run when the
5964compiler is built for cross-compilation.
157a620e 5965
cd3bb277
JM
5966@item -mcpu=@var{name}
5967@opindex mcpu
157a620e 5968This specifies the name of the target ARM processor. GCC uses this name
247f8561 5969to determine what kind of instructions it can emit when generating
aee96fe9
JM
5970assembly code. Permissible names are: @samp{arm2}, @samp{arm250},
5971@samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
5972@samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
5973@samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
5974@samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
5975@samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
5976@samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
5977@samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
5978@samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi},
5979@samp{arm1020t}, @samp{xscale}.
62b10bbc 5980
cd3bb277
JM
5981@itemx -mtune=@var{name}
5982@opindex mtune
630d3d5a 5983This option is very similar to the @option{-mcpu=} option, except that
62b10bbc
NC
5984instead of specifying the actual target processor type, and hence
5985restricting which instructions can be used, it specifies that GCC should
5986tune the performance of the code as if the target were of the type
5987specified in this option, but still choosing the instructions that it
630d3d5a 5988will generate based on the cpu specified by a @option{-mcpu=} option.
247f8561 5989For some ARM implementations better performance can be obtained by using
62b10bbc 5990this option.
157a620e 5991
cd3bb277
JM
5992@item -march=@var{name}
5993@opindex march
157a620e 5994This specifies the name of the target ARM architecture. GCC uses this
247f8561 5995name to determine what kind of instructions it can emit when generating
157a620e 5996assembly code. This option can be used in conjunction with or instead
aee96fe9
JM
5997of the @option{-mcpu=} option. Permissible names are: @samp{armv2},
5998@samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
5999@samp{armv5}, @samp{armv5t}, @samp{armv5te}.
157a620e 6000
cd3bb277
JM
6001@item -mfpe=@var{number}
6002@itemx -mfp=@var{number}
6003@opindex mfpe
6004@opindex mfp
b192711e 6005This specifies the version of the floating point emulation available on
630d3d5a 6006the target. Permissible values are 2 and 3. @option{-mfp=} is a synonym
161d7b59 6007for @option{-mfpe=}, for compatibility with older versions of GCC@.
157a620e 6008
cd3bb277
JM
6009@item -mstructure-size-boundary=@var{n}
6010@opindex mstructure-size-boundary
157a620e 6011The size of all structures and unions will be rounded up to a multiple
ed0e6530 6012of the number of bits set by this option. Permissible values are 8 and
157a620e
NC
601332. The default value varies for different toolchains. For the COFF
6014targeted toolchain the default value is 8. Specifying the larger number
ed0e6530 6015can produce faster, more efficient code, but can also increase the size
157a620e
NC
6016of the program. The two values are potentially incompatible. Code
6017compiled with one value cannot necessarily expect to work with code or
6018libraries compiled with the other value, if they exchange information
247f8561 6019using structures or unions.
157a620e 6020
f5a1b0d2 6021@item -mabort-on-noreturn
cd3bb277 6022@opindex mabort-on-noreturn
247f8561
PB
6023Generate a call to the function @code{abort} at the end of a
6024@code{noreturn} function. It will be executed if the function tries to
6025return.
f5a1b0d2 6026
c27ba912
DM
6027@item -mlong-calls
6028@itemx -mno-long-calls
cd3bb277
JM
6029@opindex mlong-calls
6030@opindex mno-long-calls
c27ba912
DM
6031Tells the compiler to perform function calls by first loading the
6032address of the function into a register and then performing a subroutine
6033call on this register. This switch is needed if the target function
6034will lie outside of the 64 megabyte addressing range of the offset based
02f52e19 6035version of subroutine call instruction.
c27ba912
DM
6036
6037Even if this switch is enabled, not all function calls will be turned
6038into long calls. The heuristic is that static functions, functions
6039which have the @samp{short-call} attribute, functions that are inside
6040the scope of a @samp{#pragma no_long_calls} directive and functions whose
6041definitions have already been compiled within the current compilation
6042unit, will not be turned into long calls. The exception to this rule is
b192711e 6043that weak function definitions, functions with the @samp{long-call}
c27ba912
DM
6044attribute or the @samp{section} attribute, and functions that are within
6045the scope of a @samp{#pragma long_calls} directive, will always be
6046turned into long calls.
6047
6048This feature is not enabled by default. Specifying
630d3d5a 6049@option{-mno-long-calls} will restore the default behaviour, as will
c27ba912
DM
6050placing the function calls within the scope of a @samp{#pragma
6051long_calls_off} directive. Note these switches have no effect on how
6052the compiler generates code to handle function calls via function
02f52e19 6053pointers.
c27ba912 6054
62b10bbc 6055@item -mnop-fun-dllimport
cd3bb277 6056@opindex mnop-fun-dllimport
aee96fe9 6057Disable support for the @code{dllimport} attribute.
62b10bbc 6058
ed0e6530 6059@item -msingle-pic-base
cd3bb277 6060@opindex msingle-pic-base
ed0e6530
PB
6061Treat the register used for PIC addressing as read-only, rather than
6062loading it in the prologue for each function. The run-time system is
6063responsible for initialising this register with an appropriate value
6064before execution begins.
6065
cd3bb277
JM
6066@item -mpic-register=@var{reg}
6067@opindex mpic-register
ed0e6530
PB
6068Specify the register to be used for PIC addressing. The default is R10
6069unless stack-checking is enabled, when R9 is used.
6070
247f8561 6071@item -mpoke-function-name
cd3bb277 6072@opindex mpoke-function-name
247f8561
PB
6073Write the name of each function into the text section, directly
6074preceding the function prologue. The generated code is similar to this:
74291a4b 6075
247f8561
PB
6076@smallexample
6077 t0
6078 .ascii "arm_poke_function_name", 0
6079 .align
6080 t1
6081 .word 0xff000000 + (t1 - t0)
6082 arm_poke_function_name
6083 mov ip, sp
6084 stmfd sp!, @{fp, ip, lr, pc@}
6085 sub fp, ip, #4
6086@end smallexample
157a620e 6087
247f8561
PB
6088When performing a stack backtrace, code can inspect the value of
6089@code{pc} stored at @code{fp + 0}. If the trace function then looks at
6090location @code{pc - 12} and the top 8 bits are set, then we know that
6091there is a function name embedded immediately preceding this location
6092and has length @code{((pc[-3]) & 0xff000000)}.
157a620e 6093
247f8561 6094@item -mthumb
cd3bb277 6095@opindex mthumb
247f8561
PB
6096Generate code for the 16-bit Thumb instruction set. The default is to
6097use the 32-bit ARM instruction set.
157a620e
NC
6098
6099@item -mtpcs-frame
cd3bb277 6100@opindex mtpcs-frame
157a620e
NC
6101Generate a stack frame that is compliant with the Thumb Procedure Call
6102Standard for all non-leaf functions. (A leaf function is one that does
630d3d5a 6103not call any other functions.) The default is @option{-mno-tpcs-frame}.
157a620e
NC
6104
6105@item -mtpcs-leaf-frame
cd3bb277 6106@opindex mtpcs-leaf-frame
157a620e
NC
6107Generate a stack frame that is compliant with the Thumb Procedure Call
6108Standard for all leaf functions. (A leaf function is one that does
630d3d5a 6109not call any other functions.) The default is @option{-mno-apcs-leaf-frame}.
62b10bbc
NC
6110
6111@item -mcallee-super-interworking
cd3bb277 6112@opindex mcallee-super-interworking
62b10bbc
NC
6113Gives all externally visible functions in the file being compiled an ARM
6114instruction set header which switches to Thumb mode before executing the
6115rest of the function. This allows these functions to be called from
6116non-interworking code.
6117
6118@item -mcaller-super-interworking
cd3bb277 6119@opindex mcaller-super-interworking
62b10bbc
NC
6120Allows calls via function pointers (including virtual functions) to
6121execute correctly regardless of whether the target code has been
6122compiled for interworking or not. There is a small overhead in the cost
4bdc1ac7
PB
6123of executing a function pointer if this option is enabled.
6124
157a620e
NC
6125@end table
6126
ecff22ab
JL
6127@node MN10200 Options
6128@subsection MN10200 Options
6129@cindex MN10200 options
630d3d5a 6130These @option{-m} options are defined for Matsushita MN10200 architectures:
2642624b 6131@table @gcctabopt
ecff22ab
JL
6132
6133@item -mrelax
cd3bb277 6134@opindex mrelax
ecff22ab
JL
6135Indicate to the linker that it should perform a relaxation optimization pass
6136to shorten branches, calls and absolute memory addresses. This option only
6137has an effect when used on the command line for the final link step.
6138
02f52e19 6139This option makes symbolic debugging impossible.
ecff22ab 6140@end table
157a620e 6141
6d6d0fa0
JL
6142@node MN10300 Options
6143@subsection MN10300 Options
6144@cindex MN10300 options
630d3d5a 6145These @option{-m} options are defined for Matsushita MN10300 architectures:
6d6d0fa0 6146
2642624b 6147@table @gcctabopt
6d6d0fa0 6148@item -mmult-bug
cd3bb277 6149@opindex mmult-bug
6d6d0fa0
JL
6150Generate code to avoid bugs in the multiply instructions for the MN10300
6151processors. This is the default.
6152
6153@item -mno-mult-bug
cd3bb277 6154@opindex mno-mult-bug
6d6d0fa0
JL
6155Do not generate code to avoid bugs in the multiply instructions for the
6156MN10300 processors.
ecff22ab 6157
705ac34f 6158@item -mam33
cd3bb277 6159@opindex mam33
705ac34f
JL
6160Generate code which uses features specific to the AM33 processor.
6161
6162@item -mno-am33
cd3bb277 6163@opindex mno-am33
705ac34f
JL
6164Do not generate code which uses features specific to the AM33 processor. This
6165is the default.
6166
c474f76b
AO
6167@item -mno-crt0
6168@opindex mno-crt0
6169Do not link in the C run-time initialization object file.
6170
ecff22ab 6171@item -mrelax
cd3bb277 6172@opindex mrelax
ecff22ab
JL
6173Indicate to the linker that it should perform a relaxation optimization pass
6174to shorten branches, calls and absolute memory addresses. This option only
6175has an effect when used on the command line for the final link step.
6176
02f52e19 6177This option makes symbolic debugging impossible.
6d6d0fa0
JL
6178@end table
6179
ecff22ab 6180
861bb6c1
JL
6181@node M32R/D Options
6182@subsection M32R/D Options
6183@cindex M32R/D options
6184
630d3d5a 6185These @option{-m} options are defined for Mitsubishi M32R/D architectures:
861bb6c1 6186
2642624b 6187@table @gcctabopt
861bb6c1 6188@item -mcode-model=small
cd3bb277 6189@opindex mcode-model=small
861bb6c1
JL
6190Assume all objects live in the lower 16MB of memory (so that their addresses
6191can be loaded with the @code{ld24} instruction), and assume all subroutines
6192are reachable with the @code{bl} instruction.
6193This is the default.
6194
6195The addressability of a particular object can be set with the
6196@code{model} attribute.
6197
6198@item -mcode-model=medium
cd3bb277 6199@opindex mcode-model=medium
02f52e19 6200Assume objects may be anywhere in the 32-bit address space (the compiler
861bb6c1
JL
6201will generate @code{seth/add3} instructions to load their addresses), and
6202assume all subroutines are reachable with the @code{bl} instruction.
6203
6204@item -mcode-model=large
cd3bb277 6205@opindex mcode-model=large
02f52e19 6206Assume objects may be anywhere in the 32-bit address space (the compiler
861bb6c1
JL
6207will generate @code{seth/add3} instructions to load their addresses), and
6208assume subroutines may not be reachable with the @code{bl} instruction
6209(the compiler will generate the much slower @code{seth/add3/jl}
6210instruction sequence).
6211
6212@item -msdata=none
cd3bb277 6213@opindex msdata=none
861bb6c1
JL
6214Disable use of the small data area. Variables will be put into
6215one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6216@code{section} attribute has been specified).
6217This is the default.
6218
6219The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6220Objects may be explicitly put in the small data area with the
6221@code{section} attribute using one of these sections.
6222
6223@item -msdata=sdata
cd3bb277 6224@opindex msdata=sdata
861bb6c1
JL
6225Put small global and static data in the small data area, but do not
6226generate special code to reference them.
6227
6228@item -msdata=use
cd3bb277 6229@opindex msdata=use
861bb6c1
JL
6230Put small global and static data in the small data area, and generate
6231special instructions to reference them.
6232
6233@item -G @var{num}
cd3bb277 6234@opindex G
861bb6c1
JL
6235@cindex smaller data references
6236Put global and static objects less than or equal to @var{num} bytes
6237into the small data or bss sections instead of the normal data or bss
6238sections. The default value of @var{num} is 8.
630d3d5a 6239The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
861bb6c1
JL
6240for this option to have any effect.
6241
630d3d5a 6242All modules should be compiled with the same @option{-G @var{num}} value.
861bb6c1 6243Compiling with different values of @var{num} may or may not work; if it
695ac33f 6244doesn't the linker will give an error message---incorrect code will not be
861bb6c1
JL
6245generated.
6246
6247@end table
6248
74291a4b
MM
6249@node M88K Options
6250@subsection M88K Options
6251@cindex M88k options
6252
6253These @samp{-m} options are defined for Motorola 88k architectures:
6254
2642624b 6255@table @gcctabopt
74291a4b 6256@item -m88000
cd3bb277 6257@opindex m88000
74291a4b
MM
6258Generate code that works well on both the m88100 and the
6259m88110.
6260
6261@item -m88100
cd3bb277 6262@opindex m88100
74291a4b
MM
6263Generate code that works best for the m88100, but that also
6264runs on the m88110.
6265
6266@item -m88110
cd3bb277 6267@opindex m88110
74291a4b
MM
6268Generate code that works best for the m88110, and may not run
6269on the m88100.
6270
6271@item -mbig-pic
cd3bb277 6272@opindex mbig-pic
74291a4b 6273Obsolete option to be removed from the next revision.
630d3d5a 6274Use @option{-fPIC}.
74291a4b
MM
6275
6276@item -midentify-revision
cd3bb277 6277@opindex midentify-revision
74291a4b
MM
6278@cindex identifying source, compiler (88k)
6279Include an @code{ident} directive in the assembler output recording the
6280source file name, compiler name and version, timestamp, and compilation
6281flags used.
6282
6283@item -mno-underscores
cd3bb277 6284@opindex mno-underscores
74291a4b
MM
6285@cindex underscores, avoiding (88k)
6286In assembler output, emit symbol names without adding an underscore
6287character at the beginning of each name. The default is to use an
6288underscore as prefix on each name.
6289
6290@item -mocs-debug-info
6291@itemx -mno-ocs-debug-info
cd3bb277
JM
6292@opindex mocs-debug-info
6293@opindex mno-ocs-debug-info
74291a4b
MM
6294@cindex OCS (88k)
6295@cindex debugging, 88k OCS
6296Include (or omit) additional debugging information (about registers used
6297in each stack frame) as specified in the 88open Object Compatibility
161d7b59 6298Standard, ``OCS''@. This extra information allows debugging of code that
74291a4b
MM
6299has had the frame pointer eliminated. The default for DG/UX, SVr4, and
6300Delta 88 SVr3.2 is to include this information; other 88k configurations
6301omit this information by default.
6302
6303@item -mocs-frame-position
cd3bb277 6304@opindex mocs-frame-position
74291a4b
MM
6305@cindex register positions in frame (88k)
6306When emitting COFF debugging information for automatic variables and
6307parameters stored on the stack, use the offset from the canonical frame
6308address, which is the stack pointer (register 31) on entry to the
6309function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
630d3d5a
JM
6310@option{-mocs-frame-position}; other 88k configurations have the default
6311@option{-mno-ocs-frame-position}.
74291a4b
MM
6312
6313@item -mno-ocs-frame-position
cd3bb277 6314@opindex mno-ocs-frame-position
74291a4b
MM
6315@cindex register positions in frame (88k)
6316When emitting COFF debugging information for automatic variables and
6317parameters stored on the stack, use the offset from the frame pointer
6318register (register 30). When this option is in effect, the frame
6319pointer is not eliminated when debugging information is selected by the
6320-g switch.
6321
6322@item -moptimize-arg-area
6323@itemx -mno-optimize-arg-area
cd3bb277
JM
6324@opindex moptimize-arg-area
6325@opindex mno-optimize-arg-area
74291a4b
MM
6326@cindex arguments in frame (88k)
6327Control how function arguments are stored in stack frames.
630d3d5a 6328@option{-moptimize-arg-area} saves space by optimizing them, but this
74291a4b 6329conflicts with the 88open specifications. The opposite alternative,
630d3d5a 6330@option{-mno-optimize-arg-area}, agrees with 88open standards. By default
0c2d1a2a 6331GCC does not optimize the argument area.
74291a4b
MM
6332
6333@item -mshort-data-@var{num}
cd3bb277 6334@opindex mshort-data
74291a4b
MM
6335@cindex smaller data references (88k)
6336@cindex r0-relative references (88k)
6337Generate smaller data references by making them relative to @code{r0},
6338which allows loading a value using a single instruction (rather than the
6339usual two). You control which data references are affected by
6340specifying @var{num} with this option. For example, if you specify
630d3d5a 6341@option{-mshort-data-512}, then the data references affected are those
74291a4b 6342involving displacements of less than 512 bytes.
630d3d5a 6343@option{-mshort-data-@var{num}} is not effective for @var{num} greater
74291a4b
MM
6344than 64k.
6345
6346@item -mserialize-volatile
cd3bb277 6347@opindex mserialize-volatile
74291a4b 6348@itemx -mno-serialize-volatile
cd3bb277 6349@opindex mno-serialize-volatile
74291a4b
MM
6350@cindex sequential consistency on 88k
6351Do, or don't, generate code to guarantee sequential consistency
6352of volatile memory references. By default, consistency is
6353guaranteed.
6354
6355The order of memory references made by the MC88110 processor does
6356not always match the order of the instructions requesting those
6357references. In particular, a load instruction may execute before
6358a preceding store instruction. Such reordering violates
6359sequential consistency of volatile memory references, when there
6360are multiple processors. When consistency must be guaranteed,
f0523f02 6361GCC generates special instructions, as needed, to force
74291a4b
MM
6362execution in the proper order.
6363
6364The MC88100 processor does not reorder memory references and so
f0523f02
JM
6365always provides sequential consistency. However, by default, GCC
6366generates the special instructions to guarantee consistency
630d3d5a 6367even when you use @option{-m88100}, so that the code may be run on an
74291a4b 6368MC88110 processor. If you intend to run your code only on the
630d3d5a 6369MC88100 processor, you may use @option{-mno-serialize-volatile}.
74291a4b
MM
6370
6371The extra code generated to guarantee consistency may affect the
6372performance of your application. If you know that you can safely
630d3d5a 6373forgo this guarantee, you may use @option{-mno-serialize-volatile}.
74291a4b
MM
6374
6375@item -msvr4
6376@itemx -msvr3
cd3bb277
JM
6377@opindex msvr4
6378@opindex msvr3
74291a4b
MM
6379@cindex assembler syntax, 88k
6380@cindex SVr4
630d3d5a 6381Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions
74291a4b
MM
6382related to System V release 4 (SVr4). This controls the following:
6383
6384@enumerate
6385@item
6386Which variant of the assembler syntax to emit.
6387@item
630d3d5a 6388@option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
74291a4b
MM
6389that is used on System V release 4.
6390@item
630d3d5a 6391@option{-msvr4} makes GCC issue additional declaration directives used in
74291a4b
MM
6392SVr4.
6393@end enumerate
6394
630d3d5a 6395@option{-msvr4} is the default for the m88k-motorola-sysv4 and
767094dd 6396m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all
74291a4b
MM
6397other m88k configurations.
6398
6399@item -mversion-03.00
cd3bb277 6400@opindex mversion-03.00
74291a4b
MM
6401This option is obsolete, and is ignored.
6402@c ??? which asm syntax better for GAS? option there too?
6403
6404@item -mno-check-zero-division
6405@itemx -mcheck-zero-division
cd3bb277
JM
6406@opindex mno-check-zero-division
6407@opindex mcheck-zero-division
74291a4b
MM
6408@cindex zero division on 88k
6409Do, or don't, generate code to guarantee that integer division by
6410zero will be detected. By default, detection is guaranteed.
6411
6412Some models of the MC88100 processor fail to trap upon integer
6413division by zero under certain conditions. By default, when
f0523f02 6414compiling code that might be run on such a processor, GCC
74291a4b
MM
6415generates code that explicitly checks for zero-valued divisors
6416and traps with exception number 503 when one is detected. Use of
6417mno-check-zero-division suppresses such checking for code
6418generated to run on an MC88100 processor.
6419
f0523f02 6420GCC assumes that the MC88110 processor correctly detects all
630d3d5a
JM
6421instances of integer division by zero. When @option{-m88110} is
6422specified, both @option{-mcheck-zero-division} and
6423@option{-mno-check-zero-division} are ignored, and no explicit checks for
74291a4b
MM
6424zero-valued divisors are generated.
6425
6426@item -muse-div-instruction
cd3bb277 6427@opindex muse-div-instruction
74291a4b
MM
6428@cindex divide instruction, 88k
6429Use the div instruction for signed integer division on the
6430MC88100 processor. By default, the div instruction is not used.
6431
6432On the MC88100 processor the signed integer division instruction
6433div) traps to the operating system on a negative operand. The
6434operating system transparently completes the operation, but at a
6435large cost in execution time. By default, when compiling code
f0523f02 6436that might be run on an MC88100 processor, GCC emulates signed
74291a4b
MM
6437integer division using the unsigned integer division instruction
6438divu), thereby avoiding the large penalty of a trap to the
6439operating system. Such emulation has its own, smaller, execution
6440cost in both time and space. To the extent that your code's
6441important signed integer division operations are performed on two
6442nonnegative operands, it may be desirable to use the div
6443instruction directly.
6444
6445On the MC88110 processor the div instruction (also known as the
6446divs instruction) processes negative operands without trapping to
630d3d5a
JM
6447the operating system. When @option{-m88110} is specified,
6448@option{-muse-div-instruction} is ignored, and the div instruction is used
74291a4b
MM
6449for signed integer division.
6450
630d3d5a 6451Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined. In
74291a4b 6452particular, the behavior of such a division with and without
630d3d5a 6453@option{-muse-div-instruction} may differ.
74291a4b
MM
6454
6455@item -mtrap-large-shift
6456@itemx -mhandle-large-shift
cd3bb277
JM
6457@opindex mtrap-large-shift
6458@opindex mhandle-large-shift
74291a4b
MM
6459@cindex bit shift overflow (88k)
6460@cindex large bit shifts (88k)
6461Include code to detect bit-shifts of more than 31 bits; respectively,
0c2d1a2a 6462trap such shifts or emit code to handle them properly. By default GCC
74291a4b
MM
6463makes no special provision for large bit shifts.
6464
6465@item -mwarn-passed-structs
cd3bb277 6466@opindex mwarn-passed-structs
74291a4b
MM
6467@cindex structure passing (88k)
6468Warn when a function passes a struct as an argument or result.
6469Structure-passing conventions have changed during the evolution of the C
6470language, and are often the source of portability problems. By default,
0c2d1a2a 6471GCC issues no such warning.
74291a4b
MM
6472@end table
6473
6474@node RS/6000 and PowerPC Options
6475@subsection IBM RS/6000 and PowerPC Options
6476@cindex RS/6000 and PowerPC Options
6477@cindex IBM RS/6000 and PowerPC Options
6478
6479These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
2642624b 6480@table @gcctabopt
74291a4b
MM
6481@item -mpower
6482@itemx -mno-power
6483@itemx -mpower2
6484@itemx -mno-power2
6485@itemx -mpowerpc
6486@itemx -mno-powerpc
6487@itemx -mpowerpc-gpopt
6488@itemx -mno-powerpc-gpopt
6489@itemx -mpowerpc-gfxopt
6490@itemx -mno-powerpc-gfxopt
7fe90e7b
DE
6491@itemx -mpowerpc64
6492@itemx -mno-powerpc64
cd3bb277
JM
6493@opindex mpower
6494@opindex mno-power
6495@opindex mpower2
6496@opindex mno-power2
6497@opindex mpowerpc
6498@opindex mno-powerpc
6499@opindex mpowerpc-gpopt
6500@opindex mno-powerpc-gpopt
6501@opindex mpowerpc-gfxopt
6502@opindex mno-powerpc-gfxopt
6503@opindex mpowerpc64
6504@opindex mno-powerpc64
0c2d1a2a 6505GCC supports two related instruction set architectures for the
161d7b59 6506RS/6000 and PowerPC@. The @dfn{POWER} instruction set are those
74291a4b
MM
6507instructions supported by the @samp{rios} chip set used in the original
6508RS/6000 systems and the @dfn{PowerPC} instruction set is the
6509architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
861bb6c1 6510the IBM 4xx microprocessors.
74291a4b
MM
6511
6512Neither architecture is a subset of the other. However there is a
6513large common subset of instructions supported by both. An MQ
6514register is included in processors supporting the POWER architecture.
6515
6516You use these options to specify which instructions are available on the
6517processor you are using. The default value of these options is
161d7b59 6518determined when configuring GCC@. Specifying the
630d3d5a
JM
6519@option{-mcpu=@var{cpu_type}} overrides the specification of these
6520options. We recommend you use the @option{-mcpu=@var{cpu_type}} option
74291a4b
MM
6521rather than the options listed above.
6522
630d3d5a 6523The @option{-mpower} option allows GCC to generate instructions that
74291a4b 6524are found only in the POWER architecture and to use the MQ register.
630d3d5a 6525Specifying @option{-mpower2} implies @option{-power} and also allows GCC
74291a4b
MM
6526to generate instructions that are present in the POWER2 architecture but
6527not the original POWER architecture.
6528
630d3d5a 6529The @option{-mpowerpc} option allows GCC to generate instructions that
74291a4b 6530are found only in the 32-bit subset of the PowerPC architecture.
630d3d5a 6531Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
0c2d1a2a 6532GCC to use the optional PowerPC architecture instructions in the
74291a4b 6533General Purpose group, including floating-point square root. Specifying
630d3d5a 6534@option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
74291a4b
MM
6535use the optional PowerPC architecture instructions in the Graphics
6536group, including floating-point select.
6537
630d3d5a 6538The @option{-mpowerpc64} option allows GCC to generate the additional
7fe90e7b 653964-bit instructions that are found in the full PowerPC64 architecture
0c2d1a2a 6540and to treat GPRs as 64-bit, doubleword quantities. GCC defaults to
630d3d5a 6541@option{-mno-powerpc64}.
7fe90e7b 6542
630d3d5a 6543If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
74291a4b
MM
6544will use only the instructions in the common subset of both
6545architectures plus some special AIX common-mode calls, and will not use
630d3d5a 6546the MQ register. Specifying both @option{-mpower} and @option{-mpowerpc}
0c2d1a2a 6547permits GCC to use any instruction from either architecture and to
74291a4b
MM
6548allow use of the MQ register; specify this for the Motorola MPC601.
6549
6550@item -mnew-mnemonics
6551@itemx -mold-mnemonics
cd3bb277
JM
6552@opindex mnew-mnemonics
6553@opindex mold-mnemonics
74291a4b 6554Select which mnemonics to use in the generated assembler code.
630d3d5a
JM
6555@option{-mnew-mnemonics} requests output that uses the assembler mnemonics
6556defined for the PowerPC architecture, while @option{-mold-mnemonics}
74291a4b
MM
6557requests the assembler mnemonics defined for the POWER architecture.
6558Instructions defined in only one architecture have only one mnemonic;
0c2d1a2a 6559GCC uses that mnemonic irrespective of which of these options is
74291a4b
MM
6560specified.
6561
0c2d1a2a 6562GCC defaults to the mnemonics appropriate for the architecture in
630d3d5a 6563use. Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
7fe90e7b 6564value of these option. Unless you are building a cross-compiler, you
630d3d5a
JM
6565should normally not specify either @option{-mnew-mnemonics} or
6566@option{-mold-mnemonics}, but should instead accept the default.
74291a4b
MM
6567
6568@item -mcpu=@var{cpu_type}
cd3bb277 6569@opindex mcpu
74291a4b
MM
6570Set architecture type, register usage, choice of mnemonics, and
6571instruction scheduling parameters for machine type @var{cpu_type}.
5f59ecb7
DE
6572Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
6573@samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
6574@samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
6575@samp{630}, @samp{740}, @samp{750}, @samp{power}, @samp{power2},
6576@samp{powerpc}, @samp{403}, @samp{505}, @samp{801}, @samp{821},
630d3d5a
JM
6577@samp{823}, and @samp{860} and @samp{common}. @option{-mcpu=power},
6578@option{-mcpu=power2}, @option{-mcpu=powerpc}, and @option{-mcpu=powerpc64}
5f59ecb7
DE
6579specify generic POWER, POWER2, pure 32-bit PowerPC (i.e., not MPC601),
6580and 64-bit PowerPC architecture machine types, with an appropriate,
bd819a4a 6581generic processor model assumed for scheduling purposes.
74291a4b 6582
02f52e19 6583Specifying any of the following options:
630d3d5a
JM
6584@option{-mcpu=rios1}, @option{-mcpu=rios2}, @option{-mcpu=rsc},
6585@option{-mcpu=power}, or @option{-mcpu=power2}
6586enables the @option{-mpower} option and disables the @option{-mpowerpc} option;
6587@option{-mcpu=601} enables both the @option{-mpower} and @option{-mpowerpc} options.
6588All of @option{-mcpu=rs64a}, @option{-mcpu=602}, @option{-mcpu=603},
6589@option{-mcpu=603e}, @option{-mcpu=604}, @option{-mcpu=620}, @option{-mcpu=630},
6590@option{-mcpu=740}, and @option{-mcpu=750}
6591enable the @option{-mpowerpc} option and disable the @option{-mpower} option.
6592Exactly similarly, all of @option{-mcpu=403},
6593@option{-mcpu=505}, @option{-mcpu=821}, @option{-mcpu=860} and @option{-mcpu=powerpc}
6594enable the @option{-mpowerpc} option and disable the @option{-mpower} option.
6595@option{-mcpu=common} disables both the
bd819a4a 6596@option{-mpower} and @option{-mpowerpc} options.
630d3d5a
JM
6597
6598AIX versions 4 or greater selects @option{-mcpu=common} by default, so
5f59ecb7 6599that code will operate on all members of the RS/6000 POWER and PowerPC
0c2d1a2a 6600families. In that case, GCC will use only the instructions in the
74291a4b 6601common subset of both architectures plus some special AIX common-mode
0c2d1a2a 6602calls, and will not use the MQ register. GCC assumes a generic
74291a4b
MM
6603processor model for scheduling purposes.
6604
630d3d5a
JM
6605Specifying any of the options @option{-mcpu=rios1}, @option{-mcpu=rios2},
6606@option{-mcpu=rsc}, @option{-mcpu=power}, or @option{-mcpu=power2} also
6607disables the @samp{new-mnemonics} option. Specifying @option{-mcpu=601},
6608@option{-mcpu=602}, @option{-mcpu=603}, @option{-mcpu=603e}, @option{-mcpu=604},
6609@option{-mcpu=620}, @option{-mcpu=630}, @option{-mcpu=403}, @option{-mcpu=505},
6610@option{-mcpu=821}, @option{-mcpu=860} or @option{-mcpu=powerpc} also enables
bd819a4a 6611the @samp{new-mnemonics} option.
74291a4b 6612
630d3d5a
JM
6613Specifying @option{-mcpu=403}, @option{-mcpu=821}, or @option{-mcpu=860} also
6614enables the @option{-msoft-float} option.
74291a4b
MM
6615
6616@item -mtune=@var{cpu_type}
cd3bb277 6617@opindex mtune
74291a4b
MM
6618Set the instruction scheduling parameters for machine type
6619@var{cpu_type}, but do not set the architecture type, register usage,
630d3d5a
JM
6620choice of mnemonics like @option{-mcpu=@var{cpu_type}} would. The same
6621values for @var{cpu_type} are used for @option{-mtune=@var{cpu_type}} as
6622for @option{-mcpu=@var{cpu_type}}. The @option{-mtune=@var{cpu_type}}
6623option overrides the @option{-mcpu=@var{cpu_type}} option in terms of
74291a4b
MM
6624instruction scheduling parameters.
6625
6626@item -mfull-toc
6627@itemx -mno-fp-in-toc
6628@itemx -mno-sum-in-toc
6629@itemx -mminimal-toc
cd3bb277
JM
6630@opindex mfull-toc
6631@opindex mno-fp-in-toc
6632@opindex mno-sum-in-toc
6633@opindex mminimal-toc
74291a4b 6634Modify generation of the TOC (Table Of Contents), which is created for
630d3d5a 6635every executable file. The @option{-mfull-toc} option is selected by
0c2d1a2a
JB
6636default. In that case, GCC will allocate at least one TOC entry for
6637each unique non-automatic variable reference in your program. GCC
161d7b59
JM
6638will also place floating-point constants in the TOC@. However, only
663916,384 entries are available in the TOC@.
74291a4b
MM
6640
6641If you receive a linker error message that saying you have overflowed
6642the available TOC space, you can reduce the amount of TOC space used
630d3d5a
JM
6643with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
6644@option{-mno-fp-in-toc} prevents GCC from putting floating-point
6645constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
74291a4b 6646generate code to calculate the sum of an address and a constant at
161d7b59 6647run-time instead of putting that sum into the TOC@. You may specify one
0c2d1a2a 6648or both of these options. Each causes GCC to produce very slightly
74291a4b
MM
6649slower and larger code at the expense of conserving TOC space.
6650
6651If you still run out of space in the TOC even when you specify both of
630d3d5a 6652these options, specify @option{-mminimal-toc} instead. This option causes
0c2d1a2a
JB
6653GCC to make only one TOC entry for every file. When you specify this
6654option, GCC will produce code that is slower and larger but which
74291a4b 6655uses extremely little TOC space. You may wish to use this option
bd819a4a 6656only on files that contain less frequently executed code.
74291a4b 6657
fa06229f
GK
6658@item -maix64
6659@itemx -maix32
cd3bb277
JM
6660@opindex maix64
6661@opindex maix32
fa06229f 6662Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
7fe90e7b 6663@code{long} type, and the infrastructure needed to support them.
630d3d5a
JM
6664Specifying @option{-maix64} implies @option{-mpowerpc64} and
6665@option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
6666implies @option{-mno-powerpc64}. GCC defaults to @option{-maix32}.
7fe90e7b 6667
74291a4b
MM
6668@item -mxl-call
6669@itemx -mno-xl-call
cd3bb277
JM
6670@opindex mxl-call
6671@opindex mno-xl-call
74291a4b
MM
6672On AIX, pass floating-point arguments to prototyped functions beyond the
6673register save area (RSA) on the stack in addition to argument FPRs. The
6674AIX calling convention was extended but not initially documented to
6675handle an obscure K&R C case of calling a function that takes the
6676address of its arguments with fewer arguments than declared. AIX XL
7fe90e7b
DE
6677compilers access floating point arguments which do not fit in the
6678RSA from the stack when a subroutine is compiled without
74291a4b
MM
6679optimization. Because always storing floating-point arguments on the
6680stack is inefficient and rarely needed, this option is not enabled by
6681default and only is necessary when calling subroutines compiled by AIX
6682XL compilers without optimization.
6683
861bb6c1 6684@item -mthreads
cd3bb277 6685@opindex mthreads
861bb6c1
JL
6686Support @dfn{AIX Threads}. Link an application written to use
6687@dfn{pthreads} with special libraries and startup code to enable the
6688application to run.
6689
6690@item -mpe
cd3bb277 6691@opindex mpe
161d7b59 6692Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@. Link an
861bb6c1
JL
6693application written to use message passing with special startup code to
6694enable the application to run. The system must have PE installed in the
6695standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
630d3d5a 6696must be overridden with the @option{-specs=} option to specify the
861bb6c1 6697appropriate directory location. The Parallel Environment does not
630d3d5a 6698support threads, so the @option{-mpe} option and the @option{-mthreads}
861bb6c1
JL
6699option are incompatible.
6700
74291a4b
MM
6701@item -msoft-float
6702@itemx -mhard-float
cd3bb277
JM
6703@opindex msoft-float
6704@opindex mhard-float
74291a4b
MM
6705Generate code that does not use (uses) the floating-point register set.
6706Software floating point emulation is provided if you use the
630d3d5a 6707@option{-msoft-float} option, and pass the option to GCC when linking.
74291a4b
MM
6708
6709@item -mmultiple
6710@itemx -mno-multiple
cd3bb277
JM
6711@opindex mmultiple
6712@opindex mno-multiple
74291a4b
MM
6713Generate code that uses (does not use) the load multiple word
6714instructions and the store multiple word instructions. These
6715instructions are generated by default on POWER systems, and not
630d3d5a 6716generated on PowerPC systems. Do not use @option{-mmultiple} on little
74291a4b 6717endian PowerPC systems, since those instructions do not work when the
bef84347
VM
6718processor is in little endian mode. The exceptions are PPC740 and
6719PPC750 which permit the instructions usage in little endian mode.
74291a4b
MM
6720
6721@item -mstring
6722@itemx -mno-string
cd3bb277
JM
6723@opindex mstring
6724@opindex mno-string
bef84347
VM
6725Generate code that uses (does not use) the load string instructions
6726and the store string word instructions to save multiple registers and
6727do small block moves. These instructions are generated by default on
6728POWER systems, and not generated on PowerPC systems. Do not use
630d3d5a 6729@option{-mstring} on little endian PowerPC systems, since those
bef84347
VM
6730instructions do not work when the processor is in little endian mode.
6731The exceptions are PPC740 and PPC750 which permit the instructions
6732usage in little endian mode.
74291a4b 6733
861bb6c1
JL
6734@item -mupdate
6735@itemx -mno-update
cd3bb277
JM
6736@opindex mupdate
6737@opindex mno-update
861bb6c1
JL
6738Generate code that uses (does not use) the load or store instructions
6739that update the base register to the address of the calculated memory
6740location. These instructions are generated by default. If you use
630d3d5a 6741@option{-mno-update}, there is a small window between the time that the
861bb6c1
JL
6742stack pointer is updated and the address of the previous frame is
6743stored, which means code that walks the stack frame across interrupts or
6744signals may get corrupted data.
6745
6746@item -mfused-madd
6747@itemx -mno-fused-madd
cd3bb277
JM
6748@opindex mfused-madd
6749@opindex mno-fused-madd
861bb6c1
JL
6750Generate code that uses (does not use) the floating point multiply and
6751accumulate instructions. These instructions are generated by default if
6752hardware floating is used.
6753
74291a4b
MM
6754@item -mno-bit-align
6755@itemx -mbit-align
cd3bb277
JM
6756@opindex mno-bit-align
6757@opindex mbit-align
74291a4b 6758On System V.4 and embedded PowerPC systems do not (do) force structures
c771326b
JM
6759and unions that contain bit-fields to be aligned to the base type of the
6760bit-field.
74291a4b
MM
6761
6762For example, by default a structure containing nothing but 8
c771326b 6763@code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
630d3d5a 6764boundary and have a size of 4 bytes. By using @option{-mno-bit-align},
74291a4b
MM
6765the structure would be aligned to a 1 byte boundary and be one byte in
6766size.
6767
6768@item -mno-strict-align
6769@itemx -mstrict-align
cd3bb277
JM
6770@opindex mno-strict-align
6771@opindex mstrict-align
74291a4b
MM
6772On System V.4 and embedded PowerPC systems do not (do) assume that
6773unaligned memory references will be handled by the system.
6774
6775@item -mrelocatable
6776@itemx -mno-relocatable
cd3bb277
JM
6777@opindex mrelocatable
6778@opindex mno-relocatable
74291a4b
MM
6779On embedded PowerPC systems generate code that allows (does not allow)
6780the program to be relocated to a different address at runtime. If you
630d3d5a
JM
6781use @option{-mrelocatable} on any module, all objects linked together must
6782be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
74291a4b
MM
6783
6784@item -mrelocatable-lib
6785@itemx -mno-relocatable-lib
cd3bb277
JM
6786@opindex mrelocatable-lib
6787@opindex mno-relocatable-lib
74291a4b
MM
6788On embedded PowerPC systems generate code that allows (does not allow)
6789the program to be relocated to a different address at runtime. Modules
630d3d5a
JM
6790compiled with @option{-mrelocatable-lib} can be linked with either modules
6791compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
6792with modules compiled with the @option{-mrelocatable} options.
74291a4b
MM
6793
6794@item -mno-toc
6795@itemx -mtoc
cd3bb277
JM
6796@opindex mno-toc
6797@opindex mtoc
74291a4b
MM
6798On System V.4 and embedded PowerPC systems do not (do) assume that
6799register 2 contains a pointer to a global area pointing to the addresses
6800used in the program.
6801
74291a4b
MM
6802@item -mlittle
6803@itemx -mlittle-endian
cd3bb277
JM
6804@opindex mlittle
6805@opindex mlittle-endian
74291a4b 6806On System V.4 and embedded PowerPC systems compile code for the
630d3d5a
JM
6807processor in little endian mode. The @option{-mlittle-endian} option is
6808the same as @option{-mlittle}.
74291a4b
MM
6809
6810@item -mbig
6811@itemx -mbig-endian
cd3bb277
JM
6812@opindex mbig
6813@opindex mbig-endian
74291a4b 6814On System V.4 and embedded PowerPC systems compile code for the
630d3d5a
JM
6815processor in big endian mode. The @option{-mbig-endian} option is
6816the same as @option{-mbig}.
74291a4b
MM
6817
6818@item -mcall-sysv
cd3bb277 6819@opindex mcall-sysv
74291a4b
MM
6820On System V.4 and embedded PowerPC systems compile code using calling
6821conventions that adheres to the March 1995 draft of the System V
6822Application Binary Interface, PowerPC processor supplement. This is the
6823default unless you configured GCC using @samp{powerpc-*-eabiaix}.
6824
6825@item -mcall-sysv-eabi
cd3bb277 6826@opindex mcall-sysv-eabi
630d3d5a 6827Specify both @option{-mcall-sysv} and @option{-meabi} options.
74291a4b
MM
6828
6829@item -mcall-sysv-noeabi
cd3bb277 6830@opindex mcall-sysv-noeabi
630d3d5a 6831Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
74291a4b
MM
6832
6833@item -mcall-aix
cd3bb277 6834@opindex mcall-aix
74291a4b 6835On System V.4 and embedded PowerPC systems compile code using calling
161d7b59 6836conventions that are similar to those used on AIX@. This is the
74291a4b
MM
6837default if you configured GCC using @samp{powerpc-*-eabiaix}.
6838
6839@item -mcall-solaris
cd3bb277 6840@opindex mcall-solaris
74291a4b
MM
6841On System V.4 and embedded PowerPC systems compile code for the Solaris
6842operating system.
6843
6844@item -mcall-linux
cd3bb277 6845@opindex mcall-linux
861bb6c1
JL
6846On System V.4 and embedded PowerPC systems compile code for the
6847Linux-based GNU system.
74291a4b
MM
6848
6849@item -mprototype
e9a25f70 6850@itemx -mno-prototype
cd3bb277
JM
6851@opindex mprototype
6852@opindex mno-prototype
74291a4b
MM
6853On System V.4 and embedded PowerPC systems assume that all calls to
6854variable argument functions are properly prototyped. Otherwise, the
6855compiler must insert an instruction before every non prototyped call to
6856set or clear bit 6 of the condition code register (@var{CR}) to
6857indicate whether floating point values were passed in the floating point
6858registers in case the function takes a variable arguments. With
630d3d5a 6859@option{-mprototype}, only calls to prototyped variable argument functions
74291a4b
MM
6860will set or clear the bit.
6861
6862@item -msim
cd3bb277 6863@opindex msim
74291a4b
MM
6864On embedded PowerPC systems, assume that the startup module is called
6865@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
6866@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
6867configurations.
6868
6869@item -mmvme
cd3bb277 6870@opindex mmvme
74291a4b 6871On embedded PowerPC systems, assume that the startup module is called
e9a25f70
JL
6872@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
6873@file{libc.a}.
6874
6875@item -mads
cd3bb277 6876@opindex mads
e9a25f70
JL
6877On embedded PowerPC systems, assume that the startup module is called
6878@file{crt0.o} and the standard C libraries are @file{libads.a} and
6879@file{libc.a}.
6880
6881@item -myellowknife
cd3bb277 6882@opindex myellowknife
e9a25f70
JL
6883On embedded PowerPC systems, assume that the startup module is called
6884@file{crt0.o} and the standard C libraries are @file{libyk.a} and
74291a4b
MM
6885@file{libc.a}.
6886
bff46771 6887@item -mvxworks
cd3bb277 6888@opindex mvxworks
bff46771
GK
6889On System V.4 and embedded PowerPC systems, specify that you are
6890compiling for a VxWorks system.
6891
74291a4b 6892@item -memb
cd3bb277 6893@opindex memb
74291a4b
MM
6894On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
6895header to indicate that @samp{eabi} extended relocations are used.
6896
6897@item -meabi
6898@itemx -mno-eabi
cd3bb277
JM
6899@opindex meabi
6900@opindex mno-eabi
74291a4b
MM
6901On System V.4 and embedded PowerPC systems do (do not) adhere to the
6902Embedded Applications Binary Interface (eabi) which is a set of
bedc7537 6903modifications to the System V.4 specifications. Selecting @option{-meabi}
74291a4b
MM
6904means that the stack is aligned to an 8 byte boundary, a function
6905@code{__eabi} is called to from @code{main} to set up the eabi
630d3d5a 6906environment, and the @option{-msdata} option can use both @code{r2} and
74291a4b 6907@code{r13} to point to two separate small data areas. Selecting
bedc7537 6908@option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
74291a4b 6909do not call an initialization function from @code{main}, and the
630d3d5a
JM
6910@option{-msdata} option will only use @code{r13} to point to a single
6911small data area. The @option{-meabi} option is on by default if you
74291a4b
MM
6912configured GCC using one of the @samp{powerpc*-*-eabi*} options.
6913
6914@item -msdata=eabi
cd3bb277 6915@opindex msdata=eabi
74291a4b
MM
6916On System V.4 and embedded PowerPC systems, put small initialized
6917@code{const} global and static data in the @samp{.sdata2} section, which
6918is pointed to by register @code{r2}. Put small initialized
6919non-@code{const} global and static data in the @samp{.sdata} section,
6920which is pointed to by register @code{r13}. Put small uninitialized
6921global and static data in the @samp{.sbss} section, which is adjacent to
630d3d5a
JM
6922the @samp{.sdata} section. The @option{-msdata=eabi} option is
6923incompatible with the @option{-mrelocatable} option. The
6924@option{-msdata=eabi} option also sets the @option{-memb} option.
74291a4b
MM
6925
6926@item -msdata=sysv
cd3bb277 6927@opindex msdata=sysv
74291a4b
MM
6928On System V.4 and embedded PowerPC systems, put small global and static
6929data in the @samp{.sdata} section, which is pointed to by register
6930@code{r13}. Put small uninitialized global and static data in the
6931@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
630d3d5a
JM
6932The @option{-msdata=sysv} option is incompatible with the
6933@option{-mrelocatable} option.
74291a4b
MM
6934
6935@item -msdata=default
6936@itemx -msdata
cd3bb277
JM
6937@opindex msdata=default
6938@opindex msdata
630d3d5a
JM
6939On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
6940compile code the same as @option{-msdata=eabi}, otherwise compile code the
6941same as @option{-msdata=sysv}.
74291a4b
MM
6942
6943@item -msdata-data
cd3bb277 6944@opindex msdata-data
74291a4b
MM
6945On System V.4 and embedded PowerPC systems, put small global and static
6946data in the @samp{.sdata} section. Put small uninitialized global and
6947static data in the @samp{.sbss} section. Do not use register @code{r13}
6948to address small data however. This is the default behavior unless
630d3d5a 6949other @option{-msdata} options are used.
74291a4b
MM
6950
6951@item -msdata=none
6952@itemx -mno-sdata
cd3bb277
JM
6953@opindex msdata=none
6954@opindex mno-sdata
74291a4b
MM
6955On embedded PowerPC systems, put all initialized global and static data
6956in the @samp{.data} section, and all uninitialized data in the
6957@samp{.bss} section.
6958
6959@item -G @var{num}
cd3bb277 6960@opindex G
74291a4b
MM
6961@cindex smaller data references (PowerPC)
6962@cindex .sdata/.sdata2 references (PowerPC)
956d6950 6963On embedded PowerPC systems, put global and static items less than or
74291a4b
MM
6964equal to @var{num} bytes into the small data or bss sections instead of
6965the normal data or bss section. By default, @var{num} is 8. The
630d3d5a
JM
6966@option{-G @var{num}} switch is also passed to the linker.
6967All modules should be compiled with the same @option{-G @var{num}} value.
74291a4b
MM
6968
6969@item -mregnames
6970@itemx -mno-regnames
cd3bb277
JM
6971@opindex mregnames
6972@opindex mno-regnames
74291a4b
MM
6973On System V.4 and embedded PowerPC systems do (do not) emit register
6974names in the assembly language output using symbolic forms.
f5a1b0d2 6975
74291a4b 6976@end table
f5a1b0d2 6977
74291a4b
MM
6978@node RT Options
6979@subsection IBM RT Options
6980@cindex RT options
6981@cindex IBM RT options
6982
6983These @samp{-m} options are defined for the IBM RT PC:
6984
2642624b 6985@table @gcctabopt
74291a4b 6986@item -min-line-mul
cd3bb277 6987@opindex min-line-mul
74291a4b
MM
6988Use an in-line code sequence for integer multiplies. This is the
6989default.
6990
6991@item -mcall-lib-mul
cd3bb277 6992@opindex mcall-lib-mul
74291a4b
MM
6993Call @code{lmul$$} for integer multiples.
6994
6995@item -mfull-fp-blocks
cd3bb277 6996@opindex mfull-fp-blocks
74291a4b 6997Generate full-size floating point data blocks, including the minimum
161d7b59 6998amount of scratch space recommended by IBM@. This is the default.
74291a4b
MM
6999
7000@item -mminimum-fp-blocks
cd3bb277 7001@opindex mminimum-fp-blocks
74291a4b
MM
7002Do not include extra scratch space in floating point data blocks. This
7003results in smaller code, but slower execution, since scratch space must
7004be allocated dynamically.
7005
7006@cindex @file{varargs.h} and RT PC
7007@cindex @file{stdarg.h} and RT PC
7008@item -mfp-arg-in-fpregs
cd3bb277 7009@opindex mfp-arg-in-fpregs
74291a4b
MM
7010Use a calling sequence incompatible with the IBM calling convention in
7011which floating point arguments are passed in floating point registers.
c771326b 7012Note that @code{varargs.h} and @code{stdarg.h} will not work with
74291a4b
MM
7013floating point operands if this option is specified.
7014
7015@item -mfp-arg-in-gregs
cd3bb277 7016@opindex mfp-arg-in-gregs
74291a4b
MM
7017Use the normal calling convention for floating point arguments. This is
7018the default.
7019
7020@item -mhc-struct-return
cd3bb277 7021@opindex mhc-struct-return
74291a4b
MM
7022Return structures of more than one word in memory, rather than in a
7023register. This provides compatibility with the MetaWare HighC (hc)
630d3d5a 7024compiler. Use the option @option{-fpcc-struct-return} for compatibility
74291a4b
MM
7025with the Portable C Compiler (pcc).
7026
7027@item -mnohc-struct-return
cd3bb277 7028@opindex mnohc-struct-return
74291a4b
MM
7029Return some structures of more than one word in registers, when
7030convenient. This is the default. For compatibility with the
630d3d5a
JM
7031IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
7032option @option{-mhc-struct-return}.
74291a4b
MM
7033@end table
7034
7035@node MIPS Options
7036@subsection MIPS Options
7037@cindex MIPS options
7038
7039These @samp{-m} options are defined for the MIPS family of computers:
7040
2642624b 7041@table @gcctabopt
7dac2f89
EC
7042
7043@item -march=@var{cpu-type}
7044@opindex march
7045Assume the defaults for the machine type @var{cpu-type} when generating
7046instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000},
7047@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
7048@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
7049and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000},
7050@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
7051@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc.
7052
7053@item -mtune=@var{cpu-type}
7054@opindex mtune
630d3d5a
JM
7055Assume the defaults for the machine type @var{cpu-type} when scheduling
7056instructions. The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000},
8b9243df
JJ
7057@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
7058@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
7059and @samp{orion}. Additionally, the @samp{r2000}, @samp{r3000},
7060@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
7061@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc. While picking a specific
630d3d5a 7062@var{cpu-type} will schedule things appropriately for that particular
8b9243df 7063chip, the compiler will not generate any code that does not meet level 1
630d3d5a
JM
7064of the MIPS ISA (instruction set architecture) without a @option{-mipsX}
7065or @option{-mabi} switch being used.
74291a4b 7066
7dac2f89
EC
7067@item -mcpu=@var{cpu-type}
7068@opindex mcpu
7069This is identical to specifying both @option{-march} and @option{-mtune}.
7070
74291a4b 7071@item -mips1
cd3bb277 7072@opindex mips1
161d7b59 7073Issue instructions from level 1 of the MIPS ISA@. This is the default.
630d3d5a 7074@samp{r3000} is the default @var{cpu-type} at this ISA level.
74291a4b
MM
7075
7076@item -mips2
cd3bb277 7077@opindex mips2
74291a4b 7078Issue instructions from level 2 of the MIPS ISA (branch likely, square
630d3d5a 7079root instructions). @samp{r6000} is the default @var{cpu-type} at this
74291a4b
MM
7080ISA level.
7081
7082@item -mips3
cd3bb277 7083@opindex mips3
02f52e19 7084Issue instructions from level 3 of the MIPS ISA (64-bit instructions).
630d3d5a 7085@samp{r4000} is the default @var{cpu-type} at this ISA level.
74291a4b 7086
3398f47f 7087@item -mips4
cd3bb277 7088@opindex mips4
8b9243df
JJ
7089Issue instructions from level 4 of the MIPS ISA (conditional move,
7090prefetch, enhanced FPU instructions). @samp{r8000} is the default
630d3d5a 7091@var{cpu-type} at this ISA level.
3398f47f 7092
74291a4b 7093@item -mfp32
cd3bb277 7094@opindex mfp32
74291a4b
MM
7095Assume that 32 32-bit floating point registers are available. This is
7096the default.
7097
7098@item -mfp64
cd3bb277 7099@opindex mfp64
74291a4b 7100Assume that 32 64-bit floating point registers are available. This is
630d3d5a 7101the default when the @option{-mips3} option is used.
74291a4b
MM
7102
7103@item -mgp32
cd3bb277 7104@opindex mgp32
74291a4b
MM
7105Assume that 32 32-bit general purpose registers are available. This is
7106the default.
7107
7108@item -mgp64
cd3bb277 7109@opindex mgp64
74291a4b 7110Assume that 32 64-bit general purpose registers are available. This is
630d3d5a 7111the default when the @option{-mips3} option is used.
74291a4b
MM
7112
7113@item -mint64
cd3bb277 7114@opindex mint64
630d3d5a 7115Force int and long types to be 64 bits wide. See @option{-mlong32} for an
3ce1ba83 7116explanation of the default, and the width of pointers.
74291a4b
MM
7117
7118@item -mlong64
cd3bb277 7119@opindex mlong64
630d3d5a 7120Force long types to be 64 bits wide. See @option{-mlong32} for an
3ce1ba83 7121explanation of the default, and the width of pointers.
fb1bf66d 7122
3ce1ba83 7123@item -mlong32
cd3bb277 7124@opindex mlong32
3ce1ba83
GRK
7125Force long, int, and pointer types to be 32 bits wide.
7126
630d3d5a 7127If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set,
b192711e 7128the size of ints, longs, and pointers depends on the ABI and ISA chosen.
630d3d5a
JM
7129For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits
7130wide. For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide.
7131For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints
7132and longs are 32 bits wide. For @option{-mabi=eabi} and higher ISAs, ints
3ce1ba83
GRK
7133are 32 bits, and longs are 64 bits wide. The width of pointer types is
7134the smaller of the width of longs or the width of general purpose
161d7b59 7135registers (which in turn depends on the ISA)@.
74291a4b 7136
62a1403d 7137@item -mabi=32
8b9243df 7138@itemx -mabi=o64
3398f47f
MM
7139@itemx -mabi=n32
7140@itemx -mabi=64
7141@itemx -mabi=eabi
cd3bb277
JM
7142@opindex mabi=32
7143@opindex mabi=o64
7144@opindex mabi=n32
7145@opindex mabi=64
7146@opindex mabi=eabi
161d7b59 7147Generate code for the indicated ABI@. The default instruction level is
630d3d5a
JM
7148@option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and
7149@option{-mips4} otherwise. Conversely, with @option{-mips1} or
7150@option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI
8b9243df 7151is @samp{64}.
3398f47f 7152
74291a4b 7153@item -mmips-as
cd3bb277 7154@opindex mmips-as
74291a4b
MM
7155Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
7156add normal debug information. This is the default for all
7157platforms except for the OSF/1 reference platform, using the OSF/rose
630d3d5a 7158object format. If the either of the @option{-gstabs} or @option{-gstabs+}
74291a4b 7159switches are used, the @file{mips-tfile} program will encapsulate the
161d7b59 7160stabs within MIPS ECOFF@.
74291a4b
MM
7161
7162@item -mgas
cd3bb277 7163@opindex mgas
74291a4b 7164Generate code for the GNU assembler. This is the default on the OSF/1
861bb6c1 7165reference platform, using the OSF/rose object format. Also, this is
630d3d5a 7166the default if the configure option @option{--with-gnu-as} is used.
861bb6c1
JL
7167
7168@item -msplit-addresses
7169@itemx -mno-split-addresses
cd3bb277
JM
7170@opindex msplit-addresses
7171@opindex mno-split-addresses
861bb6c1 7172Generate code to load the high and low parts of address constants separately.
aee96fe9 7173This allows GCC to optimize away redundant loads of the high order
861bb6c1
JL
7174bits of addresses. This optimization requires GNU as and GNU ld.
7175This optimization is enabled by default for some embedded targets where
7176GNU as and GNU ld are standard.
74291a4b
MM
7177
7178@item -mrnames
7179@itemx -mno-rnames
cd3bb277
JM
7180@opindex mrnames
7181@opindex mno-rnames
630d3d5a 7182The @option{-mrnames} switch says to output code using the MIPS software
74291a4b
MM
7183names for the registers, instead of the hardware names (ie, @var{a0}
7184instead of @var{$4}). The only known assembler that supports this option
7185is the Algorithmics assembler.
7186
7187@item -mgpopt
7188@itemx -mno-gpopt
cd3bb277
JM
7189@opindex mgpopt
7190@opindex mno-gpopt
630d3d5a 7191The @option{-mgpopt} switch says to write all of the data declarations
74291a4b
MM
7192before the instructions in the text section, this allows the MIPS
7193assembler to generate one word memory references instead of using two
7194words for short global or static data items. This is on by default if
7195optimization is selected.
7196
7197@item -mstats
7198@itemx -mno-stats
cd3bb277
JM
7199@opindex mstats
7200@opindex mno-stats
630d3d5a 7201For each non-inline function processed, the @option{-mstats} switch
74291a4b
MM
7202causes the compiler to emit one line to the standard error file to
7203print statistics about the program (number of registers saved, stack
7204size, etc.).
7205
7206@item -mmemcpy
7207@itemx -mno-memcpy
cd3bb277
JM
7208@opindex mmemcpy
7209@opindex mno-memcpy
630d3d5a 7210The @option{-mmemcpy} switch makes all block moves call the appropriate
74291a4b
MM
7211string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
7212generating inline code.
7213
7214@item -mmips-tfile
7215@itemx -mno-mips-tfile
cd3bb277
JM
7216@opindex mmips-tfile
7217@opindex mno-mips-tfile
630d3d5a 7218The @option{-mno-mips-tfile} switch causes the compiler not
74291a4b
MM
7219postprocess the object file with the @file{mips-tfile} program,
7220after the MIPS assembler has generated it to add debug support. If
7221@file{mips-tfile} is not run, then no local variables will be
7222available to the debugger. In addition, @file{stage2} and
7223@file{stage3} objects will have the temporary file names passed to the
7224assembler embedded in the object file, which means the objects will
630d3d5a 7225not compare the same. The @option{-mno-mips-tfile} switch should only
74291a4b
MM
7226be used when there are bugs in the @file{mips-tfile} program that
7227prevents compilation.
7228
7229@item -msoft-float
cd3bb277 7230@opindex msoft-float
74291a4b 7231Generate output containing library calls for floating point.
161d7b59 7232@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
7233Normally the facilities of the machine's usual C compiler are used, but
7234this can't be done directly in cross-compilation. You must make your
7235own arrangements to provide suitable library functions for
7236cross-compilation.
7237
7238@item -mhard-float
cd3bb277 7239@opindex mhard-float
74291a4b
MM
7240Generate output containing floating point instructions. This is the
7241default if you use the unmodified sources.
7242
7243@item -mabicalls
7244@itemx -mno-abicalls
cd3bb277
JM
7245@opindex mabicalls
7246@opindex mno-abicalls
74291a4b
MM
7247Emit (or do not emit) the pseudo operations @samp{.abicalls},
7248@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
7249position independent code.
7250
7251@item -mlong-calls
7252@itemx -mno-long-calls
cd3bb277
JM
7253@opindex mlong-calls
7254@opindex mno-long-calls
74291a4b
MM
7255Do all calls with the @samp{JALR} instruction, which requires
7256loading up a function's address into a register before the call.
7257You need to use this switch, if you call outside of the current
7258512 megabyte segment to functions that are not through pointers.
7259
7260@item -mhalf-pic
7261@itemx -mno-half-pic
cd3bb277
JM
7262@opindex mhalf-pic
7263@opindex mno-half-pic
74291a4b
MM
7264Put pointers to extern references into the data section and load them
7265up, rather than put the references in the text section.
7266
7267@item -membedded-pic
7268@itemx -mno-embedded-pic
cd3bb277
JM
7269@opindex membedded-pic
7270@opindex mno-embedded-pic
69fa83cf
JW
7271Generate PIC code suitable for some embedded systems. All calls are
7272made using PC relative address, and all data is addressed using the $gp
7273register. No more than 65536 bytes of global data may be used. This
7274requires GNU as and GNU ld which do most of the work. This currently
161d7b59 7275only works on targets which use ECOFF; it does not work with ELF@.
74291a4b
MM
7276
7277@item -membedded-data
7278@itemx -mno-embedded-data
cd3bb277
JM
7279@opindex membedded-data
7280@opindex mno-embedded-data
74291a4b
MM
7281Allocate variables to the read-only data section first if possible, then
7282next in the small data section if possible, otherwise in data. This gives
7283slightly slower code than the default, but reduces the amount of RAM required
7284when executing, and thus may be preferred for some embedded systems.
7285
919509ce
DN
7286@item -muninit-const-in-rodata
7287@itemx -mno-uninit-const-in-rodata
cd3bb277
JM
7288@opindex muninit-const-in-rodata
7289@opindex mno-uninit-const-in-rodata
695ac33f 7290When used together with @option{-membedded-data}, it will always store uninitialized
919509ce 7291const variables in the read-only data section.
02f52e19 7292
74291a4b
MM
7293@item -msingle-float
7294@itemx -mdouble-float
cd3bb277
JM
7295@opindex msingle-float
7296@opindex mdouble-float
630d3d5a 7297The @option{-msingle-float} switch tells gcc to assume that the floating
74291a4b 7298point coprocessor only supports single precision operations, as on the
630d3d5a 7299@samp{r4650} chip. The @option{-mdouble-float} switch permits gcc to use
74291a4b
MM
7300double precision operations. This is the default.
7301
7302@item -mmad
7303@itemx -mno-mad
cd3bb277
JM
7304@opindex mmad
7305@opindex mno-mad
74291a4b
MM
7306Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
7307as on the @samp{r4650} chip.
7308
7309@item -m4650
cd3bb277 7310@opindex m4650
630d3d5a
JM
7311Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
7312@option{-mcpu=r4650}.
74291a4b 7313
8b9243df
JJ
7314@item -mips16
7315@itemx -mno-mips16
cd3bb277
JM
7316@opindex mips16
7317@opindex mno-mips16
8b9243df
JJ
7318Enable 16-bit instructions.
7319
7320@item -mentry
cd3bb277 7321@opindex mentry
8b9243df 7322Use the entry and exit pseudo ops. This option can only be used with
630d3d5a 7323@option{-mips16}.
8b9243df 7324
74291a4b 7325@item -EL
cd3bb277 7326@opindex EL
74291a4b
MM
7327Compile code for the processor in little endian mode.
7328The requisite libraries are assumed to exist.
7329
7330@item -EB
cd3bb277 7331@opindex EB
74291a4b
MM
7332Compile code for the processor in big endian mode.
7333The requisite libraries are assumed to exist.
7334
7335@item -G @var{num}
cd3bb277 7336@opindex G
74291a4b
MM
7337@cindex smaller data references (MIPS)
7338@cindex gp-relative references (MIPS)
7339Put global and static items less than or equal to @var{num} bytes into
7340the small data or bss sections instead of the normal data or bss
7341section. This allows the assembler to emit one word memory reference
7342instructions based on the global pointer (@var{gp} or @var{$28}),
7343instead of the normal two words used. By default, @var{num} is 8 when
7344the MIPS assembler is used, and 0 when the GNU assembler is used. The
630d3d5a
JM
7345@option{-G @var{num}} switch is also passed to the assembler and linker.
7346All modules should be compiled with the same @option{-G @var{num}}
74291a4b
MM
7347value.
7348
7349@item -nocpp
cd3bb277 7350@opindex nocpp
9ec36da5 7351Tell the MIPS assembler to not run its preprocessor over user
74291a4b 7352assembler files (with a @samp{.s} suffix) when assembling them.
63357d93 7353
1e387156 7354@item -mfix7000
cd3bb277 7355@opindex mfix7000
1e387156
CM
7356Pass an option to gas which will cause nops to be inserted if
7357the read of the destination register of an mfhi or mflo instruction
7358occurs in the following two instructions.
7359
63357d93 7360@item -no-crt0
cd3bb277 7361@opindex no-crt0
63357d93 7362Do not include the default crt0.
74291a4b
MM
7363@end table
7364
7365@ifset INTERNALS
7366These options are defined by the macro
7367@code{TARGET_SWITCHES} in the machine description. The default for the
7368options is also defined by that macro, which enables you to change the
7369defaults.
7370@end ifset
7371
7372@node i386 Options
7373@subsection Intel 386 Options
7374@cindex i386 Options
7375@cindex Intel 386 Options
7376
7377These @samp{-m} options are defined for the i386 family of computers:
7378
2642624b 7379@table @gcctabopt
630d3d5a 7380@item -mcpu=@var{cpu-type}
cd3bb277 7381@opindex mcpu
630d3d5a
JM
7382Assume the defaults for the machine type @var{cpu-type} when scheduling
7383instructions. The choices for @var{cpu-type} are @samp{i386},
9d86bffc 7384@samp{i486}, @samp{i586}, @samp{i686}, @samp{pentium},
b4e89e2d 7385@samp{pentiumpro}, @samp{pentium4}, @samp{k6}, and @samp{athlon}
6f670fde 7386
630d3d5a 7387While picking a specific @var{cpu-type} will schedule things appropriately
6f670fde 7388for that particular chip, the compiler will not generate any code that
630d3d5a 7389does not run on the i386 without the @option{-march=@var{cpu-type}} option
7001ee2d 7390being used. @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
6ca3ad1b 7391is equivalent to @samp{pentiumpro}. @samp{k6} and @samp{athlon} are the
b4e89e2d 7392AMD chips as opposed to the Intel ones.
a9f3e1a4 7393
630d3d5a 7394@item -march=@var{cpu-type}
cd3bb277 7395@opindex march
630d3d5a
JM
7396Generate instructions for the machine type @var{cpu-type}. The choices
7397for @var{cpu-type} are the same as for @option{-mcpu}. Moreover,
7398specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}.
a9f3e1a4
JL
7399
7400@item -m386
7401@itemx -m486
7402@itemx -mpentium
7403@itemx -mpentiumpro
cd3bb277
JM
7404@opindex m386
7405@opindex m486
7406@opindex mpentium
7407@opindex mpentiumpro
695ac33f 7408Synonyms for @option{-mcpu=i386}, @option{-mcpu=i486}, @option{-mcpu=pentium}, and @option{-mcpu=pentiumpro}
7001ee2d 7409respectively. These synonyms are deprecated.
74291a4b 7410
04e149ab 7411@item -mintel-syntax
cd3bb277 7412@opindex mintel-syntax
04e149ab
KC
7413Emit assembly using Intel syntax opcodes instead of AT&T syntax.
7414
74291a4b
MM
7415@item -mieee-fp
7416@itemx -mno-ieee-fp
cd3bb277
JM
7417@opindex mieee-fp
7418@opindex mno-ieee-fp
74291a4b
MM
7419Control whether or not the compiler uses IEEE floating point
7420comparisons. These handle correctly the case where the result of a
7421comparison is unordered.
7422
7423@item -msoft-float
cd3bb277 7424@opindex msoft-float
74291a4b 7425Generate output containing library calls for floating point.
161d7b59 7426@strong{Warning:} the requisite libraries are not part of GCC@.
74291a4b
MM
7427Normally the facilities of the machine's usual C compiler are used, but
7428this can't be done directly in cross-compilation. You must make your
7429own arrangements to provide suitable library functions for
7430cross-compilation.
7431
7432On machines where a function returns floating point results in the 80387
7433register stack, some floating point opcodes may be emitted even if
630d3d5a 7434@option{-msoft-float} is used.
74291a4b
MM
7435
7436@item -mno-fp-ret-in-387
cd3bb277 7437@opindex mno-fp-ret-in-387
74291a4b
MM
7438Do not use the FPU registers for return values of functions.
7439
7440The usual calling convention has functions return values of types
7441@code{float} and @code{double} in an FPU register, even if there
161d7b59
JM
7442is no FPU@. The idea is that the operating system should emulate
7443an FPU@.
74291a4b 7444
630d3d5a 7445The option @option{-mno-fp-ret-in-387} causes such values to be returned
74291a4b
MM
7446in ordinary CPU registers instead.
7447
7448@item -mno-fancy-math-387
cd3bb277 7449@opindex mno-fancy-math-387
74291a4b
MM
7450Some 387 emulators do not support the @code{sin}, @code{cos} and
7451@code{sqrt} instructions for the 387. Specify this option to avoid
161d7b59 7452generating those instructions. This option is the default on FreeBSD@.
74291a4b 7453As of revision 2.6.1, these instructions are not generated unless you
630d3d5a 7454also use the @option{-funsafe-math-optimizations} switch.
74291a4b
MM
7455
7456@item -malign-double
7457@itemx -mno-align-double
cd3bb277
JM
7458@opindex malign-double
7459@opindex mno-align-double
0c2d1a2a 7460Control whether GCC aligns @code{double}, @code{long double}, and
74291a4b
MM
7461@code{long long} variables on a two word boundary or a one word
7462boundary. Aligning @code{double} variables on a two word boundary will
7463produce code that runs somewhat faster on a @samp{Pentium} at the
7464expense of more memory.
7465
2b589241
JH
7466@item -m128bit-long-double
7467@itemx -m128bit-long-double
cd3bb277
JM
7468@opindex m128bit-long-double
7469@opindex m128bit-long-double
2b589241
JH
7470Control the size of @code{long double} type. i386 application binary interface
7471specify the size to be 12 bytes, while modern architectures (Pentium and newer)
c771326b 7472prefer @code{long double} aligned to 8 or 16 byte boundary. This is
2b589241
JH
7473impossible to reach with 12 byte long doubles in the array accesses.
7474
630d3d5a 7475@strong{Warning:} if you use the @option{-m128bit-long-double} switch, the
2b589241
JH
7476structures and arrays containing @code{long double} will change their size as
7477well as function calling convention for function taking @code{long double}
02f52e19 7478will be modified.
2b589241
JH
7479
7480@item -m96bit-long-double
7481@itemx -m96bit-long-double
cd3bb277
JM
7482@opindex m96bit-long-double
7483@opindex m96bit-long-double
0a75e5c3 7484Set the size of @code{long double} to 96 bits as required by the i386
2b589241 7485application binary interface. This is the default.
74291a4b
MM
7486
7487@item -msvr3-shlib
7488@itemx -mno-svr3-shlib
cd3bb277
JM
7489@opindex msvr3-shlib
7490@opindex mno-svr3-shlib
0c2d1a2a 7491Control whether GCC places uninitialized locals into @code{bss} or
630d3d5a 7492@code{data}. @option{-msvr3-shlib} places these locals into @code{bss}.
74291a4b
MM
7493These options are meaningful only on System V Release 3.
7494
7495@item -mno-wide-multiply
7496@itemx -mwide-multiply
cd3bb277
JM
7497@opindex mno-wide-multiply
7498@opindex mwide-multiply
0c2d1a2a 7499Control whether GCC uses the @code{mul} and @code{imul} that produce
02f52e19 750064-bit results in @code{eax:edx} from 32-bit operands to do @code{long
74291a4b
MM
7501long} multiplies and 32-bit division by constants.
7502
7503@item -mrtd
cd3bb277 7504@opindex mrtd
74291a4b
MM
7505Use a different function-calling convention, in which functions that
7506take a fixed number of arguments return with the @code{ret} @var{num}
7507instruction, which pops their arguments while returning. This saves one
7508instruction in the caller since there is no need to pop the arguments
7509there.
7510
7511You can specify that an individual function is called with this calling
7512sequence with the function attribute @samp{stdcall}. You can also
630d3d5a 7513override the @option{-mrtd} option by using the function attribute
0b433de6 7514@samp{cdecl}. @xref{Function Attributes}.
74291a4b
MM
7515
7516@strong{Warning:} this calling convention is incompatible with the one
7517normally used on Unix, so you cannot use it if you need to call
7518libraries compiled with the Unix compiler.
7519
7520Also, you must provide function prototypes for all functions that
7521take variable numbers of arguments (including @code{printf});
7522otherwise incorrect code will be generated for calls to those
7523functions.
7524
7525In addition, seriously incorrect code will result if you call a
7526function with too many arguments. (Normally, extra arguments are
7527harmlessly ignored.)
7528
74291a4b 7529@item -mregparm=@var{num}
cd3bb277 7530@opindex mregparm
74291a4b
MM
7531Control how many registers are used to pass integer arguments. By
7532default, no registers are used to pass arguments, and at most 3
7533registers can be used. You can control this behavior for a specific
0b433de6
JL
7534function by using the function attribute @samp{regparm}.
7535@xref{Function Attributes}.
74291a4b
MM
7536
7537@strong{Warning:} if you use this switch, and
7538@var{num} is nonzero, then you must build all modules with the same
7539value, including any libraries. This includes the system libraries and
7540startup modules.
7541
3af4bd89 7542@item -mpreferred-stack-boundary=@var{num}
cd3bb277 7543@opindex mpreferred-stack-boundary
3af4bd89 7544Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
630d3d5a 7545byte boundary. If @option{-mpreferred-stack-boundary} is not specified,
3af4bd89
JH
7546the default is 4 (16 bytes or 128 bits).
7547
7548The stack is required to be aligned on a 4 byte boundary. On Pentium
7549and PentiumPro, @code{double} and @code{long double} values should be
630d3d5a 7550aligned to an 8 byte boundary (see @option{-malign-double}) or suffer
3af4bd89 7551significant run time performance penalties. On Pentium III, the
b192711e 7552Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
3af4bd89
JH
7553penalties if it is not 16 byte aligned.
7554
7555To ensure proper alignment of this values on the stack, the stack boundary
02f52e19 7556must be as aligned as that required by any value stored on the stack.
3af4bd89
JH
7557Further, every function must be generated such that it keeps the stack
7558aligned. Thus calling a function compiled with a higher preferred
7559stack boundary from a function compiled with a lower preferred stack
7560boundary will most likely misalign the stack. It is recommended that
7561libraries that use callbacks always use the default setting.
7562
7563This extra alignment does consume extra stack space. Code that is sensitive
7564to stack space usage, such as embedded systems and operating system kernels,
7565may want to reduce the preferred alignment to
630d3d5a 7566@option{-mpreferred-stack-boundary=2}.
f22a97d2 7567
f73ad30e 7568@item -mpush-args
cd3bb277 7569@opindex mpush-args
767094dd 7570Use PUSH operations to store outgoing parameters. This method is shorter
f73ad30e 7571and usually equally fast as method using SUB/MOV operations and is enabled
767094dd 7572by default. In some cases disabling it may improve performance because of
f73ad30e
JH
7573improved scheduling and reduced dependencies.
7574
7575@item -maccumulate-outgoing-args
cd3bb277 7576@opindex maccumulate-outgoing-args
f73ad30e 7577If enabled, the maximum amount of space required for outgoing arguments will be
767094dd 7578computed in the function prologue. This in faster on most modern CPUs
b192711e 7579because of reduced dependencies, improved scheduling and reduced stack usage
f73ad30e 7580when preferred stack boundary is not equal to 2. The drawback is a notable
767094dd 7581increase in code size. This switch implies @option{-mno-push-args}.
f73ad30e 7582
f22a97d2 7583@item -mthreads
cd3bb277 7584@opindex mthreads
767094dd 7585Support thread-safe exception handling on @samp{Mingw32}. Code that relies
02f52e19 7586on thread-safe exception handling must compile and link all code with the
767094dd 7587@option{-mthreads} option. When compiling, @option{-mthreads} defines
630d3d5a
JM
7588@option{-D_MT}; when linking, it links in a special thread helper library
7589@option{-lmingwthrd} which cleans up per thread exception handling data.
79f05c19
JH
7590
7591@item -mno-align-stringops
cd3bb277 7592@opindex mno-align-stringops
767094dd 7593Do not align destination of inlined string operations. This switch reduces
79f05c19
JH
7594code size and improves performance in case the destination is already aligned,
7595but gcc don't know about it.
7596
7597@item -minline-all-stringops
cd3bb277 7598@opindex minline-all-stringops
79f05c19 7599By default GCC inlines string operations only when destination is known to be
767094dd 7600aligned at least to 4 byte boundary. This enables more inlining, increase code
79f05c19
JH
7601size, but may improve performance of code that depends on fast memcpy, strlen
7602and memset for short lengths.
762e166b
AJ
7603
7604@item -momit-leaf-frame-pointer
cd3bb277 7605@opindex momit-leaf-frame-pointer
762e166b
AJ
7606Don't keep the frame pointer in a register for leaf functions. This
7607avoids the instructions to save, set up and restore frame pointers and
7608makes an extra register available in leaf functions. The option
630d3d5a 7609@option{-fomit-frame-pointer} removes the frame pointer for all functions
762e166b 7610which might make debugging harder.
3af4bd89
JH
7611@end table
7612
74291a4b
MM
7613@node HPPA Options
7614@subsection HPPA Options
7615@cindex HPPA Options
7616
7617These @samp{-m} options are defined for the HPPA family of computers:
7618
2642624b 7619@table @gcctabopt
630d3d5a 7620@item -march=@var{architecture-type}
cd3bb277 7621@opindex march
ea3bfbfe 7622Generate code for the specified architecture. The choices for
630d3d5a 7623@var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
ea3bfbfe
JQ
76241.1, and @samp{2.0} for PA 2.0 processors. Refer to
7625@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
7626architecture option for your machine. Code compiled for lower numbered
7627architectures will run on higher numbered architectures, but not the
7628other way around.
7629
7630PA 2.0 support currently requires gas snapshot 19990413 or later. The
7631next release of binutils (current is 2.9.1) will probably contain PA 2.0
02f52e19 7632support.
74291a4b 7633
ea3bfbfe 7634@item -mpa-risc-1-0
62a1403d
AS
7635@itemx -mpa-risc-1-1
7636@itemx -mpa-risc-2-0
cd3bb277
JM
7637@opindex mpa-risc-1-0
7638@opindex mpa-risc-1-1
7639@opindex mpa-risc-2-0
695ac33f 7640Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
74291a4b 7641
861bb6c1 7642@item -mbig-switch
cd3bb277 7643@opindex mbig-switch
861bb6c1
JL
7644Generate code suitable for big switch tables. Use this option only if
7645the assembler/linker complain about out of range branches within a switch
7646table.
7647
74291a4b 7648@item -mjump-in-delay
cd3bb277 7649@opindex mjump-in-delay
74291a4b
MM
7650Fill delay slots of function calls with unconditional jump instructions
7651by modifying the return pointer for the function call to be the target
7652of the conditional jump.
7653
7654@item -mdisable-fpregs
cd3bb277 7655@opindex mdisable-fpregs
74291a4b
MM
7656Prevent floating point registers from being used in any manner. This is
7657necessary for compiling kernels which perform lazy context switching of
7658floating point registers. If you use this option and attempt to perform
7659floating point operations, the compiler will abort.
7660
7661@item -mdisable-indexing
cd3bb277 7662@opindex mdisable-indexing
74291a4b 7663Prevent the compiler from using indexing address modes. This avoids some
161d7b59 7664rather obscure problems when compiling MIG generated code under MACH@.
74291a4b
MM
7665
7666@item -mno-space-regs
cd3bb277 7667@opindex mno-space-regs
74291a4b
MM
7668Generate code that assumes the target has no space registers. This allows
7669GCC to generate faster indirect calls and use unscaled index address modes.
7670
7671Such code is suitable for level 0 PA systems and kernels.
7672
7673@item -mfast-indirect-calls
cd3bb277 7674@opindex mfast-indirect-calls
74291a4b
MM
7675Generate code that assumes calls never cross space boundaries. This
7676allows GCC to emit code which performs faster indirect calls.
7677
b192711e 7678This option will not work in the presence of shared libraries or nested
74291a4b
MM
7679functions.
7680
74291a4b 7681@item -mlong-load-store
cd3bb277 7682@opindex mlong-load-store
74291a4b
MM
7683Generate 3-instruction load and store sequences as sometimes required by
7684the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
7685the HP compilers.
7686
7687@item -mportable-runtime
cd3bb277 7688@opindex mportable-runtime
74291a4b
MM
7689Use the portable calling conventions proposed by HP for ELF systems.
7690
7691@item -mgas
cd3bb277 7692@opindex mgas
74291a4b
MM
7693Enable the use of assembler directives only GAS understands.
7694
630d3d5a 7695@item -mschedule=@var{cpu-type}
cd3bb277 7696@opindex mschedule
74291a4b 7697Schedule code according to the constraints for the machine type
630d3d5a 7698@var{cpu-type}. The choices for @var{cpu-type} are @samp{700}
02f52e19 7699@samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}. Refer to
732135bf
JL
7700@file{/usr/lib/sched.models} on an HP-UX system to determine the
7701proper scheduling option for your machine.
74291a4b
MM
7702
7703@item -mlinker-opt
cd3bb277 7704@opindex mlinker-opt
74291a4b
MM
7705Enable the optimization pass in the HPUX linker. Note this makes symbolic
7706debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers
7707in which they give bogus error messages when linking some programs.
7708
7709@item -msoft-float
cd3bb277 7710@opindex msoft-float
74291a4b
MM
7711Generate output containing library calls for floating point.
7712@strong{Warning:} the requisite libraries are not available for all HPPA
7713targets. Normally the facilities of the machine's usual C compiler are
7714used, but this cannot be done directly in cross-compilation. You must make
7715your own arrangements to provide suitable library functions for
7716cross-compilation. The embedded target @samp{hppa1.1-*-pro}
7717does provide software floating point support.
7718
630d3d5a 7719@option{-msoft-float} changes the calling convention in the output file;
74291a4b
MM
7720therefore, it is only useful if you compile @emph{all} of a program with
7721this option. In particular, you need to compile @file{libgcc.a}, the
630d3d5a 7722library that comes with GCC, with @option{-msoft-float} in order for
74291a4b
MM
7723this to work.
7724@end table
7725
7726@node Intel 960 Options
7727@subsection Intel 960 Options
7728
7729These @samp{-m} options are defined for the Intel 960 implementations:
7730
2642624b 7731@table @gcctabopt
cd3bb277
JM
7732@item -m@var{cpu-type}
7733@opindex mka
7734@opindex mkb
7735@opindex mmc
7736@opindex mca
7737@opindex mcf
7738@opindex msa
7739@opindex msb
7740Assume the defaults for the machine type @var{cpu-type} for some of
74291a4b 7741the other options, including instruction scheduling, floating point
cd3bb277 7742support, and addressing modes. The choices for @var{cpu-type} are
74291a4b
MM
7743@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
7744@samp{sa}, and @samp{sb}.
7745The default is
7746@samp{kb}.
7747
7748@item -mnumerics
7749@itemx -msoft-float
cd3bb277
JM
7750@opindex mnumerics
7751@opindex msoft-float
630d3d5a
JM
7752The @option{-mnumerics} option indicates that the processor does support
7753floating-point instructions. The @option{-msoft-float} option indicates
74291a4b
MM
7754that floating-point support should not be assumed.
7755
7756@item -mleaf-procedures
7757@itemx -mno-leaf-procedures
cd3bb277
JM
7758@opindex mleaf-procedures
7759@opindex mno-leaf-procedures
74291a4b
MM
7760Do (or do not) attempt to alter leaf procedures to be callable with the
7761@code{bal} instruction as well as @code{call}. This will result in more
7762efficient code for explicit calls when the @code{bal} instruction can be
7763substituted by the assembler or linker, but less efficient code in other
7764cases, such as calls via function pointers, or using a linker that doesn't
7765support this optimization.
7766
7767@item -mtail-call
7768@itemx -mno-tail-call
cd3bb277
JM
7769@opindex mtail-call
7770@opindex mno-tail-call
74291a4b
MM
7771Do (or do not) make additional attempts (beyond those of the
7772machine-independent portions of the compiler) to optimize tail-recursive
7773calls into branches. You may not want to do this because the detection of
7774cases where this is not valid is not totally complete. The default is
630d3d5a 7775@option{-mno-tail-call}.
74291a4b
MM
7776
7777@item -mcomplex-addr
7778@itemx -mno-complex-addr
cd3bb277
JM
7779@opindex mcomplex-addr
7780@opindex mno-complex-addr
74291a4b
MM
7781Assume (or do not assume) that the use of a complex addressing mode is a
7782win on this implementation of the i960. Complex addressing modes may not
7783be worthwhile on the K-series, but they definitely are on the C-series.
630d3d5a 7784The default is currently @option{-mcomplex-addr} for all processors except
161d7b59 7785the CB and CC@.
74291a4b
MM
7786
7787@item -mcode-align
7788@itemx -mno-code-align
cd3bb277
JM
7789@opindex mcode-align
7790@opindex mno-code-align
74291a4b
MM
7791Align code to 8-byte boundaries for faster fetching (or don't bother).
7792Currently turned on by default for C-series implementations only.
7793
7794@ignore
7795@item -mclean-linkage
7796@itemx -mno-clean-linkage
cd3bb277
JM
7797@opindex mclean-linkage
7798@opindex mno-clean-linkage
74291a4b
MM
7799These options are not fully implemented.
7800@end ignore
7801
7802@item -mic-compat
7803@itemx -mic2.0-compat
7804@itemx -mic3.0-compat
cd3bb277
JM
7805@opindex mic-compat
7806@opindex mic2.0-compat
7807@opindex mic3.0-compat
74291a4b
MM
7808Enable compatibility with iC960 v2.0 or v3.0.
7809
7810@item -masm-compat
7811@itemx -mintel-asm
cd3bb277
JM
7812@opindex masm-compat
7813@opindex mintel-asm
74291a4b
MM
7814Enable compatibility with the iC960 assembler.
7815
7816@item -mstrict-align
7817@itemx -mno-strict-align
cd3bb277
JM
7818@opindex mstrict-align
7819@opindex mno-strict-align
74291a4b
MM
7820Do not permit (do permit) unaligned accesses.
7821
7822@item -mold-align
cd3bb277 7823@opindex mold-align
74291a4b 7824Enable structure-alignment compatibility with Intel's gcc release version
630d3d5a 78251.3 (based on gcc 1.37). This option implies @option{-mstrict-align}.
eaa4b44c
VM
7826
7827@item -mlong-double-64
cd3bb277 7828@opindex mlong-double-64
eaa4b44c
VM
7829Implement type @samp{long double} as 64-bit floating point numbers.
7830Without the option @samp{long double} is implemented by 80-bit
7831floating point numbers. The only reason we have it because there is
7832no 128-bit @samp{long double} support in @samp{fp-bit.c} yet. So it
7833is only useful for people using soft-float targets. Otherwise, we
7834should recommend against use of it.
7835
74291a4b
MM
7836@end table
7837
7838@node DEC Alpha Options
7839@subsection DEC Alpha Options
7840
7841These @samp{-m} options are defined for the DEC Alpha implementations:
7842
2642624b 7843@table @gcctabopt
74291a4b
MM
7844@item -mno-soft-float
7845@itemx -msoft-float
cd3bb277
JM
7846@opindex mno-soft-float
7847@opindex msoft-float
74291a4b 7848Use (do not use) the hardware floating-point instructions for
bedc7537 7849floating-point operations. When @option{-msoft-float} is specified,
7857f134 7850functions in @file{libgcc.a} will be used to perform floating-point
74291a4b
MM
7851operations. Unless they are replaced by routines that emulate the
7852floating-point operations, or compiled in such a way as to call such
7853emulations routines, these routines will issue floating-point
7854operations. If you are compiling for an Alpha without floating-point
7855operations, you must ensure that the library is built so as not to call
7856them.
7857
7858Note that Alpha implementations without floating-point operations are
7859required to have floating-point registers.
7860
7861@item -mfp-reg
7862@itemx -mno-fp-regs
cd3bb277
JM
7863@opindex mfp-reg
7864@opindex mno-fp-regs
74291a4b 7865Generate code that uses (does not use) the floating-point register set.
bedc7537 7866@option{-mno-fp-regs} implies @option{-msoft-float}. If the floating-point
74291a4b
MM
7867register set is not used, floating point operands are passed in integer
7868registers as if they were integers and floating-point results are passed
7869in $0 instead of $f0. This is a non-standard calling sequence, so any
7870function with a floating-point argument or return value called by code
bedc7537 7871compiled with @option{-mno-fp-regs} must also be compiled with that
74291a4b
MM
7872option.
7873
7874A typical use of this option is building a kernel that does not use,
7875and hence need not save and restore, any floating-point registers.
7876
7877@item -mieee
cd3bb277 7878@opindex mieee
74291a4b
MM
7879The Alpha architecture implements floating-point hardware optimized for
7880maximum performance. It is mostly compliant with the IEEE floating
7881point standard. However, for full compliance, software assistance is
7882required. This option generates code fully IEEE compliant code
630d3d5a 7883@emph{except} that the @var{inexact-flag} is not maintained (see below).
74291a4b 7884If this option is turned on, the CPP macro @code{_IEEE_FP} is defined
630d3d5a 7885during compilation. The option is a shorthand for: @option{-D_IEEE_FP
74291a4b
MM
7886-mfp-trap-mode=su -mtrap-precision=i -mieee-conformant}. The resulting
7887code is less efficient but is able to correctly support denormalized
7888numbers and exceptional IEEE values such as not-a-number and plus/minus
7889infinity. Other Alpha compilers call this option
bedc7537 7890@option{-ieee_with_no_inexact}.
74291a4b
MM
7891
7892@item -mieee-with-inexact
cd3bb277 7893@opindex mieee-with-inexact
74291a4b
MM
7894@c overfull hbox here --bob 22 jul96
7895@c original text between ignore ... end ignore
7896@ignore
630d3d5a
JM
7897This is like @option{-mieee} except the generated code also maintains the
7898IEEE @var{inexact-flag}. Turning on this option causes the generated
74291a4b 7899code to implement fully-compliant IEEE math. The option is a shorthand
630d3d5a
JM
7900for @option{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus @option{-mieee-conformant},
7901@option{-mfp-trap-mode=sui}, and @option{-mtrap-precision=i}. On some Alpha
74291a4b
MM
7902implementations the resulting code may execute significantly slower than
7903the code generated by default. Since there is very little code that
630d3d5a 7904depends on the @var{inexact-flag}, you should normally not specify this
74291a4b 7905option. Other Alpha compilers call this option
630d3d5a 7906@option{-ieee_with_inexact}.
74291a4b
MM
7907@end ignore
7908@c changed paragraph
630d3d5a
JM
7909This is like @option{-mieee} except the generated code also maintains the
7910IEEE @var{inexact-flag}. Turning on this option causes the generated
74291a4b 7911code to implement fully-compliant IEEE math. The option is a shorthand
630d3d5a
JM
7912for @option{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus the three following:
7913@option{-mieee-conformant},
7914@option{-mfp-trap-mode=sui},
7915and @option{-mtrap-precision=i}.
74291a4b
MM
7916On some Alpha implementations the resulting code may execute
7917significantly slower than the code generated by default. Since there
630d3d5a 7918is very little code that depends on the @var{inexact-flag}, you should
74291a4b 7919normally not specify this option. Other Alpha compilers call this
630d3d5a 7920option @option{-ieee_with_inexact}.
74291a4b
MM
7921@c end changes to prevent overfull hboxes
7922
630d3d5a 7923@item -mfp-trap-mode=@var{trap-mode}
cd3bb277 7924@opindex mfp-trap-mode
74291a4b 7925This option controls what floating-point related traps are enabled.
630d3d5a 7926Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
74291a4b
MM
7927The trap mode can be set to one of four values:
7928
7929@table @samp
7930@item n
7931This is the default (normal) setting. The only traps that are enabled
7932are the ones that cannot be disabled in software (e.g., division by zero
7933trap).
7934
7935@item u
7936In addition to the traps enabled by @samp{n}, underflow traps are enabled
7937as well.
7938
7939@item su
7940Like @samp{su}, but the instructions are marked to be safe for software
7941completion (see Alpha architecture manual for details).
7942
7943@item sui
7944Like @samp{su}, but inexact traps are enabled as well.
7945@end table
7946
630d3d5a 7947@item -mfp-rounding-mode=@var{rounding-mode}
cd3bb277 7948@opindex mfp-rounding-mode
74291a4b 7949Selects the IEEE rounding mode. Other Alpha compilers call this option
630d3d5a 7950@option{-fprm @var{rounding-mode}}. The @var{rounding-mode} can be one
74291a4b
MM
7951of:
7952
7953@table @samp
7954@item n
7955Normal IEEE rounding mode. Floating point numbers are rounded towards
7956the nearest machine number or towards the even machine number in case
7957of a tie.
7958
7959@item m
7960Round towards minus infinity.
7961
7962@item c
7963Chopped rounding mode. Floating point numbers are rounded towards zero.
7964
7965@item d
7966Dynamic rounding mode. A field in the floating point control register
7967(@var{fpcr}, see Alpha architecture reference manual) controls the
7968rounding mode in effect. The C library initializes this register for
7969rounding towards plus infinity. Thus, unless your program modifies the
ec4b2ecb
CB
7970@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
7971@end table
74291a4b 7972
630d3d5a 7973@item -mtrap-precision=@var{trap-precision}
cd3bb277 7974@opindex mtrap-precision
74291a4b
MM
7975In the Alpha architecture, floating point traps are imprecise. This
7976means without software assistance it is impossible to recover from a
7977floating trap and program execution normally needs to be terminated.
0c2d1a2a 7978GCC can generate code that can assist operating system trap handlers
74291a4b
MM
7979in determining the exact location that caused a floating point trap.
7980Depending on the requirements of an application, different levels of
7981precisions can be selected:
7982
7983@table @samp
7984@item p
7985Program precision. This option is the default and means a trap handler
7986can only identify which program caused a floating point exception.
7987
7988@item f
7989Function precision. The trap handler can determine the function that
7990caused a floating point exception.
7991
7992@item i
7993Instruction precision. The trap handler can determine the exact
7994instruction that caused a floating point exception.
7995@end table
7996
7997Other Alpha compilers provide the equivalent options called
630d3d5a 7998@option{-scope_safe} and @option{-resumption_safe}.
74291a4b
MM
7999
8000@item -mieee-conformant
cd3bb277 8001@opindex mieee-conformant
74291a4b 8002This option marks the generated code as IEEE conformant. You must not
630d3d5a
JM
8003use this option unless you also specify @option{-mtrap-precision=i} and either
8004@option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}. Its only effect
74291a4b
MM
8005is to emit the line @samp{.eflag 48} in the function prologue of the
8006generated assembly file. Under DEC Unix, this has the effect that
8007IEEE-conformant math library routines will be linked in.
8008
8009@item -mbuild-constants
cd3bb277 8010@opindex mbuild-constants
0c2d1a2a 8011Normally GCC examines a 32- or 64-bit integer constant to
74291a4b
MM
8012see if it can construct it from smaller constants in two or three
8013instructions. If it cannot, it will output the constant as a literal and
956d6950 8014generate code to load it from the data segment at runtime.
74291a4b 8015
0c2d1a2a 8016Use this option to require GCC to construct @emph{all} integer constants
74291a4b
MM
8017using code, even if it takes more instructions (the maximum is six).
8018
8019You would typically use this option to build a shared library dynamic
8020loader. Itself a shared library, it must relocate itself in memory
8021before it can find the variables and constants in its own data segment.
956d6950
JL
8022
8023@item -malpha-as
8024@itemx -mgas
cd3bb277
JM
8025@opindex malpha-as
8026@opindex mgas
956d6950 8027Select whether to generate code to be assembled by the vendor-supplied
630d3d5a 8028assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
956d6950
JL
8029
8030@item -mbwx
8031@itemx -mno-bwx
8032@itemx -mcix
8033@itemx -mno-cix
8034@itemx -mmax
8035@itemx -mno-max
cd3bb277
JM
8036@opindex mbwx
8037@opindex mno-bwx
8038@opindex mcix
8039@opindex mno-cix
8040@opindex mmax
8041@opindex mno-max
0c2d1a2a 8042Indicate whether GCC should generate code to use the optional BWX,
956d6950 8043CIX, and MAX instruction sets. The default is to use the instruction sets
630d3d5a 8044supported by the CPU type specified via @option{-mcpu=} option or that
0c2d1a2a 8045of the CPU on which GCC was built if none was specified.
956d6950 8046
956d6950 8047@item -mcpu=@var{cpu_type}
cd3bb277 8048@opindex mcpu
956d6950
JL
8049Set the instruction set, register set, and instruction scheduling
8050parameters for machine type @var{cpu_type}. You can specify either the
0c2d1a2a 8051@samp{EV} style name or the corresponding chip number. GCC
956d6950
JL
8052supports scheduling parameters for the EV4 and EV5 family of processors
8053and will choose the default values for the instruction set from
8054the processor you specify. If you do not specify a processor type,
0c2d1a2a 8055GCC will default to the processor on which the compiler was built.
956d6950
JL
8056
8057Supported values for @var{cpu_type} are
8058
8059@table @samp
8060@item ev4
8061@itemx 21064
8062Schedules as an EV4 and has no instruction set extensions.
8063
8064@item ev5
8065@itemx 21164
8066Schedules as an EV5 and has no instruction set extensions.
8067
8068@item ev56
8069@itemx 21164a
8070Schedules as an EV5 and supports the BWX extension.
8071
8072@item pca56
4f69985c 8073@itemx 21164pc
956d6950
JL
8074@itemx 21164PC
8075Schedules as an EV5 and supports the BWX and MAX extensions.
8076
8077@item ev6
8078@itemx 21264
8079Schedules as an EV5 (until Digital releases the scheduling parameters
8080for the EV6) and supports the BWX, CIX, and MAX extensions.
4f69985c
RH
8081@end table
8082
8083@item -mmemory-latency=@var{time}
cd3bb277 8084@opindex mmemory-latency
4f69985c
RH
8085Sets the latency the scheduler should assume for typical memory
8086references as seen by the application. This number is highly
b192711e 8087dependent on the memory access patterns used by the application
4f69985c
RH
8088and the size of the external cache on the machine.
8089
8090Valid options for @var{time} are
8091
8092@table @samp
8093@item @var{number}
8094A decimal number representing clock cycles.
8095
8096@item L1
8097@itemx L2
8098@itemx L3
8099@itemx main
8100The compiler contains estimates of the number of clock cycles for
8101``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8102(also called Dcache, Scache, and Bcache), as well as to main memory.
8103Note that L3 is only valid for EV5.
8104
956d6950 8105@end table
74291a4b
MM
8106@end table
8107
8108@node Clipper Options
8109@subsection Clipper Options
8110
8111These @samp{-m} options are defined for the Clipper implementations:
8112
2642624b 8113@table @gcctabopt
74291a4b 8114@item -mc300
cd3bb277 8115@opindex mc300
767094dd 8116Produce code for a C300 Clipper processor. This is the default.
74291a4b 8117
62a1403d 8118@item -mc400
cd3bb277 8119@opindex mc400
e979f9e8 8120Produce code for a C400 Clipper processor i.e.@: use floating point
630d3d5a 8121registers f8---f15.
74291a4b
MM
8122@end table
8123
8124@node H8/300 Options
8125@subsection H8/300 Options
8126
8127These @samp{-m} options are defined for the H8/300 implementations:
8128
2642624b 8129@table @gcctabopt
74291a4b 8130@item -mrelax
cd3bb277 8131@opindex mrelax
74291a4b 8132Shorten some address references at link time, when possible; uses the
630d3d5a 8133linker option @option{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
74291a4b
MM
8134ld.info, Using ld}, for a fuller description.
8135
8136@item -mh
cd3bb277 8137@opindex mh
161d7b59 8138Generate code for the H8/300H@.
74291a4b 8139
dcb9d1f0 8140@item -ms
cd3bb277 8141@opindex ms
161d7b59 8142Generate code for the H8/S@.
dcb9d1f0 8143
17f0f8fa 8144@item -ms2600
cd3bb277 8145@opindex ms2600
695ac33f 8146Generate code for the H8/S2600. This switch must be used with @option{-ms}.
17f0f8fa 8147
74291a4b 8148@item -mint32
cd3bb277 8149@opindex mint32
74291a4b
MM
8150Make @code{int} data 32 bits by default.
8151
8152@item -malign-300
cd3bb277 8153@opindex malign-300
2c54abce
KH
8154On the H8/300H and H8/S, use the same alignment rules as for the H8/300.
8155The default for the H8/300H and H8/S is to align longs and floats on 4
8156byte boundaries.
630d3d5a 8157@option{-malign-300} causes them to be aligned on 2 byte boundaries.
2c54abce 8158This option has no effect on the H8/300.
74291a4b
MM
8159@end table
8160
8161@node SH Options
8162@subsection SH Options
8163
8164These @samp{-m} options are defined for the SH implementations:
8165
2642624b 8166@table @gcctabopt
74291a4b 8167@item -m1
cd3bb277 8168@opindex m1
74291a4b
MM
8169Generate code for the SH1.
8170
8171@item -m2
cd3bb277 8172@opindex m2
74291a4b
MM
8173Generate code for the SH2.
8174
8175@item -m3
cd3bb277 8176@opindex m3
74291a4b
MM
8177Generate code for the SH3.
8178
8179@item -m3e
cd3bb277 8180@opindex m3e
74291a4b
MM
8181Generate code for the SH3e.
8182
3cadd778 8183@item -m4-nofpu
cd3bb277 8184@opindex m4-nofpu
3cadd778
AO
8185Generate code for the SH4 without a floating-point unit.
8186
8187@item -m4-single-only
cd3bb277 8188@opindex m4-single-only
3cadd778 8189Generate code for the SH4 with a floating-point unit that only
c771326b 8190supports single-precision arithmetic.
3cadd778
AO
8191
8192@item -m4-single
cd3bb277 8193@opindex m4-single
3cadd778
AO
8194Generate code for the SH4 assuming the floating-point unit is in
8195single-precision mode by default.
8196
8197@item -m4
cd3bb277 8198@opindex m4
3cadd778
AO
8199Generate code for the SH4.
8200
74291a4b 8201@item -mb
cd3bb277 8202@opindex mb
74291a4b
MM
8203Compile code for the processor in big endian mode.
8204
8205@item -ml
cd3bb277 8206@opindex ml
74291a4b
MM
8207Compile code for the processor in little endian mode.
8208
3d5a0820 8209@item -mdalign
cd3bb277 8210@opindex mdalign
02f52e19 8211Align doubles at 64-bit boundaries. Note that this changes the calling
3d5a0820 8212conventions, and thus some functions from the standard C library will
695ac33f 8213not work unless you recompile it first with @option{-mdalign}.
3d5a0820 8214
74291a4b 8215@item -mrelax
cd3bb277 8216@opindex mrelax
74291a4b 8217Shorten some address references at link time, when possible; uses the
630d3d5a 8218linker option @option{-relax}.
3cadd778
AO
8219
8220@item -mbigtable
cd3bb277 8221@opindex mbigtable
3cadd778
AO
8222Use 32-bit offsets in @code{switch} tables. The default is to use
822316-bit offsets.
8224
8225@item -mfmovd
cd3bb277 8226@opindex mfmovd
3cadd778
AO
8227Enable the use of the instruction @code{fmovd}.
8228
8229@item -mhitachi
cd3bb277 8230@opindex mhitachi
3cadd778
AO
8231Comply with the calling conventions defined by Hitachi.
8232
8233@item -mnomacsave
cd3bb277 8234@opindex mnomacsave
3cadd778 8235Mark the @code{MAC} register as call-clobbered, even if
bedc7537 8236@option{-mhitachi} is given.
3cadd778 8237
c474f76b
AO
8238@item -mieee
8239@opindex mieee
8240Increase IEEE-compliance of floating-point code.
8241
3cadd778 8242@item -misize
cd3bb277 8243@opindex misize
3cadd778
AO
8244Dump instruction size and location in the assembly code.
8245
8246@item -mpadstruct
cd3bb277 8247@opindex mpadstruct
3cadd778 8248This option is deprecated. It pads structures to multiple of 4 bytes,
161d7b59 8249which is incompatible with the SH ABI@.
3cadd778
AO
8250
8251@item -mspace
cd3bb277 8252@opindex mspace
bedc7537 8253Optimize for space instead of speed. Implied by @option{-Os}.
1a66cd67
AO
8254
8255@item -mprefergot
cd3bb277 8256@opindex mprefergot
1a66cd67
AO
8257When generating position-independent code, emit function calls using
8258the Global Offset Table instead of the Procedure Linkage Table.
93ca1662
NY
8259
8260@item -musermode
cd3bb277 8261@opindex musermode
93ca1662
NY
8262Generate a library function call to invalidate instruction cache
8263entries, after fixing up a trampoline. This library function call
8264doesn't assume it can write to the whole memory address space. This
8265is the default when the target is @code{sh-*-linux*}.
74291a4b
MM
8266@end table
8267
8268@node System V Options
8269@subsection Options for System V
8270
8271These additional options are available on System V Release 4 for
8272compatibility with other compilers on those systems:
8273
2642624b 8274@table @gcctabopt
74291a4b 8275@item -G
cd3bb277 8276@opindex G
74291a4b 8277Create a shared object.
630d3d5a 8278It is recommended that @option{-symbolic} or @option{-shared} be used instead.
74291a4b
MM
8279
8280@item -Qy
cd3bb277 8281@opindex Qy
74291a4b
MM
8282Identify the versions of each tool used by the compiler, in a
8283@code{.ident} assembler directive in the output.
8284
8285@item -Qn
cd3bb277 8286@opindex Qn
74291a4b
MM
8287Refrain from adding @code{.ident} directives to the output file (this is
8288the default).
8289
aee96fe9 8290@item -YP,@var{dirs}
cd3bb277 8291@opindex YP
74291a4b 8292Search the directories @var{dirs}, and no others, for libraries
630d3d5a 8293specified with @option{-l}.
74291a4b 8294
aee96fe9 8295@item -Ym,@var{dir}
cd3bb277 8296@opindex Ym
bedc7537 8297Look in the directory @var{dir} to find the M4 preprocessor.
74291a4b
MM
8298The assembler uses this option.
8299@c This is supposed to go with a -Yd for predefined M4 macro files, but
8300@c the generic assembler that comes with Solaris takes just -Ym.
8301@end table
8302
282a61e6
MH
8303@node TMS320C3x/C4x Options
8304@subsection TMS320C3x/C4x Options
8305@cindex TMS320C3x/C4x Options
8306
8307These @samp{-m} options are defined for TMS320C3x/C4x implementations:
8308
2642624b 8309@table @gcctabopt
282a61e6
MH
8310
8311@item -mcpu=@var{cpu_type}
cd3bb277 8312@opindex mcpu
282a61e6
MH
8313Set the instruction set, register set, and instruction scheduling
8314parameters for machine type @var{cpu_type}. Supported values for
8315@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
8316@samp{c44}. The default is @samp{c40} to generate code for the
8317TMS320C40.
8318
8319@item -mbig-memory
8320@item -mbig
8321@itemx -msmall-memory
8322@itemx -msmall
cd3bb277
JM
8323@opindex mbig-memory
8324@opindex mbig
8325@opindex msmall-memory
8326@opindex msmall
282a61e6
MH
8327Generates code for the big or small memory model. The small memory
8328model assumed that all data fits into one 64K word page. At run-time
8329the data page (DP) register must be set to point to the 64K page
8330containing the .bss and .data program sections. The big memory model is
8331the default and requires reloading of the DP register for every direct
8332memory access.
8333
8334@item -mbk
8335@itemx -mno-bk
cd3bb277
JM
8336@opindex mbk
8337@opindex mno-bk
282a61e6 8338Allow (disallow) allocation of general integer operands into the block
161d7b59 8339count register BK@.
282a61e6
MH
8340
8341@item -mdb
8342@itemx -mno-db
cd3bb277
JM
8343@opindex mdb
8344@opindex mno-db
282a61e6
MH
8345Enable (disable) generation of code using decrement and branch,
8346DBcond(D), instructions. This is enabled by default for the C4x. To be
8347on the safe side, this is disabled for the C3x, since the maximum
aee96fe9
JM
8348iteration count on the C3x is @math{2^23 + 1} (but who iterates loops more than
8349@math{2^23} times on the C3x?). Note that GCC will try to reverse a loop so
282a61e6
MH
8350that it can utilise the decrement and branch instruction, but will give
8351up if there is more than one memory reference in the loop. Thus a loop
8352where the loop counter is decremented can generate slightly more
8353efficient code, in cases where the RPTB instruction cannot be utilised.
8354
8355@item -mdp-isr-reload
8356@itemx -mparanoid
cd3bb277
JM
8357@opindex mdp-isr-reload
8358@opindex mparanoid
282a61e6
MH
8359Force the DP register to be saved on entry to an interrupt service
8360routine (ISR), reloaded to point to the data section, and restored on
161d7b59 8361exit from the ISR@. This should not be required unless someone has
282a61e6
MH
8362violated the small memory model by modifying the DP register, say within
8363an object library.
8364
8365@item -mmpyi
8366@itemx -mno-mpyi
cd3bb277
JM
8367@opindex mmpyi
8368@opindex mno-mpyi
282a61e6
MH
8369For the C3x use the 24-bit MPYI instruction for integer multiplies
8370instead of a library call to guarantee 32-bit results. Note that if one
8371of the operands is a constant, then the multiplication will be performed
695ac33f 8372using shifts and adds. If the @option{-mmpyi} option is not specified for the C3x,
282a61e6
MH
8373then squaring operations are performed inline instead of a library call.
8374
8375@item -mfast-fix
8376@itemx -mno-fast-fix
cd3bb277
JM
8377@opindex mfast-fix
8378@opindex mno-fast-fix
282a61e6
MH
8379The C3x/C4x FIX instruction to convert a floating point value to an
8380integer value chooses the nearest integer less than or equal to the
8381floating point value rather than to the nearest integer. Thus if the
8382floating point number is negative, the result will be incorrectly
8383truncated an additional code is necessary to detect and correct this
8384case. This option can be used to disable generation of the additional
8385code required to correct the result.
8386
8387@item -mrptb
8388@itemx -mno-rptb
cd3bb277
JM
8389@opindex mrptb
8390@opindex mno-rptb
282a61e6
MH
8391Enable (disable) generation of repeat block sequences using the RPTB
8392instruction for zero overhead looping. The RPTB construct is only used
8393for innermost loops that do not call functions or jump across the loop
8394boundaries. There is no advantage having nested RPTB loops due to the
8395overhead required to save and restore the RC, RS, and RE registers.
695ac33f 8396This is enabled by default with @option{-O2}.
282a61e6
MH
8397
8398@item -mrpts=@var{count}
8399@itemx -mno-rpts
cd3bb277
JM
8400@opindex mrpts
8401@opindex mno-rpts
282a61e6 8402Enable (disable) the use of the single instruction repeat instruction
161d7b59 8403RPTS@. If a repeat block contains a single instruction, and the loop
282a61e6 8404count can be guaranteed to be less than the value @var{count}, GCC will
161d7b59 8405emit a RPTS instruction instead of a RPTB@. If no value is specified,
282a61e6
MH
8406then a RPTS will be emitted even if the loop count cannot be determined
8407at compile time. Note that the repeated instruction following RPTS does
8408not have to be reloaded from memory each iteration, thus freeing up the
b192711e 8409CPU buses for operands. However, since interrupts are blocked by this
282a61e6
MH
8410instruction, it is disabled by default.
8411
8412@item -mloop-unsigned
8413@itemx -mno-loop-unsigned
cd3bb277
JM
8414@opindex mloop-unsigned
8415@opindex mno-loop-unsigned
282a61e6 8416The maximum iteration count when using RPTS and RPTB (and DB on the C40)
aee96fe9 8417is @math{2^31 + 1} since these instructions test if the iteration count is
282a61e6 8418negative to terminate the loop. If the iteration count is unsigned
aee96fe9 8419there is a possibility than the @math{2^31 + 1} maximum iteration count may be
282a61e6
MH
8420exceeded. This switch allows an unsigned iteration count.
8421
8422@item -mti
cd3bb277 8423@opindex mti
282a61e6
MH
8424Try to emit an assembler syntax that the TI assembler (asm30) is happy
8425with. This also enforces compatibility with the API employed by the TI
8426C3x C compiler. For example, long doubles are passed as structures
8427rather than in floating point registers.
8428
8429@item -mregparm
8430@itemx -mmemparm
cd3bb277
JM
8431@opindex mregparm
8432@opindex mmemparm
282a61e6
MH
8433Generate code that uses registers (stack) for passing arguments to functions.
8434By default, arguments are passed in registers where possible rather
8435than by pushing arguments on to the stack.
8436
8437@item -mparallel-insns
8438@itemx -mno-parallel-insns
cd3bb277
JM
8439@opindex mparallel-insns
8440@opindex mno-parallel-insns
282a61e6 8441Allow the generation of parallel instructions. This is enabled by
695ac33f 8442default with @option{-O2}.
282a61e6
MH
8443
8444@item -mparallel-mpy
8445@itemx -mno-parallel-mpy
cd3bb277
JM
8446@opindex mparallel-mpy
8447@opindex mno-parallel-mpy
282a61e6 8448Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
695ac33f 8449provided @option{-mparallel-insns} is also specified. These instructions have
282a61e6
MH
8450tight register constraints which can pessimize the code generation
8451of large functions.
8452
8453@end table
8454
f84271d9
JL
8455@node V850 Options
8456@subsection V850 Options
8457@cindex V850 Options
8458
8459These @samp{-m} options are defined for V850 implementations:
8460
2642624b 8461@table @gcctabopt
f84271d9
JL
8462@item -mlong-calls
8463@itemx -mno-long-calls
cd3bb277
JM
8464@opindex mlong-calls
8465@opindex mno-long-calls
f84271d9
JL
8466Treat all calls as being far away (near). If calls are assumed to be
8467far away, the compiler will always load the functions address up into a
8468register, and call indirect through the pointer.
8469
8470@item -mno-ep
bd762873 8471@itemx -mep
cd3bb277
JM
8472@opindex mno-ep
8473@opindex mep
f84271d9
JL
8474Do not optimize (do optimize) basic blocks that use the same index
8475pointer 4 or more times to copy pointer into the @code{ep} register, and
630d3d5a 8476use the shorter @code{sld} and @code{sst} instructions. The @option{-mep}
f84271d9
JL
8477option is on by default if you optimize.
8478
8479@item -mno-prolog-function
8480@itemx -mprolog-function
cd3bb277
JM
8481@opindex mno-prolog-function
8482@opindex mprolog-function
f84271d9
JL
8483Do not use (do use) external functions to save and restore registers at
8484the prolog and epilog of a function. The external functions are slower,
8485but use less code space if more than one function saves the same number
630d3d5a 8486of registers. The @option{-mprolog-function} option is on by default if
f84271d9
JL
8487you optimize.
8488
8489@item -mspace
cd3bb277 8490@opindex mspace
f84271d9 8491Try to make the code as small as possible. At present, this just turns
630d3d5a 8492on the @option{-mep} and @option{-mprolog-function} options.
f84271d9
JL
8493
8494@item -mtda=@var{n}
cd3bb277 8495@opindex mtda
f84271d9
JL
8496Put static or global variables whose size is @var{n} bytes or less into
8497the tiny data area that register @code{ep} points to. The tiny data
8498area can hold up to 256 bytes in total (128 bytes for byte references).
8499
8500@item -msda=@var{n}
cd3bb277 8501@opindex msda
f84271d9
JL
8502Put static or global variables whose size is @var{n} bytes or less into
8503the small data area that register @code{gp} points to. The small data
8504area can hold up to 64 kilobytes.
8505
8506@item -mzda=@var{n}
cd3bb277 8507@opindex mzda
f84271d9
JL
8508Put static or global variables whose size is @var{n} bytes or less into
8509the first 32 kilobytes of memory.
02f52e19 8510
48f0be1b 8511@item -mv850
cd3bb277 8512@opindex mv850
48f0be1b
SC
8513Specify that the target processor is the V850.
8514
e9a25f70 8515@item -mbig-switch
cd3bb277 8516@opindex mbig-switch
e9a25f70
JL
8517Generate code suitable for big switch tables. Use this option only if
8518the assembler/linker complain about out of range branches within a switch
8519table.
f84271d9
JL
8520@end table
8521
56b2d7a7
JL
8522@node ARC Options
8523@subsection ARC Options
8524@cindex ARC Options
8525
8526These options are defined for ARC implementations:
8527
2642624b 8528@table @gcctabopt
56b2d7a7 8529@item -EL
cd3bb277 8530@opindex EL
56b2d7a7
JL
8531Compile code for little endian mode. This is the default.
8532
8533@item -EB
cd3bb277 8534@opindex EB
56b2d7a7
JL
8535Compile code for big endian mode.
8536
8537@item -mmangle-cpu
cd3bb277 8538@opindex mmangle-cpu
56b2d7a7
JL
8539Prepend the name of the cpu to all public symbol names.
8540In multiple-processor systems, there are many ARC variants with different
8541instruction and register set characteristics. This flag prevents code
8542compiled for one cpu to be linked with code compiled for another.
695ac33f 8543No facility exists for handling variants that are ``almost identical''.
56b2d7a7
JL
8544This is an all or nothing option.
8545
8546@item -mcpu=@var{cpu}
cd3bb277 8547@opindex mcpu
56b2d7a7
JL
8548Compile code for ARC variant @var{cpu}.
8549Which variants are supported depend on the configuration.
630d3d5a 8550All variants support @option{-mcpu=base}, this is the default.
56b2d7a7 8551
630d3d5a
JM
8552@item -mtext=@var{text-section}
8553@itemx -mdata=@var{data-section}
8554@itemx -mrodata=@var{readonly-data-section}
cd3bb277
JM
8555@opindex mtext
8556@opindex mdata
8557@opindex mrodata
630d3d5a
JM
8558Put functions, data, and readonly data in @var{text-section},
8559@var{data-section}, and @var{readonly-data-section} respectively
56b2d7a7 8560by default. This can be overridden with the @code{section} attribute.
0b433de6 8561@xref{Variable Attributes}.
56b2d7a7
JL
8562
8563@end table
8564
83575957
ID
8565@node NS32K Options
8566@subsection NS32K Options
8567@cindex NS32K options
8568
8569These are the @samp{-m} options defined for the 32000 series. The default
8570values for these options depends on which style of 32000 was selected when
8571the compiler was configured; the defaults for the most common choices are
8572given below.
8573
2642624b 8574@table @gcctabopt
83575957
ID
8575@item -m32032
8576@itemx -m32032
cd3bb277
JM
8577@opindex m32032
8578@opindex m32032
83575957
ID
8579Generate output for a 32032. This is the default
8580when the compiler is configured for 32032 and 32016 based systems.
8581
8582@item -m32332
8583@itemx -m32332
cd3bb277
JM
8584@opindex m32332
8585@opindex m32332
83575957
ID
8586Generate output for a 32332. This is the default
8587when the compiler is configured for 32332-based systems.
8588
8589@item -m32532
8590@itemx -m32532
cd3bb277
JM
8591@opindex m32532
8592@opindex m32532
83575957
ID
8593Generate output for a 32532. This is the default
8594when the compiler is configured for 32532-based systems.
8595
8596@item -m32081
cd3bb277 8597@opindex m32081
83575957
ID
8598Generate output containing 32081 instructions for floating point.
8599This is the default for all systems.
8600
8601@item -m32381
cd3bb277 8602@opindex m32381
83575957 8603Generate output containing 32381 instructions for floating point. This
767094dd
JM
8604also implies @option{-m32081}. The 32381 is only compatible with the 32332
8605and 32532 cpus. This is the default for the pc532-netbsd configuration.
83575957
ID
8606
8607@item -mmulti-add
cd3bb277 8608@opindex mmulti-add
83575957 8609Try and generate multiply-add floating point instructions @code{polyF}
767094dd
JM
8610and @code{dotF}. This option is only available if the @option{-m32381}
8611option is in effect. Using these instructions requires changes to to
83575957
ID
8612register allocation which generally has a negative impact on
8613performance. This option should only be enabled when compiling code
8614particularly likely to make heavy use of multiply-add instructions.
8615
8616@item -mnomulti-add
cd3bb277 8617@opindex mnomulti-add
83575957 8618Do not try and generate multiply-add floating point instructions
767094dd 8619@code{polyF} and @code{dotF}. This is the default on all platforms.
83575957
ID
8620
8621@item -msoft-float
cd3bb277 8622@opindex msoft-float
83575957
ID
8623Generate output containing library calls for floating point.
8624@strong{Warning:} the requisite libraries may not be available.
8625
8626@item -mnobitfield
cd3bb277 8627@opindex mnobitfield
767094dd
JM
8628Do not use the bit-field instructions. On some machines it is faster to
8629use shifting and masking operations. This is the default for the pc532.
83575957
ID
8630
8631@item -mbitfield
cd3bb277 8632@opindex mbitfield
767094dd 8633Do use the bit-field instructions. This is the default for all platforms
83575957
ID
8634except the pc532.
8635
8636@item -mrtd
cd3bb277 8637@opindex mrtd
83575957
ID
8638Use a different function-calling convention, in which functions
8639that take a fixed number of arguments return pop their
8640arguments on return with the @code{ret} instruction.
8641
8642This calling convention is incompatible with the one normally
8643used on Unix, so you cannot use it if you need to call libraries
8644compiled with the Unix compiler.
8645
8646Also, you must provide function prototypes for all functions that
8647take variable numbers of arguments (including @code{printf});
8648otherwise incorrect code will be generated for calls to those
8649functions.
8650
8651In addition, seriously incorrect code will result if you call a
8652function with too many arguments. (Normally, extra arguments are
8653harmlessly ignored.)
8654
8655This option takes its name from the 680x0 @code{rtd} instruction.
8656
8657
8658@item -mregparam
cd3bb277 8659@opindex mregparam
83575957
ID
8660Use a different function-calling convention where the first two arguments
8661are passed in registers.
8662
8663This calling convention is incompatible with the one normally
8664used on Unix, so you cannot use it if you need to call libraries
8665compiled with the Unix compiler.
8666
8667@item -mnoregparam
cd3bb277 8668@opindex mnoregparam
767094dd 8669Do not pass any arguments in registers. This is the default for all
83575957
ID
8670targets.
8671
8672@item -msb
cd3bb277 8673@opindex msb
83575957 8674It is OK to use the sb as an index register which is always loaded with
767094dd 8675zero. This is the default for the pc532-netbsd target.
83575957
ID
8676
8677@item -mnosb
cd3bb277 8678@opindex mnosb
83575957 8679The sb register is not available for use or has not been initialized to
767094dd
JM
8680zero by the run time system. This is the default for all targets except
8681the pc532-netbsd. It is also implied whenever @option{-mhimem} or
630d3d5a 8682@option{-fpic} is set.
83575957
ID
8683
8684@item -mhimem
cd3bb277 8685@opindex mhimem
161d7b59 8686Many ns32000 series addressing modes use displacements of up to 512MB@.
83575957 8687If an address is above 512MB then displacements from zero can not be used.
161d7b59 8688This option causes code to be generated which can be loaded above 512MB@.
83575957
ID
8689This may be useful for operating systems or ROM code.
8690
8691@item -mnohimem
cd3bb277 8692@opindex mnohimem
83575957
ID
8693Assume code will be loaded in the first 512MB of virtual address space.
8694This is the default for all platforms.
8695
8696
8697@end table
8698
052a4b28
DC
8699@node AVR Options
8700@subsection AVR Options
8701@cindex AVR Options
8702
8703These options are defined for AVR implementations:
8704
2642624b 8705@table @gcctabopt
052a4b28 8706@item -mmcu=@var{mcu}
cd3bb277 8707@opindex mmcu
3a69a7d5
MM
8708Specify ATMEL AVR instruction set or MCU type.
8709
8710Instruction set avr1 is for the minimal AVR core, not supported by the C
8711compiler, only for assembler programs (MCU types: at90s1200, attiny10,
8712attiny11, attiny12, attiny15, attiny28).
8713
8714Instruction set avr2 (default) is for the classic AVR core with up to
87158K program memory space (MCU types: at90s2313, at90s2323, attiny22,
8716at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
8717at90c8534, at90s8535).
8718
8719Instruction set avr3 is for the classic AVR core with up to 128K program
8720memory space (MCU types: atmega103, atmega603).
8721
8722Instruction set avr4 is for the enhanced AVR core with up to 8K program
8723memory space (MCU types: atmega83, atmega85).
8724
8725Instruction set avr5 is for the enhanced AVR core with up to 128K program
8726memory space (MCU types: atmega161, atmega163, atmega32, at94k).
052a4b28
DC
8727
8728@item -msize
cd3bb277 8729@opindex msize
3a69a7d5 8730Output instruction sizes to the asm file.
052a4b28
DC
8731
8732@item -minit-stack=@var{N}
cd3bb277 8733@opindex minit-stack
3a69a7d5 8734Specify the initial stack address, which may be a symbol or numeric value,
aee96fe9 8735@samp{__stack} is the default.
052a4b28
DC
8736
8737@item -mno-interrupts
cd3bb277 8738@opindex mno-interrupts
052a4b28
DC
8739Generated code is not compatible with hardware interrupts.
8740Code size will be smaller.
8741
8742@item -mcall-prologues
cd3bb277 8743@opindex mcall-prologues
052a4b28 8744Functions prologues/epilogues expanded as call to appropriate
767094dd 8745subroutines. Code size will be smaller.
3a69a7d5
MM
8746
8747@item -mno-tablejump
cd3bb277 8748@opindex mno-tablejump
3a69a7d5
MM
8749Do not generate tablejump insns which sometimes increase code size.
8750
8751@item -mtiny-stack
cd3bb277 8752@opindex mtiny-stack
3a69a7d5 8753Change only the low 8 bits of the stack pointer.
052a4b28
DC
8754@end table
8755
789a3090
NC
8756@node MCore Options
8757@subsection MCore Options
8758@cindex MCore options
8759
8760These are the @samp{-m} options defined for the Motorola M*Core
02f52e19 8761processors.
789a3090 8762
2642624b 8763@table @gcctabopt
789a3090
NC
8764
8765@item -mhardlit
8766@itemx -mhardlit
8767@itemx -mno-hardlit
cd3bb277
JM
8768@opindex mhardlit
8769@opindex mhardlit
8770@opindex mno-hardlit
789a3090
NC
8771Inline constants into the code stream if it can be done in two
8772instructions or less.
8773
8774@item -mdiv
8775@itemx -mdiv
8776@itemx -mno-div
cd3bb277
JM
8777@opindex mdiv
8778@opindex mdiv
8779@opindex mno-div
789a3090
NC
8780Use the divide instruction. (Enabled by default).
8781
8782@item -mrelax-immediate
8783@itemx -mrelax-immediate
8784@itemx -mno-relax-immediate
cd3bb277
JM
8785@opindex mrelax-immediate
8786@opindex mrelax-immediate
8787@opindex mno-relax-immediate
b192711e 8788Allow arbitrary sized immediates in bit operations.
789a3090
NC
8789
8790@item -mwide-bitfields
8791@itemx -mwide-bitfields
8792@itemx -mno-wide-bitfields
cd3bb277
JM
8793@opindex mwide-bitfields
8794@opindex mwide-bitfields
8795@opindex mno-wide-bitfields
c771326b 8796Always treat bit-fields as int-sized.
789a3090
NC
8797
8798@item -m4byte-functions
8799@itemx -m4byte-functions
8800@itemx -mno-4byte-functions
cd3bb277
JM
8801@opindex m4byte-functions
8802@opindex m4byte-functions
8803@opindex mno-4byte-functions
b192711e 8804Force all functions to be aligned to a four byte boundary.
789a3090
NC
8805
8806@item -mcallgraph-data
8807@itemx -mcallgraph-data
8808@itemx -mno-callgraph-data
cd3bb277
JM
8809@opindex mcallgraph-data
8810@opindex mcallgraph-data
8811@opindex mno-callgraph-data
789a3090
NC
8812Emit callgraph information.
8813
8814@item -mslow-bytes
8815@itemx -mslow-bytes
8816@itemx -mno-slow-bytes
cd3bb277
JM
8817@opindex mslow-bytes
8818@opindex mslow-bytes
8819@opindex mno-slow-bytes
789a3090
NC
8820Prefer word access when reading byte quantities.
8821
8822@item -mlittle-endian
8823@itemx -mlittle-endian
8824@itemx -mbig-endian
cd3bb277
JM
8825@opindex mlittle-endian
8826@opindex mlittle-endian
8827@opindex mbig-endian
b192711e 8828Generate code for a little endian target.
789a3090
NC
8829
8830@item -m210
8831@itemx -m210
8832@itemx -m340
cd3bb277
JM
8833@opindex m210
8834@opindex m210
8835@opindex m340
789a3090 8836Generate code for the 210 processor.
789a3090 8837@end table
83575957 8838
df6194d4
JW
8839@node IA-64 Options
8840@subsection IA-64 Options
8841@cindex IA-64 Options
8842
8843These are the @samp{-m} options defined for the Intel IA-64 architecture.
8844
8845@table @gcctabopt
8846@item -mbig-endian
cd3bb277 8847@opindex mbig-endian
161d7b59 8848Generate code for a big endian target. This is the default for HPUX@.
df6194d4
JW
8849
8850@item -mlittle-endian
cd3bb277 8851@opindex mlittle-endian
df6194d4
JW
8852Generate code for a little endian target. This is the default for AIX5
8853and Linux.
8854
8855@item -mgnu-as
8856@itemx -mno-gnu-as
cd3bb277
JM
8857@opindex mgnu-as
8858@opindex mno-gnu-as
15d3a111 8859Generate (or don't) code for the GNU assembler. This is the default.
630d3d5a 8860@c Also, this is the default if the configure option @option{--with-gnu-as}
15d3a111 8861@c is used.
df6194d4
JW
8862
8863@item -mgnu-ld
8864@itemx -mno-gnu-ld
cd3bb277
JM
8865@opindex mgnu-ld
8866@opindex mno-gnu-ld
15d3a111 8867Generate (or don't) code for the GNU linker. This is the default.
630d3d5a 8868@c Also, this is the default if the configure option @option{--with-gnu-ld}
15d3a111 8869@c is used.
df6194d4
JW
8870
8871@item -mno-pic
cd3bb277 8872@opindex mno-pic
15d3a111 8873Generate code that does not use a global pointer register. The result
161d7b59 8874is not position independent code, and violates the IA-64 ABI@.
df6194d4
JW
8875
8876@item -mvolatile-asm-stop
8877@itemx -mno-volatile-asm-stop
cd3bb277
JM
8878@opindex mvolatile-asm-stop
8879@opindex mno-volatile-asm-stop
15d3a111
JW
8880Generate (or don't) a stop bit immediately before and after volatile asm
8881statements.
df6194d4
JW
8882
8883@item -mb-step
cd3bb277 8884@opindex mb-step
df6194d4
JW
8885Generate code that works around Itanium B step errata.
8886
8887@item -mregister-names
8888@itemx -mno-register-names
cd3bb277
JM
8889@opindex mregister-names
8890@opindex mno-register-names
15d3a111
JW
8891Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
8892the stacked registers. This may make assembler output more readable.
df6194d4
JW
8893
8894@item -mno-sdata
8895@itemx -msdata
cd3bb277
JM
8896@opindex mno-sdata
8897@opindex msdata
15d3a111
JW
8898Disable (or enable) optimizations that use the small data section. This may
8899be useful for working around optimizer bugs.
df6194d4
JW
8900
8901@item -mconstant-gp
cd3bb277 8902@opindex mconstant-gp
df6194d4
JW
8903Generate code that uses a single constant global pointer value. This is
8904useful when compiling kernel code.
8905
8906@item -mauto-pic
cd3bb277 8907@opindex mauto-pic
630d3d5a 8908Generate code that is self-relocatable. This implies @option{-mconstant-gp}.
df6194d4
JW
8909This is useful when compiling firmware code.
8910
8911@item -minline-divide-min-latency
cd3bb277 8912@opindex minline-divide-min-latency
df6194d4
JW
8913Generate code for inline divides using the minimum latency algorithm.
8914
8915@item -minline-divide-max-throughput
cd3bb277 8916@opindex minline-divide-max-throughput
df6194d4
JW
8917Generate code for inline divides using the maximum throughput algorithm.
8918
8919@item -mno-dwarf2-asm
8920@itemx -mdwarf2-asm
cd3bb277
JM
8921@opindex mno-dwarf2-asm
8922@opindex mdwarf2-asm
15d3a111
JW
8923Don't (or do) generate assembler code for the DWARF2 line number debugging
8924info. This may be useful when not using the GNU assembler.
df6194d4 8925
630d3d5a 8926@item -mfixed-range=@var{register-range}
cd3bb277 8927@opindex mfixed-range
df6194d4
JW
8928Generate code treating the given register range as fixed registers.
8929A fixed register is one that the register allocator can not use. This is
8930useful when compiling kernel code. A register range is specified as
8931two registers separated by a dash. Multiple register ranges can be
8932specified separated by a comma.
8933@end table
8934
e8ad90e5
MM
8935@node D30V Options
8936@subsection D30V Options
8937@cindex D30V Options
8938
8939These @samp{-m} options are defined for D30V implementations:
8940
2642624b 8941@table @gcctabopt
e8ad90e5 8942@item -mextmem
cd3bb277 8943@opindex mextmem
e8ad90e5
MM
8944Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
8945@samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
8946memory, which starts at location @code{0x80000000}.
8947
8948@item -mextmemory
cd3bb277 8949@opindex mextmemory
630d3d5a 8950Same as the @option{-mextmem} switch.
e8ad90e5
MM
8951
8952@item -monchip
cd3bb277 8953@opindex monchip
e8ad90e5
MM
8954Link the @samp{.text} section into onchip text memory, which starts at
8955location @code{0x0}. Also link @samp{.data}, @samp{.bss},
8956@samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
8957into onchip data memory, which starts at location @code{0x20000000}.
8958
8959@item -mno-asm-optimize
8960@itemx -masm-optimize
cd3bb277
JM
8961@opindex mno-asm-optimize
8962@opindex masm-optimize
630d3d5a
JM
8963Disable (enable) passing @option{-O} to the assembler when optimizing.
8964The assembler uses the @option{-O} option to automatically parallelize
e8ad90e5
MM
8965adjacent short instructions where possible.
8966
8967@item -mbranch-cost=@var{n}
cd3bb277 8968@opindex mbranch-cost
e8ad90e5
MM
8969Increase the internal costs of branches to @var{n}. Higher costs means
8970that the compiler will issue more instructions to avoid doing a branch.
8971The default is 2.
8972
8973@item -mcond-exec=@var{n}
cd3bb277 8974@opindex mcond-exec
e8ad90e5
MM
8975Specify the maximum number of conditionally executed instructions that
8976replace a branch. The default is 4.
8977@end table
56b2d7a7 8978
74291a4b
MM
8979@node Code Gen Options
8980@section Options for Code Generation Conventions
8981@cindex code generation conventions
8982@cindex options, code generation
8983@cindex run-time options
8984
8985These machine-independent options control the interface conventions
8986used in code generation.
8987
8988Most of them have both positive and negative forms; the negative form
630d3d5a 8989of @option{-ffoo} would be @option{-fno-foo}. In the table below, only
74291a4b
MM
8990one of the forms is listed---the one which is not the default. You
8991can figure out the other form by either removing @samp{no-} or adding
8992it.
8993
2642624b 8994@table @gcctabopt
956d6950 8995@item -fexceptions
cd3bb277 8996@opindex fexceptions
767094dd 8997Enable exception handling. Generates extra code needed to propagate
f0523f02 8998exceptions. For some targets, this implies GCC will generate frame
c5c76735
JL
8999unwind information for all functions, which can produce significant data
9000size overhead, although it does not affect execution. If you do not
f0523f02 9001specify this option, GCC will enable it by default for languages like
90ecce3e 9002C++ which normally require exception handling, and disable it for
c5c76735
JL
9003languages like C that do not normally require it. However, you may need
9004to enable this option when compiling C code that needs to interoperate
9005properly with exception handlers written in C++. You may also wish to
9006disable this option if you are compiling older C++ programs that don't
9007use exception handling.
956d6950 9008
6cfc0341
RH
9009@item -fnon-call-exceptions
9010@opindex fnon-call-exceptions
9011Generate code that allows trapping instructions to throw exceptions.
9012Note that this requires platform-specific runtime support that does
9013not exist everywhere. Moreover, it only allows @emph{trapping}
e979f9e8 9014instructions to throw exceptions, i.e.@: memory references or floating
6cfc0341
RH
9015point instructions. It does not allow exceptions to be thrown from
9016arbitrary signal handlers such as @code{SIGALRM}.
9017
14a774a9 9018@item -funwind-tables
cd3bb277 9019@opindex funwind-tables
bedc7537 9020Similar to @option{-fexceptions}, except that it will just generate any needed
14a774a9
RK
9021static data, but will not affect the generated code in any other way.
9022You will normally not enable this option; instead, a language processor
9023that needs this handling would enable it on your behalf.
9024
74291a4b 9025@item -fpcc-struct-return
cd3bb277 9026@opindex fpcc-struct-return
74291a4b
MM
9027Return ``short'' @code{struct} and @code{union} values in memory like
9028longer ones, rather than in registers. This convention is less
9029efficient, but it has the advantage of allowing intercallability between
0c2d1a2a 9030GCC-compiled files and files compiled with other compilers.
74291a4b
MM
9031
9032The precise convention for returning structures in memory depends
9033on the target configuration macros.
9034
9035Short structures and unions are those whose size and alignment match
9036that of some integer type.
9037
9038@item -freg-struct-return
cd3bb277 9039@opindex freg-struct-return
74291a4b
MM
9040Use the convention that @code{struct} and @code{union} values are
9041returned in registers when possible. This is more efficient for small
630d3d5a 9042structures than @option{-fpcc-struct-return}.
74291a4b 9043
630d3d5a
JM
9044If you specify neither @option{-fpcc-struct-return} nor its contrary
9045@option{-freg-struct-return}, GCC defaults to whichever convention is
0c2d1a2a 9046standard for the target. If there is no standard convention, GCC
630d3d5a 9047defaults to @option{-fpcc-struct-return}, except on targets where GCC
74291a4b
MM
9048is the principal compiler. In those cases, we can choose the standard,
9049and we chose the more efficient register return alternative.
9050
9051@item -fshort-enums
cd3bb277 9052@opindex fshort-enums
74291a4b
MM
9053Allocate to an @code{enum} type only as many bytes as it needs for the
9054declared range of possible values. Specifically, the @code{enum} type
9055will be equivalent to the smallest integer type which has enough room.
9056
9057@item -fshort-double
cd3bb277 9058@opindex fshort-double
74291a4b
MM
9059Use the same size for @code{double} as for @code{float}.
9060
9061@item -fshared-data
cd3bb277 9062@opindex fshared-data
74291a4b
MM
9063Requests that the data and non-@code{const} variables of this
9064compilation be shared data rather than private data. The distinction
9065makes sense only on certain operating systems, where shared data is
9066shared between processes running the same program, while private data
9067exists in one copy per process.
9068
9069@item -fno-common
cd3bb277 9070@opindex fno-common
90ecce3e 9071In C, allocate even uninitialized global variables in the data section of the
74291a4b
MM
9072object file, rather than generating them as common blocks. This has the
9073effect that if the same variable is declared (without @code{extern}) in
9074two different compilations, you will get an error when you link them.
9075The only reason this might be useful is if you wish to verify that the
9076program will work on other systems which always work this way.
9077
9078@item -fno-ident
cd3bb277 9079@opindex fno-ident
74291a4b
MM
9080Ignore the @samp{#ident} directive.
9081
9082@item -fno-gnu-linker
cd3bb277 9083@opindex fno-gnu-linker
74291a4b
MM
9084Do not output global initializations (such as C++ constructors and
9085destructors) in the form used by the GNU linker (on systems where the GNU
9086linker is the standard method of handling them). Use this option when
9087you want to use a non-GNU linker, which also requires using the
bedc7537
NC
9088@command{collect2} program to make sure the system linker includes
9089constructors and destructors. (@command{collect2} is included in the GCC
9090distribution.) For systems which @emph{must} use @command{collect2}, the
9091compiler driver @command{gcc} is configured to do this automatically.
74291a4b
MM
9092
9093@item -finhibit-size-directive
cd3bb277 9094@opindex finhibit-size-directive
74291a4b
MM
9095Don't output a @code{.size} assembler directive, or anything else that
9096would cause trouble if the function is split in the middle, and the
9097two halves are placed at locations far apart in memory. This option is
9098used when compiling @file{crtstuff.c}; you should not need to use it
9099for anything else.
9100
9101@item -fverbose-asm
cd3bb277 9102@opindex fverbose-asm
74291a4b
MM
9103Put extra commentary information in the generated assembly code to
9104make it more readable. This option is generally only of use to those
9105who actually need to read the generated assembly code (perhaps while
9106debugging the compiler itself).
9107
630d3d5a 9108@option{-fno-verbose-asm}, the default, causes the
74291a4b
MM
9109extra information to be omitted and is useful when comparing two assembler
9110files.
9111
9112@item -fvolatile
cd3bb277 9113@opindex fvolatile
74291a4b
MM
9114Consider all memory references through pointers to be volatile.
9115
9116@item -fvolatile-global
cd3bb277 9117@opindex fvolatile-global
74291a4b 9118Consider all memory references to extern and global data items to
0c2d1a2a 9119be volatile. GCC does not consider static data items to be volatile
ab87f8c8
JL
9120because of this switch.
9121
9122@item -fvolatile-static
cd3bb277 9123@opindex fvolatile-static
ab87f8c8 9124Consider all memory references to static data to be volatile.
74291a4b
MM
9125
9126@item -fpic
cd3bb277 9127@opindex fpic
74291a4b
MM
9128@cindex global offset table
9129@cindex PIC
9130Generate position-independent code (PIC) suitable for use in a shared
9131library, if supported for the target machine. Such code accesses all
161d7b59 9132constant addresses through a global offset table (GOT)@. The dynamic
861bb6c1 9133loader resolves the GOT entries when the program starts (the dynamic
0c2d1a2a 9134loader is not part of GCC; it is part of the operating system). If
861bb6c1
JL
9135the GOT size for the linked executable exceeds a machine-specific
9136maximum size, you get an error message from the linker indicating that
630d3d5a 9137@option{-fpic} does not work; in that case, recompile with @option{-fPIC}
861bb6c1
JL
9138instead. (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
9139on the m68k and RS/6000. The 386 has no such limit.)
74291a4b
MM
9140
9141Position-independent code requires special support, and therefore works
0c2d1a2a 9142only on certain machines. For the 386, GCC supports PIC for System V
74291a4b
MM
9143but not for the Sun 386i. Code generated for the IBM RS/6000 is always
9144position-independent.
9145
74291a4b 9146@item -fPIC
cd3bb277 9147@opindex fPIC
74291a4b
MM
9148If supported for the target machine, emit position-independent code,
9149suitable for dynamic linking and avoiding any limit on the size of the
9150global offset table. This option makes a difference on the m68k, m88k,
9151and the Sparc.
9152
9153Position-independent code requires special support, and therefore works
9154only on certain machines.
9155
9156@item -ffixed-@var{reg}
cd3bb277 9157@opindex ffixed
74291a4b
MM
9158Treat the register named @var{reg} as a fixed register; generated code
9159should never refer to it (except perhaps as a stack pointer, frame
9160pointer or in some other fixed role).
9161
9162@var{reg} must be the name of a register. The register names accepted
9163are machine-specific and are defined in the @code{REGISTER_NAMES}
9164macro in the machine description macro file.
9165
9166This flag does not have a negative form, because it specifies a
9167three-way choice.
9168
9169@item -fcall-used-@var{reg}
cd3bb277 9170@opindex fcall-used
956d6950 9171Treat the register named @var{reg} as an allocable register that is
74291a4b
MM
9172clobbered by function calls. It may be allocated for temporaries or
9173variables that do not live across a call. Functions compiled this way
9174will not save and restore the register @var{reg}.
9175
cb2fdc84
GRK
9176It is an error to used this flag with the frame pointer or stack pointer.
9177Use of this flag for other registers that have fixed pervasive roles in
9178the machine's execution model will produce disastrous results.
74291a4b
MM
9179
9180This flag does not have a negative form, because it specifies a
9181three-way choice.
9182
9183@item -fcall-saved-@var{reg}
cd3bb277 9184@opindex fcall-saved
956d6950 9185Treat the register named @var{reg} as an allocable register saved by
74291a4b
MM
9186functions. It may be allocated even for temporaries or variables that
9187live across a call. Functions compiled this way will save and restore
9188the register @var{reg} if they use it.
9189
cb2fdc84
GRK
9190It is an error to used this flag with the frame pointer or stack pointer.
9191Use of this flag for other registers that have fixed pervasive roles in
9192the machine's execution model will produce disastrous results.
74291a4b
MM
9193
9194A different sort of disaster will result from the use of this flag for
9195a register in which function values may be returned.
9196
9197This flag does not have a negative form, because it specifies a
9198three-way choice.
9199
9200@item -fpack-struct
cd3bb277 9201@opindex fpack-struct
74291a4b
MM
9202Pack all structure members together without holes. Usually you would
9203not want to use this option, since it makes the code suboptimal, and
9204the offsets of structure members won't agree with system libraries.
9205
861bb6c1 9206@item -fcheck-memory-usage
cd3bb277 9207@opindex fcheck-memory-usage
0c2d1a2a 9208Generate extra code to check each memory access. GCC will generate
861bb6c1 9209code that is suitable for a detector of bad memory accesses such as
7d384cc0 9210@file{Checker}.
861bb6c1 9211
d3111037
CB
9212Normally, you should compile all, or none, of your code with this option.
9213
9214If you do mix code compiled with and without this option,
9215you must ensure that all code that has side effects
9216and that is called by code compiled with this option
9217is, itself, compiled with this option.
9218If you do not, you might get erroneous messages from the detector.
9219
861bb6c1 9220If you use functions from a library that have side-effects (such as
d3111037 9221@code{read}), you might not be able to recompile the library and
861bb6c1 9222specify this option. In that case, you can enable the
630d3d5a 9223@option{-fprefix-function-name} option, which requests GCC to encapsulate
861bb6c1 9224your code and make other functions look as if they were compiled with
630d3d5a 9225@option{-fcheck-memory-usage}. This is done by calling ``stubs'',
861bb6c1 9226which are provided by the detector. If you cannot find or build
d3111037 9227stubs for every function you call, you might have to specify
630d3d5a 9228@option{-fcheck-memory-usage} without @option{-fprefix-function-name}.
861bb6c1 9229
7d384cc0 9230If you specify this option, you can not use the @code{asm} or
f0523f02
JM
9231@code{__asm__} keywords in functions with memory checking enabled. GCC
9232cannot understand what the @code{asm} statement may do, and therefore
c5c76735 9233cannot generate the appropriate code, so it will reject it. However, if
ee457005 9234you specify the function attribute @code{no_check_memory_usage}
f0523f02 9235(@pxref{Function Attributes}), GCC will disable memory checking within a
c5c76735
JL
9236function; you may use @code{asm} statements inside such functions. You
9237may have an inline expansion of a non-checked function within a checked
f0523f02 9238function; in that case GCC will not generate checks for the inlined
c5c76735
JL
9239function's memory accesses.
9240
9241If you move your @code{asm} statements to non-checked inline functions
9242and they do access memory, you can add calls to the support code in your
7d384cc0
KR
9243inline function, to indicate any reads, writes, or copies being done.
9244These calls would be similar to those done in the stubs described above.
9245
861bb6c1 9246@item -fprefix-function-name
cd3bb277 9247@opindex fprefix-function-name
0c2d1a2a
JB
9248Request GCC to add a prefix to the symbols generated for function names.
9249GCC adds a prefix to the names of functions defined as well as
861bb6c1 9250functions called. Code compiled with this option and code compiled
d3111037 9251without the option can't be linked together, unless stubs are used.
861bb6c1 9252
630d3d5a 9253If you compile the following code with @option{-fprefix-function-name}
861bb6c1
JL
9254@example
9255extern void bar (int);
9256void
9257foo (int a)
9258@{
9259 return bar (a + 5);
861bb6c1
JL
9260@}
9261@end example
9262
9263@noindent
0c2d1a2a 9264GCC will compile the code as if it was written:
861bb6c1
JL
9265@example
9266extern void prefix_bar (int);
9267void
9268prefix_foo (int a)
9269@{
9270 return prefix_bar (a + 5);
9271@}
9272@end example
630d3d5a 9273This option is designed to be used with @option{-fcheck-memory-usage}.
861bb6c1 9274
07417085 9275@item -finstrument-functions
cd3bb277 9276@opindex finstrument-functions
07417085
KR
9277Generate instrumentation calls for entry and exit to functions. Just
9278after function entry and just before function exit, the following
9279profiling functions will be called with the address of the current
9280function and its call site. (On some platforms,
9281@code{__builtin_return_address} does not work beyond the current
9282function, so the call site information may not be available to the
9283profiling functions otherwise.)
9284
9285@example
310668e8
JM
9286void __cyg_profile_func_enter (void *this_fn,
9287 void *call_site);
9288void __cyg_profile_func_exit (void *this_fn,
9289 void *call_site);
07417085
KR
9290@end example
9291
9292The first argument is the address of the start of the current function,
9293which may be looked up exactly in the symbol table.
9294
9295This instrumentation is also done for functions expanded inline in other
9296functions. The profiling calls will indicate where, conceptually, the
9297inline function is entered and exited. This means that addressable
9298versions of such functions must be available. If all your uses of a
9299function are expanded inline, this may mean an additional expansion of
9300code size. If you use @samp{extern inline} in your C code, an
9301addressable version of such functions must be provided. (This is
9302normally the case anyways, but if you get lucky and the optimizer always
9303expands the functions inline, you might have gotten away without
9304providing static copies.)
9305
9306A function may be given the attribute @code{no_instrument_function}, in
9307which case this instrumentation will not be done. This can be used, for
9308example, for the profiling functions listed above, high-priority
9309interrupt routines, and any functions from which the profiling functions
9310cannot safely be called (perhaps signal handlers, if the profiling
9311routines generate output or allocate memory).
9312
861bb6c1 9313@item -fstack-check
cd3bb277 9314@opindex fstack-check
861bb6c1
JL
9315Generate code to verify that you do not go beyond the boundary of the
9316stack. You should specify this flag if you are running in an
9317environment with multiple threads, but only rarely need to specify it in
9318a single-threaded environment since stack overflow is automatically
9319detected on nearly all systems if there is only one stack.
9320
a157febd
GK
9321Note that this switch does not actually cause checking to be done; the
9322operating system must do that. The switch causes generation of code
9323to ensure that the operating system sees the stack being extended.
9324
9325@item -fstack-limit-register=@var{reg}
9326@itemx -fstack-limit-symbol=@var{sym}
9327@itemx -fno-stack-limit
cd3bb277
JM
9328@opindex fstack-limit-register
9329@opindex fstack-limit-symbol
9330@opindex fno-stack-limit
a157febd
GK
9331Generate code to ensure that the stack does not grow beyond a certain value,
9332either the value of a register or the address of a symbol. If the stack
9333would grow beyond the value, a signal is raised. For most targets,
9334the signal is raised before the stack overruns the boundary, so
9335it is possible to catch the signal without taking special precautions.
9336
9337For instance, if the stack starts at address @samp{0x80000000} and grows
9338downwards you can use the flags
630d3d5a
JM
9339@samp{-fstack-limit-symbol=__stack_limit
9340-Wl,--defsym,__stack_limit=0x7ffe0000} which will enforce a stack
161d7b59 9341limit of 128K@.
a157febd 9342
e5eb27e5
JL
9343@cindex aliasing of parameters
9344@cindex parameters, aliased
9345@item -fargument-alias
04afd9d6
JL
9346@itemx -fargument-noalias
9347@itemx -fargument-noalias-global
cd3bb277
JM
9348@opindex fargument-alias
9349@opindex fargument-noalias
9350@opindex fargument-noalias-global
e5eb27e5
JL
9351Specify the possible relationships among parameters and between
9352parameters and global data.
9353
630d3d5a 9354@option{-fargument-alias} specifies that arguments (parameters) may
e5eb27e5 9355alias each other and may alias global storage.
630d3d5a 9356@option{-fargument-noalias} specifies that arguments do not alias
e5eb27e5 9357each other, but may alias global storage.
630d3d5a 9358@option{-fargument-noalias-global} specifies that arguments do not
e5eb27e5
JL
9359alias each other and do not alias global storage.
9360
9361Each language will automatically use whatever option is required by
9362the language standard. You should not need to use these options yourself.
19283265
RH
9363
9364@item -fleading-underscore
cd3bb277 9365@opindex fleading-underscore
695ac33f 9366This option and its counterpart, @option{-fno-leading-underscore}, forcibly
19283265
RH
9367change the way C symbols are represented in the object file. One use
9368is to help link with legacy assembly code.
9369
9370Be warned that you should know what you are doing when invoking this
9371option, and that not all targets provide complete support for it.
74291a4b
MM
9372@end table
9373
ee457005
JM
9374@c man end
9375
74291a4b 9376@node Environment Variables
0c2d1a2a 9377@section Environment Variables Affecting GCC
74291a4b
MM
9378@cindex environment variables
9379
ee457005
JM
9380@c man begin ENVIRONMENT
9381
0c2d1a2a
JB
9382This section describes several environment variables that affect how GCC
9383operates. Some of them work by specifying directories or prefixes to use
767094dd 9384when searching for various kinds of files. Some are used to specify other
46103ab4 9385aspects of the compilation environment.
74291a4b
MM
9386
9387@ifclear INTERNALS
9388Note that you can also specify places to search using options such as
630d3d5a 9389@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
74291a4b 9390take precedence over places specified using environment variables, which
161d7b59 9391in turn take precedence over those specified by the configuration of GCC@.
0c2d1a2a 9392
74291a4b
MM
9393@end ifclear
9394@ifset INTERNALS
9395Note that you can also specify places to search using options such as
630d3d5a 9396@option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}). These
74291a4b 9397take precedence over places specified using environment variables, which
161d7b59 9398in turn take precedence over those specified by the configuration of GCC@.
0c2d1a2a 9399@xref{Driver}.
74291a4b
MM
9400@end ifset
9401
bedc7537 9402@table @env
ab87f8c8
JL
9403@item LANG
9404@itemx LC_CTYPE
9405@c @itemx LC_COLLATE
9406@itemx LC_MESSAGES
9407@c @itemx LC_MONETARY
9408@c @itemx LC_NUMERIC
9409@c @itemx LC_TIME
9410@itemx LC_ALL
9411@findex LANG
9412@findex LC_CTYPE
9413@c @findex LC_COLLATE
9414@findex LC_MESSAGES
9415@c @findex LC_MONETARY
9416@c @findex LC_NUMERIC
9417@c @findex LC_TIME
9418@findex LC_ALL
9419@cindex locale
0c2d1a2a
JB
9420These environment variables control the way that GCC uses
9421localization information that allow GCC to work with different
9422national conventions. GCC inspects the locale categories
bedc7537 9423@env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
ab87f8c8
JL
9424so. These locale categories can be set to any value supported by your
9425installation. A typical value is @samp{en_UK} for English in the United
9426Kingdom.
9427
bedc7537 9428The @env{LC_CTYPE} environment variable specifies character
0c2d1a2a 9429classification. GCC uses it to determine the character boundaries in
ab87f8c8
JL
9430a string; this is needed for some multibyte encodings that contain quote
9431and escape characters that would otherwise be interpreted as a string
9432end or escape.
9433
bedc7537 9434The @env{LC_MESSAGES} environment variable specifies the language to
ab87f8c8
JL
9435use in diagnostic messages.
9436
bedc7537
NC
9437If the @env{LC_ALL} environment variable is set, it overrides the value
9438of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
9439and @env{LC_MESSAGES} default to the value of the @env{LANG}
0c2d1a2a 9440environment variable. If none of these variables are set, GCC
ab87f8c8
JL
9441defaults to traditional C English behavior.
9442
74291a4b
MM
9443@item TMPDIR
9444@findex TMPDIR
bedc7537 9445If @env{TMPDIR} is set, it specifies the directory to use for temporary
0c2d1a2a 9446files. GCC uses temporary files to hold the output of one stage of
74291a4b
MM
9447compilation which is to be used as input to the next stage: for example,
9448the output of the preprocessor, which is the input to the compiler
9449proper.
9450
9451@item GCC_EXEC_PREFIX
9452@findex GCC_EXEC_PREFIX
bedc7537 9453If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
74291a4b
MM
9454names of the subprograms executed by the compiler. No slash is added
9455when this prefix is combined with the name of a subprogram, but you can
9456specify a prefix that ends with a slash if you wish.
9457
f0523f02 9458If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
0deb20df
TT
9459an appropriate prefix to use based on the pathname it was invoked with.
9460
0c2d1a2a 9461If GCC cannot find the subprogram using the specified prefix, it
74291a4b
MM
9462tries looking in the usual places for the subprogram.
9463
bedc7537 9464The default value of @env{GCC_EXEC_PREFIX} is
74291a4b
MM
9465@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
9466of @code{prefix} when you ran the @file{configure} script.
9467
630d3d5a 9468Other prefixes specified with @option{-B} take precedence over this prefix.
74291a4b
MM
9469
9470This prefix is also used for finding files such as @file{crt0.o} that are
9471used for linking.
9472
9473In addition, the prefix is used in an unusual way in finding the
9474directories to search for header files. For each of the standard
9475directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
bedc7537 9476(more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
74291a4b 9477replacing that beginning with the specified prefix to produce an
630d3d5a 9478alternate directory name. Thus, with @option{-Bfoo/}, GCC will search
74291a4b
MM
9479@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
9480These alternate directories are searched first; the standard directories
9481come next.
9482
9483@item COMPILER_PATH
9484@findex COMPILER_PATH
bedc7537
NC
9485The value of @env{COMPILER_PATH} is a colon-separated list of
9486directories, much like @env{PATH}. GCC tries the directories thus
74291a4b 9487specified when searching for subprograms, if it can't find the
bedc7537 9488subprograms using @env{GCC_EXEC_PREFIX}.
74291a4b
MM
9489
9490@item LIBRARY_PATH
9491@findex LIBRARY_PATH
bedc7537
NC
9492The value of @env{LIBRARY_PATH} is a colon-separated list of
9493directories, much like @env{PATH}. When configured as a native compiler,
0c2d1a2a 9494GCC tries the directories thus specified when searching for special
bedc7537 9495linker files, if it can't find them using @env{GCC_EXEC_PREFIX}. Linking
0c2d1a2a 9496using GCC also uses these directories when searching for ordinary
630d3d5a
JM
9497libraries for the @option{-l} option (but directories specified with
9498@option{-L} come first).
74291a4b
MM
9499
9500@item C_INCLUDE_PATH
9501@itemx CPLUS_INCLUDE_PATH
9502@itemx OBJC_INCLUDE_PATH
9503@findex C_INCLUDE_PATH
9504@findex CPLUS_INCLUDE_PATH
9505@findex OBJC_INCLUDE_PATH
9506@c @itemx OBJCPLUS_INCLUDE_PATH
9507These environment variables pertain to particular languages. Each
9508variable's value is a colon-separated list of directories, much like
bedc7537 9509@env{PATH}. When GCC searches for header files, it tries the
74291a4b 9510directories listed in the variable for the language you are using, after
630d3d5a 9511the directories specified with @option{-I} but before the standard header
74291a4b
MM
9512file directories.
9513
9514@item DEPENDENCIES_OUTPUT
9515@findex DEPENDENCIES_OUTPUT
9516@cindex dependencies for make as output
9517If this variable is set, its value specifies how to output dependencies
9518for Make based on the header files processed by the compiler. This
630d3d5a 9519output looks much like the output from the @option{-M} option
74291a4b
MM
9520(@pxref{Preprocessor Options}), but it goes to a separate file, and is
9521in addition to the usual results of compilation.
9522
bedc7537 9523The value of @env{DEPENDENCIES_OUTPUT} can be just a file name, in
74291a4b
MM
9524which case the Make rules are written to that file, guessing the target
9525name from the source file name. Or the value can have the form
9526@samp{@var{file} @var{target}}, in which case the rules are written to
9527file @var{file} using @var{target} as the target name.
56f48ce9
DB
9528
9529@item LANG
9530@findex LANG
9531@cindex locale definition
767094dd 9532This variable is used to pass locale information to the compiler. One way in
56f48ce9
DB
9533which this information is used is to determine the character set to be used
9534when character literals, string literals and comments are parsed in C and C++.
9535When the compiler is configured to allow multibyte characters,
bedc7537 9536the following values for @env{LANG} are recognized:
56f48ce9 9537
2642624b 9538@table @samp
56f48ce9
DB
9539@item C-JIS
9540Recognize JIS characters.
9541@item C-SJIS
9542Recognize SJIS characters.
9543@item C-EUCJP
9544Recognize EUCJP characters.
9545@end table
9546
bedc7537 9547If @env{LANG} is not defined, or if it has some other value, then the
56f48ce9
DB
9548compiler will use mblen and mbtowc as defined by the default locale to
9549recognize and translate multibyte characters.
74291a4b
MM
9550@end table
9551
9d86bffc
JM
9552@c man end
9553
74291a4b
MM
9554@node Running Protoize
9555@section Running Protoize
9556
161d7b59 9557The program @code{protoize} is an optional part of GCC@. You can use
c1030c7c 9558it to add prototypes to a program, thus converting the program to ISO
74291a4b
MM
9559C in one respect. The companion program @code{unprotoize} does the
9560reverse: it removes argument types from any prototypes that are found.
9561
9562When you run these programs, you must specify a set of source files as
9563command line arguments. The conversion programs start out by compiling
9564these files to see what functions they define. The information gathered
9565about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
9566
9567After scanning comes actual conversion. The specified files are all
9568eligible to be converted; any files they include (whether sources or
9569just headers) are eligible as well.
9570
9571But not all the eligible files are converted. By default,
9572@code{protoize} and @code{unprotoize} convert only source and header
9573files in the current directory. You can specify additional directories
630d3d5a 9574whose files should be converted with the @option{-d @var{directory}}
74291a4b 9575option. You can also specify particular files to exclude with the
630d3d5a 9576@option{-x @var{file}} option. A file is converted if it is eligible, its
74291a4b
MM
9577directory name matches one of the specified directory names, and its
9578name within the directory has not been excluded.
9579
9580Basic conversion with @code{protoize} consists of rewriting most
9581function definitions and function declarations to specify the types of
9582the arguments. The only ones not rewritten are those for varargs
9583functions.
9584
9585@code{protoize} optionally inserts prototype declarations at the
9586beginning of the source file, to make them available for any calls that
9587precede the function's definition. Or it can insert prototype
9588declarations with block scope in the blocks where undeclared functions
9589are called.
9590
9591Basic conversion with @code{unprotoize} consists of rewriting most
9592function declarations to remove any argument types, and rewriting
c1030c7c 9593function definitions to the old-style pre-ISO form.
74291a4b
MM
9594
9595Both conversion programs print a warning for any function declaration or
9596definition that they can't convert. You can suppress these warnings
630d3d5a 9597with @option{-q}.
74291a4b
MM
9598
9599The output from @code{protoize} or @code{unprotoize} replaces the
9600original source file. The original file is renamed to a name ending
02f52e19 9601with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
a7db8bbb
MK
9602without the original @samp{.c} suffix). If the @samp{.save} (@samp{.sav}
9603for DOS) file already exists, then the source file is simply discarded.
74291a4b 9604
0c2d1a2a 9605@code{protoize} and @code{unprotoize} both depend on GCC itself to
74291a4b 9606scan the program and collect information about the functions it uses.
0c2d1a2a 9607So neither of these programs will work until GCC is installed.
74291a4b
MM
9608
9609Here is a table of the options you can use with @code{protoize} and
9610@code{unprotoize}. Each option works with both programs unless
9611otherwise stated.
9612
9613@table @code
9614@item -B @var{directory}
9615Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
9616usual directory (normally @file{/usr/local/lib}). This file contains
9617prototype information about standard system functions. This option
9618applies only to @code{protoize}.
9619
9620@item -c @var{compilation-options}
9621Use @var{compilation-options} as the options when running @code{gcc} to
630d3d5a 9622produce the @samp{.X} files. The special option @option{-aux-info} is
74291a4b
MM
9623always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
9624
9625Note that the compilation options must be given as a single argument to
9626@code{protoize} or @code{unprotoize}. If you want to specify several
9627@code{gcc} options, you must quote the entire set of compilation options
9628to make them a single word in the shell.
9629
9630There are certain @code{gcc} arguments that you cannot use, because they
630d3d5a
JM
9631would produce the wrong kind of output. These include @option{-g},
9632@option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
74291a4b
MM
9633the @var{compilation-options}, they are ignored.
9634
9635@item -C
a7db8bbb 9636Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
02f52e19 9637systems) instead of @samp{.c}. This is convenient if you are converting
ee77eda5 9638a C program to C++. This option applies only to @code{protoize}.
74291a4b
MM
9639
9640@item -g
9641Add explicit global declarations. This means inserting explicit
9642declarations at the beginning of each source file for each function
9643that is called in the file and was not declared. These declarations
9644precede the first function definition that contains a call to an
9645undeclared function. This option applies only to @code{protoize}.
9646
9647@item -i @var{string}
9648Indent old-style parameter declarations with the string @var{string}.
9649This option applies only to @code{protoize}.
9650
9651@code{unprotoize} converts prototyped function definitions to old-style
9652function definitions, where the arguments are declared between the
9653argument list and the initial @samp{@{}. By default, @code{unprotoize}
9654uses five spaces as the indentation. If you want to indent with just
630d3d5a 9655one space instead, use @option{-i " "}.
74291a4b
MM
9656
9657@item -k
9658Keep the @samp{.X} files. Normally, they are deleted after conversion
9659is finished.
9660
9661@item -l
630d3d5a 9662Add explicit local declarations. @code{protoize} with @option{-l} inserts
74291a4b
MM
9663a prototype declaration for each function in each block which calls the
9664function without any declaration. This option applies only to
9665@code{protoize}.
9666
9667@item -n
9668Make no real changes. This mode just prints information about the conversions
630d3d5a 9669that would have been done without @option{-n}.
74291a4b
MM
9670
9671@item -N
9672Make no @samp{.save} files. The original files are simply deleted.
9673Use this option with caution.
9674
9675@item -p @var{program}
9676Use the program @var{program} as the compiler. Normally, the name
9677@file{gcc} is used.
9678
9679@item -q
9680Work quietly. Most warnings are suppressed.
9681
9682@item -v
630d3d5a 9683Print the version number, just like @option{-v} for @code{gcc}.
74291a4b
MM
9684@end table
9685
9686If you need special compiler options to compile one of your program's
9687source files, then you should generate that file's @samp{.X} file
9688specially, by running @code{gcc} on that source file with the
630d3d5a 9689appropriate options and the option @option{-aux-info}. Then run
74291a4b
MM
9690@code{protoize} on the entire set of files. @code{protoize} will use
9691the existing @samp{.X} file because it is newer than the source file.
9692For example:
9693
9694@example
b1018de6 9695gcc -Dfoo=bar file1.c -aux-info file1.X
74291a4b
MM
9696protoize *.c
9697@end example
9698
9699@noindent
9700You need to include the special files along with the rest in the
9701@code{protoize} command, even though their @samp{.X} files already
9702exist, because otherwise they won't get converted.
9703
9704@xref{Protoize Caveats}, for more information on how to use
9705@code{protoize} successfully.
This page took 2.728993 seconds and 5 git commands to generate.