1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2@c 2000, 2001 Free Software Foundation, Inc.
3@c This is part of the GCC manual.
4@c For copying conditions, see the file gcc.texi.
5
6@node Invoking GCC
7@chapter GCC Command Options
8@cindex GCC command options
9@cindex command options
10@cindex options, GCC command
11
12When you invoke GCC, it normally does preprocessing, compilation,
13assembly and linking.  The ``overall options'' allow you to stop this
14process at an intermediate stage.  For example, the @samp{-c} option
15says not to run the linker.  Then the output consists of object files
16output by the assembler.
17
18Other options are passed on to one stage of processing.  Some options
19control the preprocessor and others the compiler itself.  Yet other
20options control the assembler and linker; most of these are not
21documented here, since you rarely need to use any of them.
22
23@cindex C compilation options
24Most of the command line options that you can use with GCC are useful
25for C programs; when an option is only useful with another language
26(usually C++), the explanation says so explicitly.  If the description
27for a particular option does not mention a source language, you can use
28that option with all supported languages.
29
30@cindex C++ compilation options
31@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
32options for compiling C++ programs.
33
34@cindex grouping options
35@cindex options, grouping
36The @code{gcc} program accepts options and file names as operands.  Many
37options have multiletter names; therefore multiple single-letter options
38may @emph{not} be grouped: @samp{-dr} is very different from @w{@samp{-d
39-r}}.
40
41@cindex order of options
42@cindex options, order
43You can mix options and other arguments.  For the most part, the order
44you use doesn't matter.  Order does matter when you use several options
45of the same kind; for example, if you specify @samp{-L} more than once,
46the directories are searched in the order specified.
47
48Many options have long names starting with @samp{-f} or with
49@samp{-W}---for example, @samp{-fforce-mem},
50@samp{-fstrength-reduce}, @samp{-Wformat} and so on.  Most of
51these have both positive and negative forms; the negative form of
52@samp{-ffoo} would be @samp{-fno-foo}.  This manual documents
53only one of these two forms, whichever one is not the default.
54
55@menu
56* Option Summary::	Brief list of all options, without explanations.
57* Overall Options::     Controlling the kind of output:
58                        an executable, object files, assembler files,
59                        or preprocessed source.
60* Invoking G++::	Compiling C++ programs.
61* C Dialect Options::   Controlling the variant of C language compiled.
62* C++ Dialect Options:: Variations on C++.
63* Warning Options::     How picky should the compiler be?
64* Debugging Options::   Symbol tables, measurements, and debugging dumps.
65* Optimize Options::    How much optimization?
66* Preprocessor Options:: Controlling header files and macro definitions.
67                         Also, getting dependency information for Make.
68* Assembler Options::   Passing options to the assembler.
69* Link Options::        Specifying libraries and so on.
70* Directory Options::   Where to find header files and libraries.
71                        Where to find the compiler executable files.
72* Target Options::      Running a cross-compiler, or an old version of GCC.
73* Submodel Options::    Specifying minor hardware or convention variations,
74                        such as 68010 vs 68020.
75* Code Gen Options::    Specifying conventions for function calls, data layout
76                        and register usage.
77* Environment Variables:: Env vars that affect GCC.
78* Running Protoize::    Automatically adding or removing function prototypes.
79@end menu
80
81@node Option Summary
82@section Option Summary
83
84Here is a summary of all the options, grouped by type.  Explanations are
85in the following sections.
86
87@table @emph
88@item Overall Options
89@xref{Overall Options,,Options Controlling the Kind of Output}.
90@smallexample
91-c  -S  -E  -no-beos-fixes -o  @var{file}  -pipe  -priority=@var{prio}  -v  --help  -x @var{language}
92@end smallexample
93
94@item C Language Options
95@xref{C Dialect Options,,Options Controlling C Dialect}.
96@smallexample
97-ansi -fstd  -fallow-single-precision  -fcond-mismatch  -fno-asm
98-fno-builtin  -ffreestanding  -fhosted  -fsigned-bitfields  -fsigned-char
99-funsigned-bitfields  -funsigned-char  -fwritable-strings
100-traditional  -traditional-cpp  -trigraphs
101@end smallexample
102
103@item C++ Language Options
104@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
105@smallexample
106-fno-access-control  -fcheck-new  -fconserve-space  -fdollars-in-identifiers
107-fno-elide-constructors  -fexternal-templates  -ffor-scope  
108-fno-for-scope  -fno-gnu-keywords  -fguiding-decls  -fhandle-signatures
109-fhonor-std -fhuge-objects  -fno-implicit-templates  -finit-priority
110-fno-implement-inlines -fname-mangling-version-@var{n}  -fno-default-inline  
111-fmultiple-symbol-spaces -foperator-names  -fno-optional-diags  -fpermissive
112-frepo  -fstrict-prototype
113-fsquangle  -ftemplate-depth-@var{n}  -fthis-is-variable  -fvtable-thunks
114-nostdinc++  -Wctor-dtor-privacy -Wno-deprecated -Weffc++  
115-Wno-non-template-friend 
116-Wnon-virtual-dtor  -Wold-style-cast  -Woverloaded-virtual  
117-Wno-pmf-conversions  -Wreorder  -Wsign-promo  -Wsynth
118@end smallexample
119
120@item Warning Options
121@xref{Warning Options,,Options to Request or Suppress Warnings}.
122@smallexample
123-fsyntax-only  -pedantic  -pedantic-errors
124-w  -W  -Wall  -Waggregate-return  -Wbad-function-cast
125-Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment
126-Wconversion  -Werror  -Wformat
127-Wid-clash-@var{len}  -Wimplicit -Wimplicit-int 
128-Wimplicit-function-declaration  -Wimport
129-Werror-implicit-function-declaration  -Winline
130-Wlarger-than-@var{len}  -Wlong-long
131-Wmain  -Wmissing-declarations  -Wmissing-noreturn
132-Wmissing-prototypes  -Wmultichar  -Wnested-externs  -Wno-import  
133-Wparentheses -Wpointer-arith  -Wredundant-decls
134-Wreturn-type -Wshadow  -Wsign-compare  -Wstrict-prototypes  
135-Wswitch  -Wtraditional  
136-Wtrigraphs -Wundef  -Wuninitialized  -Wunused  -Wwrite-strings
137-Wunknown-pragmas
138@end smallexample
139
140@item Debugging Options
141@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
142@smallexample
143-a  -ax  -d@var{letters}  -fdump-unnumbered -fpretend-float
144-fprofile-arcs  -ftest-coverage
145-g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2
146-ggdb  -gstabs  -gstabs+  -gxcoff  -gxcoff+
147-p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name
148-print-prog-name=@var{program}  -print-search-dirs  -save-temps
149@end smallexample
150
151@item Optimization Options
152@xref{Optimize Options,,Options that Control Optimization}.
153@smallexample
154-fbranch-probabilities  -foptimize-register-moves
155-fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
156-fdelayed-branch   -fexpensive-optimizations
157-ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
158-fdata-sections -ffunction-sections  -fgcse 
159-finline-functions -finline-limit-@var{n} -fkeep-inline-functions
160-fno-default-inline -fno-defer-pop  -fno-function-cse
161-fno-inline  -fno-peephole  -fomit-frame-pointer -fregmove
162-frerun-cse-after-loop  -frerun-loop-opt -fschedule-insns
163-fschedule-insns2  -fstrength-reduce  -fthread-jumps
164-funroll-all-loops  -funroll-loops
165-fmove-all-movables  -freduce-all-givs -fstrict-aliasing
166-O  -O0  -O1  -O2  -O3 -Os
167@end smallexample
168
169@item Preprocessor Options
170@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
171@smallexample
172-A@var{question}(@var{answer})  -C  -dD  -dM  -dN
173-D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H
174-idirafter @var{dir}
175-include @var{file}  -imacros @var{file}
176-iprefix @var{file}  -iwithprefix @var{dir}
177-iwithprefixbefore @var{dir}  -isystem @var{dir} -isystem-c++ @var{dir}
178-M  -MD  -MM  -MMD  -MG  -nostdinc  -P  -trigraphs
179-undef  -U@var{macro}  -Wp,@var{option}
180@end smallexample
181
182@item Assembler Option
183@xref{Assembler Options,,Passing Options to the Assembler}.
184@smallexample
185-Wa,@var{option}
186@end smallexample
187
188@item Linker Options
189@xref{Link Options,,Options for Linking}.
190@smallexample
191@var{object-file-name}  -l@var{library}
192-nostartfiles  -nodefaultlibs  -nostdlib
193-s  -static  -shared  -symbolic
194-Wl,@var{option}  -Xlinker @var{option}
195-u @var{symbol}
196@end smallexample
197
198@item Directory Options
199@xref{Directory Options,,Options for Directory Search}.
200@smallexample
201-B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}
202@end smallexample
203
204@item Target Options
205@c I wrote this xref this way to avoid overfull hbox. -- rms
206@xref{Target Options}.
207@smallexample
208-b @var{machine}  -V @var{version}
209@end smallexample
210
211@item Machine Dependent Options
212@xref{Submodel Options,,Hardware Models and Configurations}.
213@smallexample
214@emph{M680x0 Options}
215-m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040
216-m68060  -mcpu32 -m5200  -m68881  -mbitfield  -mc68000  -mc68020  
217-mfpa -mnobitfield  -mrtd  -mshort  -msoft-float  
218-malign-int
219
220@emph{VAX Options}
221-mg  -mgnu  -munix
222
223@emph{SPARC Options}
224-mcpu=@var{cpu type}
225-mtune=@var{cpu type}
226-mcmodel=@var{code model}
227-malign-jumps=@var{num}  -malign-loops=@var{num}
228-malign-functions=@var{num}
229-m32  -m64
230-mapp-regs  -mbroken-saverestore  -mcypress  -mepilogue
231-mflat  -mfpu  -mhard-float  -mhard-quad-float
232-mimpure-text  -mlive-g0  -mno-app-regs  -mno-epilogue
233-mno-flat  -mno-fpu  -mno-impure-text
234-mno-stack-bias  -mno-unaligned-doubles
235-msoft-float  -msoft-quad-float  -msparclite  -mstack-bias
236-msupersparc  -munaligned-doubles  -mv8
237
238@emph{Convex Options}
239-mc1  -mc2  -mc32  -mc34  -mc38
240-margcount  -mnoargcount
241-mlong32  -mlong64
242-mvolatile-cache  -mvolatile-nocache
243
244@emph{AMD29K Options}
245-m29000  -m29050  -mbw  -mnbw  -mdw  -mndw
246-mlarge  -mnormal  -msmall
247-mkernel-registers  -mno-reuse-arg-regs
248-mno-stack-check  -mno-storem-bug
249-mreuse-arg-regs  -msoft-float  -mstack-check
250-mstorem-bug  -muser-registers
251
252@emph{ARM Options}
253-mapcs-frame -mno-apcs-frame
254-mapcs-26 -mapcs-32
255-mapcs-stack-check -mno-apcs-stack-check
256-mapcs-float -mno-apcs-float
257-mapcs-reentrant -mno-apcs-reentrant
258-msched-prolog -mno-sched-prolog
259-mlittle-endian -mbig-endian -mwords-little-endian
260-mshort-load-bytes -mno-short-load-bytes -mshort-load-words -mno-short-load-words
261-msoft-float -mhard-float -mfpe
262-mthumb-interwork -mno-thumb-interwork
263-mcpu= -march= -mfpe= 
264-mstructure-size-boundary=
265-mbsd -mxopen -mno-symrename
266-mabort-on-noreturn
267-mno-sched-prolog
268
269@emph{Thumb Options}
270-mtpcs-frame -mno-tpcs-frame
271-mtpcs-leaf-frame -mno-tpcs-leaf-frame
272-mlittle-endian  -mbig-endian
273-mthumb-interwork -mno-thumb-interwork
274-mstructure-size-boundary=
275
276@emph{MN10200 Options}
277-mrelax
278
279@emph{MN10300 Options}
280-mmult-bug
281-mno-mult-bug
282-mrelax
283
284@emph{M32R/D Options}
285-mcode-model=@var{model type}  -msdata=@var{sdata type}
286-G @var{num}
287
288@emph{M88K Options}
289-m88000  -m88100  -m88110  -mbig-pic
290-mcheck-zero-division  -mhandle-large-shift
291-midentify-revision  -mno-check-zero-division
292-mno-ocs-debug-info  -mno-ocs-frame-position
293-mno-optimize-arg-area  -mno-serialize-volatile
294-mno-underscores  -mocs-debug-info
295-mocs-frame-position  -moptimize-arg-area
296-mserialize-volatile  -mshort-data-@var{num}  -msvr3
297-msvr4  -mtrap-large-shift  -muse-div-instruction
298-mversion-03.00  -mwarn-passed-structs
299
300@emph{RS/6000 and PowerPC Options}
301-mcpu=@var{cpu type}
302-mtune=@var{cpu type}
303-mpower  -mno-power  -mpower2  -mno-power2
304-mpowerpc  -mno-powerpc
305-mpowerpc-gpopt  -mno-powerpc-gpopt
306-mpowerpc-gfxopt  -mno-powerpc-gfxopt
307-mnew-mnemonics  -mno-new-mnemonics
308-mfull-toc   -mminimal-toc  -mno-fop-in-toc  -mno-sum-in-toc
309-maix64  -maix32  -mxl-call  -mno-xl-call  -mthreads  -mpe
310-msoft-float  -mhard-float  -mmultiple  -mno-multiple
311-mstring  -mno-string  -mupdate  -mno-update
312-mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align
313-mstrict-align  -mno-strict-align  -mrelocatable
314-mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib
315-mtoc  -mno-toc -mlittle  -mlittle-endian  -mbig  -mbig-endian
316-mcall-aix  -mcall-sysv  -mprototype  -mno-prototype
317-msim  -mmvme  -mads  -myellowknife  -memb -msdata
318-msdata=@var{opt}  -G @var{num}
319
320@emph{RT Options}
321-mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs
322-mfull-fp-blocks  -mhc-struct-return  -min-line-mul
323-mminimum-fp-blocks  -mnohc-struct-return
324
325@emph{MIPS Options}
326-mabicalls  -mcpu=@var{cpu type}  -membedded-data
327-membedded-pic  -mfp32  -mfp64  -mgas  -mgp32  -mgp64
328-mgpopt  -mhalf-pic  -mhard-float  -mint64  -mips1
329-mips2  -mips3 -mips4 -mlong64  -mlong32 -mlong-calls  -mmemcpy
330-mmips-as  -mmips-tfile  -mno-abicalls
331-mno-embedded-data  -mno-embedded-pic
332-mno-gpopt  -mno-long-calls
333-mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats
334-mrnames  -msoft-float
335-m4650  -msingle-float  -mmad
336-mstats  -EL  -EB  -G @var{num}  -nocpp
337-mabi=32 -mabi=n32 -mabi=64 -mabi=eabi
338
339@emph{i386 Options}
340-mcpu=@var{cpu type}
341-march=@var{cpu type}
342-mieee-fp  -mno-fancy-math-387
343-mno-fp-ret-in-387  -msoft-float  -msvr3-shlib
344-mno-wide-multiply  -mrtd  -malign-double
345-mreg-alloc=@var{list}  -mregparm=@var{num}
346-malign-jumps=@var{num}  -malign-loops=@var{num}
347-malign-functions=@var{num} -mpreferred-stack-boundary=@var{num}
348
349@emph{HPPA Options}
350-march=@var{architecture type}
351-mbig-switch  -mdisable-fpregs  -mdisable-indexing  
352-mfast-indirect-calls -mgas  -mjump-in-delay  
353-mlong-load-store  -mno-big-switch  -mno-disable-fpregs
354-mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas
355-mno-jump-in-delay  -mno-long-load-store  
356-mno-portable-runtime  -mno-soft-float  -mno-space  
357-mno-space-regs  -msoft-float  -mpa-risc-1-0  
358-mpa-risc-1-1  -mpa-risc-2-0 -mportable-runtime
359-mschedule=@var{cpu type}  -mspace  -mspace-regs
360
361@emph{Intel 960 Options}
362-m@var{cpu type}  -masm-compat  -mclean-linkage
363-mcode-align  -mcomplex-addr  -mleaf-procedures
364-mic-compat  -mic2.0-compat  -mic3.0-compat
365-mintel-asm  -mno-clean-linkage  -mno-code-align
366-mno-complex-addr  -mno-leaf-procedures
367-mno-old-align  -mno-strict-align  -mno-tail-call
368-mnumerics  -mold-align  -msoft-float  -mstrict-align
369-mtail-call
370
371@emph{DEC Alpha Options}
372-mfp-regs  -mno-fp-regs -mno-soft-float  -msoft-float
373-malpha-as -mgas
374-mieee  -mieee-with-inexact  -mieee-conformant
375-mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode}
376-mtrap-precision=@var{mode}  -mbuild-constants
377-mcpu=@var{cpu type}
378-mbwx -mno-bwx -mcix -mno-cix -mmax -mno-max
379-mmemory-latency=@var{time}
380
381@emph{Clipper Options}
382-mc300  -mc400
383
384@emph{H8/300 Options}
385-mrelax  -mh -ms -mint32  -malign-300
386
387@emph{SH Options}
388-m1  -m2  -m3  -m3e  -mb  -ml  -mdalign -mrelax
389
390@emph{System V Options}
391-Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}
392
393@emph{ARC Options}
394-EB  -EL
395-mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text section}
396-mdata=@var{data section}  -mrodata=@var{readonly data section}
397
398@emph{TMS320C3x/C4x Options}
399-mcpu=@var{cpu} -mbig -msmall -mregparm -mmemparm
400-mfast-fix -mmpyi -mbk -mti -mdp-isr-reload
401-mrpts=@var{count}  -mrptb -mdb -mloop-unsigned
402-mparallel-insns -mparallel-mpy -mpreserve-float
403
404@emph{V850 Options}
405-mlong-calls -mno-long-calls -mep -mno-ep
406-mprolog-function -mno-prolog-function -mspace
407-mtda=@var{n} -msda=@var{n} -mzda=@var{n}
408-mv850 -mbig-switch
409
410@emph{NS32K Options}
411-m32032 -m32332 -m32532 -m32081 -m32381 -mmult-add -mnomult-add
412-msoft-float -mrtd -mnortd -mregparam -mnoregparam -msb -mnosb
413-mbitfield -mnobitfield -mhimem -mnohimem
414@end smallexample
415
416@item Code Generation Options
417@xref{Code Gen Options,,Options for Code Generation Conventions}.
418@smallexample
419-fcall-saved-@var{reg}  -fcall-used-@var{reg}
420-fexceptions -ffixed-@var{reg}  -finhibit-size-directive
421-fcheck-memory-usage  -fprefix-function-name
422-fno-common  -fno-ident  -fno-gnu-linker
423-fpcc-struct-return  -fpic  -fPIC
424-freg-struct-return  -fshared-data  -fshort-enums
425-fshort-double  -fvolatile  -fvolatile-global -fvolatile-static
426-fverbose-asm -fpack-struct  -fstack-check
427-fargument-alias  -fargument-noalias
428-fargument-noalias-global
429-fleading-underscore
430@end smallexample
431@end table
432
433@menu
434* Overall Options::     Controlling the kind of output:
435                        an executable, object files, assembler files,
436                        or preprocessed source.
437* C Dialect Options::   Controlling the variant of C language compiled.
438* C++ Dialect Options:: Variations on C++.
439* Warning Options::     How picky should the compiler be?
440* Debugging Options::   Symbol tables, measurements, and debugging dumps.
441* Optimize Options::    How much optimization?
442* Preprocessor Options:: Controlling header files and macro definitions.
443                         Also, getting dependency information for Make.
444* Assembler Options::   Passing options to the assembler.
445* Link Options::        Specifying libraries and so on.
446* Directory Options::   Where to find header files and libraries.
447                        Where to find the compiler executable files.
448* Target Options::      Running a cross-compiler, or an old version of GCC.
449@end menu
450
451@node Overall Options
452@section Options Controlling the Kind of Output
453
454Compilation can involve up to four stages: preprocessing, compilation
455proper, assembly and linking, always in that order.  The first three
456stages apply to an individual source file, and end by producing an
457object file; linking combines all the object files (those newly
458compiled, and those specified as input) into an executable file.
459
460@cindex file name suffix
461For any given input file, the file name suffix determines what kind of
462compilation is done:
463
464@table @code
465@item @var{file}.c
466C source code which must be preprocessed.
467
468@item @var{file}.i
469C source code which should not be preprocessed.
470
471@item @var{file}.ii
472C++ source code which should not be preprocessed.
473
474@item @var{file}.m
475Objective-C source code.  Note that you must link with the library
476@file{libobjc.a} to make an Objective-C program work.
477
478@item @var{file}.h
479C header file (not to be compiled or linked).
480
481@item @var{file}.cc
482@itemx @var{file}.cxx
483@itemx @var{file}.cpp
484@itemx @var{file}.C
485C++ source code which must be preprocessed.  Note that in @samp{.cxx},
486the last two letters must both be literally @samp{x}.  Likewise,
487@samp{.C} refers to a literal capital C.
488
489@item @var{file}.s
490Assembler code.
491
492@item @var{file}.S
493Assembler code which must be preprocessed.
494
495@item @var{other}
496An object file to be fed straight into linking.
497Any file name with no recognized suffix is treated this way.
498@end table
499
500You can specify the input language explicitly with the @samp{-x} option:
501
502@table @code
503@item -x @var{language}
504Specify explicitly the @var{language} for the following input files
505(rather than letting the compiler choose a default based on the file
506name suffix).  This option applies to all following input files until
507the next @samp{-x} option.  Possible values for @var{language} are:
508@example
509c  objective-c  c++
510c-header  cpp-output  c++-cpp-output
511assembler  assembler-with-cpp
512@end example
513
514@item -x none
515Turn off any specification of a language, so that subsequent files are
516handled according to their file name suffixes (as they are if @samp{-x}
517has not been used at all).
518@end table
519
520If you only want some of the stages of compilation, you can use
521@samp{-x} (or filename suffixes) to tell @code{gcc} where to start, and
522one of the options @samp{-c}, @samp{-S}, or @samp{-E} to say where
523@code{gcc} is to stop.  Note that some combinations (for example,
524@samp{-x cpp-output -E} instruct @code{gcc} to do nothing at all.
525
526@table @code
527@item -c
528Compile or assemble the source files, but do not link.  The linking
529stage simply is not done.  The ultimate output is in the form of an
530object file for each source file.
531
532By default, the object file name for a source file is made by replacing
533the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
534
535Unrecognized input files, not requiring compilation or assembly, are
536ignored.
537
538@item -S
539Stop after the stage of compilation proper; do not assemble.  The output
540is in the form of an assembler code file for each non-assembler input
541file specified.
542
543By default, the assembler file name for a source file is made by
544replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
545
546Input files that don't require compilation are ignored.
547
548@item -E
549Stop after the preprocessing stage; do not run the compiler proper.  The
550output is in the form of preprocessed source code, which is sent to the
551standard output.
552
553Input files which don't require preprocessing are ignored.
554
555@cindex output file option
556@item -o @var{file}
557Place output in file @var{file}.  This applies regardless to whatever
558sort of output is being produced, whether it be an executable file,
559an object file, an assembler file or preprocessed C code.
560
561Since only one output file can be specified, it does not make sense to
562use @samp{-o} when compiling more than one input file, unless you are
563producing an executable file as output.
564
565If @samp{-o} is not specified, the default is to put an executable file
566in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
567@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
568all preprocessed C source on standard output.@refill
569
570@item -v
571Print (on standard error output) the commands executed to run the stages
572of compilation.  Also print the version number of the compiler driver
573program and of the preprocessor and the compiler proper.
574
575@item -pipe
576Use pipes rather than temporary files for communication between the
577various stages of compilation.  This fails to work on some systems where
578the assembler is unable to read from a pipe; but the GNU assembler has
579no trouble.
580
581@item -priority=<prio>
582Specify the BeOS thread-priority to use for all the tools. You can specify
583values between 1-10, the default is 5 (B_LOW_PRIORITY).
584
585@item -no-beos-fixes
586Disable any BeOS-R5 compatibility fixes (like the automatic linking of 
587fix_bdirectwindow_typeinfo.o).
588
589@item --relative-path-errors
590Disable the BeOS-specific feature of absolute paths when displaying errors.
591If you specify this option, relative paths will be used instead.
592
593@item --help
594Print (on the standard output) a description of the command line options
595understood by @code{gcc}.  If the @code{-v} option is also specified
596then @code{--help} will also be passed on to the various processes
597invoked by @code{gcc}, so that they can display the command line options
598they accept.  If the @code{-W} option is also specified then command
599line options which have no documentation associated with them will also
600be displayed.
601@end table
602
603@node Invoking G++
604@section Compiling C++ Programs
605
606@cindex suffixes for C++ source
607@cindex C++ source file suffixes
608C++ source files conventionally use one of the suffixes @samp{.C},
609@samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
610preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
611files with these names and compiles them as C++ programs even if you
612call the compiler the same way as for compiling C programs (usually with
613the name @code{gcc}).
614
615@findex g++
616@findex c++
617However, C++ programs often require class libraries as well as a
618compiler that understands the C++ language---and under some
619circumstances, you might want to compile programs from standard input,
620or otherwise without a suffix that flags them as C++ programs.
621@code{g++} is a program that calls GCC with the default language
622set to C++, and automatically specifies linking against the C++
623library.  On many systems, the script @code{g++} is also
624installed with the name @code{c++}.
625
626@cindex invoking @code{g++}
627When you compile C++ programs, you may specify many of the same
628command-line options that you use for compiling programs in any
629language; or command-line options meaningful for C and related
630languages; or options that are meaningful only for C++ programs.
631@xref{C Dialect Options,,Options Controlling C Dialect}, for
632explanations of options for languages related to C.
633@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
634explanations of options that are meaningful only for C++ programs.
635
636@node C Dialect Options
637@section Options Controlling C Dialect
638@cindex dialect options
639@cindex language dialect options
640@cindex options, dialect
641
642The following options control the dialect of C (or languages derived
643from C, such as C++ and Objective C) that the compiler accepts:
644
645@table @code
646@cindex ANSI support
647@item -ansi
648In C mode, support all ANSI standard C programs.  In C++ mode,
649remove GNU extensions that conflict with ANSI C++.
650@c shouldn't we be saying "ISO"?
651
652This turns off certain features of GCC that are incompatible with ANSI
653C (when compiling C code), or of ANSI standard C++ (when compiling C++ code),
654such as the @code{asm} and @code{typeof} keywords, and
655predefined macros such as @code{unix} and @code{vax} that identify the
656type of system you are using.  It also enables the undesirable and
657rarely used ANSI trigraph feature.  For the C compiler, 
658it disables recognition of C++ style @samp{//} comments as well as
659the @code{inline} keyword.  For the C++ compiler,
660@samp{-foperator-names} is enabled as well.
661
662
663The alternate keywords @code{__asm__}, @code{__extension__},
664@code{__inline__} and @code{__typeof__} continue to work despite
665@samp{-ansi}.  You would not want to use them in an ANSI C program, of
666course, but it is useful to put them in header files that might be included
667in compilations done with @samp{-ansi}.  Alternate predefined macros
668such as @code{__unix__} and @code{__vax__} are also available, with or
669without @samp{-ansi}.
670
671The @samp{-ansi} option does not cause non-ANSI programs to be
672rejected gratuitously.  For that, @samp{-pedantic} is required in
673addition to @samp{-ansi}.  @xref{Warning Options}.
674
675The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
676option is used.  Some header files may notice this macro and refrain
677from declaring certain functions or defining certain macros that the
678ANSI standard doesn't call for; this is to avoid interfering with any
679programs that might use these names for other things.
680
681The functions @code{alloca}, @code{abort}, @code{exit}, and
682@code{_exit} are not builtin functions when @samp{-ansi} is used.
683
684@item -fstd=
685Determine the language standard.  A value for this option must be provided;
686possible values are 
687
688@itemize @minus
689@item iso9899:1990
690Same as -ansi
691
692@item iso9899:199409
693ISO C as modified in amend. 1
694
695@item iso9899:199x
696ISO C 9x
697
698@item c89
699same as -std=iso9899:1990
700
701@item c9x
702same as -std=iso9899:199x
703
704@item gnu89
705default, iso9899:1990 + gnu extensions
706
707@item gnu9x
708iso9899:199x + gnu extensions
709@end itemize
710
711Even when this option is not specified, you can still use some of the
712features of newer standards in so far as they do not conflict with
713previous C standards.  For example, you may use @code{__restrict__} even
714when -fstd=c9x is not specified.
715
716@item -fno-asm
717Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
718keyword, so that code can use these words as identifiers.  You can use
719the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
720instead.  @samp{-ansi} implies @samp{-fno-asm}.
721
722In C++, this switch only affects the @code{typeof} keyword, since
723@code{asm} and @code{inline} are standard keywords.  You may want to
724use the @samp{-fno-gnu-keywords} flag instead, as it also disables the
725other, C++-specific, extension keywords such as @code{headof}.
726
727@item -fno-builtin
728@cindex builtin functions
729@findex abort
730@findex abs
731@findex alloca
732@findex cos
733@findex exit
734@findex fabs
735@findex ffs
736@findex labs
737@findex memcmp
738@findex memcpy
739@findex sin
740@findex sqrt
741@findex strcmp
742@findex strcpy
743@findex strlen
744Don't recognize builtin functions that do not begin with @samp{__builtin_}
745as prefix.  Currently, the functions affected include @code{abort},
746@code{abs}, @code{alloca}, @code{cos}, @code{exit}, @code{fabs},
747@code{ffs}, @code{labs}, @code{memcmp}, @code{memcpy}, @code{sin},
748@code{sqrt}, @code{strcmp}, @code{strcpy}, and @code{strlen}.
749
750GCC normally generates special code to handle certain builtin functions
751more efficiently; for instance, calls to @code{alloca} may become single
752instructions that adjust the stack directly, and calls to @code{memcpy}
753may become inline copy loops.  The resulting code is often both smaller
754and faster, but since the function calls no longer appear as such, you
755cannot set a breakpoint on those calls, nor can you change the behavior
756of the functions by linking with a different library.
757
758The @samp{-ansi} option prevents @code{alloca} and @code{ffs} from being
759builtin functions, since these functions do not have an ANSI standard
760meaning.
761
762@item -fhosted
763@cindex hosted environment
764
765Assert that compilation takes place in a hosted environment.  This implies
766@samp{-fbuiltin}.  A hosted environment is one in which the
767entire standard library is available, and in which @code{main} has a return
768type of @code{int}.  Examples are nearly everything except a kernel.
769This is equivalent to @samp{-fno-freestanding}.
770
771@item -ffreestanding
772@cindex hosted environment
773
774Assert that compilation takes place in a freestanding environment.  This
775implies @samp{-fno-builtin}.  A freestanding environment
776is one in which the standard library may not exist, and program startup may
777not necessarily be at @code{main}.  The most obvious example is an OS kernel.
778This is equivalent to @samp{-fno-hosted}.
779
780@item -trigraphs
781Support ANSI C trigraphs.  You don't want to know about this
782brain-damage.  The @samp{-ansi} option implies @samp{-trigraphs}.
783
784@cindex traditional C language
785@cindex C language, traditional
786@item -traditional
787Attempt to support some aspects of traditional C compilers.
788Specifically:
789
790@itemize @bullet
791@item
792All @code{extern} declarations take effect globally even if they
793are written inside of a function definition.  This includes implicit
794declarations of functions.
795
796@item
797The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
798and @code{volatile} are not recognized.  (You can still use the
799alternative keywords such as @code{__typeof__}, @code{__inline__}, and
800so on.)
801
802@item
803Comparisons between pointers and integers are always allowed.
804
805@item
806Integer types @code{unsigned short} and @code{unsigned char} promote
807to @code{unsigned int}.
808
809@item
810Out-of-range floating point literals are not an error.
811
812@item
813Certain constructs which ANSI regards as a single invalid preprocessing
814number, such as @samp{0xe-0xd}, are treated as expressions instead.
815
816@item
817String ``constants'' are not necessarily constant; they are stored in
818writable space, and identical looking constants are allocated
819separately.  (This is the same as the effect of
820@samp{-fwritable-strings}.)
821
822@cindex @code{longjmp} and automatic variables
823@item
824All automatic variables not declared @code{register} are preserved by
825@code{longjmp}.  Ordinarily, GNU C follows ANSI C: automatic variables
826not declared @code{volatile} may be clobbered.
827
828@item
829@kindex \x
830@kindex \a
831@cindex escape sequences, traditional
832The character escape sequences @samp{\x} and @samp{\a} evaluate as the
833literal characters @samp{x} and @samp{a} respectively.  Without
834@w{@samp{-traditional}}, @samp{\x} is a prefix for the hexadecimal
835representation of a character, and @samp{\a} produces a bell.
836@end itemize
837
838You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
839if your program uses names that are normally GNU C builtin functions for
840other purposes of its own.
841
842You cannot use @samp{-traditional} if you include any header files that
843rely on ANSI C features.  Some vendors are starting to ship systems with
844ANSI C header files and you cannot use @samp{-traditional} on such
845systems to compile files that include any system headers.
846
847The @samp{-traditional} option also enables @samp{-traditional-cpp},
848which is described next.
849
850@item -traditional-cpp
851Attempt to support some aspects of traditional C preprocessors.
852Specifically:
853
854@itemize @bullet
855@item
856Comments convert to nothing at all, rather than to a space.  This allows
857traditional token concatenation.
858
859@item
860In a preprocessing directive, the @samp{#} symbol must appear as the first
861character of a line.
862
863@item
864Macro arguments are recognized within string constants in a macro
865definition (and their values are stringified, though without additional
866quote marks, when they appear in such a context).  The preprocessor
867always considers a string constant to end at a newline.
868
869@item
870@cindex detecting @w{@samp{-traditional}}
871The predefined macro @code{__STDC__} is not defined when you use
872@samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
873which @code{__GNUC__} indicates are not affected by
874@samp{-traditional}).  If you need to write header files that work
875differently depending on whether @samp{-traditional} is in use, by
876testing both of these predefined macros you can distinguish four
877situations: GNU C, traditional GNU C, other ANSI C compilers, and other
878old C compilers.  The predefined macro @code{__STDC_VERSION__} is also
879not defined when you use @samp{-traditional}.  @xref{Standard
880Predefined,,Standard Predefined Macros,cpp.info,The C Preprocessor},
881for more discussion of these and other predefined macros.
882
883@item
884@cindex string constants vs newline
885@cindex newline vs string constants
886The preprocessor considers a string constant to end at a newline (unless
887the newline is escaped with @samp{\}).  (Without @w{@samp{-traditional}},
888string constants can contain the newline character as typed.)
889@end itemize
890
891@item -fcond-mismatch
892Allow conditional expressions with mismatched types in the second and
893third arguments.  The value of such an expression is void.
894
895@item -funsigned-char
896Let the type @code{char} be unsigned, like @code{unsigned char}.
897
898Each kind of machine has a default for what @code{char} should
899be.  It is either like @code{unsigned char} by default or like
900@code{signed char} by default.
901
902Ideally, a portable program should always use @code{signed char} or
903@code{unsigned char} when it depends on the signedness of an object.
904But many programs have been written to use plain @code{char} and
905expect it to be signed, or expect it to be unsigned, depending on the
906machines they were written for.  This option, and its inverse, let you
907make such a program work with the opposite default.
908
909The type @code{char} is always a distinct type from each of
910@code{signed char} or @code{unsigned char}, even though its behavior
911is always just like one of those two.
912
913@item -fsigned-char
914Let the type @code{char} be signed, like @code{signed char}.
915
916Note that this is equivalent to @samp{-fno-unsigned-char}, which is
917the negative form of @samp{-funsigned-char}.  Likewise, the option
918@samp{-fno-signed-char} is equivalent to @samp{-funsigned-char}.
919
920You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
921if your program uses names that are normally GNU C builtin functions for
922other purposes of its own.
923
924You cannot use @samp{-traditional} if you include any header files that
925rely on ANSI C features.  Some vendors are starting to ship systems with
926ANSI C header files and you cannot use @samp{-traditional} on such
927systems to compile files that include any system headers.
928
929@item -fsigned-bitfields
930@itemx -funsigned-bitfields
931@itemx -fno-signed-bitfields
932@itemx -fno-unsigned-bitfields
933These options control whether a bitfield is signed or unsigned, when the
934declaration does not use either @code{signed} or @code{unsigned}.  By
935default, such a bitfield is signed, because this is consistent: the
936basic integer types such as @code{int} are signed types.
937
938However, when @samp{-traditional} is used, bitfields are all unsigned
939no matter what.
940
941@item -fwritable-strings
942Store string constants in the writable data segment and don't uniquize
943them.  This is for compatibility with old programs which assume they can
944write into string constants.  The option @samp{-traditional} also has
945this effect.
946
947Writing into string constants is a very bad idea; ``constants'' should
948be constant.
949
950@item -fallow-single-precision
951Do not promote single precision math operations to double precision,
952even when compiling with @samp{-traditional}.
953
954Traditional K&R C promotes all floating point operations to double
955precision, regardless of the sizes of the operands.   On the
956architecture for which you are compiling, single precision may be faster
957than double precision.   If you must use @samp{-traditional}, but want
958to use single precision operations when the operands are single
959precision, use this option.   This option has no effect when compiling
960with ANSI or GNU C conventions (the default).
961
962@end table
963
964@node C++ Dialect Options
965@section Options Controlling C++ Dialect
966
967@cindex compiler options, C++
968@cindex C++ options, command line
969@cindex options, C++
970This section describes the command-line options that are only meaningful
971for C++ programs; but you can also use most of the GNU compiler options
972regardless of what language your program is in.  For example, you
973might compile a file @code{firstClass.C} like this:
974
975@example
976g++ -g -frepo -O -c firstClass.C
977@end example
978
979@noindent
980In this example, only @samp{-frepo} is an option meant
981only for C++ programs; you can use the other options with any
982language supported by GCC.
983
984Here is a list of options that are @emph{only} for compiling C++ programs:
985
986@table @code
987@item -fno-access-control
988Turn off all access checking.  This switch is mainly useful for working
989around bugs in the access control code.
990
991@item -fcheck-new
992Check that the pointer returned by @code{operator new} is non-null
993before attempting to modify the storage allocated.  The current Working
994Paper requires that @code{operator new} never return a null pointer, so
995this check is normally unnecessary.
996
997An alternative to using this option is to specify that your
998@code{operator new} does not throw any exceptions; if you declare it
999@samp{throw()}, g++ will check the return value.  See also @samp{new
1000(nothrow)}.
1001
1002@item -fconserve-space
1003Put uninitialized or runtime-initialized global variables into the
1004common segment, as C does.  This saves space in the executable at the
1005cost of not diagnosing duplicate definitions.  If you compile with this
1006flag and your program mysteriously crashes after @code{main()} has
1007completed, you may have an object that is being destroyed twice because
1008two definitions were merged.
1009
1010This option is no longer useful on most targets, now that support has
1011been added for putting variables into BSS without making them common.
1012
1013@item -fdollars-in-identifiers
1014Accept @samp{$} in identifiers.  You can also explicitly prohibit use of
1015@samp{$} with the option @samp{-fno-dollars-in-identifiers}.  (GNU C allows
1016@samp{$} by default on most target systems, but there are a few exceptions.)
1017Traditional C allowed the character @samp{$} to form part of
1018identifiers.  However, ANSI C and C++ forbid @samp{$} in identifiers.
1019
1020@item -fno-elide-constructors
1021The C++ standard allows an implementation to omit creating a temporary
1022which is only used to initialize another object of the same type.
1023Specifying this option disables that optimization, and forces g++ to
1024call the copy constructor in all cases.
1025
1026@item -fexternal-templates
1027Cause template instantiations to obey @samp{#pragma interface} and
1028@samp{implementation}; template instances are emitted or not according
1029to the location of the template definition.  @xref{Template
1030Instantiation}, for more information.
1031
1032This option is deprecated.
1033
1034@item -falt-external-templates
1035Similar to -fexternal-templates, but template instances are emitted or
1036not according to the place where they are first instantiated.
1037@xref{Template Instantiation}, for more information.
1038
1039This option is deprecated.
1040
1041@item -ffor-scope
1042@itemx -fno-for-scope
1043If -ffor-scope is specified, the scope of variables declared in
1044a @i{for-init-statement} is limited to the @samp{for} loop itself,
1045as specified by the draft C++ standard.
1046If -fno-for-scope is specified, the scope of variables declared in
1047a @i{for-init-statement} extends to the end of the enclosing scope,
1048as was the case in old versions of gcc, and other (traditional)
1049implementations of C++.
1050
1051The default if neither flag is given to follow the standard,
1052but to allow and give a warning for old-style code that would
1053otherwise be invalid, or have different behavior.
1054
1055@item -fno-gnu-keywords
1056Do not recognize @code{classof}, @code{headof}, @code{signature},
1057@code{sigof} or @code{typeof} as a keyword, so that code can use these
1058words as identifiers.  You can use the keywords @code{__classof__},
1059@code{__headof__}, @code{__signature__}, @code{__sigof__}, and
1060@code{__typeof__} instead.  @samp{-ansi} implies
1061@samp{-fno-gnu-keywords}.
1062
1063@item -fguiding-decls
1064Treat a function declaration with the same type as a potential function
1065template instantiation as though it declares that instantiation, not a
1066normal function.  If a definition is given for the function later in the
1067translation unit (or another translation unit if the target supports
1068weak symbols), that definition will be used; otherwise the template will
1069be instantiated.  This behavior reflects the C++ language prior to
1070September 1996, when guiding declarations were removed.
1071
1072This option implies @samp{-fname-mangling-version-0}, and will not work
1073with other name mangling versions.  Like all options that change the
1074ABI, all C++ code, @emph{including libgcc.a} must be built with the same
1075setting of this option.
1076
1077@item -fhandle-signatures
1078Recognize the @code{signature} and @code{sigof} keywords for specifying
1079abstract types.  The default (@samp{-fno-handle-signatures}) is not to
1080recognize them.  @xref{C++ Signatures, Type Abstraction using
1081Signatures}.
1082
1083@item -fhonor-std
1084Treat the @code{namespace std} as a namespace, instead of ignoring
1085it. For compatibility with earlier versions of g++, the compiler will,
1086by default, ignore @code{namespace-declarations},
1087@code{using-declarations}, @code{using-directives}, and
1088@code{namespace-names}, if they involve @code{std}.
1089
1090@item -fhuge-objects
1091Support virtual function calls for objects that exceed the size
1092representable by a @samp{short int}.  Users should not use this flag by
1093default; if you need to use it, the compiler will tell you so.
1094
1095This flag is not useful when compiling with -fvtable-thunks.
1096
1097Like all options that change the ABI, all C++ code, @emph{including
1098libgcc} must be built with the same setting of this option.
1099
1100@item -fno-implicit-templates
1101Never emit code for non-inline templates which are instantiated
1102implicitly (i.e. by use); only emit code for explicit instantiations.
1103@xref{Template Instantiation}, for more information.
1104
1105@item -fno-implicit-inline-templates
1106Don't emit code for implicit instantiations of inline templates, either.
1107The default is to handle inlines differently so that compiles with and
1108without optimization will need the same set of explicit instantiations.
1109
1110@item -finit-priority
1111Support @samp{__attribute__ ((init_priority (n)))} for controlling the
1112order of initialization of file-scope objects.  On ELF targets, this
1113requires GNU ld 2.10 or later.
1114
1115@item -fno-implement-inlines
1116To save space, do not emit out-of-line copies of inline functions
1117controlled by @samp{#pragma implementation}.  This will cause linker
1118errors if these functions are not inlined everywhere they are called.
1119
1120@item -fmultiple-symbol-spaces
1121Force the use of multiple symbol spaces. BeOS used to always activate
1122multiple symbol spaces, although it is not neccessary with ELF (as all
1123globals are exported anyway). 
1124
1125This gcc uses a single symbol space if optimization is active in order 
1126to achieve smaller object files and libs.
1127This switch can be used to revert to the original, strictly BeOS-compatible
1128behaviour.
1129
1130@item -fname-mangling-version-@var{n}
1131Control the way in which names are mangled.  Version 0 is compatible
1132with versions of g++ before 2.8.  Version 1 is the default.  Version 1
1133will allow correct mangling of function templates.  For example, 
1134version 0 mangling does not mangle foo<int, double> and foo<int, char>
1135given this declaration:
1136
1137@example
1138template <class T, class U> void foo(T t);
1139@end example
1140
1141Like all options that change the ABI, all C++ code, @emph{including
1142libgcc} must be built with the same setting of this option.
1143
1144@item -foperator-names
1145Recognize the operator name keywords @code{and}, @code{bitand},
1146@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1147synonyms for the symbols they refer to.  @samp{-ansi} implies
1148@samp{-foperator-names}.
1149
1150@item -fno-optional-diags
1151Disable diagnostics that the standard says a compiler does not need to
1152issue.  Currently, the only such diagnostic issued by g++ is the one for
1153a name having multiple meanings within a class.
1154
1155@item -fpermissive
1156Downgrade messages about nonconformant code from errors to warnings.  By
1157default, g++ effectively sets @samp{-pedantic-errors} without
1158@samp{-pedantic}; this option reverses that.  This behavior and this
1159option are superceded by @samp{-pedantic}, which works as it does for GNU C.
1160
1161@item -frepo
1162Enable automatic template instantiation.  This option also implies
1163@samp{-fno-implicit-templates}.  @xref{Template Instantiation}, for more
1164information.
1165
1166@item -fno-rtti
1167Disable generation of the information used by C++ runtime type
1168identification features (@samp{dynamic_cast} and @samp{typeid}).  If you
1169don't use those parts of the language (or exception handling, which uses
1170@samp{dynamic_cast} internally), you can save some space by using this
1171flag.
1172
1173@item -fstrict-prototype
1174Within an @samp{extern "C"} linkage specification, treat a function
1175declaration with no arguments, such as @samp{int foo ();}, as declaring
1176the function to take no arguments.  Normally, such a declaration means
1177that the function @code{foo} can take any combination of arguments, as
1178in C.  @samp{-pedantic} implies @samp{-fstrict-prototype} unless
1179overridden with @samp{-fno-strict-prototype}.
1180
1181Specifying this option will also suppress implicit declarations of
1182functions.
1183
1184This flag no longer affects declarations with C++ linkage.
1185
1186@item -fsquangle
1187@itemx -fno-squangle
1188@samp{-fsquangle} will enable a compressed form of name mangling for
1189identifiers. In particular, it helps to shorten very long names by recognizing
1190types and class names which occur more than once, replacing them with special
1191short ID codes.  This option also requires any C++ libraries being used to
1192be compiled with this option as well.  The compiler has this disabled (the
1193equivalent of @samp{-fno-squangle}) by default.
1194
1195Like all options that change the ABI, all C++ code, @emph{including
1196libgcc.a} must be built with the same setting of this option.
1197
1198@item -ftemplate-depth-@var{n}
1199Set the maximum instantiation depth for template classes to @var{n}.
1200A limit on the template instantiation depth is needed to detect
1201endless recursions during template class instantiation. ANSI/ISO C++
1202conforming programs must not rely on a maximum depth greater than 17.
1203
1204@item -fthis-is-variable
1205Permit assignment to @code{this}.  The incorporation of user-defined
1206free store management into C++ has made assignment to @samp{this} an
1207anachronism.  Therefore, by default it is invalid to assign to
1208@code{this} within a class member function; that is, GNU C++ treats
1209@samp{this} in a member function of class @code{X} as a non-lvalue of
1210type @samp{X *}.  However, for backwards compatibility, you can make it
1211valid with @samp{-fthis-is-variable}.
1212
1213@item -fvtable-thunks=@var{thunks-version}
1214Use @samp{thunks} to implement the virtual function dispatch table
1215(@samp{vtable}).  The traditional (cfront-style) approach to
1216implementing vtables was to store a pointer to the function and two
1217offsets for adjusting the @samp{this} pointer at the call site.  Newer
1218implementations store a single pointer to a @samp{thunk} function which
1219does any necessary adjustment and then calls the target function.
1220
1221The original implementation of thunks (version 1) had a bug regarding
1222virtual base classes; this bug is fixed with version 2 of the thunks
1223implementation. With setting the version to 2, compatibility to the
1224version 1 thunks is provided, at the cost of extra machine code. Version
12253 does not include this compatibility.
1226
1227This option also enables a heuristic for controlling emission of
1228vtables; if a class has any non-inline virtual functions, the vtable
1229will be emitted in the translation unit containing the first one of
1230those.
1231
1232Like all options that change the ABI, all C++ code, @emph{including
1233libgcc.a} must be built with the same setting of this option. Since
1234version 1 and version 2 are also incompatible (for classes with virtual
1235bases defining virtual functions), all code must also be compiled with
1236the same version.
1237
1238In this version of gcc, there are no targets for which version 2 thunks
1239are the default.  On all targets, not giving the option will use the
1240traditional implementation, and -fvtable-thunks will produce version 2
1241thunks.
1242
1243@item -nostdinc++
1244Do not search for header files in the standard directories specific to
1245C++, but do still search the other standard directories.  (This option
1246is used when building the C++ library.)
1247@end table
1248
1249In addition, these optimization, warning, and code generation options
1250have meanings only for C++ programs:
1251
1252@table @code
1253@item -fno-default-inline
1254Do not assume @samp{inline} for functions defined inside a class scope.
1255@xref{Optimize Options,,Options That Control Optimization}.  Note that these
1256functions will have linkage like inline functions; they just won't be
1257inlined by default.
1258
1259@item -Wctor-dtor-privacy (C++ only)
1260Warn when a class seems unusable, because all the constructors or
1261destructors in a class are private and the class has no friends or
1262public static member functions.
1263
1264@item -Wnon-virtual-dtor (C++ only)
1265Warn when a class declares a non-virtual destructor that should probably
1266be virtual, because it looks like the class will be used polymorphically.
1267
1268@item -Wreorder (C++ only)
1269@cindex reordering, warning
1270@cindex warning for reordering of member initializers
1271Warn when the order of member initializers given in the code does not
1272match the order in which they must be executed.  For instance:
1273
1274@smallexample
1275struct A @{
1276  int i;
1277  int j;
1278  A(): j (0), i (1) @{ @}
1279@};
1280@end smallexample
1281
1282Here the compiler will warn that the member initializers for @samp{i}
1283and @samp{j} will be rearranged to match the declaration order of the
1284members.
1285@end table
1286
1287The following @samp{-W@dots{}} options are not affected by @samp{-Wall}.
1288
1289@table @code
1290@item -Weffc++ (C++ only)
1291Warn about violations of various style guidelines from Scott Meyers'
1292@cite{Effective C++} books.  If you use this option, you should be aware
1293that the standard library headers do not obey all of these guidelines;
1294you can use @samp{grep -v} to filter out those warnings.
1295
1296@item -Wno-deprecated (C++ only)
1297Do not warn about usage of deprecated features. @xref{Deprecated Features}.
1298
1299@item -Wno-non-template-friend (C++ only)
1300Disable warnings when non-templatized friend functions are declared
1301within a template. With the advent of explicit template specification
1302support in g++, if the name of the friend is an unqualified-id (ie,
1303@samp{friend foo(int)}), the C++ language specification demands that the
1304friend declare or define an ordinary, nontemplate function. (Section
130514.5.3). Before g++ implemented explicit specification, unqualified-ids
1306could be interpreted as a particular specialization of a templatized
1307function. Because this non-conforming behavior is no longer the default
1308behavior for g++, @samp{-Wnon-template-friend} allows the compiler to
1309check existing code for potential trouble spots, and is on by default.
1310This new compiler behavior can also be turned off with the flag
1311@samp{-fguiding-decls}, which activates the older, non-specification
1312compiler code, or with @samp{-Wno-non-template-friend} which keeps the
1313conformant compiler code but disables the helpful warning.
1314
1315@item -Wold-style-cast (C++ only)
1316Warn if an old-style (C-style) cast is used within a C++ program.  The
1317new-style casts (@samp{static_cast}, @samp{reinterpret_cast}, and
1318@samp{const_cast}) are less vulnerable to unintended effects.
1319
1320@item -Woverloaded-virtual (C++ only)
1321@cindex overloaded virtual fn, warning
1322@cindex warning for overloaded virtual fn
1323Warn when a derived class function declaration may be an error in
1324defining a virtual function.  In a derived class, the
1325definitions of virtual functions must match the type signature of a
1326virtual function declared in the base class.  With this option, the
1327compiler warns when you define a function with the same name as a
1328virtual function, but with a type signature that does not match any
1329declarations from the base class.
1330
1331@item -Wno-pmf-conversions (C++ only)
1332Disable the diagnostic for converting a bound pointer to member function
1333to a plain pointer.
1334
1335@item -Wsign-promo (C++ only)
1336Warn when overload resolution chooses a promotion from unsigned or
1337enumeral type to a signed type over a conversion to an unsigned type of
1338the same size.  Previous versions of g++ would try to preserve
1339unsignedness, but the standard mandates the current behavior.
1340
1341@item -Wsynth (C++ only)
1342@cindex warning for synthesized methods
1343@cindex synthesized methods, warning
1344Warn when g++'s synthesis behavior does not match that of cfront.  For
1345instance:
1346
1347@smallexample
1348struct A @{
1349  operator int ();
1350  A& operator = (int);
1351@};
1352
1353main ()
1354@{
1355  A a,b;
1356  a = b;
1357@}
1358@end smallexample
1359
1360In this example, g++ will synthesize a default @samp{A& operator =
1361(const A&);}, while cfront will use the user-defined @samp{operator =}.
1362@end table
1363
1364@node Warning Options
1365@section Options to Request or Suppress Warnings
1366@cindex options to control warnings
1367@cindex warning messages
1368@cindex messages, warning
1369@cindex suppressing warnings
1370
1371Warnings are diagnostic messages that report constructions which
1372are not inherently erroneous but which are risky or suggest there
1373may have been an error.
1374
1375You can request many specific warnings with options beginning @samp{-W},
1376for example @samp{-Wimplicit} to request warnings on implicit
1377declarations.  Each of these specific warning options also has a
1378negative form beginning @samp{-Wno-} to turn off warnings;
1379for example, @samp{-Wno-implicit}.  This manual lists only one of the
1380two forms, whichever is not the default.
1381
1382These options control the amount and kinds of warnings produced by GCC:
1383
1384@table @code
1385@cindex syntax checking
1386@item -fsyntax-only
1387Check the code for syntax errors, but don't do anything beyond that.
1388
1389@item -pedantic
1390Issue all the warnings demanded by strict ANSI C and ISO C++;
1391reject all programs that use forbidden extensions.
1392
1393Valid ANSI C and ISO C++ programs should compile properly with or without
1394this option (though a rare few will require @samp{-ansi}).  However,
1395without this option, certain GNU extensions and traditional C and C++
1396features are supported as well.  With this option, they are rejected.
1397
1398@samp{-pedantic} does not cause warning messages for use of the
1399alternate keywords whose names begin and end with @samp{__}.  Pedantic
1400warnings are also disabled in the expression that follows
1401@code{__extension__}.  However, only system header files should use
1402these escape routes; application programs should avoid them.
1403@xref{Alternate Keywords}.
1404
1405This option is not intended to be @i{useful}; it exists only to satisfy
1406pedants who would otherwise claim that GCC fails to support the ANSI
1407standard.
1408
1409Some users try to use @samp{-pedantic} to check programs for strict ANSI
1410C conformance.  They soon find that it does not do quite what they want:
1411it finds some non-ANSI practices, but not all---only those for which
1412ANSI C @emph{requires} a diagnostic.
1413
1414A feature to report any failure to conform to ANSI C might be useful in
1415some instances, but would require considerable additional work and would
1416be quite different from @samp{-pedantic}.  We don't have plans to
1417support such a feature in the near future.
1418
1419@item -pedantic-errors
1420Like @samp{-pedantic}, except that errors are produced rather than
1421warnings.
1422
1423@item -w
1424Inhibit all warning messages.
1425
1426@item -Wno-import
1427Inhibit warning messages about the use of @samp{#import}.
1428
1429@item -Wchar-subscripts
1430Warn if an array subscript has type @code{char}.  This is a common cause
1431of error, as programmers often forget that this type is signed on some
1432machines.
1433
1434@item -Wcomment
1435Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1436comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1437
1438@item -Wformat
1439Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1440the arguments supplied have types appropriate to the format string
1441specified.
1442
1443@item -Wimplicit-int
1444Warn when a declaration does not specify a type.
1445
1446@item -Wimplicit-function-declaration
1447@itemx -Werror-implicit-function-declaration
1448Give a warning (or error) whenever a function is used before being
1449declared.
1450
1451@item -Wimplicit
1452Same as @samp{-Wimplicit-int} and @samp{-Wimplicit-function-}@*
1453@samp{declaration}.
1454
1455@item -Wmain
1456Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
1457function with external linkage, returning int, taking either zero
1458arguments, two, or three arguments of appropriate types.
1459
1460@item -Wmultichar
1461Warn if a multicharacter constant (@samp{'FOOF'}) is used.  Usually they
1462indicate a typo in the user's code, as they have implementation-defined
1463values, and should not be used in portable code.
1464  
1465@item -Wparentheses
1466Warn if parentheses are omitted in certain contexts, such
1467as when there is an assignment in a context where a truth value
1468is expected, or when operators are nested whose precedence people
1469often get confused about.
1470
1471Also warn about constructions where there may be confusion to which
1472@code{if} statement an @code{else} branch belongs.  Here is an example of
1473such a case:
1474
1475@smallexample
1476@{
1477  if (a)
1478    if (b)
1479      foo ();
1480  else
1481    bar ();
1482@}
1483@end smallexample
1484
1485In C, every @code{else} branch belongs to the innermost possible @code{if}
1486statement, which in this example is @code{if (b)}.  This is often not
1487what the programmer expected, as illustrated in the above example by
1488indentation the programmer chose.  When there is the potential for this
1489confusion, GNU C will issue a warning when this flag is specified.
1490To eliminate the warning, add explicit braces around the innermost
1491@code{if} statement so there is no way the @code{else} could belong to
1492the enclosing @code{if}.  The resulting code would look like this:
1493
1494@smallexample
1495@{
1496  if (a)
1497    @{
1498      if (b)
1499        foo ();
1500      else
1501        bar ();
1502    @}
1503@}
1504@end smallexample
1505
1506@item -Wreturn-type
1507Warn whenever a function is defined with a return-type that defaults
1508to @code{int}.  Also warn about any @code{return} statement with no
1509return-value in a function whose return-type is not @code{void}.
1510
1511@item -Wswitch
1512Warn whenever a @code{switch} statement has an index of enumeral type
1513and lacks a @code{case} for one or more of the named codes of that
1514enumeration.  (The presence of a @code{default} label prevents this
1515warning.)  @code{case} labels outside the enumeration range also
1516provoke warnings when this option is used.
1517
1518@item -Wtrigraphs
1519Warn if any trigraphs are encountered (assuming they are enabled).
1520
1521@item -Wunused
1522Warn whenever a variable is unused aside from its declaration,
1523whenever a function is declared static but never defined, whenever a
1524label is declared but not used, and whenever a statement computes a
1525result that is explicitly not used.
1526
1527In order to get a warning about an unused function parameter, you must
1528specify both @samp{-W} and @samp{-Wunused}.
1529
1530To suppress this warning for an expression, simply cast it to void.  For
1531unused variables, parameters and labels, use the @samp{unused} attribute
1532(@pxref{Variable Attributes}).
1533
1534@item -Wuninitialized
1535An automatic variable is used without first being initialized.
1536
1537These warnings are possible only in optimizing compilation,
1538because they require data flow information that is computed only
1539when optimizing.  If you don't specify @samp{-O}, you simply won't
1540get these warnings.
1541
1542These warnings occur only for variables that are candidates for
1543register allocation.  Therefore, they do not occur for a variable that
1544is declared @code{volatile}, or whose address is taken, or whose size
1545is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
1546structures, unions or arrays, even when they are in registers.
1547
1548Note that there may be no warning about a variable that is used only
1549to compute a value that itself is never used, because such
1550computations may be deleted by data flow analysis before the warnings
1551are printed.
1552
1553These warnings are made optional because GCC is not smart
1554enough to see all the reasons why the code might be correct
1555despite appearing to have an error.  Here is one example of how
1556this can happen:
1557
1558@smallexample
1559@{
1560  int x;
1561  switch (y)
1562    @{
1563    case 1: x = 1;
1564      break;
1565    case 2: x = 4;
1566      break;
1567    case 3: x = 5;
1568    @}
1569  foo (x);
1570@}
1571@end smallexample
1572
1573@noindent
1574If the value of @code{y} is always 1, 2 or 3, then @code{x} is
1575always initialized, but GCC doesn't know this.  Here is
1576another common case:
1577
1578@smallexample
1579@{
1580  int save_y;
1581  if (change_y) save_y = y, y = new_y;
1582  @dots{}
1583  if (change_y) y = save_y;
1584@}
1585@end smallexample
1586
1587@noindent
1588This has no bug because @code{save_y} is used only if it is set.
1589
1590Some spurious warnings can be avoided if you declare all the functions
1591you use that never return as @code{noreturn}.  @xref{Function
1592Attributes}.
1593
1594@item -Wunknown-pragmas
1595@cindex warning for unknown pragmas
1596@cindex unknown pragmas, warning
1597@cindex pragmas, warning of unknown
1598Warn when a #pragma directive is encountered which is not understood by
1599GCC.  If this command line option is used, warnings will even be issued
1600for unknown pragmas in system header files.  This is not the case if
1601the warnings were only enabled by the @samp{-Wall} command line option.
1602
1603@item -Wall
1604All of the above @samp{-W} options combined.  This enables all the
1605warnings about constructions that some users consider questionable, and
1606that are easy to avoid (or modify to prevent the warning), even in
1607conjunction with macros.
1608@end table
1609
1610The following @samp{-W@dots{}} options are not implied by @samp{-Wall}.
1611Some of them warn about constructions that users generally do not
1612consider questionable, but which occasionally you might wish to check
1613for; others warn about constructions that are necessary or hard to avoid
1614in some cases, and there is no simple way to modify the code to suppress
1615the warning.
1616
1617@table @code
1618@item -W
1619Print extra warning messages for these events:
1620
1621@itemize @bullet
1622@cindex @code{longjmp} warnings
1623@item
1624A nonvolatile automatic variable might be changed by a call to
1625@code{longjmp}.  These warnings as well are possible only in
1626optimizing compilation.
1627
1628The compiler sees only the calls to @code{setjmp}.  It cannot know
1629where @code{longjmp} will be called; in fact, a signal handler could
1630call it at any point in the code.  As a result, you may get a warning
1631even when there is in fact no problem because @code{longjmp} cannot
1632in fact be called at the place which would cause a problem.
1633
1634@item
1635A function can return either with or without a value.  (Falling
1636off the end of the function body is considered returning without
1637a value.)  For example, this function would evoke such a
1638warning:
1639
1640@smallexample
1641@group
1642foo (a)
1643@{
1644  if (a > 0)
1645    return a;
1646@}
1647@end group
1648@end smallexample
1649
1650@item
1651An expression-statement or the left-hand side of a comma expression
1652contains no side effects.
1653To suppress the warning, cast the unused expression to void.
1654For example, an expression such as @samp{x[i,j]} will cause a warning,
1655but @samp{x[(void)i,j]} will not.
1656
1657@item
1658An unsigned value is compared against zero with @samp{<} or @samp{<=}.
1659
1660@item
1661A comparison like @samp{x<=y<=z} appears; this is equivalent to
1662@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
1663that of ordinary mathematical notation.
1664
1665@item
1666Storage-class specifiers like @code{static} are not the first things in
1667a declaration.  According to the C Standard, this usage is obsolescent.
1668
1669@item
1670If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused
1671arguments.
1672
1673@item
1674A comparison between signed and unsigned values could produce an
1675incorrect result when the signed value is converted to unsigned.
1676(But don't warn if @samp{-Wno-sign-compare} is also specified.)
1677
1678@item
1679An aggregate has a partly bracketed initializer.
1680For example, the following code would evoke such a warning,
1681because braces are missing around the initializer for @code{x.h}:
1682
1683@smallexample
1684struct s @{ int f, g; @};
1685struct t @{ struct s h; int i; @};
1686struct t x = @{ 1, 2, 3 @};
1687@end smallexample
1688
1689@item
1690An aggregate has an initializer which does not initialize all members.
1691For example, the following code would cause such a warning, because
1692@code{x.h} would be implicitly initialized to zero:
1693
1694@smallexample
1695struct s @{ int f, g, h; @};
1696struct s x = @{ 3, 4 @};
1697@end smallexample
1698@end itemize
1699
1700@item -Wtraditional
1701Warn about certain constructs that behave differently in traditional and
1702ANSI C.
1703
1704@itemize @bullet
1705@item
1706Macro arguments occurring within string constants in the macro body.
1707These would substitute the argument in traditional C, but are part of
1708the constant in ANSI C.
1709
1710@item
1711A function declared external in one block and then used after the end of
1712the block.
1713
1714@item
1715A @code{switch} statement has an operand of type @code{long}.
1716
1717@item
1718A non-@code{static} function declaration follows a @code{static} one.
1719This construct is not accepted by some traditional C compilers.
1720
1721@item
1722The ANSI type of an integer constant has a different width or signedness
1723from its traditional type.  This warning is only issued if the base of
1724the constant is ten.  I.e. hexadecimal or octal values, which typically
1725represent bit patterns, are not warned about.
1726@end itemize
1727
1728@item -Wundef
1729Warn if an undefined identifier is evaluated in an @samp{#if} directive.
1730
1731@item -Wshadow
1732Warn whenever a local variable shadows another local variable.
1733
1734@item -Wid-clash-@var{len}
1735Warn whenever two distinct identifiers match in the first @var{len}
1736characters.  This may help you prepare a program that will compile
1737with certain obsolete, brain-damaged compilers.
1738
1739@item -Wlarger-than-@var{len}
1740Warn whenever an object of larger than @var{len} bytes is defined.
1741
1742@item -Wpointer-arith
1743Warn about anything that depends on the ``size of'' a function type or
1744of @code{void}.  GNU C assigns these types a size of 1, for
1745convenience in calculations with @code{void *} pointers and pointers
1746to functions.
1747
1748@item -Wbad-function-cast
1749Warn whenever a function call is cast to a non-matching type.
1750For example, warn if @code{int malloc()} is cast to @code{anything *}.
1751
1752@item -Wcast-qual
1753Warn whenever a pointer is cast so as to remove a type qualifier from
1754the target type.  For example, warn if a @code{const char *} is cast
1755to an ordinary @code{char *}.
1756
1757@item -Wcast-align
1758Warn whenever a pointer is cast such that the required alignment of the
1759target is increased.  For example, warn if a @code{char *} is cast to
1760an @code{int *} on machines where integers can only be accessed at
1761two- or four-byte boundaries.
1762
1763@item -Wwrite-strings
1764Give string constants the type @code{const char[@var{length}]} so that
1765copying the address of one into a non-@code{const} @code{char *}
1766pointer will get a warning.  These warnings will help you find at
1767compile time code that can try to write into a string constant, but
1768only if you have been very careful about using @code{const} in
1769declarations and prototypes.  Otherwise, it will just be a nuisance;
1770this is why we did not make @samp{-Wall} request these warnings.
1771
1772@item -Wconversion
1773Warn if a prototype causes a type conversion that is different from what
1774would happen to the same argument in the absence of a prototype.  This
1775includes conversions of fixed point to floating and vice versa, and
1776conversions changing the width or signedness of a fixed point argument
1777except when the same as the default promotion.
1778
1779Also, warn if a negative integer constant expression is implicitly
1780converted to an unsigned type.  For example, warn about the assignment
1781@code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
1782casts like @code{(unsigned) -1}.
1783
1784@item -Wsign-compare
1785@cindex warning for comparison of signed and unsigned values
1786@cindex comparison of signed and unsigned values, warning
1787@cindex signed and unsigned values, comparison warning
1788Warn when a comparison between signed and unsigned values could produce
1789an incorrect result when the signed value is converted to unsigned.
1790This warning is also enabled by @samp{-W}; to get the other warnings
1791of @samp{-W} without this warning, use @samp{-W -Wno-sign-compare}.
1792
1793@item -Waggregate-return
1794Warn if any functions that return structures or unions are defined or
1795called.  (In languages where you can return an array, this also elicits
1796a warning.)
1797
1798@item -Wstrict-prototypes
1799Warn if a function is declared or defined without specifying the
1800argument types.  (An old-style function definition is permitted without
1801a warning if preceded by a declaration which specifies the argument
1802types.)
1803
1804@item -Wmissing-prototypes
1805Warn if a global function is defined without a previous prototype
1806declaration.  This warning is issued even if the definition itself
1807provides a prototype.  The aim is to detect global functions that fail
1808to be declared in header files.
1809
1810@item -Wmissing-declarations
1811Warn if a global function is defined without a previous declaration.
1812Do so even if the definition itself provides a prototype.
1813Use this option to detect global functions that are not declared in
1814header files.
1815
1816@item -Wmissing-noreturn
1817Warn about functions which might be candidates for attribute @code{noreturn}.
1818Note these are only possible candidates, not absolute ones.  Care should
1819be taken to manually verify functions actually do not ever return before
1820adding the @code{noreturn} attribute, otherwise subtle code generation
1821bugs could be introduced.
1822
1823@item -Wredundant-decls
1824Warn if anything is declared more than once in the same scope, even in
1825cases where multiple declaration is valid and changes nothing.
1826
1827@item -Wnested-externs
1828Warn if an @code{extern} declaration is encountered within an function.
1829
1830@item -Winline
1831Warn if a function can not be inlined, and either it was declared as inline,
1832or else the @samp{-finline-functions} option was given.
1833
1834@item -Wlong-long
1835Warn if @samp{long long} type is used.  This is default.  To inhibit
1836the warning messages, use @samp{-Wno-long-long}.  Flags
1837@samp{-Wlong-long} and @samp{-Wno-long-long} are taken into account
1838only when @samp{-pedantic} flag is used.
1839
1840@item -Werror
1841Make all warnings into errors.
1842@end table
1843
1844@node Debugging Options
1845@section Options for Debugging Your Program or GCC
1846@cindex options, debugging
1847@cindex debugging information options
1848
1849GCC has various special options that are used for debugging
1850either your program or GCC:
1851
1852@table @code
1853@item -g
1854Produce debugging information in the operating system's native format
1855(stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugging
1856information.
1857
1858On most systems that use stabs format, @samp{-g} enables use of extra
1859debugging information that only GDB can use; this extra information
1860makes debugging work better in GDB but will probably make other debuggers
1861crash or
1862refuse to read the program.  If you want to control for certain whether
1863to generate the extra information, use @samp{-gstabs+}, @samp{-gstabs},
1864@samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf-1+}, or @samp{-gdwarf-1}
1865(see below).
1866
1867Unlike most other C compilers, GCC allows you to use @samp{-g} with
1868@samp{-O}.  The shortcuts taken by optimized code may occasionally
1869produce surprising results: some variables you declared may not exist
1870at all; flow of control may briefly move where you did not expect it;
1871some statements may not be executed because they compute constant
1872results or their values were already at hand; some statements may
1873execute in different places because they were moved out of loops.
1874
1875Nevertheless it proves possible to debug optimized output.  This makes
1876it reasonable to use the optimizer for programs that might have bugs.
1877
1878The following options are useful when GCC is generated with the
1879capability for more than one debugging format.
1880
1881@item -ggdb
1882Produce debugging information for use by GDB.  This means to use the
1883most expressive format available (DWARF 2, stabs, or the native format
1884if neither of those are supported), including GDB extensions if at all
1885possible.
1886
1887@item -gstabs
1888Produce debugging information in stabs format (if that is supported),
1889without GDB extensions.  This is the format used by DBX on most BSD
1890systems.  On MIPS, Alpha and System V Release 4 systems this option
1891produces stabs debugging output which is not understood by DBX or SDB.
1892On System V Release 4 systems this option requires the GNU assembler.
1893
1894@item -gstabs+
1895Produce debugging information in stabs format (if that is supported),
1896using GNU extensions understood only by the GNU debugger (GDB).  The
1897use of these extensions is likely to make other debuggers crash or
1898refuse to read the program.
1899
1900@item -gcoff
1901Produce debugging information in COFF format (if that is supported).
1902This is the format used by SDB on most System V systems prior to
1903System V Release 4.
1904
1905@item -gxcoff
1906Produce debugging information in XCOFF format (if that is supported).
1907This is the format used by the DBX debugger on IBM RS/6000 systems.
1908
1909@item -gxcoff+
1910Produce debugging information in XCOFF format (if that is supported),
1911using GNU extensions understood only by the GNU debugger (GDB).  The
1912use of these extensions is likely to make other debuggers crash or
1913refuse to read the program, and may cause assemblers other than the GNU
1914assembler (GAS) to fail with an error.
1915
1916@item -gdwarf
1917Produce debugging information in DWARF version 1 format (if that is
1918supported).  This is the format used by SDB on most System V Release 4
1919systems.
1920
1921@item -gdwarf+
1922Produce debugging information in DWARF version 1 format (if that is
1923supported), using GNU extensions understood only by the GNU debugger
1924(GDB).  The use of these extensions is likely to make other debuggers
1925crash or refuse to read the program.
1926
1927@item -gdwarf-2
1928Produce debugging information in DWARF version 2 format (if that is
1929supported).  This is the format used by DBX on IRIX 6.
1930
1931@item -g@var{level}
1932@itemx -ggdb@var{level}
1933@itemx -gstabs@var{level}
1934@itemx -gcoff@var{level}
1935@itemx -gxcoff@var{level}
1936@itemx -gdwarf@var{level}
1937@itemx -gdwarf-2@var{level}
1938Request debugging information and also use @var{level} to specify how
1939much information.  The default level is 2.
1940
1941Level 1 produces minimal information, enough for making backtraces in
1942parts of the program that you don't plan to debug.  This includes
1943descriptions of functions and external variables, but no information
1944about local variables and no line numbers.
1945
1946Level 3 includes extra information, such as all the macro definitions
1947present in the program.  Some debuggers support macro expansion when
1948you use @samp{-g3}.
1949
1950@cindex @code{prof}
1951@item -p
1952Generate extra code to write profile information suitable for the
1953analysis program @code{prof}.  You must use this option when compiling
1954the source files you want data about, and you must also use it when
1955linking.
1956
1957@cindex @code{gprof}
1958@item -pg
1959Generate extra code to write profile information suitable for the
1960analysis program @code{gprof}.  You must use this option when compiling
1961the source files you want data about, and you must also use it when
1962linking.
1963
1964@cindex @code{tcov}
1965@item -a
1966Generate extra code to write profile information for basic blocks, which will
1967record the number of times each basic block is executed, the basic block start
1968address, and the function name containing the basic block.  If @samp{-g} is
1969used, the line number and filename of the start of the basic block will also be
1970recorded.  If not overridden by the machine description, the default action is
1971to append to the text file @file{bb.out}.
1972
1973This data could be analyzed by a program like @code{tcov}.  Note,
1974however, that the format of the data is not what @code{tcov} expects.
1975Eventually GNU @code{gprof} should be extended to process this data.
1976
1977@item -Q
1978Makes the compiler print out each function name as it is compiled, and
1979print some statistics about each pass when it finishes.
1980
1981@item -ax
1982Generate extra code to profile basic blocks.  Your executable will
1983produce output that is a superset of that produced when @samp{-a} is
1984used.  Additional output is the source and target address of the basic
1985blocks where a jump takes place, the number of times a jump is executed,
1986and (optionally) the complete sequence of basic blocks being executed.
1987The output is appended to file @file{bb.out}.
1988
1989You can examine different profiling aspects without recompilation.  Your
1990executable will read a list of function names from file @file{bb.in}.
1991Profiling starts when a function on the list is entered and stops when
1992that invocation is exited.  To exclude a function from profiling, prefix
1993its name with `-'.  If a function name is not unique, you can
1994disambiguate it by writing it in the form
1995@samp{/path/filename.d:functionname}.  Your executable will write the
1996available paths and filenames in file @file{bb.out}.
1997
1998Several function names have a special meaning:
1999@table @code
2000@item __bb_jumps__
2001Write source, target and frequency of jumps to file @file{bb.out}.
2002@item __bb_hidecall__
2003Exclude function calls from frequency count.
2004@item __bb_showret__
2005Include function returns in frequency count.
2006@item __bb_trace__
2007Write the sequence of basic blocks executed to file @file{bbtrace.gz}.
2008The file will be compressed using the program @samp{gzip}, which must
2009exist in your @code{PATH}.  On systems without the @samp{popen}
2010function, the file will be named @file{bbtrace} and will not be
2011compressed.  @strong{Profiling for even a few seconds on these systems
2012will produce a very large file.}  Note: @code{__bb_hidecall__} and
2013@code{__bb_showret__} will not affect the sequence written to
2014@file{bbtrace.gz}.
2015@end table
2016
2017Here's a short example using different profiling parameters
2018in file @file{bb.in}.  Assume function @code{foo} consists of basic blocks
20191 and 2 and is called twice from block 3 of function @code{main}.  After
2020the calls, block 3 transfers control to block 4 of @code{main}.
2021
2022With @code{__bb_trace__} and @code{main} contained in file @file{bb.in},
2023the following sequence of blocks is written to file @file{bbtrace.gz}:
20240 3 1 2 1 2 4.  The return from block 2 to block 3 is not shown, because
2025the return is to a point inside the block and not to the top.  The
2026block address 0 always indicates, that control is transferred
2027to the trace from somewhere outside the observed functions.  With
2028@samp{-foo} added to @file{bb.in}, the blocks of function
2029@code{foo} are removed from the trace, so only 0 3 4 remains.
2030
2031With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in},
2032jump frequencies will be written to file @file{bb.out}.  The
2033frequencies are obtained by constructing a trace of blocks
2034and incrementing a counter for every neighbouring pair of blocks
2035in the trace.  The trace 0 3 1 2 1 2 4 displays the following
2036frequencies:
2037
2038@example
2039Jump from block 0x0 to block 0x3 executed 1 time(s)
2040Jump from block 0x3 to block 0x1 executed 1 time(s)
2041Jump from block 0x1 to block 0x2 executed 2 time(s)
2042Jump from block 0x2 to block 0x1 executed 1 time(s)
2043Jump from block 0x2 to block 0x4 executed 1 time(s)
2044@end example
2045
2046With @code{__bb_hidecall__}, control transfer due to call instructions
2047is removed from the trace, that is the trace is cut into three parts: 0
20483 4, 0 1 2 and 0 1 2.  With @code{__bb_showret__}, control transfer due
2049to return instructions is added to the trace.  The trace becomes: 0 3 1
20502 3 1 2 3 4.  Note, that this trace is not the same, as the sequence
2051written to @file{bbtrace.gz}.  It is solely used for counting jump
2052frequencies.
2053
2054@item -fprofile-arcs
2055Instrument @dfn{arcs} during compilation.  For each function of your
2056program, GCC creates a program flow graph, then finds a spanning tree
2057for the graph.  Only arcs that are not on the spanning tree have to be
2058instrumented: the compiler adds code to count the number of times that these
2059arcs are executed.  When an arc is the only exit or only entrance to a
2060block, the instrumentation code can be added to the block; otherwise, a
2061new basic block must be created to hold the instrumentation code.
2062
2063Since not every arc in the program must be instrumented, programs
2064compiled with this option run faster than programs compiled with
2065@samp{-a}, which adds instrumentation code to every basic block in the
2066program.  The tradeoff: since @code{gcov} does not have
2067execution counts for all branches, it must start with the execution
2068counts for the instrumented branches, and then iterate over the program
2069flow graph until the entire graph has been solved.  Hence, @code{gcov}
2070runs a little more slowly than a program which uses information from
2071@samp{-a}.
2072
2073@samp{-fprofile-arcs} also makes it possible to estimate branch
2074probabilities, and to calculate basic block execution counts.  In
2075general, basic block execution counts do not give enough information to
2076estimate all branch probabilities.  When the compiled program exits, it
2077saves the arc execution counts to a file called
2078@file{@var{sourcename}.da}.  Use the compiler option
2079@samp{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
2080Control Optimization}) when recompiling, to optimize using estimated
2081branch probabilities.
2082
2083@need 2000
2084@item -ftest-coverage
2085Create data files for the @code{gcov} code-coverage utility
2086(@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}).
2087The data file names begin with the name of your source file:
2088
2089@table @code
2090@item @var{sourcename}.bb
2091A mapping from basic blocks to line numbers, which @code{gcov} uses to
2092associate basic block execution counts with line numbers.
2093
2094@item @var{sourcename}.bbg
2095A list of all arcs in the program flow graph.  This allows @code{gcov}
2096to reconstruct the program flow graph, so that it can compute all basic
2097block and arc execution counts from the information in the
2098@code{@var{sourcename}.da} file (this last file is the output from
2099@samp{-fprofile-arcs}).
2100@end table
2101
2102@item -Q
2103Makes the compiler print out each function name as it is compiled, and
2104print some statistics about each pass when it finishes.
2105
2106@item -d@var{letters}
2107Says to make debugging dumps during compilation at times specified by
2108@var{letters}.  This is used for debugging the compiler.  The file names
2109for most of the dumps are made by appending a word to the source file
2110name (e.g.  @file{foo.c.rtl} or @file{foo.c.jump}).  Here are the
2111possible letters for use in @var{letters}, and their meanings:
2112
2113@table @samp
2114@item b
2115Dump after computing branch probabilities, to @file{@var{file}.bp}.
2116@item c
2117Dump after instruction combination, to the file @file{@var{file}.combine}.
2118@item d
2119Dump after delayed branch scheduling, to @file{@var{file}.dbr}.
2120@item D
2121Dump all macro definitions, at the end of preprocessing, in addition to
2122normal output.
2123@item r
2124Dump after RTL generation, to @file{@var{file}.rtl}.
2125@item j
2126Dump after first jump optimization, to @file{@var{file}.jump}.
2127@item F
2128Dump after purging ADDRESSOF, to @file{@var{file}.addressof}.
2129@item f
2130Dump after flow analysis, to @file{@var{file}.flow}.
2131@item g
2132Dump after global register allocation, to @file{@var{file}.greg}.
2133@item G      
2134Dump after GCSE, to @file{@var{file}.gcse}.
2135@item j
2136Dump after first jump optimization, to @file{@var{file}.jump}.
2137@item J
2138Dump after last jump optimization, to @file{@var{file}.jump2}.
2139@item k
2140Dump after conversion from registers to stack, to @file{@var{file}.stack}.
2141@item l
2142Dump after local register allocation, to @file{@var{file}.lreg}.
2143@item L
2144Dump after loop optimization, to @file{@var{file}.loop}.
2145@item M
2146Dump after performing the machine dependent reorganisation pass, to
2147@file{@var{file}.mach}. 
2148@item N
2149Dump after the register move pass, to @file{@var{file}.regmove}.
2150@item r
2151Dump after RTL generation, to @file{@var{file}.rtl}.
2152@item R
2153Dump after the second instruction scheduling pass, to @file{@var{file}.sched2}.
2154@item s
2155Dump after CSE (including the jump optimization that sometimes follows
2156CSE), to @file{@var{file}.cse}. 
2157@item S
2158Dump after the first instruction scheduling pass, to @file{@var{file}.sched}.
2159@item t
2160Dump after the second CSE pass (including the jump optimization that
2161sometimes follows CSE), to @file{@var{file}.cse2}. 
2162@item a
2163Produce all the dumps listed above.
2164@item m
2165Print statistics on memory usage, at the end of the run, to
2166standard error.
2167@item p
2168Annotate the assembler output with a comment indicating which
2169pattern and alternative was used.  The length of each instruction is
2170also printed.
2171@item x
2172Just generate RTL for a function instead of compiling it.  Usually used
2173with @samp{r}.
2174@item y
2175Dump debugging information during parsing, to standard error.
2176@item A
2177Annotate the assembler output with miscellaneous debugging information.
2178@end table
2179
2180@item -fdump-unnumbered
2181When doing debugging dumps (see -d option above), suppress instruction
2182numbers and line number note output.  This makes it more feasible to
2183use diff on debugging dumps for compiler invokations with different
2184options, in particular with and without -g.
2185
2186@item -fpretend-float
2187When running a cross-compiler, pretend that the target machine uses the
2188same floating point format as the host machine.  This causes incorrect
2189output of the actual floating constants, but the actual instruction
2190sequence will probably be the same as GCC would make when running on
2191the target machine.
2192
2193@item -save-temps
2194Store the usual ``temporary'' intermediate files permanently; place them
2195in the current directory and name them based on the source file.  Thus,
2196compiling @file{foo.c} with @samp{-c -save-temps} would produce files
2197@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.
2198
2199@item -print-file-name=@var{library}
2200Print the full absolute name of the library file @var{library} that
2201would be used when linking---and don't do anything else.  With this
2202option, GCC does not compile or link anything; it just prints the
2203file name.
2204
2205@item -print-prog-name=@var{program}
2206Like @samp{-print-file-name}, but searches for a program such as @samp{cpp}.
2207
2208@item -print-libgcc-file-name
2209Same as @samp{-print-file-name=libgcc.a}.
2210
2211This is useful when you use @samp{-nostdlib} or @samp{-nodefaultlibs}
2212but you do want to link with @file{libgcc.a}.  You can do
2213
2214@example
2215gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
2216@end example
2217
2218@item -print-search-dirs
2219Print the name of the configured installation directory and a list of
2220program and library directories gcc will search---and don't do anything else.
2221
2222This is useful when gcc prints the error message
2223@samp{installation problem, cannot exec cpp: No such file or directory}.
2224To resolve this you either need to put @file{cpp} and the other compiler
2225components where gcc expects to find them, or you can set the environment
2226variable @code{GCC_EXEC_PREFIX} to the directory where you installed them.
2227Don't forget the trailing '/'.
2228@xref{Environment Variables}.
2229@end table
2230
2231@node Optimize Options
2232@section Options That Control Optimization
2233@cindex optimize options
2234@cindex options, optimization
2235
2236These options control various sorts of optimizations:
2237
2238@table @code
2239@item -O
2240@itemx -O1
2241Optimize.  Optimizing compilation takes somewhat more time, and a lot
2242more memory for a large function.
2243
2244Without @samp{-O}, the compiler's goal is to reduce the cost of
2245compilation and to make debugging produce the expected results.
2246Statements are independent: if you stop the program with a breakpoint
2247between statements, you can then assign a new value to any variable or
2248change the program counter to any other statement in the function and
2249get exactly the results you would expect from the source code.
2250
2251Without @samp{-O}, the compiler only allocates variables declared
2252@code{register} in registers.  The resulting compiled code is a little
2253worse than produced by PCC without @samp{-O}.
2254
2255With @samp{-O}, the compiler tries to reduce code size and execution
2256time.
2257
2258When you specify @samp{-O}, the compiler turns on @samp{-fthread-jumps}
2259and @samp{-fdefer-pop} on all machines.  The compiler turns on
2260@samp{-fdelayed-branch} on machines that have delay slots, and
2261@samp{-fomit-frame-pointer} on machines that can support debugging even
2262without a frame pointer.  On some machines the compiler also turns
2263on other flags.@refill
2264
2265@item -O2
2266Optimize even more.  GCC performs nearly all supported optimizations
2267that do not involve a space-speed tradeoff.  The compiler does not
2268perform loop unrolling or function inlining when you specify @samp{-O2}.
2269As compared to @samp{-O}, this option increases both compilation time
2270and the performance of the generated code.
2271
2272@samp{-O2} turns on all optional optimizations except for loop unrolling,
2273function inlining, and strict aliasing optimizations.  It also turns on the
2274@samp{-fforce-mem} option on all machines and frame pointer elimination on
2275machines where doing so does not interfere with debugging.
2276
2277@item -O3
2278Optimize yet more.  @samp{-O3} turns on all optimizations specified by
2279@samp{-O2} and also turns on the @samp{inline-functions} option.
2280
2281@item -O0
2282Do not optimize.
2283
2284@item -Os
2285Optimize for size.  @samp{-Os} enables all @samp{-O2} optimizations that
2286do not typically increase code size.  It also performs further
2287optimizations designed to reduce code size.
2288
2289If you use multiple @samp{-O} options, with or without level numbers,
2290the last such option is the one that is effective.
2291@end table
2292
2293Options of the form @samp{-f@var{flag}} specify machine-independent
2294flags.  Most flags have both positive and negative forms; the negative
2295form of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below,
2296only one of the forms is listed---the one which is not the default.
2297You can figure out the other form by either removing @samp{no-} or
2298adding it.
2299
2300@table @code
2301@item -ffloat-store
2302Do not store floating point variables in registers, and inhibit other
2303options that might change whether a floating point value is taken from a
2304register or memory.
2305
2306@cindex floating point precision
2307This option prevents undesirable excess precision on machines such as
2308the 68000 where the floating registers (of the 68881) keep more
2309precision than a @code{double} is supposed to have.  Similarly for the
2310x86 architecture.  For most programs, the excess precision does only
2311good, but a few programs rely on the precise definition of IEEE floating
2312point.  Use @samp{-ffloat-store} for such programs, after modifying
2313them to store all pertinent intermediate computations into variables.
2314
2315@item -fno-default-inline
2316Do not make member functions inline by default merely because they are
2317defined inside the class scope (C++ only).  Otherwise, when you specify
2318@w{@samp{-O}}, member functions defined inside class scope are compiled
2319inline by default; i.e., you don't need to add @samp{inline} in front of
2320the member function name.
2321
2322@item -fno-defer-pop
2323Always pop the arguments to each function call as soon as that function
2324returns.  For machines which must pop arguments after a function call,
2325the compiler normally lets arguments accumulate on the stack for several
2326function calls and pops them all at once.
2327
2328@item -fforce-mem
2329Force memory operands to be copied into registers before doing
2330arithmetic on them.  This produces better code by making all memory
2331references potential common subexpressions.  When they are not common
2332subexpressions, instruction combination should eliminate the separate
2333register-load.  The @samp{-O2} option turns on this option.
2334
2335@item -fforce-addr
2336Force memory address constants to be copied into registers before
2337doing arithmetic on them.  This may produce better code just as
2338@samp{-fforce-mem} may.
2339
2340@item -fomit-frame-pointer
2341Don't keep the frame pointer in a register for functions that
2342don't need one.  This avoids the instructions to save, set up and
2343restore frame pointers; it also makes an extra register available
2344in many functions.  @strong{It also makes debugging impossible on
2345some machines.}
2346
2347@ifset INTERNALS
2348On some machines, such as the Vax, this flag has no effect, because
2349the standard calling sequence automatically handles the frame pointer
2350and nothing is saved by pretending it doesn't exist.  The
2351machine-description macro @code{FRAME_POINTER_REQUIRED} controls
2352whether a target machine supports this flag.  @xref{Registers}.@refill
2353@end ifset
2354@ifclear INTERNALS
2355On some machines, such as the Vax, this flag has no effect, because
2356the standard calling sequence automatically handles the frame pointer
2357and nothing is saved by pretending it doesn't exist.  The
2358machine-description macro @code{FRAME_POINTER_REQUIRED} controls
2359whether a target machine supports this flag.  @xref{Registers,,Register
2360Usage, gcc.info, Using and Porting GCC}.@refill
2361@end ifclear
2362
2363@item -fno-inline
2364Don't pay attention to the @code{inline} keyword.  Normally this option
2365is used to keep the compiler from expanding any functions inline.
2366Note that if you are not optimizing, no functions can be expanded inline.
2367
2368@item -finline-functions
2369Integrate all simple functions into their callers.  The compiler
2370heuristically decides which functions are simple enough to be worth
2371integrating in this way.
2372
2373If all calls to a given function are integrated, and the function is
2374declared @code{static}, then the function is normally not output as
2375assembler code in its own right.
2376
2377@item -finline-limit-@var{n}
2378By default, gcc limits the size of functions that can be inlined.  This flag
2379allows the control of this limit for functions that are explicitly marked as
2380inline (ie marked with the inline keyword or defined within the class 
2381definition in c++).  @var{n} is the size of functions that can be inlined in 
2382number of pseudo instructions (not counting parameter handling).  The default
2383value of n is 2000 .  Increasing this value (to e.g. 5000) can result in more
2384inlined code at the cost of compilation time and memory consumption and will
2385result in larger excutables. Too much inlining can decrease performance
2386again because of the limited size of your CPU's instruction cache.
2387Decreasing (e.g. to 250) usually makes the compilation faster and less code
2388will be inlined (which presumably means smaller executables but slower
2389programs).  This option is particularly useful for programs that use
2390inlining heavily such as those based on recursive templates with c++.
2391Note that functions at the leaf of the call tree get a bonus.
2392
2393@emph{Note:} pseudo instruction represents, in this particular context, an
2394abstract measurement of function's size.  In no way, it represents a count
2395of assembly instructions and as such its exact meaning might change from one
2396release to an another.
2397
2398@item -fkeep-inline-functions
2399Even if all calls to a given function are integrated, and the function
2400is declared @code{static}, nevertheless output a separate run-time
2401callable version of the function.  This switch does not affect
2402@code{extern inline} functions.
2403
2404@item -fkeep-static-consts
2405Emit variables declared @code{static const} when optimization isn't turned
2406on, even if the variables aren't referenced.
2407
2408GCC enables this option by default.  If you want to force the compiler to
2409check if the variable was referenced, regardless of whether or not
2410optimization is turned on, use the @samp{-fno-keep-static-consts} option.
2411
2412@item -fno-function-cse
2413Do not put function addresses in registers; make each instruction that
2414calls a constant function contain the function's address explicitly.
2415
2416This option results in less efficient code, but some strange hacks
2417that alter the assembler output may be confused by the optimizations
2418performed when this option is not used.
2419
2420@item -ffast-math
2421This option allows GCC to violate some ANSI or IEEE rules and/or
2422specifications in the interest of optimizing code for speed.  For
2423example, it allows the compiler to assume arguments to the @code{sqrt}
2424function are non-negative numbers and that no floating-point values
2425are NaNs.
2426
2427This option should never be turned on by any @samp{-O} option since
2428it can result in incorrect output for programs which depend on
2429an exact implementation of IEEE or ANSI rules/specifications for
2430math functions.
2431@end table
2432
2433@c following causes underfulls.. they don't look great, but we deal.
2434@c --mew 26jan93
2435The following options control specific optimizations.  The @samp{-O2}
2436option turns on all of these optimizations except @samp{-funroll-loops}
2437@samp{-funroll-all-loops}, and @samp{-fstrict-aliasing}.  On most machines, the
2438@samp{-O} option turns on the @samp{-fthread-jumps} and @samp{-fdelayed-branch}
2439options, but specific machines may handle it differently.
2440
2441You can use the following flags in the rare cases when ``fine-tuning''
2442of optimizations to be performed is desired.
2443
2444@table @code
2445@item -fstrength-reduce
2446Perform the optimizations of loop strength reduction and
2447elimination of iteration variables.
2448
2449@item -fthread-jumps
2450Perform optimizations where we check to see if a jump branches to a
2451location where another comparison subsumed by the first is found.  If
2452so, the first branch is redirected to either the destination of the
2453second branch or a point immediately following it, depending on whether
2454the condition is known to be true or false.
2455
2456@item -fcse-follow-jumps
2457In common subexpression elimination, scan through jump instructions
2458when the target of the jump is not reached by any other path.  For
2459example, when CSE encounters an @code{if} statement with an
2460@code{else} clause, CSE will follow the jump when the condition
2461tested is false.
2462
2463@item -fcse-skip-blocks
2464This is similar to @samp{-fcse-follow-jumps}, but causes CSE to
2465follow jumps which conditionally skip over blocks.  When CSE
2466encounters a simple @code{if} statement with no else clause,
2467@samp{-fcse-skip-blocks} causes CSE to follow the jump around the
2468body of the @code{if}.
2469
2470@item -frerun-cse-after-loop
2471Re-run common subexpression elimination after loop optimizations has been
2472performed.
2473
2474@item -frerun-loop-opt
2475Run the loop optimizer twice.
2476
2477@item -fgcse
2478Perform a global common subexpression elimination pass.
2479This pass also performs global constant and copy propagation.
2480
2481@item -fexpensive-optimizations
2482Perform a number of minor optimizations that are relatively expensive.
2483
2484@item -foptimize-register-moves
2485@itemx -fregmove
2486Attempt to reassign register numbers in move instructions and as
2487operands of other simple instructions in order to maximize the amount of
2488register tying.  This is especially helpful on machines with two-operand
2489instructions.  GCC enables this optimization by default with @samp{-O2}
2490or higher.
2491
2492Note @code{-fregmove} and @code{-foptimize-register-moves} are the same
2493optimization.
2494
2495@item -fdelayed-branch
2496If supported for the target machine, attempt to reorder instructions
2497to exploit instruction slots available after delayed branch
2498instructions.
2499
2500@item -fschedule-insns
2501If supported for the target machine, attempt to reorder instructions to
2502eliminate execution stalls due to required data being unavailable.  This
2503helps machines that have slow floating point or memory load instructions
2504by allowing other instructions to be issued until the result of the load
2505or floating point instruction is required.
2506
2507@item -fschedule-insns2
2508Similar to @samp{-fschedule-insns}, but requests an additional pass of
2509instruction scheduling after register allocation has been done.  This is
2510especially useful on machines with a relatively small number of
2511registers and where memory load instructions take more than one cycle.
2512
2513@item -ffunction-sections
2514@itemx -fdata-sections
2515Place each function or data item into its own section in the output
2516file if the target supports arbitrary sections.  The name of the
2517function or the name of the data item determines the section's name
2518in the output file.
2519
2520Use these options on systems where the linker can perform optimizations
2521to improve locality of reference in the instruction space.  HPPA
2522processors running HP-UX and Sparc processors running Solaris 2 have
2523linkers with such optimizations.  Other systems using the ELF object format
2524as well as AIX may have these optimizations in the future.
2525
2526Only use these options when there are significant benefits from doing
2527so.  When you specify these options, the assembler and linker will
2528create larger object and executable files and will also be slower.
2529You will not be able to use @code{gprof} on all systems if you
2530specify this option and you may have problems with debugging if
2531you specify both this option and @samp{-g}.
2532
2533@item -fcaller-saves
2534Enable values to be allocated in registers that will be clobbered by
2535function calls, by emitting extra instructions to save and restore the
2536registers around such calls.  Such allocation is done only when it
2537seems to result in better code than would otherwise be produced.
2538
2539This option is always enabled by default on certain machines, usually
2540those which have no call-preserved registers to use instead.
2541
2542For all machines, optimization level 2 and higher enables this flag by
2543default.
2544
2545@item -funroll-loops
2546Perform the optimization of loop unrolling.  This is only done for loops
2547whose number of iterations can be determined at compile time or run time.
2548@samp{-funroll-loops} implies both @samp{-fstrength-reduce} and
2549@samp{-frerun-cse-after-loop}.
2550
2551@item -funroll-all-loops
2552Perform the optimization of loop unrolling.  This is done for all loops
2553and usually makes programs run more slowly.  @samp{-funroll-all-loops}
2554implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}.
2555
2556@item -fmove-all-movables
2557Forces all invariant computations in loops to be moved
2558outside the loop.
2559
2560@item -freduce-all-givs
2561Forces all general-induction variables in loops to be
2562strength-reduced.
2563
2564@emph{Note:} When compiling programs written in Fortran,
2565@samp{-fmove-all-movables} and @samp{-freduce-all-givs} are enabled
2566by default when you use the optimizer.
2567
2568These options may generate better or worse code; results are highly
2569dependent on the structure of loops within the source code.
2570
2571These two options are intended to be removed someday, once
2572they have helped determine the efficacy of various
2573approaches to improving loop optimizations.
2574
2575Please let us (@code{gcc@@gcc.gnu.org} and @code{fortran@@gnu.org})
2576know how use of these options affects
2577the performance of your production code.
2578We're very interested in code that runs @emph{slower}
2579when these options are @emph{enabled}.
2580
2581@item -fno-peephole
2582Disable any machine-specific peephole optimizations.
2583
2584@item -fbranch-probabilities
2585After running a program compiled with @samp{-fprofile-arcs}
2586(@pxref{Debugging Options,, Options for Debugging Your Program or
2587@code{gcc}}), you can compile it a second time using
2588@samp{-fbranch-probabilities}, to improve optimizations based on
2589guessing the path a branch might take.
2590
2591@ifset INTERNALS
2592With @samp{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
2593note on the first instruction of each basic block, and a
2594@samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
2595These can be used to improve optimization.  Currently, they are only
2596used in one place: in @file{reorg.c}, instead of guessing which path a
2597branch is mostly to take, the @samp{REG_BR_PROB} values are used to
2598exactly determine which path is taken more often.
2599@end ifset
2600
2601@item -fstrict-aliasing
2602Allows the compiler to assume the strictest aliasing rules applicable to
2603the language being compiled.  For C (and C++), this activates
2604optimizations based on the type of expressions.  In particular, an
2605object of one type is assumed never to reside at the same address as an
2606object of a different type, unless the types are almost the same.  For
2607example, an @code{unsigned int} can alias an @code{int}, but not a
2608@code{void*} or a @code{double}.  A character type may alias any other
2609type.  
2610
2611Pay special attention to code like this:
2612@example
2613union a_union @{ 
2614  int i;
2615  double d;
2616@};
2617
2618int f() @{
2619  a_union t;
2620  t.d = 3.0;
2621  return t.i;
2622@}
2623@end example
2624The practice of reading from a different union member than the one most
2625recently written to (called ``type-punning'') is common.  Even with
2626@samp{-fstrict-aliasing}, type-punning is allowed, provided the memory
2627is accessed through the union type.  So, the code above will work as
2628expected.  However, this code might not:
2629@example
2630int f() @{ 
2631  a_union t;
2632  int* ip;
2633  t.d = 3.0;
2634  ip = &t.i;
2635  return *ip;
2636@}
2637@end example
2638
2639@ifset INTERNALS
2640Every language that wishes to perform language-specific alias analysis
2641should define a function that computes, given an @code{tree}
2642node, an alias set for the node.  Nodes in different alias sets are not
2643allowed to alias.  For an example, see the C front-end function
2644@code{c_get_alias_set}.
2645@end ifset
2646
2647@end table
2648
2649@node Preprocessor Options
2650@section Options Controlling the Preprocessor
2651@cindex preprocessor options
2652@cindex options, preprocessor
2653
2654These options control the C preprocessor, which is run on each C source
2655file before actual compilation.
2656
2657If you use the @samp{-E} option, nothing is done except preprocessing.
2658Some of these options make sense only together with @samp{-E} because
2659they cause the preprocessor output to be unsuitable for actual
2660compilation.
2661
2662@table @code
2663@item -include @var{file}
2664Process @var{file} as input before processing the regular input file.
2665In effect, the contents of @var{file} are compiled first.  Any @samp{-D}
2666and @samp{-U} options on the command line are always processed before
2667@samp{-include @var{file}}, regardless of the order in which they are
2668written.  All the @samp{-include} and @samp{-imacros} options are
2669processed in the order in which they are written.
2670
2671@item -imacros @var{file}
2672Process @var{file} as input, discarding the resulting output, before
2673processing the regular input file.  Because the output generated from
2674@var{file} is discarded, the only effect of @samp{-imacros @var{file}}
2675is to make the macros defined in @var{file} available for use in the
2676main input.
2677
2678Any @samp{-D} and @samp{-U} options on the command line are always
2679processed before @samp{-imacros @var{file}}, regardless of the order in
2680which they are written.  All the @samp{-include} and @samp{-imacros}
2681options are processed in the order in which they are written.
2682
2683@item -idirafter @var{dir}
2684@cindex second include path
2685Add the directory @var{dir} to the second include path.  The directories
2686on the second include path are searched when a header file is not found
2687in any of the directories in the main include path (the one that
2688@samp{-I} adds to).
2689
2690@item -iprefix @var{prefix}
2691Specify @var{prefix} as the prefix for subsequent @samp{-iwithprefix}
2692options.
2693
2694@item -iwithprefix @var{dir}
2695Add a directory to the second include path.  The directory's name is
2696made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
2697specified previously with @samp{-iprefix}.  If you have not specified a
2698prefix yet, the directory containing the installed passes of the
2699compiler is used as the default.
2700
2701@item -iwithprefixbefore @var{dir}
2702Add a directory to the main include path.  The directory's name is made
2703by concatenating @var{prefix} and @var{dir}, as in the case of
2704@samp{-iwithprefix}.
2705
2706@item -isystem @var{dir}
2707Add a directory to the beginning of the second include path, marking it
2708as a system directory, so that it gets the same special treatment as
2709is applied to the standard system directories.
2710
2711@item -nostdinc
2712Do not search the standard system directories for header files.  Only
2713the directories you have specified with @samp{-I} options (and the
2714current directory, if appropriate) are searched.  @xref{Directory
2715Options}, for information on @samp{-I}.
2716
2717By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
2718search path to only those directories you specify explicitly.
2719
2720@item -undef
2721Do not predefine any nonstandard macros.  (Including architecture flags).
2722
2723@item -E
2724Run only the C preprocessor.  Preprocess all the C source files
2725specified and output the results to standard output or to the
2726specified output file.
2727
2728@item -C
2729Tell the preprocessor not to discard comments.  Used with the
2730@samp{-E} option.
2731
2732@item -P
2733Tell the preprocessor not to generate @samp{#line} directives.
2734Used with the @samp{-E} option.
2735
2736@cindex make
2737@cindex dependencies, make
2738@item -M
2739Tell the preprocessor to output a rule suitable for @code{make}
2740describing the dependencies of each object file.  For each source file,
2741the preprocessor outputs one @code{make}-rule whose target is the object
2742file name for that source file and whose dependencies are all the
2743@code{#include} header files it uses.  This rule may be a single line or
2744may be continued with @samp{\}-newline if it is long.  The list of rules
2745is printed on standard output instead of the preprocessed C program.
2746
2747@samp{-M} implies @samp{-E}.
2748
2749Another way to specify output of a @code{make} rule is by setting
2750the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
2751Variables}).
2752
2753@item -MM
2754Like @samp{-M} but the output mentions only the user header files
2755included with @samp{#include "@var{file}"}.  System header files
2756included with @samp{#include <@var{file}>} are omitted.
2757
2758@item -MD
2759Like @samp{-M} but the dependency information is written to a file made by
2760replacing ".c" with ".d" at the end of the input file names.
2761This is in addition to compiling the file as specified---@samp{-MD} does
2762not inhibit ordinary compilation the way @samp{-M} does.
2763
2764In Mach, you can use the utility @code{md} to merge multiple dependency
2765files into a single dependency file suitable for using with the @samp{make}
2766command.
2767
2768@item -MMD
2769Like @samp{-MD} except mention only user header files, not system
2770header files.
2771
2772@item -MG
2773Treat missing header files as generated files and assume they live in the
2774same directory as the source file.  If you specify @samp{-MG}, you
2775must also specify either @samp{-M} or @samp{-MM}.  @samp{-MG} is not
2776supported with @samp{-MD} or @samp{-MMD}.
2777
2778@item -H
2779Print the name of each header file used, in addition to other normal
2780activities.
2781
2782@item -A@var{question}(@var{answer})
2783Assert the answer @var{answer} for @var{question}, in case it is tested
2784with a preprocessing conditional such as @samp{#if
2785#@var{question}(@var{answer})}.  @samp{-A-} disables the standard
2786assertions that normally describe the target machine.
2787
2788@item -D@var{macro}
2789Define macro @var{macro} with the string @samp{1} as its definition.
2790
2791@item -D@var{macro}=@var{defn}
2792Define macro @var{macro} as @var{defn}.  All instances of @samp{-D} on
2793the command line are processed before any @samp{-U} options.
2794
2795@item -U@var{macro}
2796Undefine macro @var{macro}.  @samp{-U} options are evaluated after all
2797@samp{-D} options, but before any @samp{-include} and @samp{-imacros}
2798options.
2799
2800@item -dM
2801Tell the preprocessor to output only a list of the macro definitions
2802that are in effect at the end of preprocessing.  Used with the @samp{-E}
2803option.
2804
2805@item -dD
2806Tell the preprocessing to pass all macro definitions into the output, in
2807their proper sequence in the rest of the output.
2808
2809@item -dN
2810Like @samp{-dD} except that the macro arguments and contents are omitted.
2811Only @samp{#define @var{name}} is included in the output.
2812
2813@item -trigraphs
2814Support ANSI C trigraphs.  The @samp{-ansi} option also has this effect.
2815
2816@item -Wp,@var{option}
2817Pass @var{option} as an option to the preprocessor.  If @var{option}
2818contains commas, it is split into multiple options at the commas.
2819@end table
2820
2821@node Assembler Options
2822@section Passing Options to the Assembler
2823
2824@c prevent bad page break with this line
2825You can pass options to the assembler.
2826
2827@table @code
2828@item -Wa,@var{option}
2829Pass @var{option} as an option to the assembler.  If @var{option}
2830contains commas, it is split into multiple options at the commas.
2831@end table
2832
2833@node Link Options
2834@section Options for Linking
2835@cindex link options
2836@cindex options, linking
2837
2838These options come into play when the compiler links object files into
2839an executable output file.  They are meaningless if the compiler is
2840not doing a link step.
2841
2842@table @code
2843@cindex file names
2844@item @var{object-file-name}
2845A file name that does not end in a special recognized suffix is
2846considered to name an object file or library.  (Object files are
2847distinguished from libraries by the linker according to the file
2848contents.)  If linking is done, these object files are used as input
2849to the linker.
2850
2851@item -c
2852@itemx -S
2853@itemx -E
2854If any of these options is used, then the linker is not run, and
2855object file names should not be used as arguments.  @xref{Overall
2856Options}.
2857
2858@cindex Libraries
2859@item -l@var{library}
2860Search the library named @var{library} when linking.
2861
2862It makes a difference where in the command you write this option; the
2863linker searches processes libraries and object files in the order they
2864are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
2865after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
2866to functions in @samp{z}, those functions may not be loaded.
2867
2868The linker searches a standard list of directories for the library,
2869which is actually a file named @file{lib@var{library}.a}.  The linker
2870then uses this file as if it had been specified precisely by name.
2871
2872The directories searched include several standard system directories
2873plus any that you specify with @samp{-L}.
2874
2875Normally the files found this way are library files---archive files
2876whose members are object files.  The linker handles an archive file by
2877scanning through it for members which define symbols that have so far
2878been referenced but not defined.  But if the file that is found is an
2879ordinary object file, it is linked in the usual fashion.  The only
2880difference between using an @samp{-l} option and specifying a file name
2881is that @samp{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
2882and searches several directories.
2883
2884@item -lobjc
2885You need this special case of the @samp{-l} option in order to
2886link an Objective C program.
2887
2888@item -nostart
2889BeOS-specific synonym for @code{-shared}, see there.
2890
2891@item -nostartfiles
2892Do not use the standard system startup files when linking.
2893The standard system libraries are used normally, unless @code{-nostdlib}
2894or @code{-nodefaultlibs} is used.
2895
2896@item -nodefaultlibs
2897Do not use the standard system libraries when linking.
2898Only the libraries you specify will be passed to the linker.
2899The standard startup files are used normally, unless @code{-nostartfiles}
2900is used.  The compiler may generate calls to memcmp, memset, and memcpy
2901for System V (and ANSI C) environments or to bcopy and bzero for
2902BSD environments.  These entries are usually resolved by entries in
2903libc.  These entry points should be supplied through some other
2904mechanism when this option is specified.
2905
2906@item -nostdlib
2907Do not use the standard system startup files or libraries when linking.
2908No startup files and only the libraries you specify will be passed to
2909the linker. The compiler may generate calls to memcmp, memset, and memcpy
2910for System V (and ANSI C) environments or to bcopy and bzero for
2911BSD environments.  These entries are usually resolved by entries in
2912libc.  These entry points should be supplied through some other
2913mechanism when this option is specified.
2914
2915@cindex @code{-lgcc}, use with @code{-nostdlib}
2916@cindex @code{-nostdlib} and unresolved references
2917@cindex unresolved references and @code{-nostdlib}
2918@cindex @code{-lgcc}, use with @code{-nodefaultlibs}
2919@cindex @code{-nodefaultlibs} and unresolved references
2920@cindex unresolved references and @code{-nodefaultlibs}
2921One of the standard libraries bypassed by @samp{-nostdlib} and
2922@samp{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
2923that GCC uses to overcome shortcomings of particular machines, or special
2924needs for some languages.
2925@ifset INTERNALS
2926(@xref{Interface,,Interfacing to GCC Output}, for more discussion of
2927@file{libgcc.a}.)
2928@end ifset
2929@ifclear INTERNALS
2930(@xref{Interface,,Interfacing to GCC Output,gcc.info,Porting GCC},
2931for more discussion of @file{libgcc.a}.)
2932@end ifclear
2933In most cases, you need @file{libgcc.a} even when you want to avoid
2934other standard libraries.  In other words, when you specify @samp{-nostdlib}
2935or @samp{-nodefaultlibs} you should usually specify @samp{-lgcc} as well.
2936This ensures that you have no unresolved references to internal GCC
2937library subroutines.  (For example, @samp{__main}, used to ensure C++
2938constructors will be called; @pxref{Collect2,,@code{collect2}}.)
2939
2940@item -s
2941Remove all symbol table and relocation information from the executable.
2942
2943@item -static
2944On systems that support dynamic linking, this prevents linking with the shared
2945libraries.  On other systems, this option has no effect.
2946
2947@item -shared
2948Produce a shared object which can then be linked with other objects to
2949form an executable.  Not all systems support this option.  You must
2950also specify @samp{-fpic} or @samp{-fPIC} on some systems when
2951you specify this option.
2952
2953@item -symbolic
2954Bind references to global symbols when building a shared object.  Warn
2955about any unresolved references (unless overridden by the link editor
2956option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
2957this option.
2958
2959@item -Xlinker @var{option}
2960Pass @var{option} as an option to the linker.  You can use this to
2961supply system-specific linker options which GCC does not know how to
2962recognize.
2963
2964If you want to pass an option that takes an argument, you must use
2965@samp{-Xlinker} twice, once for the option and once for the argument.
2966For example, to pass @samp{-assert definitions}, you must write
2967@samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
2968@samp{-Xlinker "-assert definitions"}, because this passes the entire
2969string as a single argument, which is not what the linker expects.
2970
2971@item -Wl,@var{option}
2972Pass @var{option} as an option to the linker.  If @var{option} contains
2973commas, it is split into multiple options at the commas.
2974
2975@item -u @var{symbol}
2976Pretend the symbol @var{symbol} is undefined, to force linking of
2977library modules to define it.  You can use @samp{-u} multiple times with
2978different symbols to force loading of additional library modules.
2979@end table
2980
2981@node Directory Options
2982@section Options for Directory Search
2983@cindex directory options
2984@cindex options, directory search
2985@cindex search path
2986
2987These options specify directories to search for header files, for
2988libraries and for parts of the compiler:
2989
2990@table @code
2991@item -I@var{dir}
2992Add the directory @var{dir} to the head of the list of directories to be
2993searched for header files.  This can be used to override a system header
2994file, substituting your own version, since these directories are
2995searched before the system header file directories.  If you use more
2996than one @samp{-I} option, the directories are scanned in left-to-right
2997order; the standard system directories come after.
2998
2999@item -I-
3000Any directories you specify with @samp{-I} options before the @samp{-I-}
3001option are searched only for the case of @samp{#include "@var{file}"};
3002they are not searched for @samp{#include <@var{file}>}.
3003
3004If additional directories are specified with @samp{-I} options after
3005the @samp{-I-}, these directories are searched for all @samp{#include}
3006directives.  (Ordinarily @emph{all} @samp{-I} directories are used
3007this way.)
3008
3009In addition, the @samp{-I-} option inhibits the use of the current
3010directory (where the current input file came from) as the first search
3011directory for @samp{#include "@var{file}"}.  There is no way to
3012override this effect of @samp{-I-}.  With @samp{-I.} you can specify
3013searching the directory which was current when the compiler was
3014invoked.  That is not exactly the same as what the preprocessor does
3015by default, but it is often satisfactory.
3016
3017@samp{-I-} does not inhibit the use of the standard system directories
3018for header files.  Thus, @samp{-I-} and @samp{-nostdinc} are
3019independent.
3020
3021@item -L@var{dir}
3022Add directory @var{dir} to the list of directories to be searched
3023for @samp{-l}.
3024
3025@item -B@var{prefix}
3026This option specifies where to find the executables, libraries,
3027include files, and data files of the compiler itself.
3028
3029The compiler driver program runs one or more of the subprograms
3030@file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
3031@var{prefix} as a prefix for each program it tries to run, both with and
3032without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
3033
3034For each subprogram to be run, the compiler driver first tries the
3035@samp{-B} prefix, if any.  If that name is not found, or if @samp{-B}
3036was not specified, the driver tries two standard prefixes, which are
3037@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
3038those results in a file name that is found, the unmodified program
3039name is searched for using the directories specified in your
3040@samp{PATH} environment variable.
3041
3042@samp{-B} prefixes that effectively specify directory names also apply
3043to libraries in the linker, because the compiler translates these
3044options into @samp{-L} options for the linker.  They also apply to
3045includes files in the preprocessor, because the compiler translates these
3046options into @samp{-isystem} options for the preprocessor.  In this case,
3047the compiler appends @samp{include} to the prefix.
3048
3049The run-time support file @file{libgcc.a} can also be searched for using
3050the @samp{-B} prefix, if needed.  If it is not found there, the two
3051standard prefixes above are tried, and that is all.  The file is left
3052out of the link if it is not found by those means.
3053
3054Another way to specify a prefix much like the @samp{-B} prefix is to use
3055the environment variable @code{GCC_EXEC_PREFIX}.  @xref{Environment
3056Variables}.
3057
3058@item -specs=@var{file}
3059Process @var{file} after the compiler reads in the standard @file{specs}
3060file, in order to override the defaults that the @file{gcc} driver
3061program uses when determining what switches to pass to @file{cc1},
3062@file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
3063@samp{-specs=}@var{file} can be specified on the command line, and they
3064are processed in order, from left to right.
3065@end table
3066
3067@node Target Options
3068@section Specifying Target Machine and Compiler Version
3069@cindex target options
3070@cindex cross compiling
3071@cindex specifying machine version
3072@cindex specifying compiler version and target machine
3073@cindex compiler version, specifying
3074@cindex target machine, specifying
3075
3076By default, GCC compiles code for the same type of machine that you
3077are using.  However, it can also be installed as a cross-compiler, to
3078compile for some other type of machine.  In fact, several different
3079configurations of GCC, for different target machines, can be
3080installed side by side.  Then you specify which one to use with the
3081@samp{-b} option.
3082
3083In addition, older and newer versions of GCC can be installed side
3084by side.  One of them (probably the newest) will be the default, but
3085you may sometimes wish to use another.
3086
3087@table @code
3088@item -b @var{machine}
3089The argument @var{machine} specifies the target machine for compilation.
3090This is useful when you have installed GCC as a cross-compiler.
3091
3092The value to use for @var{machine} is the same as was specified as the
3093machine type when configuring GCC as a cross-compiler.  For
3094example, if a cross-compiler was configured with @samp{configure
3095i386v}, meaning to compile for an 80386 running System V, then you
3096would specify @samp{-b i386v} to run that cross compiler.
3097
3098When you do not specify @samp{-b}, it normally means to compile for
3099the same type of machine that you are using.
3100
3101@item -V @var{version}
3102The argument @var{version} specifies which version of GCC to run.
3103This is useful when multiple versions are installed.  For example,
3104@var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
3105
3106The default version, when you do not specify @samp{-V}, is the last
3107version of GCC that you installed.
3108@end table
3109
3110The @samp{-b} and @samp{-V} options actually work by controlling part of
3111the file name used for the executable files and libraries used for
3112compilation.  A given version of GCC, for a given target machine, is
3113normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
3114
3115Thus, sites can customize the effect of @samp{-b} or @samp{-V} either by
3116changing the names of these directories or adding alternate names (or
3117symbolic links).  If in directory @file{/usr/local/lib/gcc-lib/} the
3118file @file{80386} is a link to the file @file{i386v}, then @samp{-b
311980386} becomes an alias for @samp{-b i386v}.
3120
3121In one respect, the @samp{-b} or @samp{-V} do not completely change
3122to a different compiler: the top-level driver program @code{gcc}
3123that you originally invoked continues to run and invoke the other
3124executables (preprocessor, compiler per se, assembler and linker)
3125that do the real work.  However, since no real work is done in the
3126driver program, it usually does not matter that the driver program
3127in use is not the one for the specified target and version.
3128
3129The only way that the driver program depends on the target machine is
3130in the parsing and handling of special machine-specific options.
3131However, this is controlled by a file which is found, along with the
3132other executables, in the directory for the specified version and
3133target machine.  As a result, a single installed driver program adapts
3134to any specified target machine and compiler version.
3135
3136The driver program executable does control one significant thing,
3137however: the default version and target machine.  Therefore, you can
3138install different instances of the driver program, compiled for
3139different targets or versions, under different names.
3140
3141For example, if the driver for version 2.0 is installed as @code{ogcc}
3142and that for version 2.1 is installed as @code{gcc}, then the command
3143@code{gcc} will use version 2.1 by default, while @code{ogcc} will use
31442.0 by default.  However, you can choose either version with either
3145command with the @samp{-V} option.
3146
3147@node Submodel Options
3148@section Hardware Models and Configurations
3149@cindex submodel options
3150@cindex specifying hardware config
3151@cindex hardware models and configurations, specifying
3152@cindex machine dependent options
3153
3154Earlier we discussed the standard option @samp{-b} which chooses among
3155different installed compilers for completely different target
3156machines, such as Vax vs. 68000 vs. 80386.
3157
3158In addition, each of these target machine types can have its own
3159special options, starting with @samp{-m}, to choose among various
3160hardware models or configurations---for example, 68010 vs 68020,
3161floating coprocessor or none.  A single installed version of the
3162compiler can compile for any model or configuration, according to the
3163options specified.
3164
3165Some configurations of the compiler also support additional special
3166options, usually for compatibility with other compilers on the same
3167platform.
3168
3169@ifset INTERNALS
3170These options are defined by the macro @code{TARGET_SWITCHES} in the
3171machine description.  The default for the options is also defined by
3172that macro, which enables you to change the defaults.
3173@end ifset
3174
3175@menu
3176* M680x0 Options::
3177* VAX Options::
3178* SPARC Options::
3179* Convex Options::
3180* AMD29K Options::
3181* ARM Options::
3182* Thumb Options::
3183* MN10200 Options::
3184* MN10300 Options::
3185* M32R/D Options::
3186* M88K Options::
3187* RS/6000 and PowerPC Options::
3188* RT Options::
3189* MIPS Options::
3190* i386 Options::
3191* HPPA Options::
3192* Intel 960 Options::
3193* DEC Alpha Options::
3194* Clipper Options::
3195* H8/300 Options::
3196* SH Options::
3197* System V Options::
3198* TMS320C3x/C4x Options::
3199* V850 Options::
3200* ARC Options::
3201* NS32K Options::
3202@end menu
3203
3204@node M680x0 Options
3205@subsection M680x0 Options
3206@cindex M680x0 options
3207
3208These are the @samp{-m} options defined for the 68000 series.  The default
3209values for these options depends on which style of 68000 was selected when
3210the compiler was configured; the defaults for the most common choices are
3211given below.
3212
3213@table @code
3214@item -m68000
3215@itemx -mc68000
3216Generate output for a 68000.  This is the default
3217when the compiler is configured for 68000-based systems.
3218
3219Use this option for microcontrollers with a 68000 or EC000 core,
3220including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
3221
3222@item -m68020
3223@itemx -mc68020
3224Generate output for a 68020.  This is the default
3225when the compiler is configured for 68020-based systems.
3226
3227@item -m68881
3228Generate output containing 68881 instructions for floating point.
3229This is the default for most 68020 systems unless @samp{-nfp} was
3230specified when the compiler was configured.
3231
3232@item -m68030
3233Generate output for a 68030.  This is the default when the compiler is
3234configured for 68030-based systems.
3235
3236@item -m68040
3237Generate output for a 68040.  This is the default when the compiler is
3238configured for 68040-based systems.
3239
3240This option inhibits the use of 68881/68882 instructions that have to be
3241emulated by software on the 68040.  Use this option if your 68040 does not
3242have code to emulate those instructions.
3243
3244@item -m68060
3245Generate output for a 68060.  This is the default when the compiler is
3246configured for 68060-based systems.
3247
3248This option inhibits the use of 68020 and 68881/68882 instructions that
3249have to be emulated by software on the 68060.  Use this option if your 68060
3250does not have code to emulate those instructions.
3251
3252@item -mcpu32
3253Generate output for a CPU32. This is the default
3254when the compiler is configured for CPU32-based systems.
3255
3256Use this option for microcontrollers with a
3257CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
325868336, 68340, 68341, 68349 and 68360.
3259
3260@item -m5200
3261Generate output for a 520X "coldfire" family cpu.  This is the default
3262when the compiler is configured for 520X-based systems.
3263
3264Use this option for microcontroller with a 5200 core, including 
3265the MCF5202, MCF5203, MCF5204 and MCF5202.
3266
3267
3268@item -m68020-40
3269Generate output for a 68040, without using any of the new instructions.
3270This results in code which can run relatively efficiently on either a
327168020/68881 or a 68030 or a 68040.  The generated code does use the
327268881 instructions that are emulated on the 68040.
3273
3274@item -m68020-60
3275Generate output for a 68060, without using any of the new instructions.
3276This results in code which can run relatively efficiently on either a
327768020/68881 or a 68030 or a 68040.  The generated code does use the
327868881 instructions that are emulated on the 68060.
3279
3280@item -mfpa
3281Generate output containing Sun FPA instructions for floating point.
3282
3283@item -msoft-float
3284Generate output containing library calls for floating point.
3285@strong{Warning:} the requisite libraries are not available for all m68k
3286targets.  Normally the facilities of the machine's usual C compiler are
3287used, but this can't be done directly in cross-compilation.  You must
3288make your own arrangements to provide suitable library functions for
3289cross-compilation.  The embedded targets @samp{m68k-*-aout} and
3290@samp{m68k-*-coff} do provide software floating point support.
3291
3292@item -mshort
3293Consider type @code{int} to be 16 bits wide, like @code{short int}.
3294
3295@item -mnobitfield
3296Do not use the bit-field instructions.  The @samp{-m68000}, @samp{-mcpu32}
3297and @samp{-m5200} options imply @w{@samp{-mnobitfield}}.
3298
3299@item -mbitfield
3300Do use the bit-field instructions.  The @samp{-m68020} option implies
3301@samp{-mbitfield}.  This is the default if you use a configuration
3302designed for a 68020.
3303
3304@item -mrtd
3305Use a different function-calling convention, in which functions
3306that take a fixed number of arguments return with the @code{rtd}
3307instruction, which pops their arguments while returning.  This
3308saves one instruction in the caller since there is no need to pop
3309the arguments there.
3310
3311This calling convention is incompatible with the one normally
3312used on Unix, so you cannot use it if you need to call libraries
3313compiled with the Unix compiler.
3314
3315Also, you must provide function prototypes for all functions that
3316take variable numbers of arguments (including @code{printf});
3317otherwise incorrect code will be generated for calls to those
3318functions.
3319
3320In addition, seriously incorrect code will result if you call a
3321function with too many arguments.  (Normally, extra arguments are
3322harmlessly ignored.)
3323
3324The @code{rtd} instruction is supported by the 68010, 68020, 68030,
332568040, 68060 and CPU32 processors, but not by the 68000 or 5200.
3326
3327@item -malign-int
3328@itemx -mno-align-int
3329Control whether GCC aligns @code{int}, @code{long}, @code{long long}, 
3330@code{float}, @code{double}, and @code{long double} variables on a 32-bit
3331boundary (@samp{-malign-int}) or a 16-bit boundary (@samp{-mno-align-int}).
3332Aligning variables on 32-bit boundaries produces code that runs somewhat
3333faster on processors with 32-bit busses at the expense of more memory.
3334
3335@strong{Warning:} if you use the @samp{-malign-int} switch, GCC will
3336align structures containing the above types  differently than
3337most published application binary interface specifications for the m68k.
3338
3339@end table
3340
3341@node VAX Options
3342@subsection VAX Options
3343@cindex VAX options
3344
3345These @samp{-m} options are defined for the Vax:
3346
3347@table @code
3348@item -munix
3349Do not output certain jump instructions (@code{aobleq} and so on)
3350that the Unix assembler for the Vax cannot handle across long
3351ranges.
3352
3353@item -mgnu
3354Do output those jump instructions, on the assumption that you
3355will assemble with the GNU assembler.
3356
3357@item -mg
3358Output code for g-format floating point numbers instead of d-format.
3359@end table
3360
3361@node SPARC Options
3362@subsection SPARC Options
3363@cindex SPARC options
3364
3365These @samp{-m} switches are supported on the SPARC:
3366
3367@table @code
3368@item -mno-app-regs
3369@itemx -mapp-regs
3370Specify @samp{-mapp-regs} to generate output using the global registers
33712 through 4, which the SPARC SVR4 ABI reserves for applications.  This
3372is the default.
3373
3374To be fully SVR4 ABI compliant at the cost of some performance loss,
3375specify @samp{-mno-app-regs}.  You should compile libraries and system
3376software with this option.
3377
3378@item -mfpu
3379@itemx -mhard-float
3380Generate output containing floating point instructions.  This is the
3381default.
3382
3383@item -mno-fpu
3384@itemx -msoft-float
3385Generate output containing library calls for floating point.
3386@strong{Warning:} the requisite libraries are not available for all SPARC
3387targets.  Normally the facilities of the machine's usual C compiler are
3388used, but this cannot be done directly in cross-compilation.  You must make
3389your own arrangements to provide suitable library functions for
3390cross-compilation.  The embedded targets @samp{sparc-*-aout} and
3391@samp{sparclite-*-*} do provide software floating point support.
3392
3393@samp{-msoft-float} changes the calling convention in the output file;
3394therefore, it is only useful if you compile @emph{all} of a program with
3395this option.  In particular, you need to compile @file{libgcc.a}, the
3396library that comes with GCC, with @samp{-msoft-float} in order for
3397this to work.
3398
3399@item -mhard-quad-float
3400Generate output containing quad-word (long double) floating point
3401instructions.
3402
3403@item -msoft-quad-float
3404Generate output containing library calls for quad-word (long double)
3405floating point instructions.  The functions called are those specified
3406in the SPARC ABI.  This is the default.
3407
3408As of this writing, there are no sparc implementations that have hardware
3409support for the quad-word floating point instructions.  They all invoke
3410a trap handler for one of these instructions, and then the trap handler
3411emulates the effect of the instruction.  Because of the trap handler overhead,
3412this is much slower than calling the ABI library routines.  Thus the
3413@samp{-msoft-quad-float} option is the default.
3414
3415@item -mno-epilogue
3416@itemx -mepilogue
3417With @samp{-mepilogue} (the default), the compiler always emits code for
3418function exit at the end of each function.  Any function exit in
3419the middle of the function (such as a return statement in C) will
3420generate a jump to the exit code at the end of the function.
3421
3422With @samp{-mno-epilogue}, the compiler tries to emit exit code inline
3423at every function exit.
3424
3425@item -mno-flat
3426@itemx -mflat
3427With @samp{-mflat}, the compiler does not generate save/restore instructions
3428and will use a "flat" or single register window calling convention.
3429This model uses %i7 as the frame pointer and is compatible with the normal
3430register window model.  Code from either may be intermixed.
3431The local registers and the input registers (0-5) are still treated as
3432"call saved" registers and will be saved on the stack as necessary.
3433
3434With @samp{-mno-flat} (the default), the compiler emits save/restore
3435instructions (except for leaf functions) and is the normal mode of operation.
3436
3437@item -mno-unaligned-doubles
3438@itemx -munaligned-doubles
3439Assume that doubles have 8 byte alignment.  This is the default.
3440
3441With @samp{-munaligned-doubles}, GCC assumes that doubles have 8 byte
3442alignment only if they are contained in another type, or if they have an
3443absolute address.  Otherwise, it assumes they have 4 byte alignment.
3444Specifying this option avoids some rare compatibility problems with code
3445generated by other compilers.  It is not the default because it results
3446in a performance loss, especially for floating point code.
3447
3448@item -mv8
3449@itemx -msparclite
3450These two options select variations on the SPARC architecture.
3451
3452By default (unless specifically configured for the Fujitsu SPARClite),
3453GCC generates code for the v7 variant of the SPARC architecture.
3454
3455@samp{-mv8} will give you SPARC v8 code.  The only difference from v7
3456code is that the compiler emits the integer multiply and integer
3457divide instructions which exist in SPARC v8 but not in SPARC v7.
3458
3459@samp{-msparclite} will give you SPARClite code.  This adds the integer
3460multiply, integer divide step and scan (@code{ffs}) instructions which
3461exist in SPARClite but not in SPARC v7.
3462
3463These options are deprecated and will be deleted in a future GCC release.
3464They have been replaced with @samp{-mcpu=xxx}.
3465
3466@item -mcypress
3467@itemx -msupersparc
3468These two options select the processor for which the code is optimised.
3469
3470With @samp{-mcypress} (the default), the compiler optimizes code for the
3471Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
3472This is also appropriate for the older SparcStation 1, 2, IPX etc.
3473
3474With @samp{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
3475used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
3476of the full SPARC v8 instruction set.
3477
3478These options are deprecated and will be deleted in a future GCC release.
3479They have been replaced with @samp{-mcpu=xxx}.
3480
3481@item -mcpu=@var{cpu_type}
3482Set the instruction set, register set, and instruction scheduling parameters
3483for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
3484@samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
3485@samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
3486@samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}.
3487
3488Default instruction scheduling parameters are used for values that select
3489an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
3490@samp{sparclite}, @samp{sparclet}, @samp{v9}.
3491
3492Here is a list of each supported architecture and their supported
3493implementations.
3494
3495@smallexample
3496    v7:             cypress
3497    v8:             supersparc, hypersparc
3498    sparclite:      f930, f934, sparclite86x
3499    sparclet:       tsc701
3500    v9:             ultrasparc
3501@end smallexample
3502
3503@item -mtune=@var{cpu_type}
3504Set the instruction scheduling parameters for machine type
3505@var{cpu_type}, but do not set the instruction set or register set that the
3506option @samp{-mcpu=}@var{cpu_type} would.
3507
3508The same values for @samp{-mcpu=}@var{cpu_type} are used for
3509@samp{-mtune=}@*@var{cpu_type}, though the only useful values are those that
3510select a particular cpu implementation: @samp{cypress}, @samp{supersparc},
3511@samp{hypersparc}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
3512@samp{tsc701}, @samp{ultrasparc}.
3513
3514@item -malign-loops=@var{num}
3515Align loops to a 2 raised to a @var{num} byte boundary.  If
3516@samp{-malign-loops} is not specified, the default is 2.
3517
3518@item -malign-jumps=@var{num}
3519Align instructions that are only jumped to to a 2 raised to a @var{num}
3520byte boundary.  If @samp{-malign-jumps} is not specified, the default is 2.
3521
3522@item -malign-functions=@var{num}
3523Align the start of functions to a 2 raised to @var{num} byte boundary.
3524If @samp{-malign-functions} is not specified, the default is 2 if compiling
3525for 32 bit sparc, and 5 if compiling for 64 bit sparc.
3526
3527@end table
3528
3529These @samp{-m} switches are supported in addition to the above
3530on the SPARCLET processor.
3531
3532@table @code
3533@item -mlittle-endian
3534Generate code for a processor running in little-endian mode.
3535
3536@item -mlive-g0
3537Treat register @code{%g0} as a normal register.
3538GCC will continue to clobber it as necessary but will not assume
3539it always reads as 0.
3540
3541@item -mbroken-saverestore
3542Generate code that does not use non-trivial forms of the @code{save} and
3543@code{restore} instructions.  Early versions of the SPARCLET processor do
3544not correctly handle @code{save} and @code{restore} instructions used with
3545arguments.  They correctly handle them used without arguments.  A @code{save}
3546instruction used without arguments increments the current window pointer
3547but does not allocate a new stack frame.  It is assumed that the window
3548overflow trap handler will properly handle this case as will interrupt
3549handlers.
3550@end table
3551
3552These @samp{-m} switches are supported in addition to the above
3553on SPARC V9 processors in 64 bit environments.
3554
3555@table @code
3556@item -mlittle-endian
3557Generate code for a processor running in little-endian mode.
3558
3559@item -m32
3560@itemx -m64
3561Generate code for a 32 bit or 64 bit environment.
3562The 32 bit environment sets int, long and pointer to 32 bits.
3563The 64 bit environment sets int to 32 bits and long and pointer
3564to 64 bits.
3565
3566@item -mcmodel=medlow
3567Generate code for the Medium/Low code model: the program must be linked
3568in the low 32 bits of the address space.  Pointers are 64 bits.
3569Programs can be statically or dynamically linked.
3570
3571@item -mcmodel=medmid
3572Generate code for the Medium/Middle code model: the program must be linked
3573in the low 44 bits of the address space, the text segment must be less than
35742G bytes, and data segment must be within 2G of the text segment.
3575Pointers are 64 bits.
3576
3577@item -mcmodel=medany
3578Generate code for the Medium/Anywhere code model: the program may be linked
3579anywhere in the address space, the text segment must be less than
35802G bytes, and data segment must be within 2G of the text segment.
3581Pointers are 64 bits.
3582
3583@item -mcmodel=embmedany
3584Generate code for the Medium/Anywhere code model for embedded systems:
3585assume a 32 bit text and a 32 bit data segment, both starting anywhere
3586(determined at link time).  Register %g4 points to the base of the
3587data segment.  Pointers still 64 bits.
3588Programs are statically linked, PIC is not supported.
3589
3590@item -mstack-bias
3591@itemx -mno-stack-bias
3592With @samp{-mstack-bias}, GCC assumes that the stack pointer, and
3593frame pointer if present, are offset by -2047 which must be added back
3594when making stack frame references.
3595Otherwise, assume no such offset is present.
3596@end table
3597
3598@node Convex Options
3599@subsection Convex Options
3600@cindex Convex options
3601
3602These @samp{-m} options are defined for Convex:
3603
3604@table @code
3605@item -mc1
3606Generate output for C1.  The code will run on any Convex machine.
3607The preprocessor symbol @code{__convex__c1__} is defined.
3608
3609@item -mc2
3610Generate output for C2.  Uses instructions not available on C1.
3611Scheduling and other optimizations are chosen for max performance on C2.
3612The preprocessor symbol @code{__convex_c2__} is defined.
3613
3614@item -mc32
3615Generate output for C32xx.  Uses instructions not available on C1.
3616Scheduling and other optimizations are chosen for max performance on C32.
3617The preprocessor symbol @code{__convex_c32__} is defined.
3618
3619@item -mc34
3620Generate output for C34xx.  Uses instructions not available on C1.
3621Scheduling and other optimizations are chosen for max performance on C34.
3622The preprocessor symbol @code{__convex_c34__} is defined.
3623
3624@item -mc38
3625Generate output for C38xx.  Uses instructions not available on C1.
3626Scheduling and other optimizations are chosen for max performance on C38.
3627The preprocessor symbol @code{__convex_c38__} is defined.
3628
3629@item -margcount
3630Generate code which puts an argument count in the word preceding each
3631argument list.  This is compatible with regular CC, and a few programs
3632may need the argument count word.  GDB and other source-level debuggers
3633do not need it; this info is in the symbol table.
3634
3635@item -mnoargcount
3636Omit the argument count word.  This is the default.
3637
3638@item -mvolatile-cache
3639Allow volatile references to be cached.  This is the default.
3640
3641@item -mvolatile-nocache
3642Volatile references bypass the data cache, going all the way to memory.
3643This is only needed for multi-processor code that does not use standard
3644synchronization instructions.  Making non-volatile references to volatile
3645locations will not necessarily work.
3646
3647@item -mlong32
3648Type long is 32 bits, the same as type int.  This is the default.
3649
3650@item -mlong64
3651Type long is 64 bits, the same as type long long.  This option is useless,
3652because no library support exists for it.
3653@end table
3654
3655@node AMD29K Options
3656@subsection AMD29K Options
3657@cindex AMD29K options
3658
3659These @samp{-m} options are defined for the AMD Am29000:
3660
3661@table @code
3662@item -mdw
3663@kindex -mdw
3664@cindex DW bit (29k)
3665Generate code that assumes the @code{DW} bit is set, i.e., that byte and
3666halfword operations are directly supported by the hardware.  This is the
3667default.
3668
3669@item -mndw
3670@kindex -mndw
3671Generate code that assumes the @code{DW} bit is not set.
3672
3673@item -mbw
3674@kindex -mbw
3675@cindex byte writes (29k)
3676Generate code that assumes the system supports byte and halfword write
3677operations.  This is the default.
3678
3679@item -mnbw
3680@kindex -mnbw
3681Generate code that assumes the systems does not support byte and
3682halfword write operations.  @samp{-mnbw} implies @samp{-mndw}.
3683
3684@item -msmall
3685@kindex -msmall
3686@cindex memory model (29k)
3687Use a small memory model that assumes that all function addresses are
3688either within a single 256 KB segment or at an absolute address of less
3689than 256k.  This allows the @code{call} instruction to be used instead
3690of a @code{const}, @code{consth}, @code{calli} sequence.
3691
3692@item -mnormal
3693@kindex -mnormal
3694Use the normal memory model: Generate @code{call} instructions only when
3695calling functions in the same file and @code{calli} instructions
3696otherwise.  This works if each file occupies less than 256 KB but allows
3697the entire executable to be larger than 256 KB.  This is the default.
3698
3699@item -mlarge
3700Always use @code{calli} instructions.  Specify this option if you expect
3701a single file to compile into more than 256 KB of code.
3702
3703@item -m29050
3704@kindex -m29050
3705@cindex processor selection (29k)
3706Generate code for the Am29050.
3707
3708@item -m29000
3709@kindex -m29000
3710Generate code for the Am29000.  This is the default.
3711
3712@item -mkernel-registers
3713@kindex -mkernel-registers
3714@cindex kernel and user registers (29k)
3715Generate references to registers @code{gr64-gr95} instead of to
3716registers @code{gr96-gr127}.  This option can be used when compiling
3717kernel code that wants a set of global registers disjoint from that used
3718by user-mode code.
3719
3720Note that when this option is used, register names in @samp{-f} flags
3721must use the normal, user-mode, names.
3722
3723@item -muser-registers
3724@kindex -muser-registers
3725Use the normal set of global registers, @code{gr96-gr127}.  This is the
3726default.
3727
3728@item -mstack-check
3729@itemx -mno-stack-check
3730@kindex -mstack-check
3731@cindex stack checks (29k)
3732Insert (or do not insert) a call to @code{__msp_check} after each stack
3733adjustment.  This is often used for kernel code.
3734
3735@item -mstorem-bug
3736@itemx -mno-storem-bug
3737@kindex -mstorem-bug
3738@cindex storem bug (29k)
3739@samp{-mstorem-bug} handles 29k processors which cannot handle the
3740separation of a mtsrim insn and a storem instruction (most 29000 chips
3741to date, but not the 29050).
3742
3743@item -mno-reuse-arg-regs
3744@itemx -mreuse-arg-regs
3745@kindex -mreuse-arg-regs
3746@samp{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
3747registers for copying out arguments.  This helps detect calling a function
3748with fewer arguments than it was declared with.
3749
3750@item -mno-impure-text
3751@itemx -mimpure-text
3752@kindex -mimpure-text
3753@samp{-mimpure-text}, used in addition to @samp{-shared}, tells the compiler to
3754not pass @samp{-assert pure-text} to the linker when linking a shared object.
3755
3756@item -msoft-float
3757@kindex -msoft-float
3758Generate output containing library calls for floating point.
3759@strong{Warning:} the requisite libraries are not part of GCC.
3760Normally the facilities of the machine's usual C compiler are used, but
3761this can't be done directly in cross-compilation.  You must make your
3762own arrangements to provide suitable library functions for
3763cross-compilation.
3764
3765@item -mno-multm
3766@kindex -mno-multm
3767Do not generate multm or multmu instructions.  This is useful for some embedded
3768systems which do not have trap handlers for these instructions.
3769@end table
3770
3771@node ARM Options
3772@subsection ARM Options
3773@cindex ARM options
3774
3775These @samp{-m} options are defined for Advanced RISC Machines (ARM)
3776architectures:
3777
3778@table @code
3779@item -mapcs-frame
3780@kindex -mapcs-frame
3781Generate a stack frame that is compliant with the ARM Procedure Call
3782Standard for all functions, even if this is not strictly necessary for
3783correct execution of the code.  Specifying @samp{-fomit-frame-pointer}
3784with this option will cause the stack frames not to be generated for
3785leaf functions.  The default is @samp{-mno-apcs-frame}.
3786
3787@item -mapcs
3788@kindex -mapcs
3789This is a synonym for @samp{-mapcs-frame}.
3790
3791@item -mapcs-26
3792@kindex -mapcs-26
3793Generate code for a processor running with a 26-bit program counter,
3794and conforming to the function calling standards for the APCS 26-bit
3795option.  This option replaces the @samp{-m2} and @samp{-m3} options
3796of previous releases of the compiler.
3797
3798@item -mapcs-32
3799@kindex -mapcs-32
3800Generate code for a processor running with a 32-bit program counter,
3801and conforming to the function calling standards for the APCS 32-bit
3802option.  This option replaces the @samp{-m6} option of previous releases
3803of the compiler.
3804
3805@item -mapcs-stack-check
3806@kindex -mapcs-stack-check
3807@kindex -mno-apcs-stack-check
3808Generate code to check the amount of stack space available upon entry to
3809every function (that actually uses some stack space).  If there is
3810insufficient space available then either the function
3811@samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
3812called, depending upon the amount of stack space required.  The run time
3813system is required to provide these functions.  The default is
3814@samp{-mno-apcs-stack-check}, since this produces smaller code.
3815
3816@item -mapcs-float
3817@kindex -mapcs-float
3818@kindex -mno-apcs-float
3819Pass floating point arguments using the float point registers.  This is
3820one of the variants of the APCS.  This option is reccommended if the
3821target hardware has a floating point unit or if a lot of floating point
3822arithmetic is going to be performed by the code.  The default is
3823@samp{-mno-apcs-float}, since integer only code is slightly increased in
3824size if @samp{-mapcs-float} is used.
3825
3826@item -mapcs-reentrant
3827@kindex -mapcs-reentrant
3828@kindex -mno-apcs-reentrant
3829Generate reentrant, position independent code.  This is the equivalent
3830to specifying the @samp{-fpic} option.  The default is
3831@samp{-mno-apcs-reentrant}.
3832
3833@item -mthumb-interwork
3834@kindex -mthumb-interwork
3835@kindex -mno-thumb-interwork
3836Generate code which supports calling between the ARM and THUMB
3837instruction sets.  Without this option the two instruction sets cannot
3838be reliably used inside one program.  The default is
3839@samp{-mno-thumb-interwork}, since slightly larger code is generated
3840when @samp{-mthumb-interwork} is specified.
3841
3842@item -mno-sched-prolog
3843@kindex -mno-sched-prolog
3844@kindex -msched-prolog
3845Prevent the reordering of instructions in the function prolog, or the
3846merging of those instruction with the instructions in the function's
3847body.  This means that all functions will start with a recognisable set
3848of instructions (or in fact one of a chioce from a small set of
3849different function prologues), and this information can be used to
3850locate the start if functions inside an executable piece of code.  The
3851default is @samp{-msched-prolog}.
3852
3853@item -mhard-float
3854Generate output containing floating point instructions.  This is the
3855default.
3856
3857@item -msoft-float
3858Generate output containing library calls for floating point.
3859@strong{Warning:} the requisite libraries are not available for all ARM
3860targets.  Normally the facilities of the machine's usual C compiler are
3861used, but this cannot be done directly in cross-compilation.  You must make
3862your own arrangements to provide suitable library functions for
3863cross-compilation.
3864
3865@samp{-msoft-float} changes the calling convention in the output file;
3866therefore, it is only useful if you compile @emph{all} of a program with
3867this option.  In particular, you need to compile @file{libgcc.a}, the
3868library that comes with GCC, with @samp{-msoft-float} in order for
3869this to work.
3870
3871@item -mlittle-endian
3872Generate code for a processor running in little-endian mode.  This is
3873the default for all standard configurations.
3874
3875@item -mbig-endian
3876Generate code for a processor running in big-endian mode; the default is
3877to compile code for a little-endian processor.
3878
3879@item -mwords-little-endian
3880This option only applies when generating code for big-endian processors.
3881Generate code for a little-endian word order but a big-endian byte
3882order.  That is, a byte order of the form @samp{32107654}.  Note: this
3883option should only be used if you require compatibility with code for
3884big-endian ARM processors generated by versions of the compiler prior to
38852.8.
3886
3887@item -mshort-load-bytes
3888@kindex -mshort-load-bytes
3889Do not try to load half-words (eg @samp{short}s) by loading a word from
3890an unaligned address.  For some targets the MMU is configured to trap
3891unaligned loads; use this option to generate code that is safe in these
3892environments.
3893
3894@item -mno-short-load-bytes
3895@kindex -mno-short-load-bytes
3896Use unaligned word loads to load half-words (eg @samp{short}s).  This
3897option produces more efficient code, but the MMU is sometimes configured
3898to trap these instructions.
3899
3900@item -mshort-load-words
3901@kindex -mshort-load-words
3902This is a synonym for the @samp{-mno-short-load-bytes}.
3903
3904@item -mno-short-load-words
3905@kindex -mno-short-load-words
3906This is a synonym for the @samp{-mshort-load-bytes}.
3907
3908@item -mbsd
3909@kindex -mbsd
3910This option only applies to RISC iX.  Emulate the native BSD-mode
3911compiler.  This is the default if @samp{-ansi} is not specified.
3912
3913@item -mxopen
3914@kindex -mxopen
3915This option only applies to RISC iX.  Emulate the native X/Open-mode
3916compiler.
3917
3918@item -mno-symrename
3919@kindex -mno-symrename
3920This option only applies to RISC iX.  Do not run the assembler
3921post-processor, @samp{symrename}, after code has been assembled.
3922Normally it is necessary to modify some of the standard symbols in
3923preparation for linking with the RISC iX C library; this option
3924suppresses this pass.  The post-processor is never run when the
3925compiler is built for cross-compilation.
3926
3927@item -mcpu=<name>
3928@itemx -mtune=<name>
3929@kindex -mcpu=
3930@kindex -mtune=
3931This specifies the name of the target ARM processor.  GCC uses this name
3932to determine what kind of instructions it can use when generating
3933assembly code.  Permissable names are: arm2, arm250, arm3, arm6, arm60,
3934arm600, arm610, arm620, arm7, arm7m, arm7d, arm7dm, arm7di, arm7dmi,
3935arm70, arm700, arm700i, arm710, arm710c, arm7100, arm7500, arm7500fe,
3936arm7tdmi, arm8, strongarm, strongarm110, strongarm1100, arm8, arm810,
3937arm9, arm9tdmi.  @samp{-mtune=} is a synonym for @samp{-mcpue=} to
3938support older versions of GCC.
3939
3940@item -march=<name>
3941@kindex -march=
3942This specifies the name of the target ARM architecture.  GCC uses this
3943name to determine what kind of instructions it can use when generating
3944assembly code.  This option can be used in conjunction with or instead
3945of the @samp{-mcpu=} option.  Permissable names are: armv2, armv2a,
3946armv3, armv3m, armv4, armv4t
3947
3948@item -mfpe=<number>
3949@itemx -mfp=<number>
3950@kindex -mfpe=
3951@kindex -mfp=
3952This specifes the version of the floating point emulation available on
3953the target.  Permissable values are 2 and 3.  @samp{-mfp=} is a synonym
3954for @samp{-mfpe=} to support older versions of GCC.
3955
3956@item -mstructure-size-boundary=<n>
3957@kindex -mstructure-size-boundary
3958The size of all structures and unions will be rounded up to a multiple
3959of the number of bits set by this option.  Permissable values are 8 and
396032.  The default value varies for different toolchains.  For the COFF
3961targeted toolchain the default value is 8.  Specifying the larger number
3962can produced faster, more efficient code, but can also increase the size
3963of the program.  The two values are potentially incompatible.  Code
3964compiled with one value cannot necessarily expect to work with code or
3965libraries compiled with the other value, if they exchange information
3966using structures or unions.  Programmers are encouraged to use the 32
3967value as future versions of the toolchain may default to this value.
3968
3969@item -mabort-on-noreturn
3970@kindex -mabort-on-noreturn
3971@kindex -mnoabort-on-noreturn
3972Generate a call to the function abort at the end of a noreturn function.
3973It will be executed if the function tries to return.
3974
3975@end table
3976
3977@node Thumb Options
3978@subsection Thumb Options
3979@cindex Thumb Options
3980
3981@table @code
3982
3983@item -mthumb-interwork
3984@kindex -mthumb-interwork
3985@kindex -mno-thumb-interwork
3986Generate code which supports calling between the THUMB and ARM
3987instruction sets.  Without this option the two instruction sets cannot
3988be reliably used inside one program.  The default is
3989@samp{-mno-thumb-interwork}, since slightly smaller code is generated
3990with this option.
3991
3992@item -mtpcs-frame
3993@kindex -mtpcs-frame
3994@kindex -mno-tpcs-frame
3995Generate a stack frame that is compliant with the Thumb Procedure Call
3996Standard for all non-leaf functions.  (A leaf function is one that does
3997not call any other functions).  The default is @samp{-mno-apcs-frame}. 
3998
3999@item -mtpcs-leaf-frame
4000@kindex -mtpcs-leaf-frame
4001@kindex -mno-tpcs-leaf-frame
4002Generate a stack frame that is compliant with the Thumb Procedure Call
4003Standard for all leaf functions.  (A leaf function is one that does
4004not call any other functions).  The default is @samp{-mno-apcs-leaf-frame}. 
4005
4006@item -mlittle-endian
4007@kindex -mlittle-endian
4008Generate code for a processor running in little-endian mode.  This is
4009the default for all standard configurations.
4010
4011@item -mbig-endian
4012@kindex -mbig-endian
4013Generate code for a processor running in big-endian mode.
4014
4015@item -mstructure-size-boundary=<n>
4016@kindex -mstructure-size-boundary
4017The size of all structures and unions will be rounded up to a multiple
4018of the number of bits set by this option.  Permissable values are 8 and
401932.  The default value varies for different toolchains.  For the COFF
4020targeted toolchain the default value is 8.  Specifying the larger number
4021can produced faster, more efficient code, but can also increase the size
4022of the program.  The two values are potentially incompatible.  Code
4023compiled with one value cannot necessarily expect to work with code or
4024libraries compiled with the other value, if they exchange information
4025using structures or unions.  Programmers are encouraged to use the 32
4026value as future versions of the toolchain may default to this value.
4027
4028@end table
4029
4030@node MN10200 Options
4031@subsection MN10200 Options
4032@cindex MN10200 options
4033These @samp{-m} options are defined for Matsushita MN10200 architectures:
4034@table @code
4035
4036@item -mrelax
4037Indicate to the linker that it should perform a relaxation optimization pass
4038to shorten branches, calls and absolute memory addresses.  This option only
4039has an effect when used on the command line for the final link step.
4040
4041This option makes symbolic debugging impossible. 
4042@end table
4043
4044@node MN10300 Options
4045@subsection MN10300 Options
4046@cindex MN10300 options
4047These @samp{-m} options are defined for Matsushita MN10300 architectures:
4048
4049@table @code
4050@item -mmult-bug
4051Generate code to avoid bugs in the multiply instructions for the MN10300
4052processors.  This is the default.
4053
4054@item -mno-mult-bug
4055Do not generate code to avoid bugs in the multiply instructions for the
4056MN10300 processors.
4057
4058@item -mrelax
4059Indicate to the linker that it should perform a relaxation optimization pass
4060to shorten branches, calls and absolute memory addresses.  This option only
4061has an effect when used on the command line for the final link step.
4062
4063This option makes symbolic debugging impossible. 
4064@end table
4065
4066
4067@node M32R/D Options
4068@subsection M32R/D Options
4069@cindex M32R/D options
4070
4071These @samp{-m} options are defined for Mitsubishi M32R/D architectures:
4072
4073@table @code
4074@item -mcode-model=small
4075Assume all objects live in the lower 16MB of memory (so that their addresses
4076can be loaded with the @code{ld24} instruction), and assume all subroutines
4077are reachable with the @code{bl} instruction.
4078This is the default.
4079
4080The addressability of a particular object can be set with the
4081@code{model} attribute.
4082
4083@item -mcode-model=medium
4084Assume objects may be anywhere in the 32 bit address space (the compiler
4085will generate @code{seth/add3} instructions to load their addresses), and
4086assume all subroutines are reachable with the @code{bl} instruction.
4087
4088@item -mcode-model=large
4089Assume objects may be anywhere in the 32 bit address space (the compiler
4090will generate @code{seth/add3} instructions to load their addresses), and
4091assume subroutines may not be reachable with the @code{bl} instruction
4092(the compiler will generate the much slower @code{seth/add3/jl}
4093instruction sequence).
4094
4095@item -msdata=none
4096Disable use of the small data area.  Variables will be put into
4097one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
4098@code{section} attribute has been specified).
4099This is the default.
4100
4101The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
4102Objects may be explicitly put in the small data area with the
4103@code{section} attribute using one of these sections.
4104
4105@item -msdata=sdata
4106Put small global and static data in the small data area, but do not
4107generate special code to reference them.
4108
4109@item -msdata=use
4110Put small global and static data in the small data area, and generate
4111special instructions to reference them.
4112
4113@item -G @var{num}
4114@cindex smaller data references
4115Put global and static objects less than or equal to @var{num} bytes
4116into the small data or bss sections instead of the normal data or bss
4117sections.  The default value of @var{num} is 8.
4118The @samp{-msdata} option must be set to one of @samp{sdata} or @samp{use}
4119for this option to have any effect.
4120
4121All modules should be compiled with the same @samp{-G @var{num}} value.
4122Compiling with different values of @var{num} may or may not work; if it
4123doesn't the linker will give an error message - incorrect code will not be
4124generated.
4125
4126@end table
4127
4128@node M88K Options
4129@subsection M88K Options
4130@cindex M88k options
4131
4132These @samp{-m} options are defined for Motorola 88k architectures:
4133
4134@table @code
4135@item -m88000
4136@kindex -m88000
4137Generate code that works well on both the m88100 and the
4138m88110.
4139
4140@item -m88100
4141@kindex -m88100
4142Generate code that works best for the m88100, but that also
4143runs on the m88110.
4144
4145@item -m88110
4146@kindex -m88110
4147Generate code that works best for the m88110, and may not run
4148on the m88100.
4149
4150@item -mbig-pic
4151@kindex -mbig-pic
4152Obsolete option to be removed from the next revision.
4153Use @samp{-fPIC}.
4154
4155@item -midentify-revision
4156@kindex -midentify-revision
4157@kindex ident
4158@cindex identifying source, compiler (88k)
4159Include an @code{ident} directive in the assembler output recording the
4160source file name, compiler name and version, timestamp, and compilation
4161flags used.
4162
4163@item -mno-underscores
4164@kindex -mno-underscores
4165@cindex underscores, avoiding (88k)
4166In assembler output, emit symbol names without adding an underscore
4167character at the beginning of each name.  The default is to use an
4168underscore as prefix on each name.
4169
4170@item -mocs-debug-info
4171@itemx -mno-ocs-debug-info
4172@kindex -mocs-debug-info
4173@kindex -mno-ocs-debug-info
4174@cindex OCS (88k)
4175@cindex debugging, 88k OCS
4176Include (or omit) additional debugging information (about registers used
4177in each stack frame) as specified in the 88open Object Compatibility
4178Standard, ``OCS''.  This extra information allows debugging of code that
4179has had the frame pointer eliminated.  The default for DG/UX, SVr4, and
4180Delta 88 SVr3.2 is to include this information; other 88k configurations
4181omit this information by default.
4182
4183@item -mocs-frame-position
4184@kindex -mocs-frame-position
4185@cindex register positions in frame (88k)
4186When emitting COFF debugging information for automatic variables and
4187parameters stored on the stack, use the offset from the canonical frame
4188address, which is the stack pointer (register 31) on entry to the
4189function.  The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
4190@samp{-mocs-frame-position}; other 88k configurations have the default
4191@samp{-mno-ocs-frame-position}.
4192
4193@item -mno-ocs-frame-position
4194@kindex -mno-ocs-frame-position
4195@cindex register positions in frame (88k)
4196When emitting COFF debugging information for automatic variables and
4197parameters stored on the stack, use the offset from the frame pointer
4198register (register 30).  When this option is in effect, the frame
4199pointer is not eliminated when debugging information is selected by the
4200-g switch.
4201
4202@item -moptimize-arg-area
4203@itemx -mno-optimize-arg-area
4204@kindex -moptimize-arg-area
4205@kindex -mno-optimize-arg-area
4206@cindex arguments in frame (88k)
4207Control how function arguments are stored in stack frames.
4208@samp{-moptimize-arg-area} saves space by optimizing them, but this
4209conflicts with the 88open specifications.  The opposite alternative,
4210@samp{-mno-optimize-arg-area}, agrees with 88open standards.  By default
4211GCC does not optimize the argument area.
4212
4213@item -mshort-data-@var{num}
4214@kindex -mshort-data-@var{num}
4215@cindex smaller data references (88k)
4216@cindex r0-relative references (88k)
4217Generate smaller data references by making them relative to @code{r0},
4218which allows loading a value using a single instruction (rather than the
4219usual two).  You control which data references are affected by
4220specifying @var{num} with this option.  For example, if you specify
4221@samp{-mshort-data-512}, then the data references affected are those
4222involving displacements of less than 512 bytes.
4223@samp{-mshort-data-@var{num}} is not effective for @var{num} greater
4224than 64k.
4225
4226@item -mserialize-volatile
4227@kindex -mserialize-volatile
4228@itemx -mno-serialize-volatile
4229@kindex -mno-serialize-volatile
4230@cindex sequential consistency on 88k
4231Do, or don't, generate code to guarantee sequential consistency
4232of volatile memory references.  By default, consistency is
4233guaranteed.
4234
4235The order of memory references made by the MC88110 processor does
4236not always match the order of the instructions requesting those
4237references.  In particular, a load instruction may execute before
4238a preceding store instruction.  Such reordering violates
4239sequential consistency of volatile memory references, when there
4240are multiple processors.   When consistency must be guaranteed,
4241GNU C generates special instructions, as needed, to force
4242execution in the proper order.
4243
4244The MC88100 processor does not reorder memory references and so
4245always provides sequential consistency.  However, by default, GNU
4246C generates the special instructions to guarantee consistency
4247even when you use @samp{-m88100}, so that the code may be run on an
4248MC88110 processor.  If you intend to run your code only on the
4249MC88100 processor, you may use @samp{-mno-serialize-volatile}.
4250
4251The extra code generated to guarantee consistency may affect the
4252performance of your application.  If you know that you can safely
4253forgo this guarantee, you may use @samp{-mno-serialize-volatile}.
4254
4255@item -msvr4
4256@itemx -msvr3
4257@kindex -msvr4
4258@kindex -msvr3
4259@cindex assembler syntax, 88k
4260@cindex SVr4
4261Turn on (@samp{-msvr4}) or off (@samp{-msvr3}) compiler extensions
4262related to System V release 4 (SVr4).  This controls the following:
4263
4264@enumerate
4265@item
4266Which variant of the assembler syntax to emit.
4267@item
4268@samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
4269that is used on System V release 4.
4270@item
4271@samp{-msvr4} makes GCC issue additional declaration directives used in
4272SVr4.
4273@end enumerate
4274
4275@samp{-msvr4} is the default for the m88k-motorola-sysv4 and
4276m88k-dg-dgux m88k configurations. @samp{-msvr3} is the default for all
4277other m88k configurations.
4278
4279@item -mversion-03.00
4280@kindex -mversion-03.00
4281This option is obsolete, and is ignored.
4282@c ??? which asm syntax better for GAS?  option there too?
4283
4284@item -mno-check-zero-division
4285@itemx -mcheck-zero-division
4286@kindex -mno-check-zero-division
4287@kindex -mcheck-zero-division
4288@cindex zero division on 88k
4289Do, or don't, generate code to guarantee that integer division by
4290zero will be detected.  By default, detection is guaranteed.
4291
4292Some models of the MC88100 processor fail to trap upon integer
4293division by zero under certain conditions.  By default, when
4294compiling code that might be run on such a processor, GNU C
4295generates code that explicitly checks for zero-valued divisors
4296and traps with exception number 503 when one is detected.  Use of
4297mno-check-zero-division suppresses such checking for code
4298generated to run on an MC88100 processor.
4299
4300GNU C assumes that the MC88110 processor correctly detects all
4301instances of integer division by zero.  When @samp{-m88110} is
4302specified, both @samp{-mcheck-zero-division} and
4303@samp{-mno-check-zero-division} are ignored, and no explicit checks for
4304zero-valued divisors are generated.
4305
4306@item -muse-div-instruction
4307@kindex -muse-div-instruction
4308@cindex divide instruction, 88k
4309Use the div instruction for signed integer division on the
4310MC88100 processor.  By default, the div instruction is not used.
4311
4312On the MC88100 processor the signed integer division instruction
4313div) traps to the operating system on a negative operand.  The
4314operating system transparently completes the operation, but at a
4315large cost in execution time.  By default, when compiling code
4316that might be run on an MC88100 processor, GNU C emulates signed
4317integer division using the unsigned integer division instruction
4318divu), thereby avoiding the large penalty of a trap to the
4319operating system.  Such emulation has its own, smaller, execution
4320cost in both time and space.  To the extent that your code's
4321important signed integer division operations are performed on two
4322nonnegative operands, it may be desirable to use the div
4323instruction directly.
4324
4325On the MC88110 processor the div instruction (also known as the
4326divs instruction) processes negative operands without trapping to
4327the operating system.  When @samp{-m88110} is specified,
4328@samp{-muse-div-instruction} is ignored, and the div instruction is used
4329for signed integer division.
4330
4331Note that the result of dividing INT_MIN by -1 is undefined.  In
4332particular, the behavior of such a division with and without
4333@samp{-muse-div-instruction}  may differ.
4334
4335@item -mtrap-large-shift
4336@itemx -mhandle-large-shift
4337@kindex -mtrap-large-shift
4338@kindex -mhandle-large-shift
4339@cindex bit shift overflow (88k)
4340@cindex large bit shifts (88k)
4341Include code to detect bit-shifts of more than 31 bits; respectively,
4342trap such shifts or emit code to handle them properly.  By default GCC
4343makes no special provision for large bit shifts.
4344
4345@item -mwarn-passed-structs
4346@kindex -mwarn-passed-structs
4347@cindex structure passing (88k)
4348Warn when a function passes a struct as an argument or result.
4349Structure-passing conventions have changed during the evolution of the C
4350language, and are often the source of portability problems.  By default,
4351GCC issues no such warning.
4352@end table
4353
4354@node RS/6000 and PowerPC Options
4355@subsection IBM RS/6000 and PowerPC Options
4356@cindex RS/6000 and PowerPC Options
4357@cindex IBM RS/6000 and PowerPC Options
4358
4359These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
4360@table @code
4361@item -mpower
4362@itemx -mno-power
4363@itemx -mpower2
4364@itemx -mno-power2
4365@itemx -mpowerpc
4366@itemx -mno-powerpc
4367@itemx -mpowerpc-gpopt
4368@itemx -mno-powerpc-gpopt
4369@itemx -mpowerpc-gfxopt
4370@itemx -mno-powerpc-gfxopt
4371@itemx -mpowerpc64
4372@itemx -mno-powerpc64
4373@kindex -mpower
4374@kindex -mpower2
4375@kindex -mpowerpc
4376@kindex -mpowerpc-gpopt
4377@kindex -mpowerpc-gfxopt
4378@kindex -mpowerpc64
4379GCC supports two related instruction set architectures for the
4380RS/6000 and PowerPC.  The @dfn{POWER} instruction set are those
4381instructions supported by the @samp{rios} chip set used in the original
4382RS/6000 systems and the @dfn{PowerPC} instruction set is the
4383architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
4384the IBM 4xx microprocessors.
4385
4386Neither architecture is a subset of the other.  However there is a
4387large common subset of instructions supported by both.  An MQ
4388register is included in processors supporting the POWER architecture.
4389
4390You use these options to specify which instructions are available on the
4391processor you are using.  The default value of these options is
4392determined when configuring GCC.  Specifying the
4393@samp{-mcpu=@var{cpu_type}} overrides the specification of these
4394options.  We recommend you use the @samp{-mcpu=@var{cpu_type}} option
4395rather than the options listed above.
4396
4397The @samp{-mpower} option allows GCC to generate instructions that
4398are found only in the POWER architecture and to use the MQ register.
4399Specifying @samp{-mpower2} implies @samp{-power} and also allows GCC
4400to generate instructions that are present in the POWER2 architecture but
4401not the original POWER architecture.
4402
4403The @samp{-mpowerpc} option allows GCC to generate instructions that
4404are found only in the 32-bit subset of the PowerPC architecture.
4405Specifying @samp{-mpowerpc-gpopt} implies @samp{-mpowerpc} and also allows
4406GCC to use the optional PowerPC architecture instructions in the
4407General Purpose group, including floating-point square root.  Specifying
4408@samp{-mpowerpc-gfxopt} implies @samp{-mpowerpc} and also allows GCC to
4409use the optional PowerPC architecture instructions in the Graphics
4410group, including floating-point select.
4411
4412The @samp{-mpowerpc64} option allows GCC to generate the additional
441364-bit instructions that are found in the full PowerPC64 architecture
4414and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
4415@samp{-mno-powerpc64}.
4416
4417If you specify both @samp{-mno-power} and @samp{-mno-powerpc}, GCC
4418will use only the instructions in the common subset of both
4419architectures plus some special AIX common-mode calls, and will not use
4420the MQ register.  Specifying both @samp{-mpower} and @samp{-mpowerpc}
4421permits GCC to use any instruction from either architecture and to
4422allow use of the MQ register; specify this for the Motorola MPC601.
4423
4424@item -mnew-mnemonics
4425@itemx -mold-mnemonics
4426@kindex -mnew-mnemonics
4427@kindex -mold-mnemonics
4428Select which mnemonics to use in the generated assembler code.
4429@samp{-mnew-mnemonics} requests output that uses the assembler mnemonics
4430defined for the PowerPC architecture, while @samp{-mold-mnemonics}
4431requests the assembler mnemonics defined for the POWER architecture.
4432Instructions defined in only one architecture have only one mnemonic;
4433GCC uses that mnemonic irrespective of which of these options is
4434specified.
4435
4436GCC defaults to the mnemonics appropriate for the architecture in
4437use.  Specifying @samp{-mcpu=@var{cpu_type}} sometimes overrides the
4438value of these option.  Unless you are building a cross-compiler, you
4439should normally not specify either @samp{-mnew-mnemonics} or
4440@samp{-mold-mnemonics}, but should instead accept the default.
4441
4442@item -mcpu=@var{cpu_type}
4443@kindex -mcpu
4444Set architecture type, register usage, choice of mnemonics, and
4445instruction scheduling parameters for machine type @var{cpu_type}.
4446Supported values for @var{cpu_type} are @samp{rs6000}, @samp{rios1},
4447@samp{rios2}, @samp{rsc}, @samp{601}, @samp{602}, @samp{603},
4448@samp{603e}, @samp{604}, @samp{604e}, @samp{620}, @samp{740},
4449@samp{750}, @samp{power}, @samp{power2}, @samp{powerpc}, @samp{403},
4450@samp{505}, @samp{801}, @samp{821}, @samp{823}, and @samp{860} and
4451@samp{common}.  @samp{-mcpu=power}, @samp{-mcpu=power2}, and
4452@samp{-mcpu=powerpc} specify generic POWER, POWER2 and pure PowerPC
4453(i.e., not MPC601) architecture machine types, with an appropriate,
4454generic processor model assumed for scheduling purposes.@refill
4455
4456@c overfull hbox here --bob 22 jul96
4457@c original text between ignore ... end ignore
4458@ignore
4459Specifying any of the @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
4460@samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} options
4461enables the @samp{-mpower} option and disables the @samp{-mpowerpc}
4462option; @samp{-mcpu=601} enables both the @samp{-mpower} and
4463@samp{-mpowerpc} options; all of @samp{-mcpu=602}, @samp{-mcpu=603},
4464@samp{-mcpu=603e}, @samp{-mcpu=604}, @samp{-mcpu=604e},
4465@samp{-mcpu=620}, @samp{-mcpu=403}, @samp{-mcpu=505}, @samp{-mcpu=801},
4466@samp{-mcpu=821}, @samp{-mcpu=823}, @samp{-mcpu=860} and
4467@samp{-mcpu=powerpc} enable the @samp{-mpowerpc} option and disable the
4468@samp{-mpower} option; @samp{-mcpu=common} disables both the
4469@samp{-mpower} and @samp{-mpowerpc} options.@refill
4470@end ignore
4471@c            changed paragraph
4472Specifying any of the following options: 
4473@samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @samp{-mcpu=rsc},
4474@samp{-mcpu=power}, or @samp{-mcpu=power2}  
4475enables the @samp{-mpower} option and disables the @samp{-mpowerpc} option; 
4476@samp{-mcpu=601} enables both the @samp{-mpower} and @samp{-mpowerpc} options.
4477All of @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e},
4478@samp{-mcpu=604}, @samp{-mcpu=620}, 
4479enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.  
4480Exactly similarly, all of @samp{-mcpu=403},
4481@samp{-mcpu=505}, @samp{-mcpu=821}, @samp{-mcpu=860} and @samp{-mcpu=powerpc} 
4482enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
4483@samp{-mcpu=common} disables both the 
4484@samp{-mpower} and @samp{-mpowerpc} options.@refill
4485@c             end changes to prevent overfull hboxes
4486
4487AIX versions 4 or greater selects @samp{-mcpu=common} by default, so
4488that code will operate on all members of the RS/6000 and PowerPC
4489families.  In that case, GCC will use only the instructions in the
4490common subset of both architectures plus some special AIX common-mode
4491calls, and will not use the MQ register.  GCC assumes a generic
4492processor model for scheduling purposes.
4493
4494Specifying any of the options @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
4495@samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} also
4496disables the @samp{new-mnemonics} option.  Specifying @samp{-mcpu=601},
4497@samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e}, @samp{-mcpu=604},
4498@samp{620}, @samp{403}, or @samp{-mcpu=powerpc} also enables the
4499@samp{new-mnemonics} option.@refill
4500
4501Specifying @samp{-mcpu=403}, @samp{-mcpu=821}, or @samp{-mcpu=860} also
4502enables the @samp{-msoft-float} option.
4503
4504@item -mtune=@var{cpu_type}
4505Set the instruction scheduling parameters for machine type
4506@var{cpu_type}, but do not set the architecture type, register usage,
4507choice of mnemonics like @samp{-mcpu=}@var{cpu_type} would.  The same
4508values for @var{cpu_type} are used for @samp{-mtune=}@var{cpu_type} as
4509for @samp{-mcpu=}@var{cpu_type}.  The @samp{-mtune=}@var{cpu_type}
4510option overrides the @samp{-mcpu=}@var{cpu_type} option in terms of
4511instruction scheduling parameters.
4512
4513@item -mfull-toc
4514@itemx -mno-fp-in-toc
4515@itemx -mno-sum-in-toc
4516@itemx -mminimal-toc
4517@kindex -mminimal-toc
4518Modify generation of the TOC (Table Of Contents), which is created for
4519every executable file.  The @samp{-mfull-toc} option is selected by
4520default.  In that case, GCC will allocate at least one TOC entry for
4521each unique non-automatic variable reference in your program.  GCC
4522will also place floating-point constants in the TOC.  However, only
452316,384 entries are available in the TOC.
4524
4525If you receive a linker error message that saying you have overflowed
4526the available TOC space, you can reduce the amount of TOC space used
4527with the @samp{-mno-fp-in-toc} and @samp{-mno-sum-in-toc} options.
4528@samp{-mno-fp-in-toc} prevents GCC from putting floating-point
4529constants in the TOC and @samp{-mno-sum-in-toc} forces GCC to
4530generate code to calculate the sum of an address and a constant at
4531run-time instead of putting that sum into the TOC.  You may specify one
4532or both of these options.  Each causes GCC to produce very slightly
4533slower and larger code at the expense of conserving TOC space.
4534
4535If you still run out of space in the TOC even when you specify both of
4536these options, specify @samp{-mminimal-toc} instead.  This option causes
4537GCC to make only one TOC entry for every file.  When you specify this
4538option, GCC will produce code that is slower and larger but which
4539uses extremely little TOC space.  You may wish to use this option
4540only on files that contain less frequently executed code. @refill
4541
4542@item -maix64
4543@itemx -maix32
4544@kindex -maix64
4545@kindex -maix32
4546Enable AIX 64-bit ABI and calling convention: 64-bit pointers, 64-bit
4547@code{long} type, and the infrastructure needed to support them.
4548Specifying @samp{-maix64} implies @samp{-mpowerpc64} and
4549@samp{-mpowerpc}, while @samp{-maix32} disables the 64-bit ABI and
4550implies @samp{-mno-powerpc64}.  GCC defaults to @samp{-maix32}.
4551
4552@item -mxl-call
4553@itemx -mno-xl-call
4554@kindex -mxl-call
4555On AIX, pass floating-point arguments to prototyped functions beyond the
4556register save area (RSA) on the stack in addition to argument FPRs.  The
4557AIX calling convention was extended but not initially documented to
4558handle an obscure K&R C case of calling a function that takes the
4559address of its arguments with fewer arguments than declared.  AIX XL
4560compilers access floating point arguments which do not fit in the
4561RSA from the stack when a subroutine is compiled without
4562optimization.  Because always storing floating-point arguments on the
4563stack is inefficient and rarely needed, this option is not enabled by
4564default and only is necessary when calling subroutines compiled by AIX
4565XL compilers without optimization.
4566
4567@item -mthreads
4568@kindex -mthreads
4569Support @dfn{AIX Threads}.  Link an application written to use
4570@dfn{pthreads} with special libraries and startup code to enable the
4571application to run.
4572
4573@item -mpe
4574@kindex -mpe
4575Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE).  Link an
4576application written to use message passing with special startup code to
4577enable the application to run.  The system must have PE installed in the
4578standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
4579must be overridden with the @samp{-specs=} option to specify the
4580appropriate directory location.  The Parallel Environment does not
4581support threads, so the @samp{-mpe} option and the @samp{-mthreads}
4582option are incompatible.
4583
4584@item -msoft-float
4585@itemx -mhard-float
4586@kindex -msoft-float
4587Generate code that does not use (uses) the floating-point register set.
4588Software floating point emulation is provided if you use the
4589@samp{-msoft-float} option, and pass the option to GCC when linking.
4590
4591@item -mmultiple
4592@itemx -mno-multiple
4593Generate code that uses (does not use) the load multiple word
4594instructions and the store multiple word instructions.  These
4595instructions are generated by default on POWER systems, and not
4596generated on PowerPC systems.  Do not use @samp{-mmultiple} on little
4597endian PowerPC systems, since those instructions do not work when the
4598processor is in little endian mode.  The exceptions are PPC740 and
4599PPC750 which permit the instructions usage in little endian mode.
4600
4601@item -mstring
4602@itemx -mno-string
4603@kindex -mstring
4604Generate code that uses (does not use) the load string instructions
4605and the store string word instructions to save multiple registers and
4606do small block moves.  These instructions are generated by default on
4607POWER systems, and not generated on PowerPC systems.  Do not use
4608@samp{-mstring} on little endian PowerPC systems, since those
4609instructions do not work when the processor is in little endian mode.
4610The exceptions are PPC740 and PPC750 which permit the instructions
4611usage in little endian mode.
4612
4613@item -mupdate
4614@itemx -mno-update
4615@kindex -mupdate
4616Generate code that uses (does not use) the load or store instructions
4617that update the base register to the address of the calculated memory
4618location.  These instructions are generated by default.  If you use
4619@samp{-mno-update}, there is a small window between the time that the
4620stack pointer is updated and the address of the previous frame is
4621stored, which means code that walks the stack frame across interrupts or
4622signals may get corrupted data.
4623
4624@item -mfused-madd
4625@itemx -mno-fused-madd
4626@kindex -mfused-madd
4627Generate code that uses (does not use) the floating point multiply and
4628accumulate instructions.  These instructions are generated by default if
4629hardware floating is used.
4630
4631@item -mno-bit-align
4632@itemx -mbit-align
4633@kindex -mbit-align
4634On System V.4 and embedded PowerPC systems do not (do) force structures
4635and unions that contain bit fields to be aligned to the base type of the
4636bit field.
4637
4638For example, by default a structure containing nothing but 8
4639@code{unsigned} bitfields of length 1 would be aligned to a 4 byte
4640boundary and have a size of 4 bytes.  By using @samp{-mno-bit-align},
4641the structure would be aligned to a 1 byte boundary and be one byte in
4642size.
4643
4644@item -mno-strict-align
4645@itemx -mstrict-align
4646@kindex -mstrict-align
4647On System V.4 and embedded PowerPC systems do not (do) assume that
4648unaligned memory references will be handled by the system.
4649
4650@item -mrelocatable
4651@itemx -mno-relocatable
4652@kindex -mrelocatable
4653On embedded PowerPC systems generate code that allows (does not allow)
4654the program to be relocated to a different address at runtime.  If you
4655use @samp{-mrelocatable} on any module, all objects linked together must
4656be compiled with @samp{-mrelocatable} or @samp{-mrelocatable-lib}.
4657
4658@item -mrelocatable-lib
4659@itemx -mno-relocatable-lib
4660On embedded PowerPC systems generate code that allows (does not allow)
4661the program to be relocated to a different address at runtime.  Modules
4662compiled with @samp{-mrelocatable-lib} can be linked with either modules
4663compiled without @samp{-mrelocatable} and @samp{-mrelocatable-lib} or
4664with modules compiled with the @samp{-mrelocatable} options.
4665
4666@item -mno-toc
4667@itemx -mtoc
4668On System V.4 and embedded PowerPC systems do not (do) assume that
4669register 2 contains a pointer to a global area pointing to the addresses
4670used in the program.
4671
4672@item -mlittle
4673@itemx -mlittle-endian
4674On System V.4 and embedded PowerPC systems compile code for the
4675processor in little endian mode.  The @samp{-mlittle-endian} option is
4676the same as @samp{-mlittle}.
4677
4678@item -mbig
4679@itemx -mbig-endian
4680On System V.4 and embedded PowerPC systems compile code for the
4681processor in big endian mode.  The @samp{-mbig-endian} option is
4682the same as @samp{-mbig}.
4683
4684@item -mcall-sysv
4685On System V.4 and embedded PowerPC systems compile code using calling
4686conventions that adheres to the March 1995 draft of the System V
4687Application Binary Interface, PowerPC processor supplement.  This is the
4688default unless you configured GCC using @samp{powerpc-*-eabiaix}.
4689
4690@item -mcall-sysv-eabi
4691Specify both @samp{-mcall-sysv} and @samp{-meabi} options.
4692
4693@item -mcall-sysv-noeabi
4694Specify both @samp{-mcall-sysv} and @samp{-mno-eabi} options.
4695
4696@item -mcall-aix
4697On System V.4 and embedded PowerPC systems compile code using calling
4698conventions that are similar to those used on AIX.  This is the
4699default if you configured GCC using @samp{powerpc-*-eabiaix}.
4700
4701@item -mcall-solaris
4702On System V.4 and embedded PowerPC systems compile code for the Solaris
4703operating system.
4704
4705@item -mcall-linux
4706On System V.4 and embedded PowerPC systems compile code for the
4707Linux-based GNU system.
4708
4709@item -mprototype
4710@itemx -mno-prototype
4711On System V.4 and embedded PowerPC systems assume that all calls to
4712variable argument functions are properly prototyped.  Otherwise, the
4713compiler must insert an instruction before every non prototyped call to
4714set or clear bit 6 of the condition code register (@var{CR}) to
4715indicate whether floating point values were passed in the floating point
4716registers in case the function takes a variable arguments.  With
4717@samp{-mprototype}, only calls to prototyped variable argument functions
4718will set or clear the bit.
4719
4720@item -msim
4721On embedded PowerPC systems, assume that the startup module is called
4722@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
4723@file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
4724configurations.
4725
4726@item -mmvme
4727On embedded PowerPC systems, assume that the startup module is called
4728@file{crt0.o} and the standard C libraries are @file{libmvme.a} and
4729@file{libc.a}.
4730
4731@item -mads
4732On embedded PowerPC systems, assume that the startup module is called
4733@file{crt0.o} and the standard C libraries are @file{libads.a} and
4734@file{libc.a}.
4735
4736@item -myellowknife
4737On embedded PowerPC systems, assume that the startup module is called
4738@file{crt0.o} and the standard C libraries are @file{libyk.a} and
4739@file{libc.a}.
4740
4741@item -memb
4742On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
4743header to indicate that @samp{eabi} extended relocations are used.
4744
4745@item -meabi
4746@itemx -mno-eabi
4747On System V.4 and embedded PowerPC systems do (do not) adhere to the
4748Embedded Applications Binary Interface (eabi) which is a set of
4749modifications to the System V.4 specifications.  Selecting @code{-meabi}
4750means that the stack is aligned to an 8 byte boundary, a function
4751@code{__eabi} is called to from @code{main} to set up the eabi
4752environment, and the @samp{-msdata} option can use both @code{r2} and
4753@code{r13} to point to two separate small data areas.  Selecting
4754@code{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
4755do not call an initialization function from @code{main}, and the
4756@samp{-msdata} option will only use @code{r13} to point to a single
4757small data area.  The @samp{-meabi} option is on by default if you
4758configured GCC using one of the @samp{powerpc*-*-eabi*} options.
4759
4760@item -msdata=eabi
4761On System V.4 and embedded PowerPC systems, put small initialized
4762@code{const} global and static data in the @samp{.sdata2} section, which
4763is pointed to by register @code{r2}.  Put small initialized
4764non-@code{const} global and static data in the @samp{.sdata} section,
4765which is pointed to by register @code{r13}.  Put small uninitialized
4766global and static data in the @samp{.sbss} section, which is adjacent to
4767the @samp{.sdata} section.  The @samp{-msdata=eabi} option is
4768incompatible with the @samp{-mrelocatable} option.  The
4769@samp{-msdata=eabi} option also sets the @samp{-memb} option.
4770
4771@item -msdata=sysv
4772On System V.4 and embedded PowerPC systems, put small global and static
4773data in the @samp{.sdata} section, which is pointed to by register
4774@code{r13}.  Put small uninitialized global and static data in the
4775@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
4776The @samp{-msdata=sysv} option is incompatible with the
4777@samp{-mrelocatable} option.
4778
4779@item -msdata=default
4780@itemx -msdata
4781On System V.4 and embedded PowerPC systems, if @samp{-meabi} is used,
4782compile code the same as @samp{-msdata=eabi}, otherwise compile code the
4783same as @samp{-msdata=sysv}.
4784
4785@item -msdata-data
4786On System V.4 and embedded PowerPC systems, put small global and static
4787data in the @samp{.sdata} section.  Put small uninitialized global and
4788static data in the @samp{.sbss} section.  Do not use register @code{r13}
4789to address small data however.  This is the default behavior unless
4790other @samp{-msdata} options are used.
4791
4792@item -msdata=none
4793@itemx -mno-sdata
4794On embedded PowerPC systems, put all initialized global and static data
4795in the @samp{.data} section, and all uninitialized data in the
4796@samp{.bss} section.
4797
4798@item -G @var{num}
4799@cindex smaller data references (PowerPC)
4800@cindex .sdata/.sdata2 references (PowerPC)
4801On embedded PowerPC systems, put global and static items less than or
4802equal to @var{num} bytes into the small data or bss sections instead of
4803the normal data or bss section.  By default, @var{num} is 8.  The
4804@samp{-G @var{num}} switch is also passed to the linker.
4805All modules should be compiled with the same @samp{-G @var{num}} value.
4806
4807@item -mregnames
4808@itemx -mno-regnames
4809On System V.4 and embedded PowerPC systems do (do not) emit register
4810names in the assembly language output using symbolic forms.
4811
4812@end table
4813
4814@node RT Options
4815@subsection IBM RT Options
4816@cindex RT options
4817@cindex IBM RT options
4818
4819These @samp{-m} options are defined for the IBM RT PC:
4820
4821@table @code
4822@item -min-line-mul
4823Use an in-line code sequence for integer multiplies.  This is the
4824default.
4825
4826@item -mcall-lib-mul
4827Call @code{lmul$$} for integer multiples.
4828
4829@item -mfull-fp-blocks
4830Generate full-size floating point data blocks, including the minimum
4831amount of scratch space recommended by IBM.  This is the default.
4832
4833@item -mminimum-fp-blocks
4834Do not include extra scratch space in floating point data blocks.  This
4835results in smaller code, but slower execution, since scratch space must
4836be allocated dynamically.
4837
4838@cindex @file{varargs.h} and RT PC
4839@cindex @file{stdarg.h} and RT PC
4840@item -mfp-arg-in-fpregs
4841Use a calling sequence incompatible with the IBM calling convention in
4842which floating point arguments are passed in floating point registers.
4843Note that @code{varargs.h} and @code{stdargs.h} will not work with
4844floating point operands if this option is specified.
4845
4846@item -mfp-arg-in-gregs
4847Use the normal calling convention for floating point arguments.  This is
4848the default.
4849
4850@item -mhc-struct-return
4851Return structures of more than one word in memory, rather than in a
4852register.  This provides compatibility with the MetaWare HighC (hc)
4853compiler.  Use the option @samp{-fpcc-struct-return} for compatibility
4854with the Portable C Compiler (pcc).
4855
4856@item -mnohc-struct-return
4857Return some structures of more than one word in registers, when
4858convenient.  This is the default.  For compatibility with the
4859IBM-supplied compilers, use the option @samp{-fpcc-struct-return} or the
4860option @samp{-mhc-struct-return}.
4861@end table
4862
4863@node MIPS Options
4864@subsection MIPS Options
4865@cindex MIPS options
4866
4867These @samp{-m} options are defined for the MIPS family of computers:
4868
4869@table @code
4870@item -mcpu=@var{cpu type}
4871Assume the defaults for the machine type @var{cpu type} when scheduling
4872instructions.  The choices for @var{cpu type} are @samp{r2000}, @samp{r3000},
4873@samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
4874@samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
4875and @samp{orion}.  Additionally, the @samp{r2000}, @samp{r3000},
4876@samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
4877@samp{r2k} (or @samp{r2K}), @samp{r3k}, etc.  While picking a specific
4878@var{cpu type} will schedule things appropriately for that particular
4879chip, the compiler will not generate any code that does not meet level 1
4880of the MIPS ISA (instruction set architecture) without a @samp{-mipsX}
4881or @samp{-mabi} switch being used.
4882
4883@item -mips1
4884Issue instructions from level 1 of the MIPS ISA.  This is the default.
4885@samp{r3000} is the default @var{cpu type} at this ISA level.
4886
4887@item -mips2
4888Issue instructions from level 2 of the MIPS ISA (branch likely, square
4889root instructions).  @samp{r6000} is the default @var{cpu type} at this
4890ISA level.
4891
4892@item -mips3
4893Issue instructions from level 3 of the MIPS ISA (64 bit instructions).
4894@samp{r4000} is the default @var{cpu type} at this ISA level.
4895
4896@item -mips4
4897Issue instructions from level 4 of the MIPS ISA (conditional move,
4898prefetch, enhanced FPU instructions).  @samp{r8000} is the default
4899@var{cpu type} at this ISA level.
4900
4901@item -mfp32
4902Assume that 32 32-bit floating point registers are available.  This is
4903the default.
4904
4905@item -mfp64
4906Assume that 32 64-bit floating point registers are available.  This is
4907the default when the @samp{-mips3} option is used.
4908
4909@item -mgp32
4910Assume that 32 32-bit general purpose registers are available.  This is
4911the default.
4912
4913@item -mgp64
4914Assume that 32 64-bit general purpose registers are available.  This is
4915the default when the @samp{-mips3} option is used.
4916
4917@item -mint64
4918Force int and long types to be 64 bits wide.  See @samp{-mlong32} for an
4919explanation of the default, and the width of pointers.
4920
4921@item -mlong64
4922Force long types to be 64 bits wide.  See @samp{-mlong32} for an
4923explanation of the default, and the width of pointers.
4924
4925@item -mlong32
4926Force long, int, and pointer types to be 32 bits wide.
4927
4928If none of @samp{-mlong32}, @samp{-mlong64}, or @samp{-mint64} are set,
4929the size of ints, longs, and pointers depends on the ABI and ISA choosen.
4930For @samp{-mabi=32}, and @samp{-mabi=n32}, ints and longs are 32 bits
4931wide.  For @samp{-mabi=64}, ints are 32 bits, and longs are 64 bits wide.
4932For @samp{-mabi=eabi} and either @samp{-mips1} or @samp{-mips2}, ints
4933and longs are 32 bits wide.  For @samp{-mabi=eabi} and higher ISAs, ints
4934are 32 bits, and longs are 64 bits wide.  The width of pointer types is
4935the smaller of the width of longs or the width of general purpose
4936registers (which in turn depends on the ISA).
4937
4938@item -mabi=32
4939@itemx -mabi=o64
4940@itemx -mabi=n32
4941@itemx -mabi=64
4942@itemx -mabi=eabi
4943Generate code for the indicated ABI.  The default instruction level is
4944@samp{-mips1} for @samp{32}, @samp{-mips3} for @samp{n32}, and
4945@samp{-mips4} otherwise.  Conversely, with @samp{-mips1} or
4946@samp{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI
4947is @samp{64}.
4948
4949@item -mmips-as
4950Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
4951add normal debug information.  This is the default for all
4952platforms except for the OSF/1 reference platform, using the OSF/rose
4953object format.  If the either of the @samp{-gstabs} or @samp{-gstabs+}
4954switches are used, the @file{mips-tfile} program will encapsulate the
4955stabs within MIPS ECOFF.
4956
4957@item -mgas
4958Generate code for the GNU assembler.  This is the default on the OSF/1
4959reference platform, using the OSF/rose object format.  Also, this is
4960the default if the configure option @samp{--with-gnu-as} is used.
4961
4962@item -msplit-addresses
4963@itemx -mno-split-addresses
4964Generate code to load the high and low parts of address constants separately.
4965This allows @code{gcc} to optimize away redundant loads of the high order
4966bits of addresses.  This optimization requires GNU as and GNU ld.
4967This optimization is enabled by default for some embedded targets where
4968GNU as and GNU ld are standard.
4969
4970@item -mrnames
4971@itemx -mno-rnames
4972The @samp{-mrnames} switch says to output code using the MIPS software
4973names for the registers, instead of the hardware names (ie, @var{a0}
4974instead of @var{$4}).  The only known assembler that supports this option
4975is the Algorithmics assembler.
4976
4977@item -mgpopt
4978@itemx -mno-gpopt
4979The @samp{-mgpopt} switch says to write all of the data declarations
4980before the instructions in the text section, this allows the MIPS
4981assembler to generate one word memory references instead of using two
4982words for short global or static data items.  This is on by default if
4983optimization is selected.
4984
4985@item -mstats
4986@itemx -mno-stats
4987For each non-inline function processed, the @samp{-mstats} switch
4988causes the compiler to emit one line to the standard error file to
4989print statistics about the program (number of registers saved, stack
4990size, etc.).
4991
4992@item -mmemcpy
4993@itemx -mno-memcpy
4994The @samp{-mmemcpy} switch makes all block moves call the appropriate
4995string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
4996generating inline code.
4997
4998@item -mmips-tfile
4999@itemx -mno-mips-tfile
5000The @samp{-mno-mips-tfile} switch causes the compiler not
5001postprocess the object file with the @file{mips-tfile} program,
5002after the MIPS assembler has generated it to add debug support.  If
5003@file{mips-tfile} is not run, then no local variables will be
5004available to the debugger.  In addition, @file{stage2} and
5005@file{stage3} objects will have the temporary file names passed to the
5006assembler embedded in the object file, which means the objects will
5007not compare the same.  The @samp{-mno-mips-tfile} switch should only
5008be used when there are bugs in the @file{mips-tfile} program that
5009prevents compilation.
5010
5011@item -msoft-float
5012Generate output containing library calls for floating point.
5013@strong{Warning:} the requisite libraries are not part of GCC.
5014Normally the facilities of the machine's usual C compiler are used, but
5015this can't be done directly in cross-compilation.  You must make your
5016own arrangements to provide suitable library functions for
5017cross-compilation.
5018
5019@item -mhard-float
5020Generate output containing floating point instructions.  This is the
5021default if you use the unmodified sources.
5022
5023@item -mabicalls
5024@itemx -mno-abicalls
5025Emit (or do not emit) the pseudo operations @samp{.abicalls},
5026@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
5027position independent code.
5028
5029@item -mlong-calls
5030@itemx -mno-long-calls
5031Do all calls with the @samp{JALR} instruction, which requires
5032loading up a function's address into a register before the call.
5033You need to use this switch, if you call outside of the current
5034512 megabyte segment to functions that are not through pointers.
5035
5036@item -mhalf-pic
5037@itemx -mno-half-pic
5038Put pointers to extern references into the data section and load them
5039up, rather than put the references in the text section.
5040
5041@item -membedded-pic
5042@itemx -mno-embedded-pic
5043Generate PIC code suitable for some embedded systems.  All calls are
5044made using PC relative address, and all data is addressed using the $gp
5045register.  No more than 65536 bytes of global data may be used.  This
5046requires GNU as and GNU ld which do most of the work.  This currently
5047only works on targets which use ECOFF; it does not work with ELF.
5048
5049@item -membedded-data
5050@itemx -mno-embedded-data
5051Allocate variables to the read-only data section first if possible, then
5052next in the small data section if possible, otherwise in data.  This gives
5053slightly slower code than the default, but reduces the amount of RAM required
5054when executing, and thus may be preferred for some embedded systems.
5055
5056@item -msingle-float
5057@itemx -mdouble-float
5058The @samp{-msingle-float} switch tells gcc to assume that the floating
5059point coprocessor only supports single precision operations, as on the
5060@samp{r4650} chip.  The @samp{-mdouble-float} switch permits gcc to use
5061double precision operations.  This is the default.
5062
5063@item -mmad
5064@itemx -mno-mad
5065Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
5066as on the @samp{r4650} chip.
5067
5068@item -m4650
5069Turns on @samp{-msingle-float}, @samp{-mmad}, and, at least for now,
5070@samp{-mcpu=r4650}.
5071
5072@item -mips16
5073@itemx -mno-mips16
5074Enable 16-bit instructions.
5075
5076@item -mentry
5077Use the entry and exit pseudo ops.  This option can only be used with
5078@samp{-mips16}.
5079
5080@item -EL
5081Compile code for the processor in little endian mode.
5082The requisite libraries are assumed to exist.
5083
5084@item -EB
5085Compile code for the processor in big endian mode.
5086The requisite libraries are assumed to exist.
5087
5088@item -G @var{num}
5089@cindex smaller data references (MIPS)
5090@cindex gp-relative references (MIPS)
5091Put global and static items less than or equal to @var{num} bytes into
5092the small data or bss sections instead of the normal data or bss
5093section.  This allows the assembler to emit one word memory reference
5094instructions based on the global pointer (@var{gp} or @var{$28}),
5095instead of the normal two words used.  By default, @var{num} is 8 when
5096the MIPS assembler is used, and 0 when the GNU assembler is used.  The
5097@samp{-G @var{num}} switch is also passed to the assembler and linker.
5098All modules should be compiled with the same @samp{-G @var{num}}
5099value.
5100
5101@item -nocpp
5102Tell the MIPS assembler to not run its preprocessor over user
5103assembler files (with a @samp{.s} suffix) when assembling them.
5104@end table
5105
5106@ifset INTERNALS
5107These options are defined by the macro
5108@code{TARGET_SWITCHES} in the machine description.  The default for the
5109options is also defined by that macro, which enables you to change the
5110defaults.
5111@end ifset
5112
5113@node i386 Options
5114@subsection Intel 386 Options
5115@cindex i386 Options
5116@cindex Intel 386 Options
5117
5118These @samp{-m} options are defined for the i386 family of computers:
5119
5120@table @code
5121@item -mcpu=@var{cpu type}
5122Assume the defaults for the machine type @var{cpu type} when scheduling
5123instructions.  The choices for @var{cpu type} are:
5124
5125@multitable @columnfractions .20 .20 .20 .20
5126@item @samp{i386} @tab @samp{i486} @tab @samp{i586} @tab @samp{i686}
5127@item @samp{pentium} @tab @samp{pentiumpro} @tab @samp{k6}
5128@end multitable
5129
5130While picking a specific @var{cpu type} will schedule things appropriately
5131for that particular chip, the compiler will not generate any code that
5132does not run on the i386 without the @samp{-march=@var{cpu type}} option
5133being used.  @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
5134is equivalent to @samp{pentiumpro}.  @samp{k6} is the AMD chip as
5135opposed to the Intel ones.
5136
5137@item -march=@var{cpu type}
5138Generate instructions for the machine type @var{cpu type}.  The choices
5139for @var{cpu type} are the same as for @samp{-mcpu}.  Moreover, 
5140specifying @samp{-march=@var{cpu type}} implies @samp{-mcpu=@var{cpu type}}.
5141
5142@item -m386
5143@itemx -m486
5144@itemx -mpentium
5145@itemx -mpentiumpro
5146Synonyms for -mcpu=i386, -mcpu=i486, -mcpu=pentium, and -mcpu=pentiumpro
5147respectively.  These synonyms are deprecated.
5148
5149@item -mieee-fp
5150@itemx -mno-ieee-fp
5151Control whether or not the compiler uses IEEE floating point
5152comparisons.  These handle correctly the case where the result of a
5153comparison is unordered.
5154
5155@item -msoft-float
5156Generate output containing library calls for floating point.
5157@strong{Warning:} the requisite libraries are not part of GCC.
5158Normally the facilities of the machine's usual C compiler are used, but
5159this can't be done directly in cross-compilation.  You must make your
5160own arrangements to provide suitable library functions for
5161cross-compilation.
5162
5163On machines where a function returns floating point results in the 80387
5164register stack, some floating point opcodes may be emitted even if
5165@samp{-msoft-float} is used.
5166
5167@item -mno-fp-ret-in-387
5168Do not use the FPU registers for return values of functions.
5169
5170The usual calling convention has functions return values of types
5171@code{float} and @code{double} in an FPU register, even if there
5172is no FPU.  The idea is that the operating system should emulate
5173an FPU.
5174
5175The option @samp{-mno-fp-ret-in-387} causes such values to be returned
5176in ordinary CPU registers instead.
5177
5178@item -mno-fancy-math-387
5179Some 387 emulators do not support the @code{sin}, @code{cos} and
5180@code{sqrt} instructions for the 387.  Specify this option to avoid
5181generating those instructions. This option is the default on FreeBSD.
5182As of revision 2.6.1, these instructions are not generated unless you
5183also use the @samp{-ffast-math} switch.
5184
5185@item -malign-double
5186@itemx -mno-align-double
5187Control whether GCC aligns @code{double}, @code{long double}, and
5188@code{long long} variables on a two word boundary or a one word
5189boundary.  Aligning @code{double} variables on a two word boundary will
5190produce code that runs somewhat faster on a @samp{Pentium} at the
5191expense of more memory.
5192
5193@strong{Warning:} if you use the @samp{-malign-double} switch,
5194structures containing the above types will be aligned differently than
5195the published application binary interface specifications for the 386.
5196
5197@item -msvr3-shlib
5198@itemx -mno-svr3-shlib
5199Control whether GCC places uninitialized locals into @code{bss} or
5200@code{data}.  @samp{-msvr3-shlib} places these locals into @code{bss}.
5201These options are meaningful only on System V Release 3.
5202
5203@item -mno-wide-multiply
5204@itemx -mwide-multiply
5205Control whether GCC uses the @code{mul} and @code{imul} that produce
520664 bit results in @code{eax:edx} from 32 bit operands to do @code{long
5207long} multiplies and 32-bit division by constants.
5208
5209@item -mrtd
5210Use a different function-calling convention, in which functions that
5211take a fixed number of arguments return with the @code{ret} @var{num}
5212instruction, which pops their arguments while returning.  This saves one
5213instruction in the caller since there is no need to pop the arguments
5214there.
5215
5216You can specify that an individual function is called with this calling
5217sequence with the function attribute @samp{stdcall}.  You can also
5218override the @samp{-mrtd} option by using the function attribute
5219@samp{cdecl}.  @xref{Function Attributes}.
5220
5221@strong{Warning:} this calling convention is incompatible with the one
5222normally used on Unix, so you cannot use it if you need to call
5223libraries compiled with the Unix compiler.
5224
5225Also, you must provide function prototypes for all functions that
5226take variable numbers of arguments (including @code{printf});
5227otherwise incorrect code will be generated for calls to those
5228functions.
5229
5230In addition, seriously incorrect code will result if you call a
5231function with too many arguments.  (Normally, extra arguments are
5232harmlessly ignored.)
5233
5234@item -mreg-alloc=@var{regs}
5235Control the default allocation order of integer registers.  The
5236string @var{regs} is a series of letters specifying a register.  The
5237supported letters are: @code{a} allocate EAX; @code{b} allocate EBX;
5238@code{c} allocate ECX; @code{d} allocate EDX; @code{S} allocate ESI;
5239@code{D} allocate EDI; @code{B} allocate EBP.
5240
5241@item -mregparm=@var{num}
5242Control how many registers are used to pass integer arguments.  By
5243default, no registers are used to pass arguments, and at most 3
5244registers can be used.  You can control this behavior for a specific
5245function by using the function attribute @samp{regparm}.
5246@xref{Function Attributes}.
5247
5248@strong{Warning:} if you use this switch, and
5249@var{num} is nonzero, then you must build all modules with the same
5250value, including any libraries.  This includes the system libraries and
5251startup modules.
5252
5253@item -malign-loops=@var{num}
5254Align loops to a 2 raised to a @var{num} byte boundary.  If
5255@samp{-malign-loops} is not specified, the default is 2 unless
5256gas 2.8 (or later) is being used in which case the default is
5257to align the loop on a 16 byte boundary if it is less than 8
5258bytes away.
5259
5260@item -malign-jumps=@var{num}
5261Align instructions that are only jumped to to a 2 raised to a @var{num}
5262byte boundary.  If @samp{-malign-jumps} is not specified, the default is
52632 if optimizing for a 386, and 4 if optimizing for a 486 unless
5264gas 2.8 (or later) is being used in which case the default is
5265to align the instruction on a 16 byte boundary if it is less
5266than 8 bytes away.
5267
5268@item -malign-functions=@var{num}
5269Align the start of functions to a 2 raised to @var{num} byte boundary.
5270If @samp{-malign-functions} is not specified, the default is 2 if optimizing
5271for a 386, and 4 if optimizing for a 486.
5272
5273@item -mpreferred-stack-boundary=@var{num}
5274Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
5275byte boundary.  If @samp{-mpreferred-stack-boundary} is not specified,
5276the default is 4 (16 bytes or 128 bits).
5277
5278The stack is required to be aligned on a 4 byte boundary.  On Pentium
5279and PentiumPro, @code{double} and @code{long double} values should be
5280aligned to an 8 byte boundary (see @samp{-malign-double}) or suffer
5281significant run time performance penalties.  On Pentium III, the
5282Streaming SIMD Extention (SSE) data type @code{__m128} suffers similar
5283penalties if it is not 16 byte aligned.
5284
5285To ensure proper alignment of this values on the stack, the stack boundary
5286must be as aligned as that required by any value stored on the stack. 
5287Further, every function must be generated such that it keeps the stack
5288aligned.  Thus calling a function compiled with a higher preferred
5289stack boundary from a function compiled with a lower preferred stack
5290boundary will most likely misalign the stack.  It is recommended that
5291libraries that use callbacks always use the default setting.
5292
5293This extra alignment does consume extra stack space.  Code that is sensitive
5294to stack space usage, such as embedded systems and operating system kernels,
5295may want to reduce the preferred alignment to
5296@samp{-mpreferred-stack-boundary=2}.
5297@end table
5298
5299@node HPPA Options
5300@subsection HPPA Options
5301@cindex HPPA Options
5302
5303These @samp{-m} options are defined for the HPPA family of computers:
5304
5305@table @code
5306@item -march=@var{architecture type}
5307Generate code for the specified architecture.  The choices for
5308@var{architecture type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
53091.1, and @samp{2.0} for PA 2.0 processors.  Refer to
5310@file{/usr/lib/sched.models} on an HP-UX system to determine the proper
5311architecture option for your machine.  Code compiled for lower numbered
5312architectures will run on higher numbered architectures, but not the
5313other way around.
5314
5315PA 2.0 support currently requires gas snapshot 19990413 or later.  The
5316next release of binutils (current is 2.9.1) will probably contain PA 2.0
5317support.  
5318
5319@item -mpa-risc-1-0
5320@itemx -mpa-risc-1-1
5321@itemx -mpa-risc-2-0
5322Synonyms for -march=1.0, -march=1.1, and -march=2.0 respectively.
5323
5324@item -mbig-switch
5325Generate code suitable for big switch tables.  Use this option only if
5326the assembler/linker complain about out of range branches within a switch
5327table.
5328
5329@item -mjump-in-delay
5330Fill delay slots of function calls with unconditional jump instructions
5331by modifying the return pointer for the function call to be the target
5332of the conditional jump.
5333
5334@item -mdisable-fpregs
5335Prevent floating point registers from being used in any manner.  This is
5336necessary for compiling kernels which perform lazy context switching of
5337floating point registers.  If you use this option and attempt to perform
5338floating point operations, the compiler will abort.
5339
5340@item -mdisable-indexing
5341Prevent the compiler from using indexing address modes.  This avoids some
5342rather obscure problems when compiling MIG generated code under MACH.
5343
5344@item -mno-space-regs
5345Generate code that assumes the target has no space registers.  This allows
5346GCC to generate faster indirect calls and use unscaled index address modes.
5347
5348Such code is suitable for level 0 PA systems and kernels.
5349
5350@item -mfast-indirect-calls
5351Generate code that assumes calls never cross space boundaries.  This
5352allows GCC to emit code which performs faster indirect calls.
5353
5354This option will not work in the presense of shared libraries or nested
5355functions.
5356
5357@item -mspace
5358Optimize for space rather than execution time.  Currently this only
5359enables out of line function prologues and epilogues.  This option is
5360incompatible with PIC code generation and profiling.
5361
5362@item -mlong-load-store
5363Generate 3-instruction load and store sequences as sometimes required by
5364the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
5365the HP compilers.
5366
5367@item -mportable-runtime
5368Use the portable calling conventions proposed by HP for ELF systems.
5369
5370@item -mgas
5371Enable the use of assembler directives only GAS understands.
5372
5373@item -mschedule=@var{cpu type}
5374Schedule code according to the constraints for the machine type
5375@var{cpu type}.  The choices for @var{cpu type} are @samp{700} 
5376@samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}.  Refer to 
5377@file{/usr/lib/sched.models} on an HP-UX system to determine the
5378proper scheduling option for your machine.
5379
5380@item -mlinker-opt
5381Enable the optimization pass in the HPUX linker.  Note this makes symbolic
5382debugging impossible.  It also triggers a bug in the HPUX 8 and HPUX 9 linkers
5383in which they give bogus error messages when linking some programs.
5384
5385@item -msoft-float
5386Generate output containing library calls for floating point.
5387@strong{Warning:} the requisite libraries are not available for all HPPA
5388targets.  Normally the facilities of the machine's usual C compiler are
5389used, but this cannot be done directly in cross-compilation.  You must make
5390your own arrangements to provide suitable library functions for
5391cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
5392does provide software floating point support.
5393
5394@samp{-msoft-float} changes the calling convention in the output file;
5395therefore, it is only useful if you compile @emph{all} of a program with
5396this option.  In particular, you need to compile @file{libgcc.a}, the
5397library that comes with GCC, with @samp{-msoft-float} in order for
5398this to work.
5399@end table
5400
5401@node Intel 960 Options
5402@subsection Intel 960 Options
5403
5404These @samp{-m} options are defined for the Intel 960 implementations:
5405
5406@table @code
5407@item -m@var{cpu type}
5408Assume the defaults for the machine type @var{cpu type} for some of
5409the other options, including instruction scheduling, floating point
5410support, and addressing modes.  The choices for @var{cpu type} are
5411@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
5412@samp{sa}, and @samp{sb}.
5413The default is
5414@samp{kb}.
5415
5416@item -mnumerics
5417@itemx -msoft-float
5418The @samp{-mnumerics} option indicates that the processor does support
5419floating-point instructions.  The @samp{-msoft-float} option indicates
5420that floating-point support should not be assumed.
5421
5422@item -mleaf-procedures
5423@itemx -mno-leaf-procedures
5424Do (or do not) attempt to alter leaf procedures to be callable with the
5425@code{bal} instruction as well as @code{call}.  This will result in more
5426efficient code for explicit calls when the @code{bal} instruction can be
5427substituted by the assembler or linker, but less efficient code in other
5428cases, such as calls via function pointers, or using a linker that doesn't
5429support this optimization.
5430
5431@item -mtail-call
5432@itemx -mno-tail-call
5433Do (or do not) make additional attempts (beyond those of the
5434machine-independent portions of the compiler) to optimize tail-recursive
5435calls into branches.  You may not want to do this because the detection of
5436cases where this is not valid is not totally complete.  The default is
5437@samp{-mno-tail-call}.
5438
5439@item -mcomplex-addr
5440@itemx -mno-complex-addr
5441Assume (or do not assume) that the use of a complex addressing mode is a
5442win on this implementation of the i960.  Complex addressing modes may not
5443be worthwhile on the K-series, but they definitely are on the C-series.
5444The default is currently @samp{-mcomplex-addr} for all processors except
5445the CB and CC.
5446
5447@item -mcode-align
5448@itemx -mno-code-align
5449Align code to 8-byte boundaries for faster fetching (or don't bother).
5450Currently turned on by default for C-series implementations only.
5451
5452@ignore
5453@item -mclean-linkage
5454@itemx -mno-clean-linkage
5455These options are not fully implemented.
5456@end ignore
5457
5458@item -mic-compat
5459@itemx -mic2.0-compat
5460@itemx -mic3.0-compat
5461Enable compatibility with iC960 v2.0 or v3.0.
5462
5463@item -masm-compat
5464@itemx -mintel-asm
5465Enable compatibility with the iC960 assembler.
5466
5467@item -mstrict-align
5468@itemx -mno-strict-align
5469Do not permit (do permit) unaligned accesses.
5470
5471@item -mold-align
5472Enable structure-alignment compatibility with Intel's gcc release version
54731.3 (based on gcc 1.37).  This option implies @samp{-mstrict-align}.
5474
5475@item -mlong-double-64
5476Implement type @samp{long double} as 64-bit floating point numbers.
5477Without the option @samp{long double} is implemented by 80-bit
5478floating point numbers.  The only reason we have it because there is
5479no 128-bit @samp{long double} support in @samp{fp-bit.c} yet.  So it
5480is only useful for people using soft-float targets.  Otherwise, we
5481should recommend against use of it.
5482
5483@end table
5484
5485@node DEC Alpha Options
5486@subsection DEC Alpha Options
5487
5488These @samp{-m} options are defined for the DEC Alpha implementations:
5489
5490@table @code
5491@item -mno-soft-float
5492@itemx -msoft-float
5493Use (do not use) the hardware floating-point instructions for
5494floating-point operations.  When @code{-msoft-float} is specified,
5495functions in @file{libgcc1.c} will be used to perform floating-point
5496operations.  Unless they are replaced by routines that emulate the
5497floating-point operations, or compiled in such a way as to call such
5498emulations routines, these routines will issue floating-point
5499operations.   If you are compiling for an Alpha without floating-point
5500operations, you must ensure that the library is built so as not to call
5501them.
5502
5503Note that Alpha implementations without floating-point operations are
5504required to have floating-point registers.
5505
5506@item -mfp-reg
5507@itemx -mno-fp-regs
5508Generate code that uses (does not use) the floating-point register set.
5509@code{-mno-fp-regs} implies @code{-msoft-float}.  If the floating-point
5510register set is not used, floating point operands are passed in integer
5511registers as if they were integers and floating-point results are passed
5512in $0 instead of $f0.  This is a non-standard calling sequence, so any
5513function with a floating-point argument or return value called by code
5514compiled with @code{-mno-fp-regs} must also be compiled with that
5515option.
5516
5517A typical use of this option is building a kernel that does not use,
5518and hence need not save and restore, any floating-point registers.
5519
5520@item -mieee
5521The Alpha architecture implements floating-point hardware optimized for
5522maximum performance.  It is mostly compliant with the IEEE floating
5523point standard.  However, for full compliance, software assistance is
5524required.  This option generates code fully IEEE compliant code
5525@emph{except} that the @var{inexact flag} is not maintained (see below).
5526If this option is turned on, the CPP macro @code{_IEEE_FP} is defined
5527during compilation.  The option is a shorthand for: @samp{-D_IEEE_FP
5528-mfp-trap-mode=su -mtrap-precision=i -mieee-conformant}.  The resulting
5529code is less efficient but is able to correctly support denormalized
5530numbers and exceptional IEEE values such as not-a-number and plus/minus
5531infinity.  Other Alpha compilers call this option
5532@code{-ieee_with_no_inexact}.
5533
5534@item -mieee-with-inexact
5535@c overfull hbox here --bob 22 jul96
5536@c original text between ignore ... end ignore
5537@ignore
5538This is like @samp{-mieee} except the generated code also maintains the
5539IEEE @var{inexact flag}.  Turning on this option causes the generated
5540code to implement fully-compliant IEEE math.  The option is a shorthand
5541for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus @samp{-mieee-conformant},
5542@samp{-mfp-trap-mode=sui}, and @samp{-mtrap-precision=i}.  On some Alpha
5543implementations the resulting code may execute significantly slower than
5544the code generated by default.  Since there is very little code that
5545depends on the @var{inexact flag}, you should normally not specify this
5546option.  Other Alpha compilers call this option
5547@samp{-ieee_with_inexact}.
5548@end ignore
5549@c            changed paragraph
5550This is like @samp{-mieee} except the generated code also maintains the
5551IEEE @var{inexact flag}.  Turning on this option causes the generated
5552code to implement fully-compliant IEEE math.  The option is a shorthand
5553for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus the three following:
5554@samp{-mieee-conformant},
5555@samp{-mfp-trap-mode=sui}, 
5556and @samp{-mtrap-precision=i}.  
5557On some Alpha implementations the resulting code may execute
5558significantly slower than the code generated by default.  Since there
5559is very little code that depends on the @var{inexact flag}, you should
5560normally not specify this option.  Other Alpha compilers call this
5561option @samp{-ieee_with_inexact}.
5562@c             end changes to prevent overfull hboxes
5563
5564@item -mfp-trap-mode=@var{trap mode}
5565This option controls what floating-point related traps are enabled.
5566Other Alpha compilers call this option @samp{-fptm }@var{trap mode}.
5567The trap mode can be set to one of four values:
5568
5569@table @samp
5570@item n
5571This is the default (normal) setting.  The only traps that are enabled
5572are the ones that cannot be disabled in software (e.g., division by zero
5573trap).
5574
5575@item u
5576In addition to the traps enabled by @samp{n}, underflow traps are enabled
5577as well.
5578
5579@item su
5580Like @samp{su}, but the instructions are marked to be safe for software
5581completion (see Alpha architecture manual for details).
5582
5583@item sui
5584Like @samp{su}, but inexact traps are enabled as well.
5585@end table
5586
5587@item -mfp-rounding-mode=@var{rounding mode}
5588Selects the IEEE rounding mode.  Other Alpha compilers call this option
5589@samp{-fprm }@var{rounding mode}.  The @var{rounding mode} can be one
5590of:
5591
5592@table @samp
5593@item n
5594Normal IEEE rounding mode.  Floating point numbers are rounded towards
5595the nearest machine number or towards the even machine number in case
5596of a tie.
5597
5598@item m
5599Round towards minus infinity.
5600
5601@item c
5602Chopped rounding mode.  Floating point numbers are rounded towards zero.
5603
5604@item d
5605Dynamic rounding mode.  A field in the floating point control register
5606(@var{fpcr}, see Alpha architecture reference manual) controls the
5607rounding mode in effect.  The C library initializes this register for
5608rounding towards plus infinity.  Thus, unless your program modifies the
5609@var{fpcr}, @samp{d} corresponds to round towards plus infinity.
5610@end table
5611
5612@item -mtrap-precision=@var{trap precision}
5613In the Alpha architecture, floating point traps are imprecise.  This
5614means without software assistance it is impossible to recover from a
5615floating trap and program execution normally needs to be terminated.
5616GCC can generate code that can assist operating system trap handlers
5617in determining the exact location that caused a floating point trap.
5618Depending on the requirements of an application, different levels of
5619precisions can be selected:
5620
5621@table @samp
5622@item p
5623Program precision.  This option is the default and means a trap handler
5624can only identify which program caused a floating point exception.
5625
5626@item f
5627Function precision.  The trap handler can determine the function that
5628caused a floating point exception.
5629
5630@item i
5631Instruction precision.  The trap handler can determine the exact
5632instruction that caused a floating point exception.
5633@end table
5634
5635Other Alpha compilers provide the equivalent options called
5636@samp{-scope_safe} and @samp{-resumption_safe}.
5637
5638@item -mieee-conformant
5639This option marks the generated code as IEEE conformant.  You must not
5640use this option unless you also specify @samp{-mtrap-precision=i} and either
5641@samp{-mfp-trap-mode=su} or @samp{-mfp-trap-mode=sui}.  Its only effect
5642is to emit the line @samp{.eflag 48} in the function prologue of the
5643generated assembly file.  Under DEC Unix, this has the effect that
5644IEEE-conformant math library routines will be linked in.
5645
5646@item -mbuild-constants
5647Normally GCC examines a 32- or 64-bit integer constant to
5648see if it can construct it from smaller constants in two or three
5649instructions.  If it cannot, it will output the constant as a literal and
5650generate code to load it from the data segment at runtime.
5651
5652Use this option to require GCC to construct @emph{all} integer constants
5653using code, even if it takes more instructions (the maximum is six).
5654
5655You would typically use this option to build a shared library dynamic
5656loader.  Itself a shared library, it must relocate itself in memory
5657before it can find the variables and constants in its own data segment.
5658
5659@item -malpha-as
5660@itemx -mgas
5661Select whether to generate code to be assembled by the vendor-supplied
5662assembler (@samp{-malpha-as}) or by the GNU assembler @samp{-mgas}.
5663
5664@item -mbwx
5665@itemx -mno-bwx
5666@itemx -mcix
5667@itemx -mno-cix
5668@itemx -mmax
5669@itemx -mno-max
5670Indicate whether GCC should generate code to use the optional BWX,
5671CIX, and MAX instruction sets.  The default is to use the instruction sets
5672supported by the CPU type specified via @samp{-mcpu=} option or that
5673of the CPU on which GCC was built if none was specified.
5674
5675@item -mcpu=@var{cpu_type}
5676Set the instruction set, register set, and instruction scheduling
5677parameters for machine type @var{cpu_type}.  You can specify either the
5678@samp{EV} style name or the corresponding chip number.  GCC
5679supports scheduling parameters for the EV4 and EV5 family of processors
5680and will choose the default values for the instruction set from
5681the processor you specify.  If you do not specify a processor type,
5682GCC will default to the processor on which the compiler was built.
5683
5684Supported values for @var{cpu_type} are
5685
5686@table @samp
5687@item ev4
5688@itemx 21064
5689Schedules as an EV4 and has no instruction set extensions.
5690
5691@item ev5
5692@itemx 21164
5693Schedules as an EV5 and has no instruction set extensions.
5694
5695@item ev56
5696@itemx 21164a
5697Schedules as an EV5 and supports the BWX extension.
5698
5699@item pca56
5700@itemx 21164pc
5701@itemx 21164PC
5702Schedules as an EV5 and supports the BWX and MAX extensions.
5703
5704@item ev6
5705@itemx 21264
5706Schedules as an EV5 (until Digital releases the scheduling parameters
5707for the EV6) and supports the BWX, CIX, and MAX extensions.
5708@end table
5709
5710@item -mmemory-latency=@var{time}
5711Sets the latency the scheduler should assume for typical memory
5712references as seen by the application.  This number is highly
5713dependant on the memory access patterns used by the application
5714and the size of the external cache on the machine.
5715
5716Valid options for @var{time} are
5717
5718@table @samp
5719@item @var{number}
5720A decimal number representing clock cycles.
5721
5722@item L1
5723@itemx L2
5724@itemx L3
5725@itemx main
5726The compiler contains estimates of the number of clock cycles for
5727``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
5728(also called Dcache, Scache, and Bcache), as well as to main memory.
5729Note that L3 is only valid for EV5.
5730
5731@end table
5732@end table
5733
5734@node Clipper Options
5735@subsection Clipper Options
5736
5737These @samp{-m} options are defined for the Clipper implementations:
5738
5739@table @code
5740@item -mc300
5741Produce code for a C300 Clipper processor. This is the default.
5742
5743@item -mc400
5744Produce code for a C400 Clipper processor i.e. use floating point
5745registers f8..f15.
5746@end table
5747
5748@node H8/300 Options
5749@subsection H8/300 Options
5750
5751These @samp{-m} options are defined for the H8/300 implementations:
5752
5753@table @code
5754@item -mrelax
5755Shorten some address references at link time, when possible; uses the
5756linker option @samp{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
5757ld.info, Using ld}, for a fuller description.
5758
5759@item -mh
5760Generate code for the H8/300H.
5761
5762@item -ms
5763Generate code for the H8/S.
5764
5765@item -mint32
5766Make @code{int} data 32 bits by default.
5767
5768@item -malign-300
5769On the h8/300h, use the same alignment rules as for the h8/300.
5770The default for the h8/300h is to align longs and floats on 4 byte boundaries.
5771@samp{-malign-300} causes them to be aligned on 2 byte boundaries.
5772This option has no effect on the h8/300.
5773@end table
5774
5775@node SH Options
5776@subsection SH Options
5777
5778These @samp{-m} options are defined for the SH implementations:
5779
5780@table @code
5781@item -m1
5782Generate code for the SH1.
5783
5784@item -m2
5785Generate code for the SH2.
5786
5787@item -m3
5788Generate code for the SH3.
5789
5790@item -m3e
5791Generate code for the SH3e.
5792
5793@item -mb
5794Compile code for the processor in big endian mode.
5795
5796@item -ml
5797Compile code for the processor in little endian mode.
5798
5799@item -mdalign
5800Align doubles at 64 bit boundaries.  Note that this changes the calling
5801conventions, and thus some functions from the standard C library will
5802not work unless you recompile it first with -mdalign.
5803
5804@item -mrelax
5805Shorten some address references at link time, when possible; uses the
5806linker option @samp{-relax}.
5807@end table
5808
5809@node System V Options
5810@subsection Options for System V
5811
5812These additional options are available on System V Release 4 for
5813compatibility with other compilers on those systems:
5814
5815@table @code
5816@item -G
5817Create a shared object.
5818It is recommended that @samp{-symbolic} or @samp{-shared} be used instead.
5819
5820@item -Qy
5821Identify the versions of each tool used by the compiler, in a
5822@code{.ident} assembler directive in the output.
5823
5824@item -Qn
5825Refrain from adding @code{.ident} directives to the output file (this is
5826the default).
5827
5828@item -YP,@var{dirs}
5829Search the directories @var{dirs}, and no others, for libraries
5830specified with @samp{-l}.
5831
5832@item -Ym,@var{dir}
5833Look in the directory @var{dir} to find the M4 preprocessor.
5834The assembler uses this option.
5835@c This is supposed to go with a -Yd for predefined M4 macro files, but
5836@c the generic assembler that comes with Solaris takes just -Ym.
5837@end table
5838
5839@node TMS320C3x/C4x Options
5840@subsection TMS320C3x/C4x Options
5841@cindex TMS320C3x/C4x Options
5842
5843These @samp{-m} options are defined for TMS320C3x/C4x implementations:
5844
5845@table @code
5846
5847@item -mcpu=@var{cpu_type}
5848Set the instruction set, register set, and instruction scheduling
5849parameters for machine type @var{cpu_type}.  Supported values for
5850@var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
5851@samp{c44}.  The default is @samp{c40} to generate code for the
5852TMS320C40.
5853
5854@item -mbig-memory
5855@item -mbig
5856@itemx -msmall-memory
5857@itemx -msmall
5858Generates code for the big or small memory model.  The small memory
5859model assumed that all data fits into one 64K word page.  At run-time
5860the data page (DP) register must be set to point to the 64K page
5861containing the .bss and .data program sections.  The big memory model is
5862the default and requires reloading of the DP register for every direct
5863memory access.
5864
5865@item -mbk
5866@itemx -mno-bk
5867Allow (disallow) allocation of general integer operands into the block
5868count register BK. 
5869
5870@item -mdb
5871@itemx -mno-db
5872Enable (disable) generation of code using decrement and branch,
5873DBcond(D), instructions.  This is enabled by default for the C4x.  To be
5874on the safe side, this is disabled for the C3x, since the maximum
5875iteration count on the C3x is 2^23 + 1 (but who iterates loops more than
58762^23 times on the C3x?).  Note that GCC will try to reverse a loop so
5877that it can utilise the decrement and branch instruction, but will give
5878up if there is more than one memory reference in the loop.  Thus a loop
5879where the loop counter is decremented can generate slightly more
5880efficient code, in cases where the RPTB instruction cannot be utilised.
5881
5882@item -mdp-isr-reload
5883@itemx -mparanoid
5884Force the DP register to be saved on entry to an interrupt service
5885routine (ISR), reloaded to point to the data section, and restored on
5886exit from the ISR.  This should not be required unless someone has
5887violated the small memory model by modifying the DP register, say within
5888an object library.
5889
5890@item -mmpyi
5891@itemx -mno-mpyi
5892For the C3x use the 24-bit MPYI instruction for integer multiplies
5893instead of a library call to guarantee 32-bit results.  Note that if one
5894of the operands is a constant, then the multiplication will be performed
5895using shifts and adds.  If the -mmpyi option is not specified for the C3x,
5896then squaring operations are performed inline instead of a library call.
5897
5898@item -mfast-fix
5899@itemx -mno-fast-fix
5900The C3x/C4x FIX instruction to convert a floating point value to an
5901integer value chooses the nearest integer less than or equal to the
5902floating point value rather than to the nearest integer.  Thus if the
5903floating point number is negative, the result will be incorrectly
5904truncated an additional code is necessary to detect and correct this
5905case.  This option can be used to disable generation of the additional
5906code required to correct the result.
5907
5908@item -mrptb
5909@itemx -mno-rptb
5910Enable (disable) generation of repeat block sequences using the RPTB
5911instruction for zero overhead looping.  The RPTB construct is only used
5912for innermost loops that do not call functions or jump across the loop
5913boundaries.  There is no advantage having nested RPTB loops due to the
5914overhead required to save and restore the RC, RS, and RE registers.
5915This is enabled by default with -O2.
5916
5917@item -mrpts=@var{count}
5918@itemx -mno-rpts
5919Enable (disable) the use of the single instruction repeat instruction
5920RPTS.  If a repeat block contains a single instruction, and the loop
5921count can be guaranteed to be less than the value @var{count}, GCC will
5922emit a RPTS instruction instead of a RPTB.  If no value is specified,
5923then a RPTS will be emitted even if the loop count cannot be determined
5924at compile time.  Note that the repeated instruction following RPTS does
5925not have to be reloaded from memory each iteration, thus freeing up the
5926CPU buses for oeprands.  However, since interrupts are blocked by this
5927instruction, it is disabled by default.
5928
5929@item -mloop-unsigned
5930@itemx -mno-loop-unsigned
5931The maximum iteration count when using RPTS and RPTB (and DB on the C40)
5932is 2^31 + 1 since these instructions test if the iteration count is
5933negative to terminate the loop.  If the iteration count is unsigned
5934there is a possibility than the 2^31 + 1 maximum iteration count may be
5935exceeded.  This switch allows an unsigned iteration count.
5936
5937@item -mti
5938Try to emit an assembler syntax that the TI assembler (asm30) is happy
5939with.  This also enforces compatibility with the API employed by the TI
5940C3x C compiler.  For example, long doubles are passed as structures
5941rather than in floating point registers.
5942
5943@item -mregparm
5944@itemx -mmemparm
5945Generate code that uses registers (stack) for passing arguments to functions.
5946By default, arguments are passed in registers where possible rather
5947than by pushing arguments on to the stack.
5948
5949@item -mparallel-insns
5950@itemx -mno-parallel-insns
5951Allow the generation of parallel instructions.  This is enabled by
5952default with -O2.
5953
5954@item -mparallel-mpy
5955@itemx -mno-parallel-mpy
5956Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
5957provided -mparallel-insns is also specified.  These instructions have
5958tight register constraints which can pessimize the code generation
5959of large functions.
5960
5961@end table
5962
5963@node V850 Options
5964@subsection V850 Options
5965@cindex V850 Options
5966
5967These @samp{-m} options are defined for V850 implementations:
5968
5969@table @code
5970@item -mlong-calls
5971@itemx -mno-long-calls
5972Treat all calls as being far away (near).  If calls are assumed to be
5973far away, the compiler will always load the functions address up into a
5974register, and call indirect through the pointer.
5975
5976@item -mno-ep
5977@itemx -mep
5978Do not optimize (do optimize) basic blocks that use the same index
5979pointer 4 or more times to copy pointer into the @code{ep} register, and
5980use the shorter @code{sld} and @code{sst} instructions.  The @samp{-mep}
5981option is on by default if you optimize.
5982
5983@item -mno-prolog-function
5984@itemx -mprolog-function
5985Do not use (do use) external functions to save and restore registers at
5986the prolog and epilog of a function.  The external functions are slower,
5987but use less code space if more than one function saves the same number
5988of registers.  The @samp{-mprolog-function} option is on by default if
5989you optimize.
5990
5991@item -mspace
5992Try to make the code as small as possible.  At present, this just turns
5993on the @samp{-mep} and @samp{-mprolog-function} options.
5994
5995@item -mtda=@var{n}
5996Put static or global variables whose size is @var{n} bytes or less into
5997the tiny data area that register @code{ep} points to.  The tiny data
5998area can hold up to 256 bytes in total (128 bytes for byte references).
5999
6000@item -msda=@var{n}
6001Put static or global variables whose size is @var{n} bytes or less into
6002the small data area that register @code{gp} points to.  The small data
6003area can hold up to 64 kilobytes.
6004
6005@item -mzda=@var{n}
6006Put static or global variables whose size is @var{n} bytes or less into
6007the first 32 kilobytes of memory.
6008 
6009@item -mv850
6010Specify that the target processor is the V850.
6011
6012@item -mbig-switch
6013Generate code suitable for big switch tables.  Use this option only if
6014the assembler/linker complain about out of range branches within a switch
6015table.
6016@end table
6017
6018@node ARC Options
6019@subsection ARC Options
6020@cindex ARC Options
6021
6022These options are defined for ARC implementations:
6023
6024@table @code
6025@item -EL
6026Compile code for little endian mode.  This is the default.
6027
6028@item -EB
6029Compile code for big endian mode.
6030
6031@item -mmangle-cpu
6032Prepend the name of the cpu to all public symbol names.
6033In multiple-processor systems, there are many ARC variants with different
6034instruction and register set characteristics.  This flag prevents code
6035compiled for one cpu to be linked with code compiled for another.
6036No facility exists for handling variants that are "almost identical".
6037This is an all or nothing option.
6038
6039@item -mcpu=@var{cpu}
6040Compile code for ARC variant @var{cpu}.
6041Which variants are supported depend on the configuration.
6042All variants support @samp{-mcpu=base}, this is the default.
6043
6044@item -mtext=@var{text section}
6045@itemx -mdata=@var{data section}
6046@itemx -mrodata=@var{readonly data section}
6047Put functions, data, and readonly data in @var{text section},
6048@var{data section}, and @var{readonly data section} respectively
6049by default.  This can be overridden with the @code{section} attribute.
6050@xref{Variable Attributes}.
6051
6052@end table
6053
6054@node NS32K Options
6055@subsection NS32K Options
6056@cindex NS32K options
6057
6058These are the @samp{-m} options defined for the 32000 series.  The default
6059values for these options depends on which style of 32000 was selected when
6060the compiler was configured; the defaults for the most common choices are
6061given below.
6062
6063@table @code
6064@item -m32032
6065@itemx -m32032
6066Generate output for a 32032.  This is the default
6067when the compiler is configured for 32032 and 32016 based systems.
6068
6069@item -m32332
6070@itemx -m32332
6071Generate output for a 32332.  This is the default
6072when the compiler is configured for 32332-based systems.
6073
6074@item -m32532
6075@itemx -m32532
6076Generate output for a 32532.  This is the default
6077when the compiler is configured for 32532-based systems.
6078
6079@item -m32081
6080Generate output containing 32081 instructions for floating point.
6081This is the default for all systems.
6082
6083@item -m32381
6084Generate output containing 32381 instructions for floating point.  This
6085also implies @samp{-m32081}. The 32381 is only compatible with the 32332
6086and 32532 cpus. This is the default for the pc532-netbsd configuration.
6087
6088@item -mmulti-add
6089Try and generate multiply-add floating point instructions @code{polyF}
6090and @code{dotF}. This option is only available if the @samp{-m32381}
6091option is in effect. Using these instructions requires changes to to
6092register allocation which generally has a negative impact on
6093performance.  This option should only be enabled when compiling code
6094particularly likely to make heavy use of multiply-add instructions.
6095
6096@item -mnomulti-add
6097Do not try and generate multiply-add floating point instructions
6098@code{polyF} and @code{dotF}. This is the default on all platforms.
6099
6100@item -msoft-float
6101Generate output containing library calls for floating point.
6102@strong{Warning:} the requisite libraries may not be available.
6103
6104@item -mnobitfield
6105Do not use the bit-field instructions. On some machines it is faster to
6106use shifting and masking operations. This is the default for the pc532.
6107
6108@item -mbitfield
6109Do use the bit-field instructions. This is the default for all platforms
6110except the pc532.
6111
6112@item -mrtd
6113Use a different function-calling convention, in which functions
6114that take a fixed number of arguments return pop their
6115arguments on return with the @code{ret} instruction.
6116
6117This calling convention is incompatible with the one normally
6118used on Unix, so you cannot use it if you need to call libraries
6119compiled with the Unix compiler.
6120
6121Also, you must provide function prototypes for all functions that
6122take variable numbers of arguments (including @code{printf});
6123otherwise incorrect code will be generated for calls to those
6124functions.
6125
6126In addition, seriously incorrect code will result if you call a
6127function with too many arguments.  (Normally, extra arguments are
6128harmlessly ignored.)
6129
6130This option takes its name from the 680x0 @code{rtd} instruction.
6131
6132
6133@item -mregparam
6134Use a different function-calling convention where the first two arguments
6135are passed in registers.
6136
6137This calling convention is incompatible with the one normally
6138used on Unix, so you cannot use it if you need to call libraries
6139compiled with the Unix compiler.
6140
6141@item -mnoregparam
6142Do not pass any arguments in registers. This is the default for all
6143targets.
6144
6145@item -msb
6146It is OK to use the sb as an index register which is always loaded with
6147zero. This is the default for the pc532-netbsd target.
6148
6149@item -mnosb
6150The sb register is not available for use or has not been initialized to
6151zero by the run time system. This is the default for all targets except
6152the pc532-netbsd. It is also implied whenever @samp{-mhimem} or
6153@samp{-fpic} is set.
6154
6155@item -mhimem
6156Many ns32000 series addressing modes use displacements of up to 512MB.
6157If an address is above 512MB then displacements from zero can not be used.
6158This option causes code to be generated which can be loaded above 512MB.
6159This may be useful for operating systems or ROM code.
6160
6161@item -mnohimem
6162Assume code will be loaded in the first 512MB of virtual address space.
6163This is the default for all platforms.
6164
6165
6166@end table
6167
6168
6169
6170@node Code Gen Options
6171@section Options for Code Generation Conventions
6172@cindex code generation conventions
6173@cindex options, code generation
6174@cindex run-time options
6175
6176These machine-independent options control the interface conventions
6177used in code generation.
6178
6179Most of them have both positive and negative forms; the negative form
6180of @samp{-ffoo} would be @samp{-fno-foo}.  In the table below, only
6181one of the forms is listed---the one which is not the default.  You
6182can figure out the other form by either removing @samp{no-} or adding
6183it.
6184
6185@table @code
6186@item -fexceptions
6187Enable exception handling. Generates extra code needed to propagate
6188exceptions.  For some targets, this implies generation of frame unwind 
6189information for all functions. This can produce significant data size 
6190overhead, although it does not affect execution.
6191If you do not specify this option, it is enabled by
6192default for languages like C++ which normally require exception handling,
6193and disabled for languages like C that do not normally require it.
6194However, when compiling C code that needs to interoperate properly with
6195exception handlers written in C++, you may need to enable this option.
6196You may also wish to disable this option is you are compiling older C++
6197programs that don't use exception handling.
6198
6199@item -fpcc-struct-return
6200Return ``short'' @code{struct} and @code{union} values in memory like
6201longer ones, rather than in registers.  This convention is less
6202efficient, but it has the advantage of allowing intercallability between
6203GCC-compiled files and files compiled with other compilers.
6204
6205The precise convention for returning structures in memory depends
6206on the target configuration macros.
6207
6208Short structures and unions are those whose size and alignment match
6209that of some integer type.
6210
6211@item -freg-struct-return
6212Use the convention that @code{struct} and @code{union} values are
6213returned in registers when possible.  This is more efficient for small
6214structures than @samp{-fpcc-struct-return}.
6215
6216If you specify neither @samp{-fpcc-struct-return} nor its contrary
6217@samp{-freg-struct-return}, GCC defaults to whichever convention is
6218standard for the target.  If there is no standard convention, GCC
6219defaults to @samp{-fpcc-struct-return}, except on targets where GCC
6220is the principal compiler.  In those cases, we can choose the standard,
6221and we chose the more efficient register return alternative.
6222
6223@item -fshort-enums
6224Allocate to an @code{enum} type only as many bytes as it needs for the
6225declared range of possible values.  Specifically, the @code{enum} type
6226will be equivalent to the smallest integer type which has enough room.
6227
6228@item -fshort-double
6229Use the same size for @code{double} as for @code{float}.
6230
6231@item -fshared-data
6232Requests that the data and non-@code{const} variables of this
6233compilation be shared data rather than private data.  The distinction
6234makes sense only on certain operating systems, where shared data is
6235shared between processes running the same program, while private data
6236exists in one copy per process.
6237
6238@item -fno-common
6239Allocate even uninitialized global variables in the bss section of the
6240object file, rather than generating them as common blocks.  This has the
6241effect that if the same variable is declared (without @code{extern}) in
6242two different compilations, you will get an error when you link them.
6243The only reason this might be useful is if you wish to verify that the
6244program will work on other systems which always work this way.
6245
6246@item -fno-ident
6247Ignore the @samp{#ident} directive.
6248
6249@item -fno-gnu-linker
6250Do not output global initializations (such as C++ constructors and
6251destructors) in the form used by the GNU linker (on systems where the GNU
6252linker is the standard method of handling them).  Use this option when
6253you want to use a non-GNU linker, which also requires using the
6254@code{collect2} program to make sure the system linker includes
6255constructors and destructors.  (@code{collect2} is included in the GCC
6256distribution.)  For systems which @emph{must} use @code{collect2}, the
6257compiler driver @code{gcc} is configured to do this automatically.
6258
6259@item -finhibit-size-directive
6260Don't output a @code{.size} assembler directive, or anything else that
6261would cause trouble if the function is split in the middle, and the
6262two halves are placed at locations far apart in memory.  This option is
6263used when compiling @file{crtstuff.c}; you should not need to use it
6264for anything else.
6265
6266@item -fverbose-asm
6267Put extra commentary information in the generated assembly code to
6268make it more readable.  This option is generally only of use to those
6269who actually need to read the generated assembly code (perhaps while
6270debugging the compiler itself).
6271
6272@samp{-fno-verbose-asm}, the default, causes the
6273extra information to be omitted and is useful when comparing two assembler
6274files.
6275
6276@item -fvolatile
6277Consider all memory references through pointers to be volatile.
6278
6279@item -fvolatile-global
6280Consider all memory references to extern and global data items to
6281be volatile.  GCC does not consider static data items to be volatile
6282because of this switch.
6283
6284@item -fvolatile-static
6285Consider all memory references to static data to be volatile.
6286
6287@item -fpic
6288@cindex global offset table
6289@cindex PIC
6290Generate position-independent code (PIC) suitable for use in a shared
6291library, if supported for the target machine.  Such code accesses all
6292constant addresses through a global offset table (GOT).  The dynamic
6293loader resolves the GOT entries when the program starts (the dynamic
6294loader is not part of GCC; it is part of the operating system).  If
6295the GOT size for the linked executable exceeds a machine-specific
6296maximum size, you get an error message from the linker indicating that
6297@samp{-fpic} does not work; in that case, recompile with @samp{-fPIC}
6298instead.  (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
6299on the m68k and RS/6000.  The 386 has no such limit.)
6300
6301Position-independent code requires special support, and therefore works
6302only on certain machines.  For the 386, GCC supports PIC for System V
6303but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
6304position-independent.
6305
6306@item -fPIC
6307If supported for the target machine, emit position-independent code,
6308suitable for dynamic linking and avoiding any limit on the size of the
6309global offset table.  This option makes a difference on the m68k, m88k,
6310and the Sparc.
6311
6312Position-independent code requires special support, and therefore works
6313only on certain machines.
6314
6315@item -ffixed-@var{reg}
6316Treat the register named @var{reg} as a fixed register; generated code
6317should never refer to it (except perhaps as a stack pointer, frame
6318pointer or in some other fixed role).
6319
6320@var{reg} must be the name of a register.  The register names accepted
6321are machine-specific and are defined in the @code{REGISTER_NAMES}
6322macro in the machine description macro file.
6323
6324This flag does not have a negative form, because it specifies a
6325three-way choice.
6326
6327@item -fcall-used-@var{reg}
6328Treat the register named @var{reg} as an allocable register that is
6329clobbered by function calls.  It may be allocated for temporaries or
6330variables that do not live across a call.  Functions compiled this way
6331will not save and restore the register @var{reg}.
6332
6333It is an error to used this flag with the frame pointer or stack pointer.
6334Use of this flag for other registers that have fixed pervasive roles in
6335the machine's execution model will produce disastrous results.
6336
6337This flag does not have a negative form, because it specifies a
6338three-way choice.
6339
6340@item -fcall-saved-@var{reg}
6341Treat the register named @var{reg} as an allocable register saved by
6342functions.  It may be allocated even for temporaries or variables that
6343live across a call.  Functions compiled this way will save and restore
6344the register @var{reg} if they use it.
6345
6346It is an error to used this flag with the frame pointer or stack pointer.
6347Use of this flag for other registers that have fixed pervasive roles in
6348the machine's execution model will produce disastrous results.
6349
6350A different sort of disaster will result from the use of this flag for
6351a register in which function values may be returned.
6352
6353This flag does not have a negative form, because it specifies a
6354three-way choice.
6355
6356@item -fpack-struct
6357Pack all structure members together without holes.  Usually you would
6358not want to use this option, since it makes the code suboptimal, and
6359the offsets of structure members won't agree with system libraries.
6360
6361@item -fcheck-memory-usage
6362Generate extra code to check each memory access.  GCC will generate
6363code that is suitable for a detector of bad memory accesses such as
6364@file{Checker}.
6365
6366Normally, you should compile all, or none, of your code with this option.
6367
6368If you do mix code compiled with and without this option,
6369you must ensure that all code that has side effects
6370and that is called by code compiled with this option
6371is, itself, compiled with this option.
6372If you do not, you might get erroneous messages from the detector.
6373
6374If you use functions from a library that have side-effects (such as
6375@code{read}), you might not be able to recompile the library and
6376specify this option.  In that case, you can enable the
6377@samp{-fprefix-function-name} option, which requests GCC to encapsulate
6378your code and make other functions look as if they were compiled with
6379@samp{-fcheck-memory-usage}.  This is done by calling ``stubs'',
6380which are provided by the detector.  If you cannot find or build
6381stubs for every function you call, you might have to specify
6382@samp{-fcheck-memory-usage} without @samp{-fprefix-function-name}.
6383
6384If you specify this option, you can not use the @code{asm} or
6385@code{__asm__} keywords in functions with memory checking enabled.  The
6386compiler cannot understand what the @code{asm} statement will do, and
6387therefore cannot generate the appropriate code, so it is rejected.
6388However, the function attribute @code{no_check_memory_usage} will
6389disable memory checking within a function, and @code{asm} statements can
6390be put inside such functions.  Inline expansion of a non-checked
6391function within a checked function is permitted; the inline function's
6392memory accesses won't be checked, but the rest will.
6393
6394If you move your @code{asm} statements to non-checked inline functions,
6395but they do access memory, you can add calls to the support code in your
6396inline function, to indicate any reads, writes, or copies being done.
6397These calls would be similar to those done in the stubs described above.
6398
6399@c FIXME: The support-routine interface is defined by the compiler and
6400@c        should be documented!
6401
6402@item -fprefix-function-name
6403Request GCC to add a prefix to the symbols generated for function names.
6404GCC adds a prefix to the names of functions defined as well as
6405functions called.  Code compiled with this option and code compiled
6406without the option can't be linked together, unless stubs are used.
6407
6408If you compile the following code with @samp{-fprefix-function-name}
6409@example
6410extern void bar (int);
6411void
6412foo (int a)
6413@{
6414  return bar (a + 5);
6415@}
6416@end example
6417
6418@noindent
6419GCC will compile the code as if it was written:
6420@example
6421extern void prefix_bar (int);
6422void
6423prefix_foo (int a)
6424@{
6425  return prefix_bar (a + 5);
6426@}
6427@end example
6428This option is designed to be used with @samp{-fcheck-memory-usage}.
6429
6430@item -finstrument-functions
6431Generate instrumentation calls for entry and exit to functions.  Just
6432after function entry and just before function exit, the following
6433profiling functions will be called with the address of the current
6434function and its call site.  (On some platforms,
6435@code{__builtin_return_address} does not work beyond the current
6436function, so the call site information may not be available to the
6437profiling functions otherwise.)
6438
6439@example
6440void __cyg_profile_func_enter (void *this_fn, void *call_site);
6441void __cyg_profile_func_exit  (void *this_fn, void *call_site);
6442@end example
6443
6444The first argument is the address of the start of the current function,
6445which may be looked up exactly in the symbol table.
6446
6447This instrumentation is also done for functions expanded inline in other
6448functions.  The profiling calls will indicate where, conceptually, the
6449inline function is entered and exited.  This means that addressable
6450versions of such functions must be available.  If all your uses of a
6451function are expanded inline, this may mean an additional expansion of
6452code size.  If you use @samp{extern inline} in your C code, an
6453addressable version of such functions must be provided.  (This is
6454normally the case anyways, but if you get lucky and the optimizer always
6455expands the functions inline, you might have gotten away without
6456providing static copies.)
6457
6458A function may be given the attribute @code{no_instrument_function}, in
6459which case this instrumentation will not be done.  This can be used, for
6460example, for the profiling functions listed above, high-priority
6461interrupt routines, and any functions from which the profiling functions
6462cannot safely be called (perhaps signal handlers, if the profiling
6463routines generate output or allocate memory).
6464
6465@item -fstack-check
6466Generate code to verify that you do not go beyond the boundary of the
6467stack.  You should specify this flag if you are running in an
6468environment with multiple threads, but only rarely need to specify it in
6469a single-threaded environment since stack overflow is automatically
6470detected on nearly all systems if there is only one stack.
6471
6472@cindex aliasing of parameters
6473@cindex parameters, aliased
6474@item -fargument-alias
6475@itemx -fargument-noalias
6476@itemx -fargument-noalias-global
6477Specify the possible relationships among parameters and between
6478parameters and global data.
6479
6480@samp{-fargument-alias} specifies that arguments (parameters) may
6481alias each other and may alias global storage.
6482@samp{-fargument-noalias} specifies that arguments do not alias
6483each other, but may alias global storage.
6484@samp{-fargument-noalias-global} specifies that arguments do not
6485alias each other and do not alias global storage.
6486
6487Each language will automatically use whatever option is required by
6488the language standard.  You should not need to use these options yourself.
6489
6490@item -fleading-underscore
6491This option and its counterpart, -fno-leading-underscore, forcibly
6492change the way C symbols are represented in the object file.  One use
6493is to help link with legacy assembly code.
6494
6495Be warned that you should know what you are doing when invoking this
6496option, and that not all targets provide complete support for it.
6497@end table
6498
6499@node Environment Variables
6500@section Environment Variables Affecting GCC
6501@cindex environment variables
6502
6503This section describes several environment variables that affect how GCC
6504operates.  Some of them work by specifying directories or prefixes to use
6505when searching for various kinds of files. Some are used to specify other
6506aspects of the compilation environment.
6507
6508@ifclear INTERNALS
6509Note that you can also specify places to search using options such as
6510@samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
6511take precedence over places specified using environment variables, which
6512in turn take precedence over those specified by the configuration of GCC.
6513
6514@end ifclear
6515@ifset INTERNALS
6516Note that you can also specify places to search using options such as
6517@samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}).  These
6518take precedence over places specified using environment variables, which
6519in turn take precedence over those specified by the configuration of GCC.
6520@xref{Driver}.
6521@end ifset
6522
6523@table @code
6524@item LANG
6525@itemx LC_CTYPE
6526@c @itemx LC_COLLATE
6527@itemx LC_MESSAGES
6528@c @itemx LC_MONETARY
6529@c @itemx LC_NUMERIC
6530@c @itemx LC_TIME
6531@itemx LC_ALL
6532@findex LANG
6533@findex LC_CTYPE
6534@c @findex LC_COLLATE
6535@findex LC_MESSAGES
6536@c @findex LC_MONETARY
6537@c @findex LC_NUMERIC
6538@c @findex LC_TIME
6539@findex LC_ALL
6540@cindex locale
6541These environment variables control the way that GCC uses
6542localization information that allow GCC to work with different
6543national conventions.  GCC inspects the locale categories
6544@code{LC_CTYPE} and @code{LC_MESSAGES} if it has been configured to do
6545so.  These locale categories can be set to any value supported by your
6546installation.  A typical value is @samp{en_UK} for English in the United
6547Kingdom.
6548
6549The @code{LC_CTYPE} environment variable specifies character
6550classification.  GCC uses it to determine the character boundaries in
6551a string; this is needed for some multibyte encodings that contain quote
6552and escape characters that would otherwise be interpreted as a string
6553end or escape.
6554
6555The @code{LC_MESSAGES} environment variable specifies the language to
6556use in diagnostic messages.
6557
6558If the @code{LC_ALL} environment variable is set, it overrides the value
6559of @code{LC_CTYPE} and @code{LC_MESSAGES}; otherwise, @code{LC_CTYPE}
6560and @code{LC_MESSAGES} default to the value of the @code{LANG}
6561environment variable.  If none of these variables are set, GCC
6562defaults to traditional C English behavior.
6563
6564@item TMPDIR
6565@findex TMPDIR
6566If @code{TMPDIR} is set, it specifies the directory to use for temporary
6567files.  GCC uses temporary files to hold the output of one stage of
6568compilation which is to be used as input to the next stage: for example,
6569the output of the preprocessor, which is the input to the compiler
6570proper.
6571
6572@item GCC_EXEC_PREFIX
6573@findex GCC_EXEC_PREFIX
6574If @code{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
6575names of the subprograms executed by the compiler.  No slash is added
6576when this prefix is combined with the name of a subprogram, but you can
6577specify a prefix that ends with a slash if you wish.
6578
6579If GCC cannot find the subprogram using the specified prefix, it
6580tries looking in the usual places for the subprogram.
6581
6582The default value of @code{GCC_EXEC_PREFIX} is
6583@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
6584of @code{prefix} when you ran the @file{configure} script.
6585
6586Other prefixes specified with @samp{-B} take precedence over this prefix.
6587
6588This prefix is also used for finding files such as @file{crt0.o} that are
6589used for linking.
6590
6591In addition, the prefix is used in an unusual way in finding the
6592directories to search for header files.  For each of the standard
6593directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
6594(more precisely, with the value of @code{GCC_INCLUDE_DIR}), GCC tries
6595replacing that beginning with the specified prefix to produce an
6596alternate directory name.  Thus, with @samp{-Bfoo/}, GCC will search
6597@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
6598These alternate directories are searched first; the standard directories
6599come next.
6600
6601@item COMPILER_PATH
6602@findex COMPILER_PATH
6603The value of @code{COMPILER_PATH} is a colon-separated list of
6604directories, much like @code{PATH}.  GCC tries the directories thus
6605specified when searching for subprograms, if it can't find the
6606subprograms using @code{GCC_EXEC_PREFIX}.
6607
6608@item LIBRARY_PATH
6609@findex LIBRARY_PATH
6610The value of @code{LIBRARY_PATH} is a colon-separated list of
6611directories, much like @code{PATH}.  When configured as a native compiler,
6612GCC tries the directories thus specified when searching for special
6613linker files, if it can't find them using @code{GCC_EXEC_PREFIX}.  Linking
6614using GCC also uses these directories when searching for ordinary
6615libraries for the @samp{-l} option (but directories specified with
6616@samp{-L} come first).
6617
6618@item C_INCLUDE_PATH
6619@itemx CPLUS_INCLUDE_PATH
6620@itemx OBJC_INCLUDE_PATH
6621@findex C_INCLUDE_PATH
6622@findex CPLUS_INCLUDE_PATH
6623@findex OBJC_INCLUDE_PATH
6624@c @itemx OBJCPLUS_INCLUDE_PATH
6625These environment variables pertain to particular languages.  Each
6626variable's value is a colon-separated list of directories, much like
6627@code{PATH}.  When GCC searches for header files, it tries the
6628directories listed in the variable for the language you are using, after
6629the directories specified with @samp{-I} but before the standard header
6630file directories.
6631
6632@item DEPENDENCIES_OUTPUT
6633@findex DEPENDENCIES_OUTPUT
6634@cindex dependencies for make as output
6635If this variable is set, its value specifies how to output dependencies
6636for Make based on the header files processed by the compiler.  This
6637output looks much like the output from the @samp{-M} option
6638(@pxref{Preprocessor Options}), but it goes to a separate file, and is
6639in addition to the usual results of compilation.
6640
6641The value of @code{DEPENDENCIES_OUTPUT} can be just a file name, in
6642which case the Make rules are written to that file, guessing the target
6643name from the source file name.  Or the value can have the form
6644@samp{@var{file} @var{target}}, in which case the rules are written to
6645file @var{file} using @var{target} as the target name.
6646
6647@item LANG
6648@findex LANG
6649@cindex locale definition
6650This variable is used to pass locale information to the compiler. One way in
6651which this information is used is to determine the character set to be used
6652when character literals, string literals and comments are parsed in C and C++.
6653When the compiler is configured to allow multibyte characters,
6654the following values for @code{LANG} are recognized:
6655
6656@table @code
6657@item C-JIS
6658Recognize JIS characters.
6659@item C-SJIS
6660Recognize SJIS characters.
6661@item C-EUCJP
6662Recognize EUCJP characters.
6663@end table
6664
6665If @code{LANG} is not defined, or if it has some other value, then the
6666compiler will use mblen and mbtowc as defined by the default locale to
6667recognize and translate multibyte characters.
6668@end table
6669
6670@node Running Protoize
6671@section Running Protoize
6672
6673The program @code{protoize} is an optional part of GNU C.  You can use
6674it to add prototypes to a program, thus converting the program to ANSI
6675C in one respect.  The companion program @code{unprotoize} does the
6676reverse: it removes argument types from any prototypes that are found.
6677
6678When you run these programs, you must specify a set of source files as
6679command line arguments.  The conversion programs start out by compiling
6680these files to see what functions they define.  The information gathered
6681about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
6682
6683After scanning comes actual conversion.  The specified files are all
6684eligible to be converted; any files they include (whether sources or
6685just headers) are eligible as well.
6686
6687But not all the eligible files are converted.  By default,
6688@code{protoize} and @code{unprotoize} convert only source and header
6689files in the current directory.  You can specify additional directories
6690whose files should be converted with the @samp{-d @var{directory}}
6691option.  You can also specify particular files to exclude with the
6692@samp{-x @var{file}} option.  A file is converted if it is eligible, its
6693directory name matches one of the specified directory names, and its
6694name within the directory has not been excluded.
6695
6696Basic conversion with @code{protoize} consists of rewriting most
6697function definitions and function declarations to specify the types of
6698the arguments.  The only ones not rewritten are those for varargs
6699functions.
6700
6701@code{protoize} optionally inserts prototype declarations at the
6702beginning of the source file, to make them available for any calls that
6703precede the function's definition.  Or it can insert prototype
6704declarations with block scope in the blocks where undeclared functions
6705are called.
6706
6707Basic conversion with @code{unprotoize} consists of rewriting most
6708function declarations to remove any argument types, and rewriting
6709function definitions to the old-style pre-ANSI form.
6710
6711Both conversion programs print a warning for any function declaration or
6712definition that they can't convert.  You can suppress these warnings
6713with @samp{-q}.
6714
6715The output from @code{protoize} or @code{unprotoize} replaces the
6716original source file.  The original file is renamed to a name ending
6717with @samp{.save}.  If the @samp{.save} file already exists, then
6718the source file is simply discarded.
6719
6720@code{protoize} and @code{unprotoize} both depend on GCC itself to
6721scan the program and collect information about the functions it uses.
6722So neither of these programs will work until GCC is installed.
6723
6724Here is a table of the options you can use with @code{protoize} and
6725@code{unprotoize}.  Each option works with both programs unless
6726otherwise stated.
6727
6728@table @code
6729@item -B @var{directory}
6730Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
6731usual directory (normally @file{/usr/local/lib}).  This file contains
6732prototype information about standard system functions.  This option
6733applies only to @code{protoize}.
6734
6735@item -c @var{compilation-options}
6736Use  @var{compilation-options} as the options when running @code{gcc} to
6737produce the @samp{.X} files.  The special option @samp{-aux-info} is
6738always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
6739
6740Note that the compilation options must be given as a single argument to
6741@code{protoize} or @code{unprotoize}.  If you want to specify several
6742@code{gcc} options, you must quote the entire set of compilation options
6743to make them a single word in the shell.
6744
6745There are certain @code{gcc} arguments that you cannot use, because they
6746would produce the wrong kind of output.  These include @samp{-g},
6747@samp{-O}, @samp{-c}, @samp{-S}, and @samp{-o} If you include these in
6748the @var{compilation-options}, they are ignored.
6749
6750@item -C
6751Rename files to end in @samp{.C} instead of @samp{.c}.
6752This is convenient if you are converting a C program to C++.
6753This option applies only to @code{protoize}.
6754
6755@item -g
6756Add explicit global declarations.  This means inserting explicit
6757declarations at the beginning of each source file for each function
6758that is called in the file and was not declared.  These declarations
6759precede the first function definition that contains a call to an
6760undeclared function.  This option applies only to @code{protoize}.
6761
6762@item -i @var{string}
6763Indent old-style parameter declarations with the string @var{string}.
6764This option applies only to @code{protoize}.
6765
6766@code{unprotoize} converts prototyped function definitions to old-style
6767function definitions, where the arguments are declared between the
6768argument list and the initial @samp{@{}.  By default, @code{unprotoize}
6769uses five spaces as the indentation.  If you want to indent with just
6770one space instead, use @samp{-i " "}.
6771
6772@item -k
6773Keep the @samp{.X} files.  Normally, they are deleted after conversion
6774is finished.
6775
6776@item -l
6777Add explicit local declarations.  @code{protoize} with @samp{-l} inserts
6778a prototype declaration for each function in each block which calls the
6779function without any declaration.  This option applies only to
6780@code{protoize}.
6781
6782@item -n
6783Make no real changes.  This mode just prints information about the conversions
6784that would have been done without @samp{-n}.
6785
6786@item -N
6787Make no @samp{.save} files.  The original files are simply deleted.
6788Use this option with caution.
6789
6790@item -p @var{program}
6791Use the program @var{program} as the compiler.  Normally, the name
6792@file{gcc} is used.
6793
6794@item -q
6795Work quietly.  Most warnings are suppressed.
6796
6797@item -v
6798Print the version number, just like @samp{-v} for @code{gcc}.
6799@end table
6800
6801If you need special compiler options to compile one of your program's
6802source files, then you should generate that file's @samp{.X} file
6803specially, by running @code{gcc} on that source file with the
6804appropriate options and the option @samp{-aux-info}.  Then run
6805@code{protoize} on the entire set of files.  @code{protoize} will use
6806the existing @samp{.X} file because it is newer than the source file.
6807For example:
6808
6809@example
6810gcc -Dfoo=bar file1.c -aux-info
6811protoize *.c
6812@end example
6813
6814@noindent
6815You need to include the special files along with the rest in the
6816@code{protoize} command, even though their @samp{.X} files already
6817exist, because otherwise they won't get converted.
6818
6819@xref{Protoize Caveats}, for more information on how to use
6820@code{protoize} successfully.
6821
6822