]> gcc.gnu.org Git - gcc.git/blame - gcc/invoke.texi
Initial revision
[gcc.git] / gcc / invoke.texi
CommitLineData
74291a4b
MM
1@c Copyright (C) 1988, 89, 92, 93, 94, 1995, 1996 Free Software Foundation, Inc.
2@c This is part of the GCC manual.
3@c For copying conditions, see the file gcc.texi.
4
5@node Invoking GCC
6@chapter GNU CC Command Options
7@cindex GNU CC command options
8@cindex command options
9@cindex options, GNU CC command
10
11When you invoke GNU CC, it normally does preprocessing, compilation,
12assembly and linking. The ``overall options'' allow you to stop this
13process at an intermediate stage. For example, the @samp{-c} option
14says not to run the linker. Then the output consists of object files
15output by the assembler.
16
17Other options are passed on to one stage of processing. Some options
18control the preprocessor and others the compiler itself. Yet other
19options control the assembler and linker; most of these are not
20documented here, since you rarely need to use any of them.
21
22@cindex C compilation options
23Most of the command line options that you can use with GNU CC are useful
24for C programs; when an option is only useful with another language
25(usually C++), the explanation says so explicitly. If the description
26for a particular option does not mention a source language, you can use
27that option with all supported languages.
28
29@cindex C++ compilation options
30@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
31options for compiling C++ programs.
32
33@cindex grouping options
34@cindex options, grouping
35The @code{gcc} program accepts options and file names as operands. Many
36options have multiletter names; therefore multiple single-letter options
37may @emph{not} be grouped: @samp{-dr} is very different from @w{@samp{-d
38-r}}.
39
40@cindex order of options
41@cindex options, order
42You can mix options and other arguments. For the most part, the order
43you use doesn't matter. Order does matter when you use several options
44of the same kind; for example, if you specify @samp{-L} more than once,
45the directories are searched in the order specified.
46
47Many options have long names starting with @samp{-f} or with
48@samp{-W}---for example, @samp{-fforce-mem},
49@samp{-fstrength-reduce}, @samp{-Wformat} and so on. Most of
50these have both positive and negative forms; the negative form of
51@samp{-ffoo} would be @samp{-fno-foo}. This manual documents
52only one of these two forms, whichever one is not the default.
53
54@menu
55* Option Summary:: Brief list of all options, without explanations.
56* Overall Options:: Controlling the kind of output:
57 an executable, object files, assembler files,
58 or preprocessed source.
59* Invoking G++:: Compiling C++ programs.
60* C Dialect Options:: Controlling the variant of C language compiled.
61* C++ Dialect Options:: Variations on C++.
62* Warning Options:: How picky should the compiler be?
63* Debugging Options:: Symbol tables, measurements, and debugging dumps.
64* Optimize Options:: How much optimization?
65* Preprocessor Options:: Controlling header files and macro definitions.
66 Also, getting dependency information for Make.
67* Assembler Options:: Passing options to the assembler.
68* Link Options:: Specifying libraries and so on.
69* Directory Options:: Where to find header files and libraries.
70 Where to find the compiler executable files.
71* Target Options:: Running a cross-compiler, or an old version of GNU CC.
72* Submodel Options:: Specifying minor hardware or convention variations,
73 such as 68010 vs 68020.
74* Code Gen Options:: Specifying conventions for function calls, data layout
75 and register usage.
76* Environment Variables:: Env vars that affect GNU CC.
77* Running Protoize:: Automatically adding or removing function prototypes.
78@end menu
79
80@node Option Summary
81@section Option Summary
82
83Here is a summary of all the options, grouped by type. Explanations are
84in the following sections.
85
86@table @emph
87@item Overall Options
88@xref{Overall Options,,Options Controlling the Kind of Output}.
89@smallexample
90-c -S -E -o @var{file} -pipe -v -x @var{language}
91@end smallexample
92
93@item C Language Options
94@xref{C Dialect Options,,Options Controlling C Dialect}.
95@smallexample
96-ansi -fallow-single-precision -fcond-mismatch -fno-asm
97-fno-builtin -fsigned-bitfields -fsigned-char
98-funsigned-bitfields -funsigned-char -fwritable-strings
99-traditional -traditional-cpp -trigraphs
100@end smallexample
101
102@item C++ Language Options
103@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
104@smallexample
105-fall-virtual -fdollars-in-identifiers -felide-constructors
106-fenum-int-equiv -fexternal-templates -ffor-scope -fno-for-scope
107-fhandle-signatures -fmemoize-lookups -fno-default-inline -fno-gnu-keywords
108-fnonnull-objects -foperator-names -fstrict-prototype
109-fthis-is-variable -nostdinc++ -traditional +e@var{n}
110@end smallexample
111
112@item Warning Options
113@xref{Warning Options,,Options to Request or Suppress Warnings}.
114@smallexample
115-fsyntax-only -pedantic -pedantic-errors
116-w -W -Wall -Waggregate-return -Wbad-function-cast
117-Wcast-align -Wcast-qual -Wchar-subscript -Wcomment
118-Wconversion -Werror -Wformat
119-Wid-clash-@var{len} -Wimplicit -Wimport -Winline
120-Wlarger-than-@var{len} -Wmissing-declarations
121-Wmissing-prototypes -Wnested-externs
122-Wno-import -Woverloaded-virtual -Wparentheses
123-Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type -Wshadow
124-Wsign-compare -Wstrict-prototypes -Wswitch -Wsynth
125-Wtemplate-debugging -Wtraditional -Wtrigraphs
126-Wuninitialized -Wunused -Wwrite-strings
127@end smallexample
128
129@item Debugging Options
130@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
131@smallexample
132-a -ax -d@var{letters} -fpretend-float
133-g -g@var{level} -gcoff -gdwarf -gdwarf+
134-ggdb -gstabs -gstabs+ -gxcoff -gxcoff+
135-p -pg -print-file-name=@var{library} -print-libgcc-file-name
136-print-prog-name=@var{program} -print-search-dirs -save-temps
137@end smallexample
138
139@item Optimization Options
140@xref{Optimize Options,,Options that Control Optimization}.
141@smallexample
142-fcaller-saves -fcse-follow-jumps -fcse-skip-blocks
143-fdelayed-branch -fexpensive-optimizations
144-ffast-math -ffloat-store -fforce-addr -fforce-mem
145-ffunction-sections -finline-functions
146-fkeep-inline-functions -fno-default-inline
147-fno-defer-pop -fno-function-cse
148-fno-inline -fno-peephole -fomit-frame-pointer
149-frerun-cse-after-loop -fschedule-insns
150-fschedule-insns2 -fstrength-reduce -fthread-jumps
151-funroll-all-loops -funroll-loops
152-O -O0 -O1 -O2 -O3
153@end smallexample
154
155@item Preprocessor Options
156@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
157@smallexample
158-A@var{question}(@var{answer}) -C -dD -dM -dN
159-D@var{macro}@r{[}=@var{defn}@r{]} -E -H
160-idirafter @var{dir}
161-include @var{file} -imacros @var{file}
162-iprefix @var{file} -iwithprefix @var{dir}
163-iwithprefixbefore @var{dir} -isystem @var{dir}
164-M -MD -MM -MMD -MG -nostdinc -P -trigraphs
165-undef -U@var{macro} -Wp,@var{option}
166@end smallexample
167
168@item Assembler Option
169@xref{Assembler Options,,Passing Options to the Assembler}.
170@smallexample
171-Wa,@var{option}
172@end smallexample
173
174@item Linker Options
175@xref{Link Options,,Options for Linking}.
176@smallexample
177@var{object-file-name} -l@var{library}
178-nostartfiles -nodefaultlibs -nostdlib
179-s -static -shared -symbolic
180-Wl,@var{option} -Xlinker @var{option}
181-u @var{symbol}
182@end smallexample
183
184@item Directory Options
185@xref{Directory Options,,Options for Directory Search}.
186@smallexample
187-B@var{prefix} -I@var{dir} -I- -L@var{dir}
188@end smallexample
189
190@item Target Options
191@c I wrote this xref this way to avoid overfull hbox. -- rms
192@xref{Target Options}.
193@smallexample
194-b @var{machine} -V @var{version}
195@end smallexample
196
197@item Machine Dependent Options
198@xref{Submodel Options,,Hardware Models and Configurations}.
199@smallexample
200@emph{M680x0 Options}
201-m68000 -m68020 -m68020-40 -m68030 -m68040 -m68060
202-m5200 -m68881 -mbitfield -mc68000 -mc68020 -mfpa
203-mnobitfield -mrtd -mshort -msoft-float
204
205@emph{VAX Options}
206-mg -mgnu -munix
207
208@emph{SPARC Options}
209-mcpu=@var{cpu type}
210-mtune=@var{cpu type}
211-mapp-regs -mbroken-saverestore -mcypress -mepilogue
212-mflat -mfpu -mfullany -mhard-float -mhard-quad-float
213-mimpure-text -mint32 -mint64 -mlive-g0
214-mlong32 -mlong64 -mmedlow -mmedany
215-mno-app-regs -mno-epilogue
216-mno-flat -mno-fpu -mno-impure-text
217-mno-stack-bias -mno-unaligned-doubles
218-msoft-float -msoft-quad-float -msparclite -mstack-bias
219-msupersparc -munaligned-doubles -mv8
220
221@emph{Convex Options}
222-mc1 -mc2 -mc32 -mc34 -mc38
223-margcount -mnoargcount
224-mlong32 -mlong64
225-mvolatile-cache -mvolatile-nocache
226
227@emph{AMD29K Options}
228-m29000 -m29050 -mbw -mnbw -mdw -mndw
229-mlarge -mnormal -msmall
230-mkernel-registers -mno-reuse-arg-regs
231-mno-stack-check -mno-storem-bug
232-mreuse-arg-regs -msoft-float -mstack-check
233-mstorem-bug -muser-registers
234
235@emph{ARM Options}
236-mapcs-frame -mapcs-26 -mapcs-32
237-mlittle-endian -mbig-endian -mwords-little-endian
238-mshort-load-bytes -mno-short-load-bytes
239-msoft-float -mhard-float
240-mbsd -mxopen -mno-symrename
241
242@emph{M88K Options}
243-m88000 -m88100 -m88110 -mbig-pic
244-mcheck-zero-division -mhandle-large-shift
245-midentify-revision -mno-check-zero-division
246-mno-ocs-debug-info -mno-ocs-frame-position
247-mno-optimize-arg-area -mno-serialize-volatile
248-mno-underscores -mocs-debug-info
249-mocs-frame-position -moptimize-arg-area
250-mserialize-volatile -mshort-data-@var{num} -msvr3
251-msvr4 -mtrap-large-shift -muse-div-instruction
252-mversion-03.00 -mwarn-passed-structs
253
254@emph{RS/6000 and PowerPC Options}
255-mcpu=@var{cpu type}
256-mtune=@var{cpu type}
257-mpower -mno-power -mpower2 -mno-power2
258-mpowerpc -mno-powerpc
259-mpowerpc-gpopt -mno-powerpc-gpopt
260-mpowerpc-gfxopt -mno-powerpc-gfxopt
261-mnew-mnemonics -mno-new-mnemonics
262-mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc
263-mxl-call -mno-xl-call
264-msoft-float -mhard-float -mmultiple -mno-multiple
265-mstring -mno-string -mbit-align -mno-bit-align
266-mstrict-align -mno-strict-align -mrelocatable
267-mno-relocatable -mrelocatable-lib -mno-relocatable-lib
268-mtoc -mno-toc -mtraceback -mno-traceback
269-mlittle -mlittle-endian -mbig -mbig-endian
270-mcall-aix -mcall-sysv -mprototype -mno-prototype
271-msim -mmvme -memb -msdata -msdata=@var{opt} -G @var{num}
272
273@emph{RT Options}
274-mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
275-mfull-fp-blocks -mhc-struct-return -min-line-mul
276-mminimum-fp-blocks -mnohc-struct-return
277
278@emph{MIPS Options}
279-mabicalls -mcpu=@var{cpu type} -membedded-data
280-membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64
281-mgpopt -mhalf-pic -mhard-float -mint64 -mips1
282-mips2 -mips3 -mlong64 -mlong-calls -mmemcpy
283-mmips-as -mmips-tfile -mno-abicalls
284-mno-embedded-data -mno-embedded-pic
285-mno-gpopt -mno-long-calls
286-mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats
287-mrnames -msoft-float
288-m4650 -msingle-float -mmad
289-mstats -EL -EB -G @var{num} -nocpp
290
291@emph{i386 Options}
292-m486 -m386 -mieee-fp -mno-fancy-math-387
293-mno-fp-ret-in-387 -msoft-float -msvr3-shlib
294-mno-wide-multiply -mrtd -malign-double
295-mreg-alloc=@var{list} -mregparm=@var{num}
296-malign-jumps=@var{num} -malign-loops=@var{num}
297-malign-functions=@var{num}
298
299@emph{HPPA Options}
300-mdisable-fpregs -mdisable-indexing -mfast-indirect-calls
301-mgas -mjump-in-delay -mlong-load-store -mno-disable-fpregs
302-mno-disable-indexing -mno-fast-indirect-calls -mno-gas
303-mno-jump-in-delay
304-mno-long-load-store
305-mno-portable-runtime -mno-soft-float -mno-space -mno-space-regs -msoft-float
306-mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime
307-mschedule=@var{list} -mspace -mspace-regs
308
309@emph{Intel 960 Options}
310-m@var{cpu type} -masm-compat -mclean-linkage
311-mcode-align -mcomplex-addr -mleaf-procedures
312-mic-compat -mic2.0-compat -mic3.0-compat
313-mintel-asm -mno-clean-linkage -mno-code-align
314-mno-complex-addr -mno-leaf-procedures
315-mno-old-align -mno-strict-align -mno-tail-call
316-mnumerics -mold-align -msoft-float -mstrict-align
317-mtail-call
318
319@emph{DEC Alpha Options}
320-mfp-regs -mno-fp-regs
321-mno-soft-float -msoft-float
322-mieee -mieee-with-inexact -mieee-conformant
323-mfp-trap-mode -mfp-rounding-mode -mtrap-precision
324-mbuild-constants
325
326@emph{Clipper Options}
327-mc300 -mc400
328
329@emph{H8/300 Options}
330-mrelax -mh -mint32 -malign-300
331
332@emph{SH Options}
333-m1 -m2 -m3 -m3e -mb -ml -mrelax
334
335@emph{System V Options}
336-Qy -Qn -YP,@var{paths} -Ym,@var{dir}
337@end smallexample
338
339@item Code Generation Options
340@xref{Code Gen Options,,Options for Code Generation Conventions}.
341@smallexample
342-fcall-saved-@var{reg} -fcall-used-@var{reg}
343-ffixed-@var{reg} -finhibit-size-directive
344-fno-common -fno-ident -fno-gnu-linker
345-fpcc-struct-return -fpic -fPIC
346-freg-struct-return -fshared-data -fshort-enums
347-fshort-double -fvolatile -fvolatile-global
348-fverbose-asm -fpack-struct +e0 +e1
349@end smallexample
350@end table
351
352@menu
353* Overall Options:: Controlling the kind of output:
354 an executable, object files, assembler files,
355 or preprocessed source.
356* C Dialect Options:: Controlling the variant of C language compiled.
357* C++ Dialect Options:: Variations on C++.
358* Warning Options:: How picky should the compiler be?
359* Debugging Options:: Symbol tables, measurements, and debugging dumps.
360* Optimize Options:: How much optimization?
361* Preprocessor Options:: Controlling header files and macro definitions.
362 Also, getting dependency information for Make.
363* Assembler Options:: Passing options to the assembler.
364* Link Options:: Specifying libraries and so on.
365* Directory Options:: Where to find header files and libraries.
366 Where to find the compiler executable files.
367* Target Options:: Running a cross-compiler, or an old version of GNU CC.
368@end menu
369
370@node Overall Options
371@section Options Controlling the Kind of Output
372
373Compilation can involve up to four stages: preprocessing, compilation
374proper, assembly and linking, always in that order. The first three
375stages apply to an individual source file, and end by producing an
376object file; linking combines all the object files (those newly
377compiled, and those specified as input) into an executable file.
378
379@cindex file name suffix
380For any given input file, the file name suffix determines what kind of
381compilation is done:
382
383@table @code
384@item @var{file}.c
385C source code which must be preprocessed.
386
387@item @var{file}.i
388C source code which should not be preprocessed.
389
390@item @var{file}.ii
391C++ source code which should not be preprocessed.
392
393@item @var{file}.m
394Objective-C source code. Note that you must link with the library
395@file{libobjc.a} to make an Objective-C program work.
396
397@item @var{file}.h
398C header file (not to be compiled or linked).
399
400@item @var{file}.cc
401@itemx @var{file}.cxx
402@itemx @var{file}.cpp
403@itemx @var{file}.C
404C++ source code which must be preprocessed. Note that in @samp{.cxx},
405the last two letters must both be literally @samp{x}. Likewise,
406@samp{.C} refers to a literal capital C.
407
408@item @var{file}.s
409Assembler code.
410
411@item @var{file}.S
412Assembler code which must be preprocessed.
413
414@item @var{other}
415An object file to be fed straight into linking.
416Any file name with no recognized suffix is treated this way.
417@end table
418
419You can specify the input language explicitly with the @samp{-x} option:
420
421@table @code
422@item -x @var{language}
423Specify explicitly the @var{language} for the following input files
424(rather than letting the compiler choose a default based on the file
425name suffix). This option applies to all following input files until
426the next @samp{-x} option. Possible values for @var{language} are:
427@example
428c objective-c c++
429c-header cpp-output c++-cpp-output
430assembler assembler-with-cpp
431@end example
432
433@item -x none
434Turn off any specification of a language, so that subsequent files are
435handled according to their file name suffixes (as they are if @samp{-x}
436has not been used at all).
437@end table
438
439If you only want some of the stages of compilation, you can use
440@samp{-x} (or filename suffixes) to tell @code{gcc} where to start, and
441one of the options @samp{-c}, @samp{-S}, or @samp{-E} to say where
442@code{gcc} is to stop. Note that some combinations (for example,
443@samp{-x cpp-output -E} instruct @code{gcc} to do nothing at all.
444
445@table @code
446@item -c
447Compile or assemble the source files, but do not link. The linking
448stage simply is not done. The ultimate output is in the form of an
449object file for each source file.
450
451By default, the object file name for a source file is made by replacing
452the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
453
454Unrecognized input files, not requiring compilation or assembly, are
455ignored.
456
457@item -S
458Stop after the stage of compilation proper; do not assemble. The output
459is in the form of an assembler code file for each non-assembler input
460file specified.
461
462By default, the assembler file name for a source file is made by
463replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
464
465Input files that don't require compilation are ignored.
466
467@item -E
468Stop after the preprocessing stage; do not run the compiler proper. The
469output is in the form of preprocessed source code, which is sent to the
470standard output.
471
472Input files which don't require preprocessing are ignored.
473
474@cindex output file option
475@item -o @var{file}
476Place output in file @var{file}. This applies regardless to whatever
477sort of output is being produced, whether it be an executable file,
478an object file, an assembler file or preprocessed C code.
479
480Since only one output file can be specified, it does not make sense to
481use @samp{-o} when compiling more than one input file, unless you are
482producing an executable file as output.
483
484If @samp{-o} is not specified, the default is to put an executable file
485in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
486@file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
487all preprocessed C source on standard output.@refill
488
489@item -v
490Print (on standard error output) the commands executed to run the stages
491of compilation. Also print the version number of the compiler driver
492program and of the preprocessor and the compiler proper.
493
494@item -pipe
495Use pipes rather than temporary files for communication between the
496various stages of compilation. This fails to work on some systems where
497the assembler is unable to read from a pipe; but the GNU assembler has
498no trouble.
499@end table
500
501@node Invoking G++
502@section Compiling C++ Programs
503
504@cindex suffixes for C++ source
505@cindex C++ source file suffixes
506C++ source files conventionally use one of the suffixes @samp{.C},
507@samp{.cc}, @samp{cpp}, or @samp{.cxx}; preprocessed C++ files use the
508suffix @samp{.ii}. GNU CC recognizes files with these names and
509compiles them as C++ programs even if you call the compiler the same way
510as for compiling C programs (usually with the name @code{gcc}).
511
512@findex g++
513@findex c++
514However, C++ programs often require class libraries as well as a
515compiler that understands the C++ language---and under some
516circumstances, you might want to compile programs from standard input,
517or otherwise without a suffix that flags them as C++ programs.
518@code{g++} is a program that calls GNU CC with the default language
519set to C++, and automatically specifies linking against the GNU class
520library libg++.
521@cindex @code{g++ 1.@var{xx}}
522@cindex @code{g++}, separate compiler
523@cindex @code{g++} older version
524@footnote{Prior to release 2 of the compiler,
525there was a separate @code{g++} compiler. That version was based on GNU
526CC, but not integrated with it. Versions of @code{g++} with a
527@samp{1.@var{xx}} version number---for example, @code{g++} version 1.37
528or 1.42---are much less reliable than the versions integrated with GCC
5292. Moreover, combining G++ @samp{1.@var{xx}} with a version 2 GCC will
530simply not work.} On many systems, the script @code{g++} is also
531installed with the name @code{c++}.
532
533@cindex invoking @code{g++}
534When you compile C++ programs, you may specify many of the same
535command-line options that you use for compiling programs in any
536language; or command-line options meaningful for C and related
537languages; or options that are meaningful only for C++ programs.
538@xref{C Dialect Options,,Options Controlling C Dialect}, for
539explanations of options for languages related to C.
540@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
541explanations of options that are meaningful only for C++ programs.
542
543@node C Dialect Options
544@section Options Controlling C Dialect
545@cindex dialect options
546@cindex language dialect options
547@cindex options, dialect
548
549The following options control the dialect of C (or languages derived
550from C, such as C++ and Objective C) that the compiler accepts:
551
552@table @code
553@cindex ANSI support
554@item -ansi
555Support all ANSI standard C programs.
556
557This turns off certain features of GNU C that are incompatible with ANSI
558C, such as the @code{asm}, @code{inline} and @code{typeof} keywords, and
559predefined macros such as @code{unix} and @code{vax} that identify the
560type of system you are using. It also enables the undesirable and
561rarely used ANSI trigraph feature, disallows @samp{$} as part of
562identifiers, and disables recognition of C++ style @samp{//} comments.
563
564The alternate keywords @code{__asm__}, @code{__extension__},
565@code{__inline__} and @code{__typeof__} continue to work despite
566@samp{-ansi}. You would not want to use them in an ANSI C program, of
567course, but it is useful to put them in header files that might be included
568in compilations done with @samp{-ansi}. Alternate predefined macros
569such as @code{__unix__} and @code{__vax__} are also available, with or
570without @samp{-ansi}.
571
572The @samp{-ansi} option does not cause non-ANSI programs to be
573rejected gratuitously. For that, @samp{-pedantic} is required in
574addition to @samp{-ansi}. @xref{Warning Options}.
575
576The macro @code{__STRICT_ANSI__} is predefined when the @samp{-ansi}
577option is used. Some header files may notice this macro and refrain
578from declaring certain functions or defining certain macros that the
579ANSI standard doesn't call for; this is to avoid interfering with any
580programs that might use these names for other things.
581
582The functions @code{alloca}, @code{abort}, @code{exit}, and
583@code{_exit} are not builtin functions when @samp{-ansi} is used.
584
585@item -fno-asm
586Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
587keyword, so that code can use these words as identifiers. You can use
588the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
589instead. @samp{-ansi} implies @samp{-fno-asm}.
590
591In C++, this switch only affects the @code{typeof} keyword, since
592@code{asm} and @code{inline} are standard keywords. You may want to
593use the @samp{-fno-gnu-keywords} flag instead, as it also disables the
594other, C++-specific, extension keywords such as @code{headof}.
595
596@item -fno-builtin
597@cindex builtin functions
598@findex abort
599@findex abs
600@findex alloca
601@findex cos
602@findex exit
603@findex fabs
604@findex ffs
605@findex labs
606@findex memcmp
607@findex memcpy
608@findex sin
609@findex sqrt
610@findex strcmp
611@findex strcpy
612@findex strlen
613Don't recognize builtin functions that do not begin with two leading
614underscores. Currently, the functions affected include @code{abort},
615@code{abs}, @code{alloca}, @code{cos}, @code{exit}, @code{fabs},
616@code{ffs}, @code{labs}, @code{memcmp}, @code{memcpy}, @code{sin},
617@code{sqrt}, @code{strcmp}, @code{strcpy}, and @code{strlen}.
618
619GCC normally generates special code to handle certain builtin functions
620more efficiently; for instance, calls to @code{alloca} may become single
621instructions that adjust the stack directly, and calls to @code{memcpy}
622may become inline copy loops. The resulting code is often both smaller
623and faster, but since the function calls no longer appear as such, you
624cannot set a breakpoint on those calls, nor can you change the behavior
625of the functions by linking with a different library.
626
627The @samp{-ansi} option prevents @code{alloca} and @code{ffs} from being
628builtin functions, since these functions do not have an ANSI standard
629meaning.
630
631@item -trigraphs
632Support ANSI C trigraphs. You don't want to know about this
633brain-damage. The @samp{-ansi} option implies @samp{-trigraphs}.
634
635@cindex traditional C language
636@cindex C language, traditional
637@item -traditional
638Attempt to support some aspects of traditional C compilers.
639Specifically:
640
641@itemize @bullet
642@item
643All @code{extern} declarations take effect globally even if they
644are written inside of a function definition. This includes implicit
645declarations of functions.
646
647@item
648The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
649and @code{volatile} are not recognized. (You can still use the
650alternative keywords such as @code{__typeof__}, @code{__inline__}, and
651so on.)
652
653@item
654Comparisons between pointers and integers are always allowed.
655
656@item
657Integer types @code{unsigned short} and @code{unsigned char} promote
658to @code{unsigned int}.
659
660@item
661Out-of-range floating point literals are not an error.
662
663@item
664Certain constructs which ANSI regards as a single invalid preprocessing
665number, such as @samp{0xe-0xd}, are treated as expressions instead.
666
667@item
668String ``constants'' are not necessarily constant; they are stored in
669writable space, and identical looking constants are allocated
670separately. (This is the same as the effect of
671@samp{-fwritable-strings}.)
672
673@cindex @code{longjmp} and automatic variables
674@item
675All automatic variables not declared @code{register} are preserved by
676@code{longjmp}. Ordinarily, GNU C follows ANSI C: automatic variables
677not declared @code{volatile} may be clobbered.
678
679@item
680@kindex \x
681@kindex \a
682@cindex escape sequences, traditional
683The character escape sequences @samp{\x} and @samp{\a} evaluate as the
684literal characters @samp{x} and @samp{a} respectively. Without
685@w{@samp{-traditional}}, @samp{\x} is a prefix for the hexadecimal
686representation of a character, and @samp{\a} produces a bell.
687
688@item
689In C++ programs, assignment to @code{this} is permitted with
690@samp{-traditional}. (The option @samp{-fthis-is-variable} also has
691this effect.)
692@end itemize
693
694You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
695if your program uses names that are normally GNU C builtin functions for
696other purposes of its own.
697
698You cannot use @samp{-traditional} if you include any header files that
699rely on ANSI C features. Some vendors are starting to ship systems with
700ANSI C header files and you cannot use @samp{-traditional} on such
701systems to compile files that include any system headers.
702
703The @samp{-traditional} option also enables the @samp{-traditional-cpp}
704option, which is described next.
705
706@item -traditional-cpp
707Attempt to support some aspects of traditional C preprocessors.
708Specifically:
709
710@itemize @bullet
711@item
712Comments convert to nothing at all, rather than to a space. This allows
713traditional token concatenation.
714
715@item
716In a preprocessing directive, the @samp{#} symbol must appear as the first
717character of a line.
718
719@item
720Macro arguments are recognized within string constants in a macro
721definition (and their values are stringified, though without additional
722quote marks, when they appear in such a context). The preprocessor
723always considers a string constant to end at a newline.
724
725@item
726@cindex detecting @w{@samp{-traditional}}
727The predefined macro @code{__STDC__} is not defined when you use
728@samp{-traditional}, but @code{__GNUC__} is (since the GNU extensions
729which @code{__GNUC__} indicates are not affected by
730@samp{-traditional}). If you need to write header files that work
731differently depending on whether @samp{-traditional} is in use, by
732testing both of these predefined macros you can distinguish four
733situations: GNU C, traditional GNU C, other ANSI C compilers, and other
734old C compilers. The predefined macro @code{__STDC_VERSION__} is also
735not defined when you use @samp{-traditional}. @xref{Standard
736Predefined,,Standard Predefined Macros,cpp.info,The C Preprocessor},
737for more discussion of these and other predefined macros.
738
739@item
740@cindex string constants vs newline
741@cindex newline vs string constants
742The preprocessor considers a string constant to end at a newline (unless
743the newline is escaped with @samp{\}). (Without @w{@samp{-traditional}},
744string constants can contain the newline character as typed.)
745@end itemize
746
747@item -fcond-mismatch
748Allow conditional expressions with mismatched types in the second and
749third arguments. The value of such an expression is void.
750
751@item -funsigned-char
752Let the type @code{char} be unsigned, like @code{unsigned char}.
753
754Each kind of machine has a default for what @code{char} should
755be. It is either like @code{unsigned char} by default or like
756@code{signed char} by default.
757
758Ideally, a portable program should always use @code{signed char} or
759@code{unsigned char} when it depends on the signedness of an object.
760But many programs have been written to use plain @code{char} and
761expect it to be signed, or expect it to be unsigned, depending on the
762machines they were written for. This option, and its inverse, let you
763make such a program work with the opposite default.
764
765The type @code{char} is always a distinct type from each of
766@code{signed char} or @code{unsigned char}, even though its behavior
767is always just like one of those two.
768
769@item -fsigned-char
770Let the type @code{char} be signed, like @code{signed char}.
771
772Note that this is equivalent to @samp{-fno-unsigned-char}, which is
773the negative form of @samp{-funsigned-char}. Likewise, the option
774@samp{-fno-signed-char} is equivalent to @samp{-funsigned-char}.
775
776You may wish to use @samp{-fno-builtin} as well as @samp{-traditional}
777if your program uses names that are normally GNU C builtin functions for
778other purposes of its own.
779
780You cannot use @samp{-traditional} if you include any header files that
781rely on ANSI C features. Some vendors are starting to ship systems with
782ANSI C header files and you cannot use @samp{-traditional} on such
783systems to compile files that include any system headers.
784
785@item -fsigned-bitfields
786@itemx -funsigned-bitfields
787@itemx -fno-signed-bitfields
788@itemx -fno-unsigned-bitfields
789These options control whether a bitfield is signed or unsigned, when the
790declaration does not use either @code{signed} or @code{unsigned}. By
791default, such a bitfield is signed, because this is consistent: the
792basic integer types such as @code{int} are signed types.
793
794However, when @samp{-traditional} is used, bitfields are all unsigned
795no matter what.
796
797@item -fwritable-strings
798Store string constants in the writable data segment and don't uniquize
799them. This is for compatibility with old programs which assume they can
800write into string constants. The option @samp{-traditional} also has
801this effect.
802
803Writing into string constants is a very bad idea; ``constants'' should
804be constant.
805
806@item -fallow-single-precision
807Do not promote single precision math operations to double precision,
808even when compiling with @samp{-traditional}.
809
810Traditional K&R C promotes all floating point operations to double
811precision, regardless of the sizes of the operands. On the
812architecture for which you are compiling, single precision may be faster
813than double precision. If you must use @samp{-traditional}, but want
814to use single precision operations when the operands are single
815precision, use this option. This option has no effect when compiling
816with ANSI or GNU C conventions (the default).
817
818@end table
819
820@node C++ Dialect Options
821@section Options Controlling C++ Dialect
822
823@cindex compiler options, C++
824@cindex C++ options, command line
825@cindex options, C++
826This section describes the command-line options that are only meaningful
827for C++ programs; but you can also use most of the GNU compiler options
828regardless of what language your program is in. For example, you
829might compile a file @code{firstClass.C} like this:
830
831@example
832g++ -g -felide-constructors -O -c firstClass.C
833@end example
834
835@noindent
836In this example, only @samp{-felide-constructors} is an option meant
837only for C++ programs; you can use the other options with any
838language supported by GNU CC.
839
840Here is a list of options that are @emph{only} for compiling C++ programs:
841
842@table @code
843@item -fno-access-control
844Turn off all access checking. This switch is mainly useful for working
845around bugs in the access control code.
846
847@item -fall-virtual
848Treat all possible member functions as virtual, implicitly.
849All member functions (except for constructor functions and @code{new} or
850@code{delete} member operators) are treated as virtual functions of the
851class where they appear.
852
853This does not mean that all calls to these member functions will be made
854through the internal table of virtual functions. Under some
855circumstances, the compiler can determine that a call to a given virtual
856function can be made directly; in these cases the calls are direct in
857any case.
858
859@item -fcheck-new
860Check that the pointer returned by @code{operator new} is non-null
861before attempting to modify the storage allocated. The current Working
862Paper requires that @code{operator new} never return a null pointer, so
863this check is normally unnecessary.
864
865@item -fconserve-space
866Put uninitialized or runtime-initialized global variables into the
867common segment, as C does. This saves space in the executable at the
868cost of not diagnosing duplicate definitions. If you compile with this
869flag and your program mysteriously crashes after @code{main()} has
870completed, you may have an object that is being destroyed twice because
871two definitions were merged.
872
873@item -fdollars-in-identifiers
874Accept @samp{$} in identifiers. You can also explicitly prohibit use of
875@samp{$} with the option @samp{-fno-dollars-in-identifiers}. (GNU C++
876allows @samp{$} by default on some target systems but not others.)
877Traditional C allowed the character @samp{$} to form part of
878identifiers. However, ANSI C and C++ forbid @samp{$} in identifiers.
879
880@item -fenum-int-equiv
881Anachronistically permit implicit conversion of @code{int} to
882enumeration types. Current C++ allows conversion of @code{enum} to
883@code{int}, but not the other way around.
884
885@item -fexternal-templates
886Cause template instantiations to obey @samp{#pragma interface} and
887@samp{implementation}; template instances are emitted or not according
888to the location of the template definition. @xref{Template
889Instantiation}, for more information.
890
891@item -falt-external-templates
892Similar to -fexternal-templates, but template instances are emitted or
893not according to the place where they are first instantiated.
894@xref{Template Instantiation}, for more information.
895
896@item -ffor-scope
897@item -fno-for-scope
898If -ffor-scope is specified, the scope of variables declared in
899a @i{for-init-statement} is limited to the @samp{for} loop itself,
900as specified by the draft C++ standard.
901If -fno-for-scope is specified, the scope of variables declared in
902a @i{for-init-statement} extends to the end of the enclosing scope,
903as was the case in old versions of gcc, and other (traditional)
904implementations of C++.
905
906The default if neither flag is given to follow the standard,
907but to allow and give a warning for old-style code that would
908otherwise be invalid, or have different behavior.
909
910@item -fno-gnu-keywords
911Do not recognize @code{classof}, @code{headof}, @code{signature},
912@code{sigof} or @code{typeof} as a keyword, so that code can use these
913words as identifiers. You can use the keywords @code{__classof__},
914@code{__headof__}, @code{__signature__}, @code{__sigof__}, and
915@code{__typeof__} instead. @samp{-ansi} implies
916@samp{-fno-gnu-keywords}.
917
918@item -fno-implicit-templates
919Never emit code for templates which are instantiated implicitly (i.e. by
920use); only emit code for explicit instantiations. @xref{Template
921Instantiation}, for more information.
922
923@item -fhandle-signatures
924Recognize the @code{signature} and @code{sigof} keywords for specifying
925abstract types. The default (@samp{-fno-handle-signatures}) is not to
926recognize them. @xref{C++ Signatures, Type Abstraction using
927Signatures}.
928
929@item -fhuge-objects
930Support virtual function calls for objects that exceed the size
931representable by a @samp{short int}. Users should not use this flag by
932default; if you need to use it, the compiler will tell you so. If you
933compile any of your code with this flag, you must compile @emph{all} of
934your code with this flag (including libg++, if you use it).
935
936This flag is not useful when compiling with -fvtable-thunks.
937
938@item -fno-implement-inlines
939To save space, do not emit out-of-line copies of inline functions
940controlled by @samp{#pragma implementation}. This will cause linker
941errors if these functions are not inlined everywhere they are called.
942
943@item -fmemoize-lookups
944@itemx -fsave-memoized
945Use heuristics to compile faster. These heuristics are not enabled by
946default, since they are only effective for certain input files. Other
947input files compile more slowly.
948
949The first time the compiler must build a call to a member function (or
950reference to a data member), it must (1) determine whether the class
951implements member functions of that name; (2) resolve which member
952function to call (which involves figuring out what sorts of type
953conversions need to be made); and (3) check the visibility of the member
954function to the caller. All of this adds up to slower compilation.
955Normally, the second time a call is made to that member function (or
956reference to that data member), it must go through the same lengthy
957process again. This means that code like this:
958
959@smallexample
960cout << "This " << p << " has " << n << " legs.\n";
961@end smallexample
962
963@noindent
964makes six passes through all three steps. By using a software cache, a
965``hit'' significantly reduces this cost. Unfortunately, using the cache
966introduces another layer of mechanisms which must be implemented, and so
967incurs its own overhead. @samp{-fmemoize-lookups} enables the software
968cache.
969
970Because access privileges (visibility) to members and member functions
971may differ from one function context to the next, G++ may need to flush
972the cache. With the @samp{-fmemoize-lookups} flag, the cache is flushed
973after every function that is compiled. The @samp{-fsave-memoized} flag
974enables the same software cache, but when the compiler determines that
975the context of the last function compiled would yield the same access
976privileges of the next function to compile, it preserves the cache.
977This is most helpful when defining many member functions for the same
978class: with the exception of member functions which are friends of other
979classes, each member function has exactly the same access privileges as
980every other, and the cache need not be flushed.
981
982The code that implements these flags has rotted; you should probably
983avoid using them.
984
985@item -fstrict-prototype
986Within an @samp{extern "C"} linkage specification, treat a function
987declaration with no arguments, such as @samp{int foo ();}, as declaring
988the function to take no arguments. Normally, such a declaration means
989that the function @code{foo} can take any combination of arguments, as
990in C. @samp{-pedantic} implies @samp{-fstrict-prototype} unless
991overridden with @samp{-fno-strict-prototype}.
992
993This flag no longer affects declarations with C++ linkage.
994
995@item -fno-nonnull-objects
996Don't assume that a reference is initialized to refer to a valid object.
997Although the current C++ Working Paper prohibits null references, some
998old code may rely on them, and you can use @samp{-fno-nonnull-objects}
999to turn on checking.
1000
1001At the moment, the compiler only does this checking for conversions to
1002virtual base classes.
1003
1004@item -foperator-names
1005Recognize the operator name keywords @code{and}, @code{bitand},
1006@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1007synonyms for the symbols they refer to. @samp{-ansi} implies
1008@samp{-foperator-names}.
1009
1010@item -fthis-is-variable
1011Permit assignment to @code{this}. The incorporation of user-defined
1012free store management into C++ has made assignment to @samp{this} an
1013anachronism. Therefore, by default it is invalid to assign to
1014@code{this} within a class member function; that is, GNU C++ treats
1015@samp{this} in a member function of class @code{X} as a non-lvalue of
1016type @samp{X *}. However, for backwards compatibility, you can make it
1017valid with @samp{-fthis-is-variable}.
1018
1019@item -fvtable-thunks
1020Use @samp{thunks} to implement the virtual function dispatch table
1021(@samp{vtable}). The traditional (cfront-style) approach to
1022implementing vtables was to store a pointer to the function and two
1023offsets for adjusting the @samp{this} pointer at the call site. Newer
1024implementations store a single pointer to a @samp{thunk} function which
1025does any necessary adjustment and then calls the target function.
1026
1027This option also enables a heuristic for controlling emission of
1028vtables; if a class has any non-inline virtual functions, the vtable
1029will be emitted in the translation unit containing the first one of
1030those.
1031
1032@item -nostdinc++
1033Do not search for header files in the standard directories specific to
1034C++, but do still search the other standard directories. (This option
1035is used when building libg++.)
1036
1037@item -traditional
1038For C++ programs (in addition to the effects that apply to both C and
1039C++), this has the same effect as @samp{-fthis-is-variable}.
1040@xref{C Dialect Options,, Options Controlling C Dialect}.
1041@end table
1042
1043In addition, these optimization, warning, and code generation options
1044have meanings only for C++ programs:
1045
1046@table @code
1047@item -fno-default-inline
1048Do not assume @samp{inline} for functions defined inside a class scope.
1049@xref{Optimize Options,,Options That Control Optimization}.
1050
1051@item -Woverloaded-virtual
1052@itemx -Wtemplate-debugging
1053Warnings that apply only to C++ programs. @xref{Warning
1054Options,,Options to Request or Suppress Warnings}.
1055
1056@item +e@var{n}
1057Control how virtual function definitions are used, in a fashion
1058compatible with @code{cfront} 1.x. @xref{Code Gen Options,,Options for
1059Code Generation Conventions}.
1060@end table
1061
1062@node Warning Options
1063@section Options to Request or Suppress Warnings
1064@cindex options to control warnings
1065@cindex warning messages
1066@cindex messages, warning
1067@cindex suppressing warnings
1068
1069Warnings are diagnostic messages that report constructions which
1070are not inherently erroneous but which are risky or suggest there
1071may have been an error.
1072
1073You can request many specific warnings with options beginning @samp{-W},
1074for example @samp{-Wimplicit} to request warnings on implicit
1075declarations. Each of these specific warning options also has a
1076negative form beginning @samp{-Wno-} to turn off warnings;
1077for example, @samp{-Wno-implicit}. This manual lists only one of the
1078two forms, whichever is not the default.
1079
1080These options control the amount and kinds of warnings produced by GNU
1081CC:
1082
1083@table @code
1084@cindex syntax checking
1085@item -fsyntax-only
1086Check the code for syntax errors, but don't do anything beyond that.
1087
1088@item -pedantic
1089Issue all the warnings demanded by strict ANSI standard C; reject
1090all programs that use forbidden extensions.
1091
1092Valid ANSI standard C programs should compile properly with or without
1093this option (though a rare few will require @samp{-ansi}). However,
1094without this option, certain GNU extensions and traditional C features
1095are supported as well. With this option, they are rejected.
1096
1097@samp{-pedantic} does not cause warning messages for use of the
1098alternate keywords whose names begin and end with @samp{__}. Pedantic
1099warnings are also disabled in the expression that follows
1100@code{__extension__}. However, only system header files should use
1101these escape routes; application programs should avoid them.
1102@xref{Alternate Keywords}.
1103
1104This option is not intended to be @i{useful}; it exists only to satisfy
1105pedants who would otherwise claim that GNU CC fails to support the ANSI
1106standard.
1107
1108Some users try to use @samp{-pedantic} to check programs for strict ANSI
1109C conformance. They soon find that it does not do quite what they want:
1110it finds some non-ANSI practices, but not all---only those for which
1111ANSI C @emph{requires} a diagnostic.
1112
1113A feature to report any failure to conform to ANSI C might be useful in
1114some instances, but would require considerable additional work and would
1115be quite different from @samp{-pedantic}. We recommend, rather, that
1116users take advantage of the extensions of GNU C and disregard the
1117limitations of other compilers. Aside from certain supercomputers and
1118obsolete small machines, there is less and less reason ever to use any
1119other C compiler other than for bootstrapping GNU CC.
1120
1121@item -pedantic-errors
1122Like @samp{-pedantic}, except that errors are produced rather than
1123warnings.
1124
1125@item -w
1126Inhibit all warning messages.
1127
1128@item -Wno-import
1129Inhibit warning messages about the use of @samp{#import}.
1130
1131@item -Wchar-subscripts
1132Warn if an array subscript has type @code{char}. This is a common cause
1133of error, as programmers often forget that this type is signed on some
1134machines.
1135
1136@item -Wcomment
1137Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1138comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1139
1140@item -Wformat
1141Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1142the arguments supplied have types appropriate to the format string
1143specified.
1144
1145@item -Wimplicit
1146Warn whenever a function or parameter is implicitly declared.
1147
1148@item -Wparentheses
1149Warn if parentheses are omitted in certain contexts, such
1150as when there is an assignment in a context where a truth value
1151is expected, or when operators are nested whose precedence people
1152often get confused about.
1153
1154@item -Wreturn-type
1155Warn whenever a function is defined with a return-type that defaults
1156to @code{int}. Also warn about any @code{return} statement with no
1157return-value in a function whose return-type is not @code{void}.
1158
1159@item -Wswitch
1160Warn whenever a @code{switch} statement has an index of enumeral type
1161and lacks a @code{case} for one or more of the named codes of that
1162enumeration. (The presence of a @code{default} label prevents this
1163warning.) @code{case} labels outside the enumeration range also
1164provoke warnings when this option is used.
1165
1166@item -Wtrigraphs
1167Warn if any trigraphs are encountered (assuming they are enabled).
1168
1169@item -Wunused
1170Warn whenever a variable is unused aside from its declaration,
1171whenever a function is declared static but never defined, whenever a
1172label is declared but not used, and whenever a statement computes a
1173result that is explicitly not used.
1174
1175To suppress this warning for an expression, simply cast it to void. For
1176unused variables and parameters, use the @samp{unused} attribute
1177(@pxref{Variable Attributes}).
1178
1179@item -Wuninitialized
1180An automatic variable is used without first being initialized.
1181
1182These warnings are possible only in optimizing compilation,
1183because they require data flow information that is computed only
1184when optimizing. If you don't specify @samp{-O}, you simply won't
1185get these warnings.
1186
1187These warnings occur only for variables that are candidates for
1188register allocation. Therefore, they do not occur for a variable that
1189is declared @code{volatile}, or whose address is taken, or whose size
1190is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
1191structures, unions or arrays, even when they are in registers.
1192
1193Note that there may be no warning about a variable that is used only
1194to compute a value that itself is never used, because such
1195computations may be deleted by data flow analysis before the warnings
1196are printed.
1197
1198These warnings are made optional because GNU CC is not smart
1199enough to see all the reasons why the code might be correct
1200despite appearing to have an error. Here is one example of how
1201this can happen:
1202
1203@smallexample
1204@{
1205 int x;
1206 switch (y)
1207 @{
1208 case 1: x = 1;
1209 break;
1210 case 2: x = 4;
1211 break;
1212 case 3: x = 5;
1213 @}
1214 foo (x);
1215@}
1216@end smallexample
1217
1218@noindent
1219If the value of @code{y} is always 1, 2 or 3, then @code{x} is
1220always initialized, but GNU CC doesn't know this. Here is
1221another common case:
1222
1223@smallexample
1224@{
1225 int save_y;
1226 if (change_y) save_y = y, y = new_y;
1227 @dots{}
1228 if (change_y) y = save_y;
1229@}
1230@end smallexample
1231
1232@noindent
1233This has no bug because @code{save_y} is used only if it is set.
1234
1235Some spurious warnings can be avoided if you declare all the functions
1236you use that never return as @code{noreturn}. @xref{Function
1237Attributes}.
1238
1239@item -Wreorder (C++ only)
1240@cindex reordering, warning
1241@cindex warning for reordering of member initializers
1242Warn when the order of member initializers given in the code does not
1243match the order in which they must be executed. For instance:
1244
1245@smallexample
1246struct A @{
1247 int i;
1248 int j;
1249 A(): j (0), i (1) @{ @}
1250@};
1251@end smallexample
1252
1253Here the compiler will warn that the member initializers for @samp{i}
1254and @samp{j} will be rearranged to match the declaration order of the
1255members.
1256
1257@item -Wsign-compare
1258@cindex warning for comparison of signed and unsigned values
1259@cindex comparison of signed and unsigned values, warning
1260@cindex signed and unsigned values, comparison warning
1261Warn when a comparison between signed and unsigned values could produce
1262an incorrect result when the signed value is converted to unsigned.
1263
1264@item -Wtemplate-debugging
1265@cindex template debugging
1266When using templates in a C++ program, warn if debugging is not yet
1267fully available (C++ only).
1268
1269@item -Wall
1270All of the above @samp{-W} options combined. This enables all the
1271warnings about constructions that some users consider questionable, and
1272that are easy to avoid (or modify to prevent the warning), even in
1273conjunction with macros.
1274@end table
1275
1276The following @samp{-W@dots{}} options are not implied by @samp{-Wall}.
1277Some of them warn about constructions that users generally do not
1278consider questionable, but which occasionally you might wish to check
1279for; others warn about constructions that are necessary or hard to avoid
1280in some cases, and there is no simple way to modify the code to suppress
1281the warning.
1282
1283@table @code
1284@item -W
1285Print extra warning messages for these events:
1286
1287@itemize @bullet
1288@cindex @code{longjmp} warnings
1289@item
1290A nonvolatile automatic variable might be changed by a call to
1291@code{longjmp}. These warnings as well are possible only in
1292optimizing compilation.
1293
1294The compiler sees only the calls to @code{setjmp}. It cannot know
1295where @code{longjmp} will be called; in fact, a signal handler could
1296call it at any point in the code. As a result, you may get a warning
1297even when there is in fact no problem because @code{longjmp} cannot
1298in fact be called at the place which would cause a problem.
1299
1300@item
1301A function can return either with or without a value. (Falling
1302off the end of the function body is considered returning without
1303a value.) For example, this function would evoke such a
1304warning:
1305
1306@smallexample
1307@group
1308foo (a)
1309@{
1310 if (a > 0)
1311 return a;
1312@}
1313@end group
1314@end smallexample
1315
1316@item
1317An expression-statement or the left-hand side of a comma expression
1318contains no side effects.
1319To suppress the warning, cast the unused expression to void.
1320For example, an expression such as @samp{x[i,j]} will cause a warning,
1321but @samp{x[(void)i,j]} will not.
1322
1323@item
1324An unsigned value is compared against zero with @samp{<} or @samp{<=}.
1325
1326@item
1327A comparison like @samp{x<=y<=z} appears; this is equivalent to
1328@samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
1329that of ordinary mathematical notation.
1330
1331@item
1332Storage-class specifiers like @code{static} are not the first things in
1333a declaration. According to the C Standard, this usage is obsolescent.
1334
1335@item
1336If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused
1337arguments.
1338
1339@item
1340An aggregate has a partly bracketed initializer.
1341For example, the following code would evoke such a warning,
1342because braces are missing around the initializer for @code{x.h}:
1343
1344@smallexample
1345struct s @{ int f, g; @};
1346struct t @{ struct s h; int i; @};
1347struct t x = @{ 1, 2, 3 @};
1348@end smallexample
1349@end itemize
1350
1351@item -Wtraditional
1352Warn about certain constructs that behave differently in traditional and
1353ANSI C.
1354
1355@itemize @bullet
1356@item
1357Macro arguments occurring within string constants in the macro body.
1358These would substitute the argument in traditional C, but are part of
1359the constant in ANSI C.
1360
1361@item
1362A function declared external in one block and then used after the end of
1363the block.
1364
1365@item
1366A @code{switch} statement has an operand of type @code{long}.
1367@end itemize
1368
1369@item -Wshadow
1370Warn whenever a local variable shadows another local variable.
1371
1372@item -Wid-clash-@var{len}
1373Warn whenever two distinct identifiers match in the first @var{len}
1374characters. This may help you prepare a program that will compile
1375with certain obsolete, brain-damaged compilers.
1376
1377@item -Wlarger-than-@var{len}
1378Warn whenever an object of larger than @var{len} bytes is defined.
1379
1380@item -Wpointer-arith
1381Warn about anything that depends on the ``size of'' a function type or
1382of @code{void}. GNU C assigns these types a size of 1, for
1383convenience in calculations with @code{void *} pointers and pointers
1384to functions.
1385
1386@item -Wbad-function-cast
1387Warn whenever a function call is cast to a non-matching type.
1388For example, warn if @code{int malloc()} is cast to @code{anything *}.
1389
1390@item -Wcast-qual
1391Warn whenever a pointer is cast so as to remove a type qualifier from
1392the target type. For example, warn if a @code{const char *} is cast
1393to an ordinary @code{char *}.
1394
1395@item -Wcast-align
1396Warn whenever a pointer is cast such that the required alignment of the
1397target is increased. For example, warn if a @code{char *} is cast to
1398an @code{int *} on machines where integers can only be accessed at
1399two- or four-byte boundaries.
1400
1401@item -Wwrite-strings
1402Give string constants the type @code{const char[@var{length}]} so that
1403copying the address of one into a non-@code{const} @code{char *}
1404pointer will get a warning. These warnings will help you find at
1405compile time code that can try to write into a string constant, but
1406only if you have been very careful about using @code{const} in
1407declarations and prototypes. Otherwise, it will just be a nuisance;
1408this is why we did not make @samp{-Wall} request these warnings.
1409
1410@item -Wconversion
1411Warn if a prototype causes a type conversion that is different from what
1412would happen to the same argument in the absence of a prototype. This
1413includes conversions of fixed point to floating and vice versa, and
1414conversions changing the width or signedness of a fixed point argument
1415except when the same as the default promotion.
1416
1417Also, warn if a negative integer constant expression is implicitly
1418converted to an unsigned type. For example, warn about the assignment
1419@code{x = -1} if @code{x} is unsigned. But do not warn about explicit
1420casts like @code{(unsigned) -1}.
1421
1422@item -Waggregate-return
1423Warn if any functions that return structures or unions are defined or
1424called. (In languages where you can return an array, this also elicits
1425a warning.)
1426
1427@item -Wstrict-prototypes
1428Warn if a function is declared or defined without specifying the
1429argument types. (An old-style function definition is permitted without
1430a warning if preceded by a declaration which specifies the argument
1431types.)
1432
1433@item -Wmissing-prototypes
1434Warn if a global function is defined without a previous prototype
1435declaration. This warning is issued even if the definition itself
1436provides a prototype. The aim is to detect global functions that fail
1437to be declared in header files.
1438
1439@item -Wmissing-declarations
1440Warn if a global function is defined without a previous declaration.
1441Do so even if the definition itself provides a prototype.
1442Use this option to detect global functions that are not declared in
1443header files.
1444
1445@item -Wredundant-decls
1446Warn if anything is declared more than once in the same scope, even in
1447cases where multiple declaration is valid and changes nothing.
1448
1449@item -Wnested-externs
1450Warn if an @code{extern} declaration is encountered within an function.
1451
1452@item -Winline
1453Warn if a function can not be inlined, and either it was declared as inline,
1454or else the @samp{-finline-functions} option was given.
1455
1456@item -Woverloaded-virtual
1457@cindex overloaded virtual fn, warning
1458@cindex warning for overloaded virtual fn
1459Warn when a derived class function declaration may be an error in
1460defining a virtual function (C++ only). In a derived class, the
1461definitions of virtual functions must match the type signature of a
1462virtual function declared in the base class. With this option, the
1463compiler warns when you define a function with the same name as a
1464virtual function, but with a type signature that does not match any
1465declarations from the base class.
1466
1467@item -Wsynth (C++ only)
1468@cindex warning for synthesized methods
1469@cindex synthesized methods, warning
1470Warn when g++'s synthesis behavior does not match that of cfront. For
1471instance:
1472
1473@smallexample
1474struct A @{
1475 operator int ();
1476 A& operator = (int);
1477@};
1478
1479main ()
1480@{
1481 A a,b;
1482 a = b;
1483@}
1484@end smallexample
1485
1486In this example, g++ will synthesize a default @samp{A& operator =
1487(const A&);}, while cfront will use the user-defined @samp{operator =}.
1488
1489@item -Werror
1490Make all warnings into errors.
1491@end table
1492
1493@node Debugging Options
1494@section Options for Debugging Your Program or GNU CC
1495@cindex options, debugging
1496@cindex debugging information options
1497
1498GNU CC has various special options that are used for debugging
1499either your program or GCC:
1500
1501@table @code
1502@item -g
1503Produce debugging information in the operating system's native format
1504(stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging
1505information.
1506
1507On most systems that use stabs format, @samp{-g} enables use of extra
1508debugging information that only GDB can use; this extra information
1509makes debugging work better in GDB but will probably make other debuggers
1510crash or
1511refuse to read the program. If you want to control for certain whether
1512to generate the extra information, use @samp{-gstabs+}, @samp{-gstabs},
1513@samp{-gxcoff+}, @samp{-gxcoff}, @samp{-gdwarf+}, or @samp{-gdwarf}
1514(see below).
1515
1516Unlike most other C compilers, GNU CC allows you to use @samp{-g} with
1517@samp{-O}. The shortcuts taken by optimized code may occasionally
1518produce surprising results: some variables you declared may not exist
1519at all; flow of control may briefly move where you did not expect it;
1520some statements may not be executed because they compute constant
1521results or their values were already at hand; some statements may
1522execute in different places because they were moved out of loops.
1523
1524Nevertheless it proves possible to debug optimized output. This makes
1525it reasonable to use the optimizer for programs that might have bugs.
1526
1527The following options are useful when GNU CC is generated with the
1528capability for more than one debugging format.
1529
1530@item -ggdb
1531Produce debugging information in the native format (if that is supported),
1532including GDB extensions if at all possible.
1533
1534@item -gstabs
1535Produce debugging information in stabs format (if that is supported),
1536without GDB extensions. This is the format used by DBX on most BSD
1537systems. On MIPS, Alpha and System V Release 4 systems this option
1538produces stabs debugging output which is not understood by DBX or SDB.
1539On System V Release 4 systems this option requires the GNU assembler.
1540
1541@item -gstabs+
1542Produce debugging information in stabs format (if that is supported),
1543using GNU extensions understood only by the GNU debugger (GDB). The
1544use of these extensions is likely to make other debuggers crash or
1545refuse to read the program.
1546
1547@item -gcoff
1548Produce debugging information in COFF format (if that is supported).
1549This is the format used by SDB on most System V systems prior to
1550System V Release 4.
1551
1552@item -gxcoff
1553Produce debugging information in XCOFF format (if that is supported).
1554This is the format used by the DBX debugger on IBM RS/6000 systems.
1555
1556@item -gxcoff+
1557Produce debugging information in XCOFF format (if that is supported),
1558using GNU extensions understood only by the GNU debugger (GDB). The
1559use of these extensions is likely to make other debuggers crash or
1560refuse to read the program, and may cause assemblers other than the GNU
1561assembler (GAS) to fail with an error.
1562
1563@item -gdwarf
1564Produce debugging information in DWARF format (if that is supported).
1565This is the format used by SDB on most System V Release 4 systems.
1566
1567@item -gdwarf+
1568Produce debugging information in DWARF format (if that is supported),
1569using GNU extensions understood only by the GNU debugger (GDB). The
1570use of these extensions is likely to make other debuggers crash or
1571refuse to read the program.
1572
1573@item -g@var{level}
1574@itemx -ggdb@var{level}
1575@itemx -gstabs@var{level}
1576@itemx -gcoff@var{level}
1577@itemx -gxcoff@var{level}
1578@itemx -gdwarf@var{level}
1579Request debugging information and also use @var{level} to specify how
1580much information. The default level is 2.
1581
1582Level 1 produces minimal information, enough for making backtraces in
1583parts of the program that you don't plan to debug. This includes
1584descriptions of functions and external variables, but no information
1585about local variables and no line numbers.
1586
1587Level 3 includes extra information, such as all the macro definitions
1588present in the program. Some debuggers support macro expansion when
1589you use @samp{-g3}.
1590
1591@cindex @code{prof}
1592@item -p
1593Generate extra code to write profile information suitable for the
1594analysis program @code{prof}. You must use this option when compiling
1595the source files you want data about, and you must also use it when
1596linking.
1597
1598@cindex @code{gprof}
1599@item -pg
1600Generate extra code to write profile information suitable for the
1601analysis program @code{gprof}. You must use this option when compiling
1602the source files you want data about, and you must also use it when
1603linking.
1604
1605@cindex @code{tcov}
1606@item -a
1607Generate extra code to write profile information for basic blocks, which will
1608record the number of times each basic block is executed, the basic block start
1609address, and the function name containing the basic block. If @samp{-g} is
1610used, the line number and filename of the start of the basic block will also be
1611recorded. If not overridden by the machine description, the default action is
1612to append to the text file @file{bb.out}.
1613
1614This data could be analyzed by a program like @code{tcov}. Note,
1615however, that the format of the data is not what @code{tcov} expects.
1616Eventually GNU @code{gprof} should be extended to process this data.
1617
1618@item -ax
1619Generate extra code to profile basic blocks. Your executable will
1620produce output that is a superset of that produced when @samp{-a} is
1621used. Additional output is the source and target address of the basic
1622blocks where a jump takes place, the number of times a jump is executed,
1623and (optionally) the complete sequence of basic blocks being executed.
1624The output is appended to file @file{bb.out}.
1625
1626You can examine different profiling aspects without recompilation. Your
1627execuable will read a list of function names from file @file{bb.in}.
1628Profiling starts when a function on the list is entered and stops when
1629that invocation is exited. To exclude a function from profiling, prefix
1630its name with `-'. If a function name is not unique, you can
1631disambiguate it by writing it in the form
1632@samp{/path/filename.d:functionname}. Your executable will write the
1633available paths and filenames in file @file{bb.out}.
1634
1635Several function names have a special meaning:
1636@table @code
1637@item __bb_jumps__
1638Write source, target and frequency of jumps to file @file{bb.out}.
1639@item __bb_hidecall__
1640Exclude function calls from frequency count.
1641@item __bb_showret__
1642Include function returns in frequency count.
1643@item __bb_trace__
1644Write the sequence of basic blocks executed to file @file{bbtrace.gz}.
1645The file will be compressed using the program @samp{gzip}, which must
1646exist in your @code{PATH}. On systems without the @samp{popen}
1647function, the file will be named @file{bbtrace} and will not be
1648compressed. @strong{Profiling for even a few seconds on these systems
1649will produce a very large file.} Note: @code{__bb_hidecall__} and
1650@code{__bb_showret__} will not affect the sequence written to
1651@file{bbtrace.gz}.
1652@end table
1653
1654Here's a short example using different profiling parameters
1655in file @file{bb.in}. Assume function @code{foo} consists of basic blocks
16561 and 2 and is called twice from block 3 of function @code{main}. After
1657the calls, block 3 transfers control to block 4 of @code{main}.
1658
1659With @code{__bb_trace__} and @code{main} contained in file @file{bb.in},
1660the following sequence of blocks is written to file @file{bbtrace.gz}:
16610 3 1 2 1 2 4. The return from block 2 to block 3 is not shown, because
1662the return is to a point inside the block and not to the top. The
1663block address 0 always indicates, that control is transferred
1664to the trace from somewhere outside the observed functions. With
1665@samp{-foo} added to @file{bb.in}, the blocks of function
1666@code{foo} are removed from the trace, so only 0 3 4 remains.
1667
1668With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in},
1669jump frequencies will be written to file @file{bb.out}. The
1670frequencies are obtained by constructing a trace of blocks
1671and incrementing a counter for every neighbouring pair of blocks
1672in the trace. The trace 0 3 1 2 1 2 4 displays the following
1673frequencies:
1674
1675@example
1676Jump from block 0x0 to block 0x3 executed 1 time(s)
1677Jump from block 0x3 to block 0x1 executed 1 time(s)
1678Jump from block 0x1 to block 0x2 executed 2 time(s)
1679Jump from block 0x2 to block 0x1 executed 1 time(s)
1680Jump from block 0x2 to block 0x4 executed 1 time(s)
1681@end example
1682
1683With @code{__bb_hidecall__}, control transfer due to call instructions
1684is removed from the trace, that is the trace is cut into three parts: 0
16853 4, 0 1 2 and 0 1 2. With @code{__bb_showret__}, control transfer due
1686to return instructions is added to the trace. The trace becomes: 0 3 1
16872 3 1 2 3 4. Note, that this trace is not the same, as the sequence
1688written to @file{bbtrace.gz}. It is solely used for counting jump
1689frequencies.
1690
1691@item -d@var{letters}
1692Says to make debugging dumps during compilation at times specified by
1693@var{letters}. This is used for debugging the compiler. The file names
1694for most of the dumps are made by appending a word to the source file
1695name (e.g. @file{foo.c.rtl} or @file{foo.c.jump}). Here are the
1696possible letters for use in @var{letters}, and their meanings:
1697
1698@table @samp
1699@item M
1700Dump all macro definitions, at the end of preprocessing, and write no
1701output.
1702@item N
1703Dump all macro names, at the end of preprocessing.
1704@item D
1705Dump all macro definitions, at the end of preprocessing, in addition to
1706normal output.
1707@item y
1708Dump debugging information during parsing, to standard error.
1709@item r
1710Dump after RTL generation, to @file{@var{file}.rtl}.
1711@item x
1712Just generate RTL for a function instead of compiling it. Usually used
1713with @samp{r}.
1714@item j
1715Dump after first jump optimization, to @file{@var{file}.jump}.
1716@item s
1717Dump after CSE (including the jump optimization that sometimes
1718follows CSE), to @file{@var{file}.cse}.
1719@item L
1720Dump after loop optimization, to @file{@var{file}.loop}.
1721@item t
1722Dump after the second CSE pass (including the jump optimization that
1723sometimes follows CSE), to @file{@var{file}.cse2}.
1724@item f
1725Dump after flow analysis, to @file{@var{file}.flow}.
1726@item c
1727Dump after instruction combination, to the file
1728@file{@var{file}.combine}.
1729@item S
1730Dump after the first instruction scheduling pass, to
1731@file{@var{file}.sched}.
1732@item l
1733Dump after local register allocation, to
1734@file{@var{file}.lreg}.
1735@item g
1736Dump after global register allocation, to
1737@file{@var{file}.greg}.
1738@item R
1739Dump after the second instruction scheduling pass, to
1740@file{@var{file}.sched2}.
1741@item J
1742Dump after last jump optimization, to @file{@var{file}.jump2}.
1743@item d
1744Dump after delayed branch scheduling, to @file{@var{file}.dbr}.
1745@item k
1746Dump after conversion from registers to stack, to @file{@var{file}.stack}.
1747@item a
1748Produce all the dumps listed above.
1749@item m
1750Print statistics on memory usage, at the end of the run, to
1751standard error.
1752@item p
1753Annotate the assembler output with a comment indicating which
1754pattern and alternative was used.
1755@item A
1756Annotate the assembler output with miscellaneous debugging information.
1757@end table
1758
1759@item -fpretend-float
1760When running a cross-compiler, pretend that the target machine uses the
1761same floating point format as the host machine. This causes incorrect
1762output of the actual floating constants, but the actual instruction
1763sequence will probably be the same as GNU CC would make when running on
1764the target machine.
1765
1766@item -save-temps
1767Store the usual ``temporary'' intermediate files permanently; place them
1768in the current directory and name them based on the source file. Thus,
1769compiling @file{foo.c} with @samp{-c -save-temps} would produce files
1770@file{foo.i} and @file{foo.s}, as well as @file{foo.o}.
1771
1772@item -print-file-name=@var{library}
1773Print the full absolute name of the library file @var{library} that
1774would be used when linking---and don't do anything else. With this
1775option, GNU CC does not compile or link anything; it just prints the
1776file name.
1777
1778@item -print-prog-name=@var{program}
1779Like @samp{-print-file-name}, but searches for a program such as @samp{cpp}.
1780
1781@item -print-libgcc-file-name
1782Same as @samp{-print-file-name=libgcc.a}.
1783
1784This is useful when you use @samp{-nostdlib} or @samp{-nodefaultlibs}
1785but you do want to link with @file{libgcc.a}. You can do
1786
1787@example
1788gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
1789@end example
1790
1791@item -print-search-dirs
1792Print the name of the configured installation directory and a list of
1793program and library directories gcc will search---and don't do anything else.
1794
1795This is useful when gcc prints the error message
1796@samp{installation problem, cannot exec cpp: No such file or directory}.
1797To resolve this you either need to put @file{cpp} and the other compiler
1798components where gcc expects to find them, or you can set the environment
1799variable @code{GCC_EXEC_PREFIX} to the directory where you installed them.
1800Don't forget the trailing '/'.
1801@xref{Environment Variables}.
1802@end table
1803
1804@node Optimize Options
1805@section Options That Control Optimization
1806@cindex optimize options
1807@cindex options, optimization
1808
1809These options control various sorts of optimizations:
1810
1811@table @code
1812@item -O
1813@itemx -O1
1814Optimize. Optimizing compilation takes somewhat more time, and a lot
1815more memory for a large function.
1816
1817Without @samp{-O}, the compiler's goal is to reduce the cost of
1818compilation and to make debugging produce the expected results.
1819Statements are independent: if you stop the program with a breakpoint
1820between statements, you can then assign a new value to any variable or
1821change the program counter to any other statement in the function and
1822get exactly the results you would expect from the source code.
1823
1824Without @samp{-O}, the compiler only allocates variables declared
1825@code{register} in registers. The resulting compiled code is a little
1826worse than produced by PCC without @samp{-O}.
1827
1828With @samp{-O}, the compiler tries to reduce code size and execution
1829time.
1830
1831When you specify @samp{-O}, the compiler turns on @samp{-fthread-jumps}
1832and @samp{-fdefer-pop} on all machines. The compiler turns on
1833@samp{-fdelayed-branch} on machines that have delay slots, and
1834@samp{-fomit-frame-pointer} on machines that can support debugging even
1835without a frame pointer. On some machines the compiler also turns
1836on other flags.@refill
1837
1838@item -O2
1839Optimize even more. GNU CC performs nearly all supported optimizations
1840that do not involve a space-speed tradeoff. The compiler does not
1841perform loop unrolling or function inlining when you specify @samp{-O2}.
1842As compared to @samp{-O}, this option increases both compilation time
1843and the performance of the generated code.
1844
1845@samp{-O2} turns on all optional optimizations except for loop unrolling
1846and function inlining. It also turns on the @samp{-fforce-mem} option
1847on all machines and frame pointer elimination on machines where doing so
1848does not interfere with debugging.
1849
1850@item -O3
1851Optimize yet more. @samp{-O3} turns on all optimizations specified by
1852@samp{-O2} and also turns on the @samp{inline-functions} option.
1853
1854@item -O0
1855Do not optimize.
1856
1857If you use multiple @samp{-O} options, with or without level numbers,
1858the last such option is the one that is effective.
1859@end table
1860
1861Options of the form @samp{-f@var{flag}} specify machine-independent
1862flags. Most flags have both positive and negative forms; the negative
1863form of @samp{-ffoo} would be @samp{-fno-foo}. In the table below,
1864only one of the forms is listed---the one which is not the default.
1865You can figure out the other form by either removing @samp{no-} or
1866adding it.
1867
1868@table @code
1869@item -ffloat-store
1870Do not store floating point variables in registers, and inhibit other
1871options that might change whether a floating point value is taken from a
1872register or memory.
1873
1874@cindex floating point precision
1875This option prevents undesirable excess precision on machines such as
1876the 68000 where the floating registers (of the 68881) keep more
1877precision than a @code{double} is supposed to have. Similarly for the
1878x86 architecture. For most programs, the excess precision does only
1879good, but a few programs rely on the precise definition of IEEE floating
1880point. Use @samp{-ffloat-store} for such programs.
1881
1882@item -fno-default-inline
1883Do not make member functions inline by default merely because they are
1884defined inside the class scope (C++ only). Otherwise, when you specify
1885@w{@samp{-O}}, member functions defined inside class scope are compiled
1886inline by default; i.e., you don't need to add @samp{inline} in front of
1887the member function name.
1888
1889@item -fno-defer-pop
1890Always pop the arguments to each function call as soon as that function
1891returns. For machines which must pop arguments after a function call,
1892the compiler normally lets arguments accumulate on the stack for several
1893function calls and pops them all at once.
1894
1895@item -fforce-mem
1896Force memory operands to be copied into registers before doing
1897arithmetic on them. This produces better code by making all memory
1898references potential common subexpressions. When they are not common
1899subexpressions, instruction combination should eliminate the separate
1900register-load. The @samp{-O2} option turns on this option.
1901
1902@item -fforce-addr
1903Force memory address constants to be copied into registers before
1904doing arithmetic on them. This may produce better code just as
1905@samp{-fforce-mem} may.
1906
1907@item -fomit-frame-pointer
1908Don't keep the frame pointer in a register for functions that
1909don't need one. This avoids the instructions to save, set up and
1910restore frame pointers; it also makes an extra register available
1911in many functions. @strong{It also makes debugging impossible on
1912some machines.}
1913
1914@ifset INTERNALS
1915On some machines, such as the Vax, this flag has no effect, because
1916the standard calling sequence automatically handles the frame pointer
1917and nothing is saved by pretending it doesn't exist. The
1918machine-description macro @code{FRAME_POINTER_REQUIRED} controls
1919whether a target machine supports this flag. @xref{Registers}.@refill
1920@end ifset
1921@ifclear INTERNALS
1922On some machines, such as the Vax, this flag has no effect, because
1923the standard calling sequence automatically handles the frame pointer
1924and nothing is saved by pretending it doesn't exist. The
1925machine-description macro @code{FRAME_POINTER_REQUIRED} controls
1926whether a target machine supports this flag. @xref{Registers,,Register
1927Usage, gcc.info, Using and Porting GCC}.@refill
1928@end ifclear
1929
1930@item -fno-inline
1931Don't pay attention to the @code{inline} keyword. Normally this option
1932is used to keep the compiler from expanding any functions inline.
1933Note that if you are not optimizing, no functions can be expanded inline.
1934
1935@item -finline-functions
1936Integrate all simple functions into their callers. The compiler
1937heuristically decides which functions are simple enough to be worth
1938integrating in this way.
1939
1940If all calls to a given function are integrated, and the function is
1941declared @code{static}, then the function is normally not output as
1942assembler code in its own right.
1943
1944@item -fkeep-inline-functions
1945Even if all calls to a given function are integrated, and the function
1946is declared @code{static}, nevertheless output a separate run-time
1947callable version of the function. This switch does not affect
1948@code{extern inline} functions.
1949
1950@item -fkeep-static-consts
1951Emit variables declared @code{static const} when optimization isn't turned
1952on, even if the variables aren't referenced.
1953
1954GNU CC enables this option by default. If you want to force the compiler to
1955check if the variable was referenced, regardless of whether or not
1956optimization is turned on, use the @samp{-fno-keep-static-consts} option.
1957
1958@item -fno-function-cse
1959Do not put function addresses in registers; make each instruction that
1960calls a constant function contain the function's address explicitly.
1961
1962This option results in less efficient code, but some strange hacks
1963that alter the assembler output may be confused by the optimizations
1964performed when this option is not used.
1965
1966@item -ffast-math
1967This option allows GCC to violate some ANSI or IEEE rules and/or
1968specifications in the interest of optimizing code for speed. For
1969example, it allows the compiler to assume arguments to the @code{sqrt}
1970function are non-negative numbers and that no floating-point values
1971are NaNs.
1972
1973This option should never be turned on by any @samp{-O} option since
1974it can result in incorrect output for programs which depend on
1975an exact implementation of IEEE or ANSI rules/specifications for
1976math functions.
1977@end table
1978
1979@c following causes underfulls.. they don't look great, but we deal.
1980@c --mew 26jan93
1981The following options control specific optimizations. The @samp{-O2}
1982option turns on all of these optimizations except @samp{-funroll-loops}
1983and @samp{-funroll-all-loops}. On most machines, the @samp{-O} option
1984turns on the @samp{-fthread-jumps} and @samp{-fdelayed-branch} options,
1985but specific machines may handle it differently.
1986
1987You can use the following flags in the rare cases when ``fine-tuning''
1988of optimizations to be performed is desired.
1989
1990@table @code
1991@item -fstrength-reduce
1992Perform the optimizations of loop strength reduction and
1993elimination of iteration variables.
1994
1995@item -fthread-jumps
1996Perform optimizations where we check to see if a jump branches to a
1997location where another comparison subsumed by the first is found. If
1998so, the first branch is redirected to either the destination of the
1999second branch or a point immediately following it, depending on whether
2000the condition is known to be true or false.
2001
2002@item -fcse-follow-jumps
2003In common subexpression elimination, scan through jump instructions
2004when the target of the jump is not reached by any other path. For
2005example, when CSE encounters an @code{if} statement with an
2006@code{else} clause, CSE will follow the jump when the condition
2007tested is false.
2008
2009@item -fcse-skip-blocks
2010This is similar to @samp{-fcse-follow-jumps}, but causes CSE to
2011follow jumps which conditionally skip over blocks. When CSE
2012encounters a simple @code{if} statement with no else clause,
2013@samp{-fcse-skip-blocks} causes CSE to follow the jump around the
2014body of the @code{if}.
2015
2016@item -frerun-cse-after-loop
2017Re-run common subexpression elimination after loop optimizations has been
2018performed.
2019
2020@item -fexpensive-optimizations
2021Perform a number of minor optimizations that are relatively expensive.
2022
2023@item -fdelayed-branch
2024If supported for the target machine, attempt to reorder instructions
2025to exploit instruction slots available after delayed branch
2026instructions.
2027
2028@item -fschedule-insns
2029If supported for the target machine, attempt to reorder instructions to
2030eliminate execution stalls due to required data being unavailable. This
2031helps machines that have slow floating point or memory load instructions
2032by allowing other instructions to be issued until the result of the load
2033or floating point instruction is required.
2034
2035@item -fschedule-insns2
2036Similar to @samp{-fschedule-insns}, but requests an additional pass of
2037instruction scheduling after register allocation has been done. This is
2038especially useful on machines with a relatively small number of
2039registers and where memory load instructions take more than one cycle.
2040
2041@item -ffunction-sections
2042Place each function into its own section in the output file if the
2043target supports arbitrary sections. The function's name determines
2044the section's name in the output file.
2045
2046Use this option on systems where the linker can perform optimizations
2047to improve locality of reference in the instruction space. HPPA
2048processors running HP-UX and Sparc processors running Solaris 2 have
2049linkers with such optimizations. Other systems using the ELF object format
2050as well as AIX may have these optimizations in the future.
2051
2052Only use this option when there are significant benefits from doing
2053so. When you specify this option, the assembler and linker will
2054create larger object and executable files and will also be slower.
2055You will not be able to use @code{gprof} on all systems if you
2056specify this option and you may have problems with debugging if
2057you specify both this option and @samp{-g}.
2058
2059@item -fcaller-saves
2060Enable values to be allocated in registers that will be clobbered by
2061function calls, by emitting extra instructions to save and restore the
2062registers around such calls. Such allocation is done only when it
2063seems to result in better code than would otherwise be produced.
2064
2065This option is enabled by default on certain machines, usually those
2066which have no call-preserved registers to use instead.
2067
2068@item -funroll-loops
2069Perform the optimization of loop unrolling. This is only done for loops
2070whose number of iterations can be determined at compile time or run time.
2071@samp{-funroll-loop} implies both @samp{-fstrength-reduce} and
2072@samp{-frerun-cse-after-loop}.
2073
2074@item -funroll-all-loops
2075Perform the optimization of loop unrolling. This is done for all loops
2076and usually makes programs run more slowly. @samp{-funroll-all-loops}
2077implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}.
2078
2079@item -fno-peephole
2080Disable any machine-specific peephole optimizations.
2081@end table
2082
2083@node Preprocessor Options
2084@section Options Controlling the Preprocessor
2085@cindex preprocessor options
2086@cindex options, preprocessor
2087
2088These options control the C preprocessor, which is run on each C source
2089file before actual compilation.
2090
2091If you use the @samp{-E} option, nothing is done except preprocessing.
2092Some of these options make sense only together with @samp{-E} because
2093they cause the preprocessor output to be unsuitable for actual
2094compilation.
2095
2096@table @code
2097@item -include @var{file}
2098Process @var{file} as input before processing the regular input file.
2099In effect, the contents of @var{file} are compiled first. Any @samp{-D}
2100and @samp{-U} options on the command line are always processed before
2101@samp{-include @var{file}}, regardless of the order in which they are
2102written. All the @samp{-include} and @samp{-imacros} options are
2103processed in the order in which they are written.
2104
2105@item -imacros @var{file}
2106Process @var{file} as input, discarding the resulting output, before
2107processing the regular input file. Because the output generated from
2108@var{file} is discarded, the only effect of @samp{-imacros @var{file}}
2109is to make the macros defined in @var{file} available for use in the
2110main input.
2111
2112Any @samp{-D} and @samp{-U} options on the command line are always
2113processed before @samp{-imacros @var{file}}, regardless of the order in
2114which they are written. All the @samp{-include} and @samp{-imacros}
2115options are processed in the order in which they are written.
2116
2117@item -idirafter @var{dir}
2118@cindex second include path
2119Add the directory @var{dir} to the second include path. The directories
2120on the second include path are searched when a header file is not found
2121in any of the directories in the main include path (the one that
2122@samp{-I} adds to).
2123
2124@item -iprefix @var{prefix}
2125Specify @var{prefix} as the prefix for subsequent @samp{-iwithprefix}
2126options.
2127
2128@item -iwithprefix @var{dir}
2129Add a directory to the second include path. The directory's name is
2130made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
2131specified previously with @samp{-iprefix}. If you have not specified a
2132prefix yet, the directory containing the installed passes of the
2133compiler is used as the default.
2134
2135@item -iwithprefixbefore @var{dir}
2136Add a directory to the main include path. The directory's name is made
2137by concatenating @var{prefix} and @var{dir}, as in the case of
2138@samp{-iwithprefix}.
2139
2140@item -isystem @var{dir}
2141Add a directory to the beginning of the second include path, marking it
2142as a system directory, so that it gets the same special treatment as
2143is applied to the standard system directories.
2144
2145@item -nostdinc
2146Do not search the standard system directories for header files. Only
2147the directories you have specified with @samp{-I} options (and the
2148current directory, if appropriate) are searched. @xref{Directory
2149Options}, for information on @samp{-I}.
2150
2151By using both @samp{-nostdinc} and @samp{-I-}, you can limit the include-file
2152search path to only those directories you specify explicitly.
2153
2154@item -undef
2155Do not predefine any nonstandard macros. (Including architecture flags).
2156
2157@item -E
2158Run only the C preprocessor. Preprocess all the C source files
2159specified and output the results to standard output or to the
2160specified output file.
2161
2162@item -C
2163Tell the preprocessor not to discard comments. Used with the
2164@samp{-E} option.
2165
2166@item -P
2167Tell the preprocessor not to generate @samp{#line} directives.
2168Used with the @samp{-E} option.
2169
2170@cindex make
2171@cindex dependencies, make
2172@item -M
2173Tell the preprocessor to output a rule suitable for @code{make}
2174describing the dependencies of each object file. For each source file,
2175the preprocessor outputs one @code{make}-rule whose target is the object
2176file name for that source file and whose dependencies are all the
2177@code{#include} header files it uses. This rule may be a single line or
2178may be continued with @samp{\}-newline if it is long. The list of rules
2179is printed on standard output instead of the preprocessed C program.
2180
2181@samp{-M} implies @samp{-E}.
2182
2183Another way to specify output of a @code{make} rule is by setting
2184the environment variable @code{DEPENDENCIES_OUTPUT} (@pxref{Environment
2185Variables}).
2186
2187@item -MM
2188Like @samp{-M} but the output mentions only the user header files
2189included with @samp{#include "@var{file}"}. System header files
2190included with @samp{#include <@var{file}>} are omitted.
2191
2192@item -MD
2193Like @samp{-M} but the dependency information is written to a file made by
2194replacing ".c" with ".d" at the end of the input file names.
2195This is in addition to compiling the file as specified---@samp{-MD} does
2196not inhibit ordinary compilation the way @samp{-M} does.
2197
2198In Mach, you can use the utility @code{md} to merge multiple dependency
2199files into a single dependency file suitable for using with the @samp{make}
2200command.
2201
2202@item -MMD
2203Like @samp{-MD} except mention only user header files, not system
2204header files.
2205
2206@item -MG
2207Treat missing header files as generated files and assume they live in the
2208same directory as the source file. If you specify @samp{-MG}, you
2209must also specify either @samp{-M} or @samp{-MM}. @samp{-MG} is not
2210supported with @samp{-MD} or @samp{-MMD}.
2211
2212@item -H
2213Print the name of each header file used, in addition to other normal
2214activities.
2215
2216@item -A@var{question}(@var{answer})
2217Assert the answer @var{answer} for @var{question}, in case it is tested
2218with a preprocessing conditional such as @samp{#if
2219#@var{question}(@var{answer})}. @samp{-A-} disables the standard
2220assertions that normally describe the target machine.
2221
2222@item -D@var{macro}
2223Define macro @var{macro} with the string @samp{1} as its definition.
2224
2225@item -D@var{macro}=@var{defn}
2226Define macro @var{macro} as @var{defn}. All instances of @samp{-D} on
2227the command line are processed before any @samp{-U} options.
2228
2229@item -U@var{macro}
2230Undefine macro @var{macro}. @samp{-U} options are evaluated after all
2231@samp{-D} options, but before any @samp{-include} and @samp{-imacros}
2232options.
2233
2234@item -dM
2235Tell the preprocessor to output only a list of the macro definitions
2236that are in effect at the end of preprocessing. Used with the @samp{-E}
2237option.
2238
2239@item -dD
2240Tell the preprocessing to pass all macro definitions into the output, in
2241their proper sequence in the rest of the output.
2242
2243@item -dN
2244Like @samp{-dD} except that the macro arguments and contents are omitted.
2245Only @samp{#define @var{name}} is included in the output.
2246
2247@item -trigraphs
2248Support ANSI C trigraphs. The @samp{-ansi} option also has this effect.
2249
2250@item -Wp,@var{option}
2251Pass @var{option} as an option to the preprocessor. If @var{option}
2252contains commas, it is split into multiple options at the commas.
2253@end table
2254
2255@node Assembler Options
2256@section Passing Options to the Assembler
2257
2258@c prevent bad page break with this line
2259You can pass options to the assembler.
2260
2261@table @code
2262@item -Wa,@var{option}
2263Pass @var{option} as an option to the assembler. If @var{option}
2264contains commas, it is split into multiple options at the commas.
2265@end table
2266
2267@node Link Options
2268@section Options for Linking
2269@cindex link options
2270@cindex options, linking
2271
2272These options come into play when the compiler links object files into
2273an executable output file. They are meaningless if the compiler is
2274not doing a link step.
2275
2276@table @code
2277@cindex file names
2278@item @var{object-file-name}
2279A file name that does not end in a special recognized suffix is
2280considered to name an object file or library. (Object files are
2281distinguished from libraries by the linker according to the file
2282contents.) If linking is done, these object files are used as input
2283to the linker.
2284
2285@item -c
2286@itemx -S
2287@itemx -E
2288If any of these options is used, then the linker is not run, and
2289object file names should not be used as arguments. @xref{Overall
2290Options}.
2291
2292@cindex Libraries
2293@item -l@var{library}
2294Search the library named @var{library} when linking.
2295
2296It makes a difference where in the command you write this option; the
2297linker searches processes libraries and object files in the order they
2298are specified. Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
2299after file @file{foo.o} but before @file{bar.o}. If @file{bar.o} refers
2300to functions in @samp{z}, those functions may not be loaded.
2301
2302The linker searches a standard list of directories for the library,
2303which is actually a file named @file{lib@var{library}.a}. The linker
2304then uses this file as if it had been specified precisely by name.
2305
2306The directories searched include several standard system directories
2307plus any that you specify with @samp{-L}.
2308
2309Normally the files found this way are library files---archive files
2310whose members are object files. The linker handles an archive file by
2311scanning through it for members which define symbols that have so far
2312been referenced but not defined. But if the file that is found is an
2313ordinary object file, it is linked in the usual fashion. The only
2314difference between using an @samp{-l} option and specifying a file name
2315is that @samp{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
2316and searches several directories.
2317
2318@item -lobjc
2319You need this special case of the @samp{-l} option in order to
2320link an Objective C program.
2321
2322@item -nostartfiles
2323Do not use the standard system startup files when linking.
2324The standard system libraries are used normally, unless @code{-nostdlib}
2325or @code{-nodefaultlibs} is used.
2326
2327@item -nodefaultlibs
2328Do not use the standard system libraries when linking.
2329Only the libraries you specify will be passed to the linker.
2330The standard startup files are used normally, unless @code{-nostartfiles}
2331is used.
2332
2333@item -nostdlib
2334Do not use the standard system startup files or libraries when linking.
2335No startup files and only the libraries you specify will be passed to
2336the linker.
2337
2338@cindex @code{-lgcc}, use with @code{-nostdlib}
2339@cindex @code{-nostdlib} and unresolved references
2340@cindex unresolved references and @code{-nostdlib}
2341@cindex @code{-lgcc}, use with @code{-nodefaultlibs}
2342@cindex @code{-nodefaultlibs} and unresolved references
2343@cindex unresolved references and @code{-nodefaultlibs}
2344One of the standard libraries bypassed by @samp{-nostdlib} and
2345@samp{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
2346that GNU CC uses to overcome shortcomings of particular machines, or special
2347needs for some languages.
2348@ifset INTERNALS
2349(@xref{Interface,,Interfacing to GNU CC Output}, for more discussion of
2350@file{libgcc.a}.)
2351@end ifset
2352@ifclear INTERNALS
2353(@xref{Interface,,Interfacing to GNU CC Output,gcc.info,Porting GNU CC},
2354for more discussion of @file{libgcc.a}.)
2355@end ifclear
2356In most cases, you need @file{libgcc.a} even when you want to avoid
2357other standard libraries. In other words, when you specify @samp{-nostdlib}
2358or @samp{-nodefaultlibs} you should usually specify @samp{-lgcc} as well.
2359This ensures that you have no unresolved references to internal GNU CC
2360library subroutines. (For example, @samp{__main}, used to ensure C++
2361constructors will be called; @pxref{Collect2,,@code{collect2}}.)
2362
2363@item -s
2364Remove all symbol table and relocation information from the executable.
2365
2366@item -static
2367On systems that support dynamic linking, this prevents linking with the shared
2368libraries. On other systems, this option has no effect.
2369
2370@item -shared
2371Produce a shared object which can then be linked with other objects to
2372form an executable. Not all systems support this option. You must
2373also specify @samp{-fpic} or @samp{-fPIC} on some systems when
2374you specify this option.
2375
2376@item -symbolic
2377Bind references to global symbols when building a shared object. Warn
2378about any unresolved references (unless overridden by the link editor
2379option @samp{-Xlinker -z -Xlinker defs}). Only a few systems support
2380this option.
2381
2382@item -Xlinker @var{option}
2383Pass @var{option} as an option to the linker. You can use this to
2384supply system-specific linker options which GNU CC does not know how to
2385recognize.
2386
2387If you want to pass an option that takes an argument, you must use
2388@samp{-Xlinker} twice, once for the option and once for the argument.
2389For example, to pass @samp{-assert definitions}, you must write
2390@samp{-Xlinker -assert -Xlinker definitions}. It does not work to write
2391@samp{-Xlinker "-assert definitions"}, because this passes the entire
2392string as a single argument, which is not what the linker expects.
2393
2394@item -Wl,@var{option}
2395Pass @var{option} as an option to the linker. If @var{option} contains
2396commas, it is split into multiple options at the commas.
2397
2398@item -u @var{symbol}
2399Pretend the symbol @var{symbol} is undefined, to force linking of
2400library modules to define it. You can use @samp{-u} multiple times with
2401different symbols to force loading of additional library modules.
2402@end table
2403
2404@node Directory Options
2405@section Options for Directory Search
2406@cindex directory options
2407@cindex options, directory search
2408@cindex search path
2409
2410These options specify directories to search for header files, for
2411libraries and for parts of the compiler:
2412
2413@table @code
2414@item -I@var{dir}
2415Add the directory @var{directory} to the head of the list of directories
2416to be searched for header files. This can be used to override a system
2417header file, substituting your own version, since these directories are
2418searched before the system header file directories. If you use more
2419than one @samp{-I} option, the directories are scanned in left-to-right
2420order; the standard system directories come after.
2421
2422@item -I-
2423Any directories you specify with @samp{-I} options before the @samp{-I-}
2424option are searched only for the case of @samp{#include "@var{file}"};
2425they are not searched for @samp{#include <@var{file}>}.
2426
2427If additional directories are specified with @samp{-I} options after
2428the @samp{-I-}, these directories are searched for all @samp{#include}
2429directives. (Ordinarily @emph{all} @samp{-I} directories are used
2430this way.)
2431
2432In addition, the @samp{-I-} option inhibits the use of the current
2433directory (where the current input file came from) as the first search
2434directory for @samp{#include "@var{file}"}. There is no way to
2435override this effect of @samp{-I-}. With @samp{-I.} you can specify
2436searching the directory which was current when the compiler was
2437invoked. That is not exactly the same as what the preprocessor does
2438by default, but it is often satisfactory.
2439
2440@samp{-I-} does not inhibit the use of the standard system directories
2441for header files. Thus, @samp{-I-} and @samp{-nostdinc} are
2442independent.
2443
2444@item -L@var{dir}
2445Add directory @var{dir} to the list of directories to be searched
2446for @samp{-l}.
2447
2448@item -B@var{prefix}
2449This option specifies where to find the executables, libraries,
2450include files, and data files of the compiler itself.
2451
2452The compiler driver program runs one or more of the subprograms
2453@file{cpp}, @file{cc1}, @file{as} and @file{ld}. It tries
2454@var{prefix} as a prefix for each program it tries to run, both with and
2455without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
2456
2457For each subprogram to be run, the compiler driver first tries the
2458@samp{-B} prefix, if any. If that name is not found, or if @samp{-B}
2459was not specified, the driver tries two standard prefixes, which are
2460@file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}. If neither of
2461those results in a file name that is found, the unmodified program
2462name is searched for using the directories specified in your
2463@samp{PATH} environment variable.
2464
2465@samp{-B} prefixes that effectively specify directory names also apply
2466to libraries in the linker, because the compiler translates these
2467options into @samp{-L} options for the linker. They also apply to
2468includes files in the preprocessor, because the compiler translates these
2469options into @samp{-isystem} options for the preprocessor. In this case,
2470the compiler appends @samp{include} to the prefix.
2471
2472The run-time support file @file{libgcc.a} can also be searched for using
2473the @samp{-B} prefix, if needed. If it is not found there, the two
2474standard prefixes above are tried, and that is all. The file is left
2475out of the link if it is not found by those means.
2476
2477Another way to specify a prefix much like the @samp{-B} prefix is to use
2478the environment variable @code{GCC_EXEC_PREFIX}. @xref{Environment
2479Variables}.
2480@end table
2481
2482@node Target Options
2483@section Specifying Target Machine and Compiler Version
2484@cindex target options
2485@cindex cross compiling
2486@cindex specifying machine version
2487@cindex specifying compiler version and target machine
2488@cindex compiler version, specifying
2489@cindex target machine, specifying
2490
2491By default, GNU CC compiles code for the same type of machine that you
2492are using. However, it can also be installed as a cross-compiler, to
2493compile for some other type of machine. In fact, several different
2494configurations of GNU CC, for different target machines, can be
2495installed side by side. Then you specify which one to use with the
2496@samp{-b} option.
2497
2498In addition, older and newer versions of GNU CC can be installed side
2499by side. One of them (probably the newest) will be the default, but
2500you may sometimes wish to use another.
2501
2502@table @code
2503@item -b @var{machine}
2504The argument @var{machine} specifies the target machine for compilation.
2505This is useful when you have installed GNU CC as a cross-compiler.
2506
2507The value to use for @var{machine} is the same as was specified as the
2508machine type when configuring GNU CC as a cross-compiler. For
2509example, if a cross-compiler was configured with @samp{configure
2510i386v}, meaning to compile for an 80386 running System V, then you
2511would specify @samp{-b i386v} to run that cross compiler.
2512
2513When you do not specify @samp{-b}, it normally means to compile for
2514the same type of machine that you are using.
2515
2516@item -V @var{version}
2517The argument @var{version} specifies which version of GNU CC to run.
2518This is useful when multiple versions are installed. For example,
2519@var{version} might be @samp{2.0}, meaning to run GNU CC version 2.0.
2520
2521The default version, when you do not specify @samp{-V}, is the last
2522version of GNU CC that you installed.
2523@end table
2524
2525The @samp{-b} and @samp{-V} options actually work by controlling part of
2526the file name used for the executable files and libraries used for
2527compilation. A given version of GNU CC, for a given target machine, is
2528normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
2529
2530Thus, sites can customize the effect of @samp{-b} or @samp{-V} either by
2531changing the names of these directories or adding alternate names (or
2532symbolic links). If in directory @file{/usr/local/lib/gcc-lib/} the
2533file @file{80386} is a link to the file @file{i386v}, then @samp{-b
253480386} becomes an alias for @samp{-b i386v}.
2535
2536In one respect, the @samp{-b} or @samp{-V} do not completely change
2537to a different compiler: the top-level driver program @code{gcc}
2538that you originally invoked continues to run and invoke the other
2539executables (preprocessor, compiler per se, assembler and linker)
2540that do the real work. However, since no real work is done in the
2541driver program, it usually does not matter that the driver program
2542in use is not the one for the specified target and version.
2543
2544The only way that the driver program depends on the target machine is
2545in the parsing and handling of special machine-specific options.
2546However, this is controlled by a file which is found, along with the
2547other executables, in the directory for the specified version and
2548target machine. As a result, a single installed driver program adapts
2549to any specified target machine and compiler version.
2550
2551The driver program executable does control one significant thing,
2552however: the default version and target machine. Therefore, you can
2553install different instances of the driver program, compiled for
2554different targets or versions, under different names.
2555
2556For example, if the driver for version 2.0 is installed as @code{ogcc}
2557and that for version 2.1 is installed as @code{gcc}, then the command
2558@code{gcc} will use version 2.1 by default, while @code{ogcc} will use
25592.0 by default. However, you can choose either version with either
2560command with the @samp{-V} option.
2561
2562@node Submodel Options
2563@section Hardware Models and Configurations
2564@cindex submodel options
2565@cindex specifying hardware config
2566@cindex hardware models and configurations, specifying
2567@cindex machine dependent options
2568
2569Earlier we discussed the standard option @samp{-b} which chooses among
2570different installed compilers for completely different target
2571machines, such as Vax vs. 68000 vs. 80386.
2572
2573In addition, each of these target machine types can have its own
2574special options, starting with @samp{-m}, to choose among various
2575hardware models or configurations---for example, 68010 vs 68020,
2576floating coprocessor or none. A single installed version of the
2577compiler can compile for any model or configuration, according to the
2578options specified.
2579
2580Some configurations of the compiler also support additional special
2581options, usually for compatibility with other compilers on the same
2582platform.
2583
2584@ifset INTERNALS
2585These options are defined by the macro @code{TARGET_SWITCHES} in the
2586machine description. The default for the options is also defined by
2587that macro, which enables you to change the defaults.
2588@end ifset
2589
2590@menu
2591* M680x0 Options::
2592* VAX Options::
2593* SPARC Options::
2594* Convex Options::
2595* AMD29K Options::
2596* ARM Options::
2597* M88K Options::
2598* RS/6000 and PowerPC Options::
2599* RT Options::
2600* MIPS Options::
2601* i386 Options::
2602* HPPA Options::
2603* Intel 960 Options::
2604* DEC Alpha Options::
2605* Clipper Options::
2606* H8/300 Options::
2607* SH Options::
2608* System V Options::
2609@end menu
2610
2611@node M680x0 Options
2612@subsection M680x0 Options
2613@cindex M680x0 options
2614
2615These are the @samp{-m} options defined for the 68000 series. The default
2616values for these options depends on which style of 68000 was selected when
2617the compiler was configured; the defaults for the most common choices are
2618given below.
2619
2620@table @code
2621@item -m68000
2622@itemx -mc68000
2623Generate output for a 68000. This is the default
2624when the compiler is configured for 68000-based systems.
2625
2626@item -m68020
2627@itemx -mc68020
2628Generate output for a 68020. This is the default
2629when the compiler is configured for 68020-based systems.
2630
2631@item -m68881
2632Generate output containing 68881 instructions for floating point.
2633This is the default for most 68020 systems unless @samp{-nfp} was
2634specified when the compiler was configured.
2635
2636@item -m68030
2637Generate output for a 68030. This is the default when the compiler is
2638configured for 68030-based systems.
2639
2640@item -m68040
2641Generate output for a 68040. This is the default when the compiler is
2642configured for 68040-based systems.
2643
2644This option inhibits the use of 68881/68882 instructions that have to be
2645emulated by software on the 68040. If your 68040 does not have code to
2646emulate those instructions, use @samp{-m68040}.
2647
2648@item -m68060
2649Generate output for a 68060. This is the default when the compiler is
2650configured for 68060-based systems.
2651
2652This option inhibits the use of 68020 and 68881/68882 instructions that
2653have to be emulated by software on the 68060. If your 68060 does not
2654have code to emulate those instructions, use @samp{-m68060}.
2655
2656@item -m5200
2657Generate output for a 520X "coldfire" family cpu. This is the default
2658when the compiler is configured for 520X-based systems.
2659
2660
2661@item -m68020-40
2662Generate output for a 68040, without using any of the new instructions.
2663This results in code which can run relatively efficiently on either a
266468020/68881 or a 68030 or a 68040. The generated code does use the
266568881 instructions that are emulated on the 68040.
2666
2667@item -mfpa
2668Generate output containing Sun FPA instructions for floating point.
2669
2670@item -msoft-float
2671Generate output containing library calls for floating point.
2672@strong{Warning:} the requisite libraries are not available for all m68k
2673targets. Normally the facilities of the machine's usual C compiler are
2674used, but this can't be done directly in cross-compilation. You must
2675make your own arrangements to provide suitable library functions for
2676cross-compilation. The embedded targets @samp{m68k-*-aout} and
2677@samp{m68k-*-coff} do provide software floating point support.
2678
2679@item -mshort
2680Consider type @code{int} to be 16 bits wide, like @code{short int}.
2681
2682@item -mnobitfield
2683Do not use the bit-field instructions. The @samp{-m68000} option
2684implies @w{@samp{-mnobitfield}}.
2685
2686@item -mbitfield
2687Do use the bit-field instructions. The @samp{-m68020} option implies
2688@samp{-mbitfield}. This is the default if you use a configuration
2689designed for a 68020.
2690
2691@item -mrtd
2692Use a different function-calling convention, in which functions
2693that take a fixed number of arguments return with the @code{rtd}
2694instruction, which pops their arguments while returning. This
2695saves one instruction in the caller since there is no need to pop
2696the arguments there.
2697
2698This calling convention is incompatible with the one normally
2699used on Unix, so you cannot use it if you need to call libraries
2700compiled with the Unix compiler.
2701
2702Also, you must provide function prototypes for all functions that
2703take variable numbers of arguments (including @code{printf});
2704otherwise incorrect code will be generated for calls to those
2705functions.
2706
2707In addition, seriously incorrect code will result if you call a
2708function with too many arguments. (Normally, extra arguments are
2709harmlessly ignored.)
2710
2711The @code{rtd} instruction is supported by the 68010, 68020, 68030,
271268040, and 68060 processors, but not by the 68000 or 5200.
2713@end table
2714
2715@node VAX Options
2716@subsection VAX Options
2717@cindex VAX options
2718
2719These @samp{-m} options are defined for the Vax:
2720
2721@table @code
2722@item -munix
2723Do not output certain jump instructions (@code{aobleq} and so on)
2724that the Unix assembler for the Vax cannot handle across long
2725ranges.
2726
2727@item -mgnu
2728Do output those jump instructions, on the assumption that you
2729will assemble with the GNU assembler.
2730
2731@item -mg
2732Output code for g-format floating point numbers instead of d-format.
2733@end table
2734
2735@node SPARC Options
2736@subsection SPARC Options
2737@cindex SPARC options
2738
2739These @samp{-m} switches are supported on the SPARC:
2740
2741@table @code
2742@item -mno-app-regs
2743@itemx -mapp-regs
2744Specify @samp{-mapp-regs} to generate output using the global registers
27452 through 4, which the SPARC SVR4 ABI reserves for applications. This
2746is the default.
2747
2748To be fully SVR4 ABI compliant at the cost of some performance loss,
2749specify @samp{-mno-app-regs}. You should compile libraries and system
2750software with this option.
2751
2752@item -mfpu
2753@itemx -mhard-float
2754Generate output containing floating point instructions. This is the
2755default.
2756
2757@item -mno-fpu
2758@itemx -msoft-float
2759Generate output containing library calls for floating point.
2760@strong{Warning:} the requisite libraries are not available for all SPARC
2761targets. Normally the facilities of the machine's usual C compiler are
2762used, but this cannot be done directly in cross-compilation. You must make
2763your own arrangements to provide suitable library functions for
2764cross-compilation. The embedded targets @samp{sparc-*-aout} and
2765@samp{sparclite-*-*} do provide software floating point support.
2766
2767@samp{-msoft-float} changes the calling convention in the output file;
2768therefore, it is only useful if you compile @emph{all} of a program with
2769this option. In particular, you need to compile @file{libgcc.a}, the
2770library that comes with GNU CC, with @samp{-msoft-float} in order for
2771this to work.
2772
2773@item -mhard-quad-float
2774Generate output containing quad-word (long double) floating point
2775instructions.
2776
2777@item -msoft-quad-float
2778Generate output containing library calls for quad-word (long double)
2779floating point instructions. The functions called are those specified
2780in the SPARC ABI. This is the default.
2781
2782As of this writing, there are no sparc implementations that have hardware
2783support for the quad-word floating point instructions. They all invoke
2784a trap handler for one of these instructions, and then the trap handler
2785emulates the effect of the instruction. Because of the trap handler overhead,
2786this is much slower than calling the ABI library routines. Thus the
2787@samp{-msoft-quad-float} option is the default.
2788
2789@item -mno-epilogue
2790@itemx -mepilogue
2791With @samp{-mepilogue} (the default), the compiler always emits code for
2792function exit at the end of each function. Any function exit in
2793the middle of the function (such as a return statement in C) will
2794generate a jump to the exit code at the end of the function.
2795
2796With @samp{-mno-epilogue}, the compiler tries to emit exit code inline
2797at every function exit.
2798
2799@item -mno-flat
2800@itemx -mflat
2801With @samp{-mflat}, the compiler does not generate save/restore instructions
2802and will use a "flat" or single register window calling convention.
2803This model uses %i7 as the frame pointer and is compatible with the normal
2804register window model. Code from either may be intermixed.
2805The local registers and the input registers (0-5) are still treated as
2806"call saved" registers and will be saved on the stack as necessary.
2807
2808With @samp{-mno-flat} (the default), the compiler emits save/restore
2809instructions (except for leaf functions) and is the normal mode of operation.
2810
2811@item -mno-unaligned-doubles
2812@itemx -munaligned-doubles
2813Assume that doubles have 8 byte alignment. This is the default.
2814
2815With @samp{-munaligned-doubles}, GNU CC assumes that doubles have 8 byte
2816alignment only if they are contained in another type, or if they have an
2817absolute address. Otherwise, it assumes they have 4 byte alignment.
2818Specifying this option avoids some rare compatibility problems with code
2819generated by other compilers. It is not the default because it results
2820in a performance loss, especially for floating point code.
2821
2822@item -mv8
2823@itemx -msparclite
2824These two options select variations on the SPARC architecture.
2825
2826By default (unless specifically configured for the Fujitsu SPARClite),
2827GCC generates code for the v7 variant of the SPARC architecture.
2828
2829@samp{-mv8} will give you SPARC v8 code. The only difference from v7
2830code is that the compiler emits the integer multiply and integer
2831divide instructions which exist in SPARC v8 but not in SPARC v7.
2832
2833@samp{-msparclite} will give you SPARClite code. This adds the integer
2834multiply, integer divide step and scan (@code{ffs}) instructions which
2835exist in SPARClite but not in SPARC v7.
2836
2837These options are deprecated and will be deleted in GNU CC 2.9.
2838They have been replaced with @samp{-mcpu=xxx}.
2839
2840@item -mcypress
2841@itemx -msupersparc
2842These two options select the processor for which the code is optimised.
2843
2844With @samp{-mcypress} (the default), the compiler optimizes code for the
2845Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
2846This is also appropriate for the older SparcStation 1, 2, IPX etc.
2847
2848With @samp{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
2849used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
2850of the full SPARC v8 instruction set.
2851
2852These options are deprecated and will be deleted in GNU CC 2.9.
2853They have been replaced with @samp{-mcpu=xxx}.
2854
2855@item -mcpu=@var{cpu_type}
2856Set architecture type and instruction scheduling parameters for machine
2857type @var{cpu_type}. Supported values for @var{cpu_type} are
2858@samp{common}, @samp{cypress}, @samp{v8}, @samp{supersparc},
2859@samp{sparclite}, @samp{f930}, @samp{f934},
2860@samp{sparclet}, @samp{90c701}, @samp{v8plus}, @samp{v9},
2861and @samp{ultrasparc}. Specifying @samp{v9} is only supported on true
286264 bit targets.
2863
2864@item -mtune=@var{cpu_type}
2865Set the instruction scheduling parameters for machine type
2866@var{cpu_type}, but do not set the architecture type as the option
2867@samp{-mcpu=}@var{cpu_type} would. The same values for
2868@samp{-mcpu=}@var{cpu_type} are used for @samp{-tune=}@var{cpu_type}.
2869
2870@end table
2871
2872These @samp{-m} switches are supported in addition to the above
2873on the SPARCLET processor.
2874
2875@table @code
2876@item -mlittle-endian
2877Generate code for a processor running in little-endian mode.
2878
2879@item -mlive-g0
2880Treat register @code{%g0} as a normal register.
2881GCC will continue to clobber it as necessary but will not assume
2882it always reads as 0.
2883
2884@item -mbroken-saverestore
2885Generate code that does not use non-trivial forms of the @code{save} and
2886@code{restore} instructions. Early versions of the SPARCLET processor do
2887not correctly handle @code{save} and @code{restore} instructions used with
2888arguments. They correctly handle them used without arguments. A @code{save}
2889instruction used without arguments increments the current window pointer
2890but does not allocate a new stack frame. It is assumed that the window
2891overflow trap handler will properly handle this case as will interrupt
2892handlers.
2893@end table
2894
2895These @samp{-m} switches are supported in addition to the above
2896on SPARC V9 processors in 64 bit environments.
2897
2898@table @code
2899@item -mlittle-endian
2900Generate code for a processor running in little-endian mode.
2901
2902@item -mmedlow
2903Generate code for the Medium/Low code model: assume a 32 bit address space.
2904Programs are statically linked, PIC is not supported. Pointers are still
290564 bits.
2906
2907It is very likely that a future version of GCC will rename this option.
2908
2909@item -mmedany
2910Generate code for the Medium/Anywhere code model: assume a 32 bit text
2911and a 32 bit data segment, both starting anywhere (determined at link time).
2912Programs are statically linked, PIC is not supported. Pointers are still
291364 bits.
2914
2915It is very likely that a future version of GCC will rename this option.
2916
2917@item -mfullany
2918Generate code for the Full/Anywhere code model: assume a full 64 bit
2919address space. PIC is not supported.
2920
2921It is very likely that a future version of GCC will rename this option.
2922
2923@item -mint64
2924Types long and int are 64 bits.
2925
2926@item -mlong32
2927Types long and int are 32 bits.
2928
2929@item -mlong64
2930@itemx -mint32
2931Type long is 64 bits, and type int is 32 bits.
2932
2933@item -mstack-bias
2934@itemx -mno-stack-bias
2935With @samp{-mstack-bias}, GNU CC assumes that the stack pointer, and
2936frame pointer if present, are offset by -2047 which must be added back
2937when making stack frame references.
2938Otherwise, assume no such offset is present.
2939@end table
2940
2941@node Convex Options
2942@subsection Convex Options
2943@cindex Convex options
2944
2945These @samp{-m} options are defined for Convex:
2946
2947@table @code
2948@item -mc1
2949Generate output for C1. The code will run on any Convex machine.
2950The preprocessor symbol @code{__convex__c1__} is defined.
2951
2952@item -mc2
2953Generate output for C2. Uses instructions not available on C1.
2954Scheduling and other optimizations are chosen for max performance on C2.
2955The preprocessor symbol @code{__convex_c2__} is defined.
2956
2957@item -mc32
2958Generate output for C32xx. Uses instructions not available on C1.
2959Scheduling and other optimizations are chosen for max performance on C32.
2960The preprocessor symbol @code{__convex_c32__} is defined.
2961
2962@item -mc34
2963Generate output for C34xx. Uses instructions not available on C1.
2964Scheduling and other optimizations are chosen for max performance on C34.
2965The preprocessor symbol @code{__convex_c34__} is defined.
2966
2967@item -mc38
2968Generate output for C38xx. Uses instructions not available on C1.
2969Scheduling and other optimizations are chosen for max performance on C38.
2970The preprocessor symbol @code{__convex_c38__} is defined.
2971
2972@item -margcount
2973Generate code which puts an argument count in the word preceding each
2974argument list. This is compatible with regular CC, and a few programs
2975may need the argument count word. GDB and other source-level debuggers
2976do not need it; this info is in the symbol table.
2977
2978@item -mnoargcount
2979Omit the argument count word. This is the default.
2980
2981@item -mvolatile-cache
2982Allow volatile references to be cached. This is the default.
2983
2984@item -mvolatile-nocache
2985Volatile references bypass the data cache, going all the way to memory.
2986This is only needed for multi-processor code that does not use standard
2987synchronization instructions. Making non-volatile references to volatile
2988locations will not necessarily work.
2989
2990@item -mlong32
2991Type long is 32 bits, the same as type int. This is the default.
2992
2993@item -mlong64
2994Type long is 64 bits, the same as type long long. This option is useless,
2995because no library support exists for it.
2996@end table
2997
2998@node AMD29K Options
2999@subsection AMD29K Options
3000@cindex AMD29K options
3001
3002These @samp{-m} options are defined for the AMD Am29000:
3003
3004@table @code
3005@item -mdw
3006@kindex -mdw
3007@cindex DW bit (29k)
3008Generate code that assumes the @code{DW} bit is set, i.e., that byte and
3009halfword operations are directly supported by the hardware. This is the
3010default.
3011
3012@item -mndw
3013@kindex -mndw
3014Generate code that assumes the @code{DW} bit is not set.
3015
3016@item -mbw
3017@kindex -mbw
3018@cindex byte writes (29k)
3019Generate code that assumes the system supports byte and halfword write
3020operations. This is the default.
3021
3022@item -mnbw
3023@kindex -mnbw
3024Generate code that assumes the systems does not support byte and
3025halfword write operations. @samp{-mnbw} implies @samp{-mndw}.
3026
3027@item -msmall
3028@kindex -msmall
3029@cindex memory model (29k)
3030Use a small memory model that assumes that all function addresses are
3031either within a single 256 KB segment or at an absolute address of less
3032than 256k. This allows the @code{call} instruction to be used instead
3033of a @code{const}, @code{consth}, @code{calli} sequence.
3034
3035@item -mnormal
3036@kindex -mnormal
3037Use the normal memory model: Generate @code{call} instructions only when
3038calling functions in the same file and @code{calli} instructions
3039otherwise. This works if each file occupies less than 256 KB but allows
3040the entire executable to be larger than 256 KB. This is the default.
3041
3042@item -mlarge
3043Always use @code{calli} instructions. Specify this option if you expect
3044a single file to compile into more than 256 KB of code.
3045
3046@item -m29050
3047@kindex -m29050
3048@cindex processor selection (29k)
3049Generate code for the Am29050.
3050
3051@item -m29000
3052@kindex -m29000
3053Generate code for the Am29000. This is the default.
3054
3055@item -mkernel-registers
3056@kindex -mkernel-registers
3057@cindex kernel and user registers (29k)
3058Generate references to registers @code{gr64-gr95} instead of to
3059registers @code{gr96-gr127}. This option can be used when compiling
3060kernel code that wants a set of global registers disjoint from that used
3061by user-mode code.
3062
3063Note that when this option is used, register names in @samp{-f} flags
3064must use the normal, user-mode, names.
3065
3066@item -muser-registers
3067@kindex -muser-registers
3068Use the normal set of global registers, @code{gr96-gr127}. This is the
3069default.
3070
3071@item -mstack-check
3072@itemx -mno-stack-check
3073@kindex -mstack-check
3074@cindex stack checks (29k)
3075Insert (or do not insert) a call to @code{__msp_check} after each stack
3076adjustment. This is often used for kernel code.
3077
3078@item -mstorem-bug
3079@itemx -mno-storem-bug
3080@kindex -mstorem-bug
3081@cindex storem bug (29k)
3082@samp{-mstorem-bug} handles 29k processors which cannot handle the
3083separation of a mtsrim insn and a storem instruction (most 29000 chips
3084to date, but not the 29050).
3085
3086@item -mno-reuse-arg-regs
3087@itemx -mreuse-arg-regs
3088@kindex -mreuse-arg-regs
3089@samp{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
3090registers for copying out arguments. This helps detect calling a function
3091with fewer arguments than it was declared with.
3092
3093@item -msoft-float
3094@kindex -msoft-float
3095Generate output containing library calls for floating point.
3096@strong{Warning:} the requisite libraries are not part of GNU CC.
3097Normally the facilities of the machine's usual C compiler are used, but
3098this can't be done directly in cross-compilation. You must make your
3099own arrangements to provide suitable library functions for
3100cross-compilation.
3101@end table
3102
3103@node ARM Options
3104@subsection ARM Options
3105@cindex ARM options
3106
3107These @samp{-m} options are defined for Advanced RISC Machines (ARM)
3108architectures:
3109
3110@table @code
3111@item -mapcs-frame
3112@kindex -mapcs-frame
3113Generate a stack frame that is compliant with the ARM Procedure Call
3114Standard for all functions, even if this is not strictly necessary for
3115correct execution of the code.
3116
3117@item -mapcs-26
3118@kindex -mapcs-26
3119Generate code for a processor running with a 26-bit program counter,
3120and conforming to the function calling standards for the APCS 26-bit
3121option. This option replaces the @samp{-m2} and @samp{-m3} options
3122of previous releases of the compiler.
3123
3124@item -mapcs-32
3125@kindex -mapcs-32
3126Generate code for a processor running with a 32-bit program counter,
3127and conforming to the function calling standards for the APCS 32-bit
3128option. This option replaces the @samp{-m6} option of previous releases
3129of the compiler.
3130
3131@item -mhard-float
3132Generate output containing floating point instructions. This is the
3133default.
3134
3135@item -msoft-float
3136Generate output containing library calls for floating point.
3137@strong{Warning:} the requisite libraries are not available for all ARM
3138targets. Normally the facilities of the machine's usual C compiler are
3139used, but this cannot be done directly in cross-compilation. You must make
3140your own arrangements to provide suitable library functions for
3141cross-compilation.
3142
3143@samp{-msoft-float} changes the calling convention in the output file;
3144therefore, it is only useful if you compile @emph{all} of a program with
3145this option. In particular, you need to compile @file{libgcc.a}, the
3146library that comes with GNU CC, with @samp{-msoft-float} in order for
3147this to work.
3148
3149@item -mlittle-endian
3150Generate code for a processor running in little-endian mode. This is
3151the default for all standard configurations.
3152
3153@item -mbig-endian
3154Generate code for a processor running in big-endian mode; the default is
3155to compile code for a little-endian processor.
3156
3157@item -mwords-little-endian
3158This option only applies when generating code for big-endian processors.
3159Generate code for a little-endian word order but a big-endian byte
3160order. That is, a byte order of the form @samp{32107654}. Note: this
3161option should only be used if you require compatibility with code for
3162big-endian ARM processors generated by versions of the compiler prior to
31632.8.
3164
3165@item -mshort-load-bytes
3166@kindex -mshort-load-bytes
3167Do not try to load half-words (eg @samp{short}s) by loading a word from
3168an unaligned address. For some targets the MMU is configured to trap
3169unaligned loads; use this option to generate code that is safe in these
3170environments.
3171
3172@item -mno-short-load-bytes
3173@kindex -mno-short-load-bytes
3174Use unaligned word loads to load half-words (eg @samp{short}s). This
3175option produces more efficient code, but the MMU is sometimes configured
3176to trap these instructions.
3177
3178@item -mbsd
3179@kindex -mbsd
3180This option only applies to RISC iX. Emulate the native BSD-mode
3181compiler. This is the default if @samp{-ansi} is not specified.
3182
3183@item -mxopen
3184@kindex -mxopen
3185This option only applies to RISC iX. Emulate the native X/Open-mode
3186compiler.
3187
3188@item -mno-symrename
3189@kindex -mno-symrename
3190This option only applies to RISC iX. Do not run the assembler
3191post-processor, @samp{symrename}, after code has been assembled.
3192Normally it is necessary to modify some of the standard symbols in
3193preparation for linking with the RISC iX C library; this option
3194suppresses this pass. The post-processor is never run when the
3195compiler is built for cross-compilation.
3196@end table
3197
3198@node M88K Options
3199@subsection M88K Options
3200@cindex M88k options
3201
3202These @samp{-m} options are defined for Motorola 88k architectures:
3203
3204@table @code
3205@item -m88000
3206@kindex -m88000
3207Generate code that works well on both the m88100 and the
3208m88110.
3209
3210@item -m88100
3211@kindex -m88100
3212Generate code that works best for the m88100, but that also
3213runs on the m88110.
3214
3215@item -m88110
3216@kindex -m88110
3217Generate code that works best for the m88110, and may not run
3218on the m88100.
3219
3220@item -mbig-pic
3221@kindex -mbig-pic
3222Obsolete option to be removed from the next revision.
3223Use @samp{-fPIC}.
3224
3225@item -midentify-revision
3226@kindex -midentify-revision
3227@kindex ident
3228@cindex identifying source, compiler (88k)
3229Include an @code{ident} directive in the assembler output recording the
3230source file name, compiler name and version, timestamp, and compilation
3231flags used.
3232
3233@item -mno-underscores
3234@kindex -mno-underscores
3235@cindex underscores, avoiding (88k)
3236In assembler output, emit symbol names without adding an underscore
3237character at the beginning of each name. The default is to use an
3238underscore as prefix on each name.
3239
3240@item -mocs-debug-info
3241@itemx -mno-ocs-debug-info
3242@kindex -mocs-debug-info
3243@kindex -mno-ocs-debug-info
3244@cindex OCS (88k)
3245@cindex debugging, 88k OCS
3246Include (or omit) additional debugging information (about registers used
3247in each stack frame) as specified in the 88open Object Compatibility
3248Standard, ``OCS''. This extra information allows debugging of code that
3249has had the frame pointer eliminated. The default for DG/UX, SVr4, and
3250Delta 88 SVr3.2 is to include this information; other 88k configurations
3251omit this information by default.
3252
3253@item -mocs-frame-position
3254@kindex -mocs-frame-position
3255@cindex register positions in frame (88k)
3256When emitting COFF debugging information for automatic variables and
3257parameters stored on the stack, use the offset from the canonical frame
3258address, which is the stack pointer (register 31) on entry to the
3259function. The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
3260@samp{-mocs-frame-position}; other 88k configurations have the default
3261@samp{-mno-ocs-frame-position}.
3262
3263@item -mno-ocs-frame-position
3264@kindex -mno-ocs-frame-position
3265@cindex register positions in frame (88k)
3266When emitting COFF debugging information for automatic variables and
3267parameters stored on the stack, use the offset from the frame pointer
3268register (register 30). When this option is in effect, the frame
3269pointer is not eliminated when debugging information is selected by the
3270-g switch.
3271
3272@item -moptimize-arg-area
3273@itemx -mno-optimize-arg-area
3274@kindex -moptimize-arg-area
3275@kindex -mno-optimize-arg-area
3276@cindex arguments in frame (88k)
3277Control how function arguments are stored in stack frames.
3278@samp{-moptimize-arg-area} saves space by optimizing them, but this
3279conflicts with the 88open specifications. The opposite alternative,
3280@samp{-mno-optimize-arg-area}, agrees with 88open standards. By default
3281GNU CC does not optimize the argument area.
3282
3283@item -mshort-data-@var{num}
3284@kindex -mshort-data-@var{num}
3285@cindex smaller data references (88k)
3286@cindex r0-relative references (88k)
3287Generate smaller data references by making them relative to @code{r0},
3288which allows loading a value using a single instruction (rather than the
3289usual two). You control which data references are affected by
3290specifying @var{num} with this option. For example, if you specify
3291@samp{-mshort-data-512}, then the data references affected are those
3292involving displacements of less than 512 bytes.
3293@samp{-mshort-data-@var{num}} is not effective for @var{num} greater
3294than 64k.
3295
3296@item -mserialize-volatile
3297@kindex -mserialize-volatile
3298@itemx -mno-serialize-volatile
3299@kindex -mno-serialize-volatile
3300@cindex sequential consistency on 88k
3301Do, or don't, generate code to guarantee sequential consistency
3302of volatile memory references. By default, consistency is
3303guaranteed.
3304
3305The order of memory references made by the MC88110 processor does
3306not always match the order of the instructions requesting those
3307references. In particular, a load instruction may execute before
3308a preceding store instruction. Such reordering violates
3309sequential consistency of volatile memory references, when there
3310are multiple processors. When consistency must be guaranteed,
3311GNU C generates special instructions, as needed, to force
3312execution in the proper order.
3313
3314The MC88100 processor does not reorder memory references and so
3315always provides sequential consistency. However, by default, GNU
3316C generates the special instructions to guarantee consistency
3317even when you use @samp{-m88100}, so that the code may be run on an
3318MC88110 processor. If you intend to run your code only on the
3319MC88100 processor, you may use @samp{-mno-serialize-volatile}.
3320
3321The extra code generated to guarantee consistency may affect the
3322performance of your application. If you know that you can safely
3323forgo this guarantee, you may use @samp{-mno-serialize-volatile}.
3324
3325@item -msvr4
3326@itemx -msvr3
3327@kindex -msvr4
3328@kindex -msvr3
3329@cindex assembler syntax, 88k
3330@cindex SVr4
3331Turn on (@samp{-msvr4}) or off (@samp{-msvr3}) compiler extensions
3332related to System V release 4 (SVr4). This controls the following:
3333
3334@enumerate
3335@item
3336Which variant of the assembler syntax to emit.
3337@item
3338@samp{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
3339that is used on System V release 4.
3340@item
3341@samp{-msvr4} makes GNU CC issue additional declaration directives used in
3342SVr4.
3343@end enumerate
3344
3345@samp{-msvr4} is the default for the m88k-motorola-sysv4 and
3346m88k-dg-dgux m88k configurations. @samp{-msvr3} is the default for all
3347other m88k configurations.
3348
3349@item -mversion-03.00
3350@kindex -mversion-03.00
3351This option is obsolete, and is ignored.
3352@c ??? which asm syntax better for GAS? option there too?
3353
3354@item -mno-check-zero-division
3355@itemx -mcheck-zero-division
3356@kindex -mno-check-zero-division
3357@kindex -mcheck-zero-division
3358@cindex zero division on 88k
3359Do, or don't, generate code to guarantee that integer division by
3360zero will be detected. By default, detection is guaranteed.
3361
3362Some models of the MC88100 processor fail to trap upon integer
3363division by zero under certain conditions. By default, when
3364compiling code that might be run on such a processor, GNU C
3365generates code that explicitly checks for zero-valued divisors
3366and traps with exception number 503 when one is detected. Use of
3367mno-check-zero-division suppresses such checking for code
3368generated to run on an MC88100 processor.
3369
3370GNU C assumes that the MC88110 processor correctly detects all
3371instances of integer division by zero. When @samp{-m88110} is
3372specified, both @samp{-mcheck-zero-division} and
3373@samp{-mno-check-zero-division} are ignored, and no explicit checks for
3374zero-valued divisors are generated.
3375
3376@item -muse-div-instruction
3377@kindex -muse-div-instruction
3378@cindex divide instruction, 88k
3379Use the div instruction for signed integer division on the
3380MC88100 processor. By default, the div instruction is not used.
3381
3382On the MC88100 processor the signed integer division instruction
3383div) traps to the operating system on a negative operand. The
3384operating system transparently completes the operation, but at a
3385large cost in execution time. By default, when compiling code
3386that might be run on an MC88100 processor, GNU C emulates signed
3387integer division using the unsigned integer division instruction
3388divu), thereby avoiding the large penalty of a trap to the
3389operating system. Such emulation has its own, smaller, execution
3390cost in both time and space. To the extent that your code's
3391important signed integer division operations are performed on two
3392nonnegative operands, it may be desirable to use the div
3393instruction directly.
3394
3395On the MC88110 processor the div instruction (also known as the
3396divs instruction) processes negative operands without trapping to
3397the operating system. When @samp{-m88110} is specified,
3398@samp{-muse-div-instruction} is ignored, and the div instruction is used
3399for signed integer division.
3400
3401Note that the result of dividing INT_MIN by -1 is undefined. In
3402particular, the behavior of such a division with and without
3403@samp{-muse-div-instruction} may differ.
3404
3405@item -mtrap-large-shift
3406@itemx -mhandle-large-shift
3407@kindex -mtrap-large-shift
3408@kindex -mhandle-large-shift
3409@cindex bit shift overflow (88k)
3410@cindex large bit shifts (88k)
3411Include code to detect bit-shifts of more than 31 bits; respectively,
3412trap such shifts or emit code to handle them properly. By default GNU CC
3413makes no special provision for large bit shifts.
3414
3415@item -mwarn-passed-structs
3416@kindex -mwarn-passed-structs
3417@cindex structure passing (88k)
3418Warn when a function passes a struct as an argument or result.
3419Structure-passing conventions have changed during the evolution of the C
3420language, and are often the source of portability problems. By default,
3421GNU CC issues no such warning.
3422@end table
3423
3424@node RS/6000 and PowerPC Options
3425@subsection IBM RS/6000 and PowerPC Options
3426@cindex RS/6000 and PowerPC Options
3427@cindex IBM RS/6000 and PowerPC Options
3428
3429These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
3430@table @code
3431@item -mpower
3432@itemx -mno-power
3433@itemx -mpower2
3434@itemx -mno-power2
3435@itemx -mpowerpc
3436@itemx -mno-powerpc
3437@itemx -mpowerpc-gpopt
3438@itemx -mno-powerpc-gpopt
3439@itemx -mpowerpc-gfxopt
3440@itemx -mno-powerpc-gfxopt
3441@kindex -mpower
3442@kindex -mpower2
3443@kindex -mpowerpc
3444@kindex -mpowerpc-gpopt
3445@kindex -mpowerpc-gfxopt
3446GNU CC supports two related instruction set architectures for the
3447RS/6000 and PowerPC. The @dfn{POWER} instruction set are those
3448instructions supported by the @samp{rios} chip set used in the original
3449RS/6000 systems and the @dfn{PowerPC} instruction set is the
3450architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
3451the IBM 40x microprocessors. The PowerPC architecture defines 64-bit
3452instructions, but they are not supported by any current processors.
3453
3454Neither architecture is a subset of the other. However there is a
3455large common subset of instructions supported by both. An MQ
3456register is included in processors supporting the POWER architecture.
3457
3458You use these options to specify which instructions are available on the
3459processor you are using. The default value of these options is
3460determined when configuring GNU CC. Specifying the
3461@samp{-mcpu=@var{cpu_type}} overrides the specification of these
3462options. We recommend you use the @samp{-mcpu=@var{cpu_type}} option
3463rather than the options listed above.
3464
3465The @samp{-mpower} option allows GNU CC to generate instructions that
3466are found only in the POWER architecture and to use the MQ register.
3467Specifying @samp{-mpower2} implies @samp{-power} and also allows GNU CC
3468to generate instructions that are present in the POWER2 architecture but
3469not the original POWER architecture.
3470
3471The @samp{-mpowerpc} option allows GNU CC to generate instructions that
3472are found only in the 32-bit subset of the PowerPC architecture.
3473Specifying @samp{-mpowerpc-gpopt} implies @samp{-mpowerpc} and also allows
3474GNU CC to use the optional PowerPC architecture instructions in the
3475General Purpose group, including floating-point square root. Specifying
3476@samp{-mpowerpc-gfxopt} implies @samp{-mpowerpc} and also allows GNU CC to
3477use the optional PowerPC architecture instructions in the Graphics
3478group, including floating-point select.
3479
3480If you specify both @samp{-mno-power} and @samp{-mno-powerpc}, GNU CC
3481will use only the instructions in the common subset of both
3482architectures plus some special AIX common-mode calls, and will not use
3483the MQ register. Specifying both @samp{-mpower} and @samp{-mpowerpc}
3484permits GNU CC to use any instruction from either architecture and to
3485allow use of the MQ register; specify this for the Motorola MPC601.
3486
3487@item -mnew-mnemonics
3488@itemx -mold-mnemonics
3489@kindex -mnew-mnemonics
3490@kindex -mold-mnemonics
3491Select which mnemonics to use in the generated assembler code.
3492@samp{-mnew-mnemonics} requests output that uses the assembler mnemonics
3493defined for the PowerPC architecture, while @samp{-mold-mnemonics}
3494requests the assembler mnemonics defined for the POWER architecture.
3495Instructions defined in only one architecture have only one mnemonic;
3496GNU CC uses that mnemonic irrespective of which of these options is
3497specified.
3498
3499PowerPC assemblers support both the old and new mnemonics, as will later
3500POWER assemblers. Current POWER assemblers only support the old
3501mnemonics. Specify @samp{-mnew-mnemonics} if you have an assembler that
3502supports them, otherwise specify @samp{-mold-mnemonics}.
3503
3504The default value of these options depends on how GNU CC was configured.
3505Specifying @samp{-mcpu=@var{cpu_type}} sometimes overrides the value of
3506these option. Unless you are building a cross-compiler, you should
3507normally not specify either @samp{-mnew-mnemonics} or
3508@samp{-mold-mnemonics}, but should instead accept the default.
3509
3510@item -mcpu=@var{cpu_type}
3511Set architecture type, register usage, choice of mnemonics, and
3512instruction scheduling parameters for machine type @var{cpu_type}.
3513Supported values for @var{cpu_type} are @samp{rs6000}, @samp{rios1},
3514@samp{rios2}, @samp{rsc}, @samp{601}, @samp{602}, @samp{603},
3515@samp{603e}, @samp{604}, @samp{620}, @samp{power}, @samp{power2},
3516@samp{powerpc}, @samp{403}, @samp{505}, @samp{821}, and @samp{860} and
3517@samp{common}. @samp{-mcpu=power}, @samp{-mcpu=power2}, and
3518@samp{-mcpu=powerpc} specify generic POWER, POWER2 and pure PowerPC
3519(i.e., not MPC601) architecture machine types, with an appropriate,
3520generic processor model assumed for scheduling purposes.@refill
3521
3522@c overfull hbox here --bob 22 jul96
3523@c original text between ignore ... end ignore
3524@ignore
3525Specifying any of the @samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @samp{-mcpu=rsc},
3526@samp{-mcpu=power}, or @samp{-mcpu=power2} options enables the @samp{-mpower}
3527option and disables the @samp{-mpowerpc} option; @samp{-mcpu=601}
3528enables both the @samp{-mpower} and @samp{-mpowerpc} options;
3529all of @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e}, @samp{-mcpu=604},
3530@samp{-mcpu=620}, @samp{-mcpu=403}, @samp{-mcpu=505}, @samp{-mcpu=821},
3531@samp{-mcpu=860} and @samp{-mcpu=powerpc} enable the @samp{-mpowerpc}
3532option and disable the @samp{-mpower} option; @samp{-mcpu=common}
3533disables both the @samp{-mpower} and @samp{-mpowerpc} options.@refill
3534@end ignore
3535@c changed paragraph
3536Specifying any of the following options:
3537@samp{-mcpu=rios1}, @samp{-mcpu=rios2}, @samp{-mcpu=rsc},
3538@samp{-mcpu=power}, or @samp{-mcpu=power2}
3539enables the @samp{-mpower} option and disables the @samp{-mpowerpc} option;
3540@samp{-mcpu=601} enables both the @samp{-mpower} and @samp{-mpowerpc} options.
3541All of @samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e},
3542@samp{-mcpu=604}, @samp{-mcpu=620},
3543enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
3544Exactly similarly, all of @samp{-mcpu=403},
3545@samp{-mcpu=505}, @samp{-mcpu=821}, @samp{-mcpu=860} and @samp{-mcpu=powerpc}
3546enable the @samp{-mpowerpc} option and disable the @samp{-mpower} option.
3547@samp{-mcpu=common} disables both the
3548@samp{-mpower} and @samp{-mpowerpc} options.@refill
3549@c end changes to prevent overfull hboxes
3550
3551AIX versions 4 or greater selects @samp{-mcpu=common} by default, so
3552that code will operate on all members of the RS/6000 and PowerPC
3553families. In that case, GNU CC will use only the instructions in the
3554common subset of both architectures plus some special AIX common-mode
3555calls, and will not use the MQ register. GNU CC assumes a generic
3556processor model for scheduling purposes.
3557
3558Specifying any of the options @samp{-mcpu=rios1}, @samp{-mcpu=rios2},
3559@samp{-mcpu=rsc}, @samp{-mcpu=power}, or @samp{-mcpu=power2} also
3560disables the @samp{new-mnemonics} option. Specifying @samp{-mcpu=601},
3561@samp{-mcpu=602}, @samp{-mcpu=603}, @samp{-mcpu=603e}, @samp{-mcpu=604},
3562@samp{620}, @samp{403}, or @samp{-mcpu=powerpc} also enables the
3563@samp{new-mnemonics} option.@refill
3564
3565Specifying @samp{-mcpu=403}, @samp{-mcpu=821}, or @samp{-mcpu=860} also
3566enables the @samp{-msoft-float} option.
3567
3568@item -mtune=@var{cpu_type}
3569Set the instruction scheduling parameters for machine type
3570@var{cpu_type}, but do not set the architecture type, register usage,
3571choice of mnemonics like @samp{-mcpu=}@var{cpu_type} would. The same
3572values for @var{cpu_type} are used for @samp{-mtune=}@var{cpu_type} as
3573for @samp{-mcpu=}@var{cpu_type}. The @samp{-mtune=}@var{cpu_type}
3574option overrides the @samp{-mcpu=}@var{cpu_type} option in terms of
3575instruction scheduling parameters.
3576
3577@item -mfull-toc
3578@itemx -mno-fp-in-toc
3579@itemx -mno-sum-in-toc
3580@itemx -mminimal-toc
3581Modify generation of the TOC (Table Of Contents), which is created for
3582every executable file. The @samp{-mfull-toc} option is selected by
3583default. In that case, GNU CC will allocate at least one TOC entry for
3584each unique non-automatic variable reference in your program. GNU CC
3585will also place floating-point constants in the TOC. However, only
358616,384 entries are available in the TOC.
3587
3588If you receive a linker error message that saying you have overflowed
3589the available TOC space, you can reduce the amount of TOC space used
3590with the @samp{-mno-fp-in-toc} and @samp{-mno-sum-in-toc} options.
3591@samp{-mno-fp-in-toc} prevents GNU CC from putting floating-point
3592constants in the TOC and @samp{-mno-sum-in-toc} forces GNU CC to
3593generate code to calculate the sum of an address and a constant at
3594run-time instead of putting that sum into the TOC. You may specify one
3595or both of these options. Each causes GNU CC to produce very slightly
3596slower and larger code at the expense of conserving TOC space.
3597
3598If you still run out of space in the TOC even when you specify both of
3599these options, specify @samp{-mminimal-toc} instead. This option causes
3600GNU CC to make only one TOC entry for every file. When you specify this
3601option, GNU CC will produce code that is slower and larger but which
3602uses extremely little TOC space. You may wish to use this option
3603only on files that contain less frequently executed code. @refill
3604
3605@item -mxl-call
3606@itemx -mno-xl-call
3607On AIX, pass floating-point arguments to prototyped functions beyond the
3608register save area (RSA) on the stack in addition to argument FPRs. The
3609AIX calling convention was extended but not initially documented to
3610handle an obscure K&R C case of calling a function that takes the
3611address of its arguments with fewer arguments than declared. AIX XL
3612compilers assume that floating point arguments which do not fit in the
3613RSA are on the stack when they compile a subroutine without
3614optimization. Because always storing floating-point arguments on the
3615stack is inefficient and rarely needed, this option is not enabled by
3616default and only is necessary when calling subroutines compiled by AIX
3617XL compilers without optimization.
3618
3619@item -msoft-float
3620@itemx -mhard-float
3621Generate code that does not use (uses) the floating-point register set.
3622Software floating point emulation is provided if you use the
3623@samp{-msoft-float} option, and pass the option to GNU CC when linking.
3624
3625@item -mmultiple
3626@itemx -mno-multiple
3627Generate code that uses (does not use) the load multiple word
3628instructions and the store multiple word instructions. These
3629instructions are generated by default on POWER systems, and not
3630generated on PowerPC systems. Do not use @samp{-mmultiple} on little
3631endian PowerPC systems, since those instructions do not work when the
3632processor is in little endian mode.
3633
3634@item -mstring
3635@itemx -mno-string
3636Generate code that uses (does not use) the load string instructions and the
3637store string word instructions to save multiple registers and do small block
3638moves. These instructions are generated by default on POWER systems, anod not
3639generated on PowerPC systems. Do not use @samp{-mstring} on little endian
3640PowerPC systems, since those instructions do not work when the processor is in
3641little endian mode.
3642
3643@item -mno-bit-align
3644@itemx -mbit-align
3645On System V.4 and embedded PowerPC systems do not (do) force structures
3646and unions that contain bit fields to be aligned to the base type of the
3647bit field.
3648
3649For example, by default a structure containing nothing but 8
3650@code{unsigned} bitfields of length 1 would be aligned to a 4 byte
3651boundary and have a size of 4 bytes. By using @samp{-mno-bit-align},
3652the structure would be aligned to a 1 byte boundary and be one byte in
3653size.
3654
3655@item -mno-strict-align
3656@itemx -mstrict-align
3657On System V.4 and embedded PowerPC systems do not (do) assume that
3658unaligned memory references will be handled by the system.
3659
3660@item -mrelocatable
3661@itemx -mno-relocatable
3662On embedded PowerPC systems generate code that allows (does not allow)
3663the program to be relocated to a different address at runtime. If you
3664use @samp{-mrelocatable} on any module, all objects linked together must
3665be compiled with @samp{-mrelocatable} or @samp{-mrelocatable-lib}.
3666
3667@item -mrelocatable-lib
3668@itemx -mno-relocatable-lib
3669On embedded PowerPC systems generate code that allows (does not allow)
3670the program to be relocated to a different address at runtime. Modules
3671compiled with @samp{-mreloctable-lib} can be linked with either modules
3672compiled without @samp{-mrelocatable} and @samp{-mrelocatable-lib} or
3673with modules compiled with the @samp{-mrelocatable} options.
3674
3675@item -mno-toc
3676@itemx -mtoc
3677On System V.4 and embedded PowerPC systems do not (do) assume that
3678register 2 contains a pointer to a global area pointing to the addresses
3679used in the program.
3680
3681@item -mno-traceback
3682@itemx -mtraceback
3683On embedded PowerPC systems do not (do) generate a traceback tag before
3684the start of the function. This tag can be used by the debugger to
3685identify where the start of a function is.
3686
3687@item -mlittle
3688@itemx -mlittle-endian
3689On System V.4 and embedded PowerPC systems compile code for the
3690processor in little endian mode. The @samp{-mlittle-endian} option is
3691the same as @samp{-mlittle}.
3692
3693@item -mbig
3694@itemx -mbig-endian
3695On System V.4 and embedded PowerPC systems compile code for the
3696processor in big endian mode. The @samp{-mbig-endian} option is
3697the same as @samp{-mbig}.
3698
3699@item -mcall-sysv
3700On System V.4 and embedded PowerPC systems compile code using calling
3701conventions that adheres to the March 1995 draft of the System V
3702Application Binary Interface, PowerPC processor supplement. This is the
3703default unless you configured GCC using @samp{powerpc-*-eabiaix}.
3704
3705@item -mcall-sysv-eabi
3706Specify both @samp{-mcall-sysv} and @samp{-meabi} options.
3707
3708@item -mcall-sysv-noeabi
3709Specify both @samp{-mcall-sysv} and @samp{-mno-eabi} options.
3710
3711@item -mcall-aix
3712On System V.4 and embedded PowerPC systems compile code using calling
3713conventions that are similar to those used on AIX. This is the
3714default if you configured GCC using @samp{powerpc-*-eabiaix}.
3715
3716@item -mcall-solaris
3717On System V.4 and embedded PowerPC systems compile code for the Solaris
3718operating system.
3719
3720@item -mcall-linux
3721On System V.4 and embedded PowerPC systems compile code for the Linux
3722operating system.
3723
3724@item -mprototype
3725@item -mno-prototype
3726On System V.4 and embedded PowerPC systems assume that all calls to
3727variable argument functions are properly prototyped. Otherwise, the
3728compiler must insert an instruction before every non prototyped call to
3729set or clear bit 6 of the condition code register (@var{CR}) to
3730indicate whether floating point values were passed in the floating point
3731registers in case the function takes a variable arguments. With
3732@samp{-mprototype}, only calls to prototyped variable argument functions
3733will set or clear the bit.
3734
3735@item -msim
3736On embedded PowerPC systems, assume that the startup module is called
3737@file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
3738@file{libc.a}. This is the default for @samp{powerpc-*-eabisim}.
3739configurations.
3740
3741@item -mmvme
3742On embedded PowerPC systems, assume that the startup module is called
3743@file{mvme-crt0.o} and the standard C libraries are @file{libmvme.a} and
3744@file{libc.a}.
3745
3746@item -memb
3747On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
3748header to indicate that @samp{eabi} extended relocations are used.
3749
3750@item -meabi
3751@itemx -mno-eabi
3752On System V.4 and embedded PowerPC systems do (do not) adhere to the
3753Embedded Applications Binary Interface (eabi) which is a set of
3754modifications to the System V.4 specifications. Selecting @code{-meabi}
3755means that the stack is aligned to an 8 byte boundary, a function
3756@code{__eabi} is called to from @code{main} to set up the eabi
3757environment, and the @samp{-msdata} option can use both @code{r2} and
3758@code{r13} to point to two separate small data areas. Selecting
3759@code{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
3760do not call an initialization function from @code{main}, and the
3761@samp{-msdata} option will only use @code{r13} to point to a single
3762small data area. The @samp{-meabi} option is on by default if you
3763configured GCC using one of the @samp{powerpc*-*-eabi*} options.
3764
3765@item -msdata=eabi
3766On System V.4 and embedded PowerPC systems, put small initialized
3767@code{const} global and static data in the @samp{.sdata2} section, which
3768is pointed to by register @code{r2}. Put small initialized
3769non-@code{const} global and static data in the @samp{.sdata} section,
3770which is pointed to by register @code{r13}. Put small uninitialized
3771global and static data in the @samp{.sbss} section, which is adjacent to
3772the @samp{.sdata} section. The @samp{-msdata=eabi} option is
3773incompatible with the @samp{-mrelocatable} option. The
3774@samp{-msdata=eabi} option also sets the @samp{-memb} option.
3775
3776@item -msdata=sysv
3777On System V.4 and embedded PowerPC systems, put small global and static
3778data in the @samp{.sdata} section, which is pointed to by register
3779@code{r13}. Put small uninitialized global and static data in the
3780@samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
3781The @samp{-msdata=sysv} option is incompatible with the
3782@samp{-mrelocatable} option.
3783
3784@item -msdata=default
3785@itemx -msdata
3786On System V.4 and embedded PowerPC systems, if @samp{-meabi} is used,
3787compile code the same as @samp{-msdata=eabi}, otherwise compile code the
3788same as @samp{-msdata=sysv}.
3789
3790@item -msdata-data
3791On System V.4 and embedded PowerPC systems, put small global and static
3792data in the @samp{.sdata} section. Put small uninitialized global and
3793static data in the @samp{.sbss} section. Do not use register @code{r13}
3794to address small data however. This is the default behavior unless
3795other @samp{-msdata} options are used.
3796
3797@item -msdata=none
3798@itemx -mno-sdata
3799On embedded PowerPC systems, put all initialized global and static data
3800in the @samp{.data} section, and all uninitialized data in the
3801@samp{.bss} section.
3802
3803@item -G @var{num}
3804@cindex smaller data references (PowerPC)
3805@cindex .sdata/.sdata2 references (PowerPC)
3806On embbeded PowerPC systems, put global and static items less than or
3807equal to @var{num} bytes into the small data or bss sections instead of
3808the normal data or bss section. By default, @var{num} is 8. The
3809@samp{-G @var{num}} switch is also passed to the linker.
3810All modules should be compiled with the same @samp{-G @var{num}} value.
3811
3812@item -mregnames
3813@itemx -mno-regnames
3814On System V.4 and embedded PowerPC systems do (do not) emit register
3815names in the assembly language output using symbolic forms.
3816@end table
3817@node RT Options
3818@subsection IBM RT Options
3819@cindex RT options
3820@cindex IBM RT options
3821
3822These @samp{-m} options are defined for the IBM RT PC:
3823
3824@table @code
3825@item -min-line-mul
3826Use an in-line code sequence for integer multiplies. This is the
3827default.
3828
3829@item -mcall-lib-mul
3830Call @code{lmul$$} for integer multiples.
3831
3832@item -mfull-fp-blocks
3833Generate full-size floating point data blocks, including the minimum
3834amount of scratch space recommended by IBM. This is the default.
3835
3836@item -mminimum-fp-blocks
3837Do not include extra scratch space in floating point data blocks. This
3838results in smaller code, but slower execution, since scratch space must
3839be allocated dynamically.
3840
3841@cindex @file{varargs.h} and RT PC
3842@cindex @file{stdarg.h} and RT PC
3843@item -mfp-arg-in-fpregs
3844Use a calling sequence incompatible with the IBM calling convention in
3845which floating point arguments are passed in floating point registers.
3846Note that @code{varargs.h} and @code{stdargs.h} will not work with
3847floating point operands if this option is specified.
3848
3849@item -mfp-arg-in-gregs
3850Use the normal calling convention for floating point arguments. This is
3851the default.
3852
3853@item -mhc-struct-return
3854Return structures of more than one word in memory, rather than in a
3855register. This provides compatibility with the MetaWare HighC (hc)
3856compiler. Use the option @samp{-fpcc-struct-return} for compatibility
3857with the Portable C Compiler (pcc).
3858
3859@item -mnohc-struct-return
3860Return some structures of more than one word in registers, when
3861convenient. This is the default. For compatibility with the
3862IBM-supplied compilers, use the option @samp{-fpcc-struct-return} or the
3863option @samp{-mhc-struct-return}.
3864@end table
3865
3866@node MIPS Options
3867@subsection MIPS Options
3868@cindex MIPS options
3869
3870These @samp{-m} options are defined for the MIPS family of computers:
3871
3872@table @code
3873@item -mcpu=@var{cpu type}
3874Assume the defaults for the machine type @var{cpu type} when scheduling
3875instructions. The choices for @var{cpu type} are @samp{r2000}, @samp{r3000},
3876@samp{r4000}, @samp{r4400}, @samp{r4600}, and @samp{r6000}. While picking a
3877specific @var{cpu type} will schedule things appropriately for that
3878particular chip, the compiler will not generate any code that does not
3879meet level 1 of the MIPS ISA (instruction set architecture) without
3880the @samp{-mips2} or @samp{-mips3} switches being used.
3881
3882@item -mips1
3883Issue instructions from level 1 of the MIPS ISA. This is the default.
3884@samp{r3000} is the default @var{cpu type} at this ISA level.
3885
3886@item -mips2
3887Issue instructions from level 2 of the MIPS ISA (branch likely, square
3888root instructions). @samp{r6000} is the default @var{cpu type} at this
3889ISA level.
3890
3891@item -mips3
3892Issue instructions from level 3 of the MIPS ISA (64 bit instructions).
3893@samp{r4000} is the default @var{cpu type} at this ISA level.
3894This option does not change the sizes of any of the C data types.
3895
3896@item -mfp32
3897Assume that 32 32-bit floating point registers are available. This is
3898the default.
3899
3900@item -mfp64
3901Assume that 32 64-bit floating point registers are available. This is
3902the default when the @samp{-mips3} option is used.
3903
3904@item -mgp32
3905Assume that 32 32-bit general purpose registers are available. This is
3906the default.
3907
3908@item -mgp64
3909Assume that 32 64-bit general purpose registers are available. This is
3910the default when the @samp{-mips3} option is used.
3911
3912@item -mint64
3913Types long, int, and pointer are 64 bits. This works only if @samp{-mips3}
3914is also specified.
3915
3916@item -mlong64
3917Types long and pointer are 64 bits, and type int is 32 bits.
3918This works only if @samp{-mips3} is also specified.
3919
3920@item -mmips-as
3921Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
3922add normal debug information. This is the default for all
3923platforms except for the OSF/1 reference platform, using the OSF/rose
3924object format. If the either of the @samp{-gstabs} or @samp{-gstabs+}
3925switches are used, the @file{mips-tfile} program will encapsulate the
3926stabs within MIPS ECOFF.
3927
3928@item -mgas
3929Generate code for the GNU assembler. This is the default on the OSF/1
3930reference platform, using the OSF/rose object format.
3931
3932@item -mrnames
3933@itemx -mno-rnames
3934The @samp{-mrnames} switch says to output code using the MIPS software
3935names for the registers, instead of the hardware names (ie, @var{a0}
3936instead of @var{$4}). The only known assembler that supports this option
3937is the Algorithmics assembler.
3938
3939@item -mgpopt
3940@itemx -mno-gpopt
3941The @samp{-mgpopt} switch says to write all of the data declarations
3942before the instructions in the text section, this allows the MIPS
3943assembler to generate one word memory references instead of using two
3944words for short global or static data items. This is on by default if
3945optimization is selected.
3946
3947@item -mstats
3948@itemx -mno-stats
3949For each non-inline function processed, the @samp{-mstats} switch
3950causes the compiler to emit one line to the standard error file to
3951print statistics about the program (number of registers saved, stack
3952size, etc.).
3953
3954@item -mmemcpy
3955@itemx -mno-memcpy
3956The @samp{-mmemcpy} switch makes all block moves call the appropriate
3957string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
3958generating inline code.
3959
3960@item -mmips-tfile
3961@itemx -mno-mips-tfile
3962The @samp{-mno-mips-tfile} switch causes the compiler not
3963postprocess the object file with the @file{mips-tfile} program,
3964after the MIPS assembler has generated it to add debug support. If
3965@file{mips-tfile} is not run, then no local variables will be
3966available to the debugger. In addition, @file{stage2} and
3967@file{stage3} objects will have the temporary file names passed to the
3968assembler embedded in the object file, which means the objects will
3969not compare the same. The @samp{-mno-mips-tfile} switch should only
3970be used when there are bugs in the @file{mips-tfile} program that
3971prevents compilation.
3972
3973@item -msoft-float
3974Generate output containing library calls for floating point.
3975@strong{Warning:} the requisite libraries are not part of GNU CC.
3976Normally the facilities of the machine's usual C compiler are used, but
3977this can't be done directly in cross-compilation. You must make your
3978own arrangements to provide suitable library functions for
3979cross-compilation.
3980
3981@item -mhard-float
3982Generate output containing floating point instructions. This is the
3983default if you use the unmodified sources.
3984
3985@item -mabicalls
3986@itemx -mno-abicalls
3987Emit (or do not emit) the pseudo operations @samp{.abicalls},
3988@samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
3989position independent code.
3990
3991@item -mlong-calls
3992@itemx -mno-long-calls
3993Do all calls with the @samp{JALR} instruction, which requires
3994loading up a function's address into a register before the call.
3995You need to use this switch, if you call outside of the current
3996512 megabyte segment to functions that are not through pointers.
3997
3998@item -mhalf-pic
3999@itemx -mno-half-pic
4000Put pointers to extern references into the data section and load them
4001up, rather than put the references in the text section.
4002
4003@item -membedded-pic
4004@itemx -mno-embedded-pic
4005Generate PIC code suitable for some embedded systems. All calls are made
4006using PC relative address, and all data is addressed using the $gp register.
4007This requires GNU as and GNU ld which do most of the work.
4008
4009@item -membedded-data
4010@itemx -mno-embedded-data
4011Allocate variables to the read-only data section first if possible, then
4012next in the small data section if possible, otherwise in data. This gives
4013slightly slower code than the default, but reduces the amount of RAM required
4014when executing, and thus may be preferred for some embedded systems.
4015
4016@item -msingle-float
4017@itemx -mdouble-float
4018The @samp{-msingle-float} switch tells gcc to assume that the floating
4019point coprocessor only supports single precision operations, as on the
4020@samp{r4650} chip. The @samp{-mdouble-float} switch permits gcc to use
4021double precision operations. This is the default.
4022
4023@item -mmad
4024@itemx -mno-mad
4025Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
4026as on the @samp{r4650} chip.
4027
4028@item -m4650
4029Turns on @samp{-msingle-float}, @samp{-mmad}, and, at least for now,
4030@samp{-mcpu=r4650}.
4031
4032@item -EL
4033Compile code for the processor in little endian mode.
4034The requisite libraries are assumed to exist.
4035
4036@item -EB
4037Compile code for the processor in big endian mode.
4038The requisite libraries are assumed to exist.
4039
4040@item -G @var{num}
4041@cindex smaller data references (MIPS)
4042@cindex gp-relative references (MIPS)
4043Put global and static items less than or equal to @var{num} bytes into
4044the small data or bss sections instead of the normal data or bss
4045section. This allows the assembler to emit one word memory reference
4046instructions based on the global pointer (@var{gp} or @var{$28}),
4047instead of the normal two words used. By default, @var{num} is 8 when
4048the MIPS assembler is used, and 0 when the GNU assembler is used. The
4049@samp{-G @var{num}} switch is also passed to the assembler and linker.
4050All modules should be compiled with the same @samp{-G @var{num}}
4051value.
4052
4053@item -nocpp
4054Tell the MIPS assembler to not run it's preprocessor over user
4055assembler files (with a @samp{.s} suffix) when assembling them.
4056@end table
4057
4058@ifset INTERNALS
4059These options are defined by the macro
4060@code{TARGET_SWITCHES} in the machine description. The default for the
4061options is also defined by that macro, which enables you to change the
4062defaults.
4063@end ifset
4064
4065@node i386 Options
4066@subsection Intel 386 Options
4067@cindex i386 Options
4068@cindex Intel 386 Options
4069
4070These @samp{-m} options are defined for the i386 family of computers:
4071
4072@table @code
4073@item -m486
4074@itemx -m386
4075Control whether or not code is optimized for a 486 instead of an
4076386. Code generated for an 486 will run on a 386 and vice versa.
4077
4078@item -mieee-fp
4079@itemx -mno-ieee-fp
4080Control whether or not the compiler uses IEEE floating point
4081comparisons. These handle correctly the case where the result of a
4082comparison is unordered.
4083
4084@item -msoft-float
4085Generate output containing library calls for floating point.
4086@strong{Warning:} the requisite libraries are not part of GNU CC.
4087Normally the facilities of the machine's usual C compiler are used, but
4088this can't be done directly in cross-compilation. You must make your
4089own arrangements to provide suitable library functions for
4090cross-compilation.
4091
4092On machines where a function returns floating point results in the 80387
4093register stack, some floating point opcodes may be emitted even if
4094@samp{-msoft-float} is used.
4095
4096@item -mno-fp-ret-in-387
4097Do not use the FPU registers for return values of functions.
4098
4099The usual calling convention has functions return values of types
4100@code{float} and @code{double} in an FPU register, even if there
4101is no FPU. The idea is that the operating system should emulate
4102an FPU.
4103
4104The option @samp{-mno-fp-ret-in-387} causes such values to be returned
4105in ordinary CPU registers instead.
4106
4107@item -mno-fancy-math-387
4108Some 387 emulators do not support the @code{sin}, @code{cos} and
4109@code{sqrt} instructions for the 387. Specify this option to avoid
4110generating those instructions. This option is the default on FreeBSD.
4111As of revision 2.6.1, these instructions are not generated unless you
4112also use the @samp{-ffast-math} switch.
4113
4114@item -malign-double
4115@itemx -mno-align-double
4116Control whether GNU CC aligns @code{double}, @code{long double}, and
4117@code{long long} variables on a two word boundary or a one word
4118boundary. Aligning @code{double} variables on a two word boundary will
4119produce code that runs somewhat faster on a @samp{Pentium} at the
4120expense of more memory.
4121
4122@strong{Warning:} if you use the @samp{-malign-double} switch,
4123structures containing the above types will be aligned differently than
4124the published application binary interface specifications for the 386.
4125
4126@item -msvr3-shlib
4127@itemx -mno-svr3-shlib
4128Control whether GNU CC places uninitialized locals into @code{bss} or
4129@code{data}. @samp{-msvr3-shlib} places these locals into @code{bss}.
4130These options are meaningful only on System V Release 3.
4131
4132@item -mno-wide-multiply
4133@itemx -mwide-multiply
4134Control whether GNU CC uses the @code{mul} and @code{imul} that produce
413564 bit results in @code{eax:edx} from 32 bit operands to do @code{long
4136long} multiplies and 32-bit division by constants.
4137
4138@item -mrtd
4139Use a different function-calling convention, in which functions that
4140take a fixed number of arguments return with the @code{ret} @var{num}
4141instruction, which pops their arguments while returning. This saves one
4142instruction in the caller since there is no need to pop the arguments
4143there.
4144
4145You can specify that an individual function is called with this calling
4146sequence with the function attribute @samp{stdcall}. You can also
4147override the @samp{-mrtd} option by using the function attribute
4148@samp{cdecl}. @xref{Function Attributes}
4149
4150@strong{Warning:} this calling convention is incompatible with the one
4151normally used on Unix, so you cannot use it if you need to call
4152libraries compiled with the Unix compiler.
4153
4154Also, you must provide function prototypes for all functions that
4155take variable numbers of arguments (including @code{printf});
4156otherwise incorrect code will be generated for calls to those
4157functions.
4158
4159In addition, seriously incorrect code will result if you call a
4160function with too many arguments. (Normally, extra arguments are
4161harmlessly ignored.)
4162
4163@item -mreg-alloc=@var{regs}
4164Control the default allocation order of integer registers. The
4165string @var{regs} is a series of letters specifying a register. The
4166supported letters are: @code{a} allocate EAX; @code{b} allocate EBX;
4167@code{c} allocate ECX; @code{d} allocate EDX; @code{S} allocate ESI;
4168@code{D} allocate EDI; @code{B} allocate EBP.
4169
4170@item -mregparm=@var{num}
4171Control how many registers are used to pass integer arguments. By
4172default, no registers are used to pass arguments, and at most 3
4173registers can be used. You can control this behavior for a specific
4174function by using the function attribute @samp{regparm}. @xref{Function Attributes}
4175
4176@strong{Warning:} if you use this switch, and
4177@var{num} is nonzero, then you must build all modules with the same
4178value, including any libraries. This includes the system libraries and
4179startup modules.
4180
4181@item -malign-loops=@var{num}
4182Align loops to a 2 raised to a @var{num} byte boundary. If
4183@samp{-malign-loops} is not specified, the default is 2.
4184
4185@item -malign-jumps=@var{num}
4186Align instructions that are only jumped to to a 2 raised to a @var{num}
4187byte boundary. If @samp{-malign-jumps} is not specified, the default is
41882 if optimizing for a 386, and 4 if optimizing for a 486.
4189
4190@item -malign-functions=@var{num}
4191Align the start of functions to a 2 raised to @var{num} byte boundary.
4192If @samp{-malign-jumps} is not specified, the default is 2 if optimizing
4193for a 386, and 4 if optimizing for a 486.
4194@end table
4195
4196@node HPPA Options
4197@subsection HPPA Options
4198@cindex HPPA Options
4199
4200These @samp{-m} options are defined for the HPPA family of computers:
4201
4202@table @code
4203@item -mpa-risc-1-0
4204Generate code for a PA 1.0 processor.
4205
4206@item -mpa-risc-1-1
4207Generate code for a PA 1.1 processor.
4208
4209@item -mjump-in-delay
4210Fill delay slots of function calls with unconditional jump instructions
4211by modifying the return pointer for the function call to be the target
4212of the conditional jump.
4213
4214@item -mdisable-fpregs
4215Prevent floating point registers from being used in any manner. This is
4216necessary for compiling kernels which perform lazy context switching of
4217floating point registers. If you use this option and attempt to perform
4218floating point operations, the compiler will abort.
4219
4220@item -mdisable-indexing
4221Prevent the compiler from using indexing address modes. This avoids some
4222rather obscure problems when compiling MIG generated code under MACH.
4223
4224@item -mno-space-regs
4225Generate code that assumes the target has no space registers. This allows
4226GCC to generate faster indirect calls and use unscaled index address modes.
4227
4228Such code is suitable for level 0 PA systems and kernels.
4229
4230@item -mfast-indirect-calls
4231Generate code that assumes calls never cross space boundaries. This
4232allows GCC to emit code which performs faster indirect calls.
4233
4234This option will not work in the presense of shared libraries or nested
4235functions.
4236
4237@item -mspace
4238Optimize for space rather than execution time. Currently this only
4239enables out of line function prologues and epilogues. This option is
4240incompatable with PIC code generation and profiling.
4241
4242@item -mlong-load-store
4243Generate 3-instruction load and store sequences as sometimes required by
4244the HP-UX 10 linker. This is equivalent to the @samp{+k} option to
4245the HP compilers.
4246
4247@item -mportable-runtime
4248Use the portable calling conventions proposed by HP for ELF systems.
4249
4250@item -mgas
4251Enable the use of assembler directives only GAS understands.
4252
4253@item -mschedule=@var{cpu type}
4254Schedule code according to the constraints for the machine type
4255@var{cpu type}. The choices for @var{cpu type} are @samp{700} for
42567@var{n}0 machines, @samp{7100} for 7@var{n}5 machines, and @samp{7100}
4257for 7@var{n}2 machines. @samp{7100} is the default for @var{cpu type}.
4258
4259Note the @samp{7100LC} scheduling information is incomplete and using
4260@samp{7100LC} often leads to bad schedules. For now it's probably best
4261to use @samp{7100} instead of @samp{7100LC} for the 7@var{n}2 machines.
4262
4263@item -mlinker-opt
4264Enable the optimization pass in the HPUX linker. Note this makes symbolic
4265debugging impossible. It also triggers a bug in the HPUX 8 and HPUX 9 linkers
4266in which they give bogus error messages when linking some programs.
4267
4268@item -msoft-float
4269Generate output containing library calls for floating point.
4270@strong{Warning:} the requisite libraries are not available for all HPPA
4271targets. Normally the facilities of the machine's usual C compiler are
4272used, but this cannot be done directly in cross-compilation. You must make
4273your own arrangements to provide suitable library functions for
4274cross-compilation. The embedded target @samp{hppa1.1-*-pro}
4275does provide software floating point support.
4276
4277@samp{-msoft-float} changes the calling convention in the output file;
4278therefore, it is only useful if you compile @emph{all} of a program with
4279this option. In particular, you need to compile @file{libgcc.a}, the
4280library that comes with GNU CC, with @samp{-msoft-float} in order for
4281this to work.
4282@end table
4283
4284@node Intel 960 Options
4285@subsection Intel 960 Options
4286
4287These @samp{-m} options are defined for the Intel 960 implementations:
4288
4289@table @code
4290@item -m@var{cpu type}
4291Assume the defaults for the machine type @var{cpu type} for some of
4292the other options, including instruction scheduling, floating point
4293support, and addressing modes. The choices for @var{cpu type} are
4294@samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
4295@samp{sa}, and @samp{sb}.
4296The default is
4297@samp{kb}.
4298
4299@item -mnumerics
4300@itemx -msoft-float
4301The @samp{-mnumerics} option indicates that the processor does support
4302floating-point instructions. The @samp{-msoft-float} option indicates
4303that floating-point support should not be assumed.
4304
4305@item -mleaf-procedures
4306@itemx -mno-leaf-procedures
4307Do (or do not) attempt to alter leaf procedures to be callable with the
4308@code{bal} instruction as well as @code{call}. This will result in more
4309efficient code for explicit calls when the @code{bal} instruction can be
4310substituted by the assembler or linker, but less efficient code in other
4311cases, such as calls via function pointers, or using a linker that doesn't
4312support this optimization.
4313
4314@item -mtail-call
4315@itemx -mno-tail-call
4316Do (or do not) make additional attempts (beyond those of the
4317machine-independent portions of the compiler) to optimize tail-recursive
4318calls into branches. You may not want to do this because the detection of
4319cases where this is not valid is not totally complete. The default is
4320@samp{-mno-tail-call}.
4321
4322@item -mcomplex-addr
4323@itemx -mno-complex-addr
4324Assume (or do not assume) that the use of a complex addressing mode is a
4325win on this implementation of the i960. Complex addressing modes may not
4326be worthwhile on the K-series, but they definitely are on the C-series.
4327The default is currently @samp{-mcomplex-addr} for all processors except
4328the CB and CC.
4329
4330@item -mcode-align
4331@itemx -mno-code-align
4332Align code to 8-byte boundaries for faster fetching (or don't bother).
4333Currently turned on by default for C-series implementations only.
4334
4335@ignore
4336@item -mclean-linkage
4337@itemx -mno-clean-linkage
4338These options are not fully implemented.
4339@end ignore
4340
4341@item -mic-compat
4342@itemx -mic2.0-compat
4343@itemx -mic3.0-compat
4344Enable compatibility with iC960 v2.0 or v3.0.
4345
4346@item -masm-compat
4347@itemx -mintel-asm
4348Enable compatibility with the iC960 assembler.
4349
4350@item -mstrict-align
4351@itemx -mno-strict-align
4352Do not permit (do permit) unaligned accesses.
4353
4354@item -mold-align
4355Enable structure-alignment compatibility with Intel's gcc release version
43561.3 (based on gcc 1.37). Currently this is buggy in that @samp{#pragma
4357align 1} is always assumed as well, and cannot be turned off.
4358@end table
4359
4360@node DEC Alpha Options
4361@subsection DEC Alpha Options
4362
4363These @samp{-m} options are defined for the DEC Alpha implementations:
4364
4365@table @code
4366@item -mno-soft-float
4367@itemx -msoft-float
4368Use (do not use) the hardware floating-point instructions for
4369floating-point operations. When @code{-msoft-float} is specified,
4370functions in @file{libgcc1.c} will be used to perform floating-point
4371operations. Unless they are replaced by routines that emulate the
4372floating-point operations, or compiled in such a way as to call such
4373emulations routines, these routines will issue floating-point
4374operations. If you are compiling for an Alpha without floating-point
4375operations, you must ensure that the library is built so as not to call
4376them.
4377
4378Note that Alpha implementations without floating-point operations are
4379required to have floating-point registers.
4380
4381@item -mfp-reg
4382@itemx -mno-fp-regs
4383Generate code that uses (does not use) the floating-point register set.
4384@code{-mno-fp-regs} implies @code{-msoft-float}. If the floating-point
4385register set is not used, floating point operands are passed in integer
4386registers as if they were integers and floating-point results are passed
4387in $0 instead of $f0. This is a non-standard calling sequence, so any
4388function with a floating-point argument or return value called by code
4389compiled with @code{-mno-fp-regs} must also be compiled with that
4390option.
4391
4392A typical use of this option is building a kernel that does not use,
4393and hence need not save and restore, any floating-point registers.
4394
4395@item -mieee
4396The Alpha architecture implements floating-point hardware optimized for
4397maximum performance. It is mostly compliant with the IEEE floating
4398point standard. However, for full compliance, software assistance is
4399required. This option generates code fully IEEE compliant code
4400@emph{except} that the @var{inexact flag} is not maintained (see below).
4401If this option is turned on, the CPP macro @code{_IEEE_FP} is defined
4402during compilation. The option is a shorthand for: @samp{-D_IEEE_FP
4403-mfp-trap-mode=su -mtrap-precision=i -mieee-conformant}. The resulting
4404code is less efficient but is able to correctly support denormalized
4405numbers and exceptional IEEE values such as not-a-number and plus/minus
4406infinity. Other Alpha compilers call this option
4407@code{-ieee_with_no_inexact}.
4408
4409@item -mieee-with-inexact
4410@c overfull hbox here --bob 22 jul96
4411@c original text between ignore ... end ignore
4412@ignore
4413This is like @samp{-mieee} except the generated code also maintains the
4414IEEE @var{inexact flag}. Turning on this option causes the generated
4415code to implement fully-compliant IEEE math. The option is a shorthand
4416for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus @samp{-mieee-conformant},
4417@samp{-mfp-trap-mode=sui}, and @samp{-mtrap-precision=i}. On some Alpha
4418implementations the resulting code may execute significantly slower than
4419the code generated by default. Since there is very little code that
4420depends on the @var{inexact flag}, you should normally not specify this
4421option. Other Alpha compilers call this option
4422@samp{-ieee_with_inexact}.
4423@end ignore
4424@c changed paragraph
4425This is like @samp{-mieee} except the generated code also maintains the
4426IEEE @var{inexact flag}. Turning on this option causes the generated
4427code to implement fully-compliant IEEE math. The option is a shorthand
4428for @samp{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus the three following:
4429@samp{-mieee-conformant},
4430@samp{-mfp-trap-mode=sui},
4431and @samp{-mtrap-precision=i}.
4432On some Alpha implementations the resulting code may execute
4433significantly slower than the code generated by default. Since there
4434is very little code that depends on the @var{inexact flag}, you should
4435normally not specify this option. Other Alpha compilers call this
4436option @samp{-ieee_with_inexact}.
4437@c end changes to prevent overfull hboxes
4438
4439@item -mfp-trap-mode=@var{trap mode}
4440This option controls what floating-point related traps are enabled.
4441Other Alpha compilers call this option @samp{-fptm }@var{trap mode}.
4442The trap mode can be set to one of four values:
4443
4444@table @samp
4445@item n
4446This is the default (normal) setting. The only traps that are enabled
4447are the ones that cannot be disabled in software (e.g., division by zero
4448trap).
4449
4450@item u
4451In addition to the traps enabled by @samp{n}, underflow traps are enabled
4452as well.
4453
4454@item su
4455Like @samp{su}, but the instructions are marked to be safe for software
4456completion (see Alpha architecture manual for details).
4457
4458@item sui
4459Like @samp{su}, but inexact traps are enabled as well.
4460@end table
4461
4462@item -mfp-rounding-mode=@var{rounding mode}
4463Selects the IEEE rounding mode. Other Alpha compilers call this option
4464@samp{-fprm }@var{rounding mode}. The @var{rounding mode} can be one
4465of:
4466
4467@table @samp
4468@item n
4469Normal IEEE rounding mode. Floating point numbers are rounded towards
4470the nearest machine number or towards the even machine number in case
4471of a tie.
4472
4473@item m
4474Round towards minus infinity.
4475
4476@item c
4477Chopped rounding mode. Floating point numbers are rounded towards zero.
4478
4479@item d
4480Dynamic rounding mode. A field in the floating point control register
4481(@var{fpcr}, see Alpha architecture reference manual) controls the
4482rounding mode in effect. The C library initializes this register for
4483rounding towards plus infinity. Thus, unless your program modifies the
4484@var{fpcr}, @samp{d} corresponds to round towards plus infinity.@end table
4485
4486@item -mtrap-precision=@var{trap precision}
4487In the Alpha architecture, floating point traps are imprecise. This
4488means without software assistance it is impossible to recover from a
4489floating trap and program execution normally needs to be terminated.
4490GNU CC can generate code that can assist operating system trap handlers
4491in determining the exact location that caused a floating point trap.
4492Depending on the requirements of an application, different levels of
4493precisions can be selected:
4494
4495@table @samp
4496@item p
4497Program precision. This option is the default and means a trap handler
4498can only identify which program caused a floating point exception.
4499
4500@item f
4501Function precision. The trap handler can determine the function that
4502caused a floating point exception.
4503
4504@item i
4505Instruction precision. The trap handler can determine the exact
4506instruction that caused a floating point exception.
4507@end table
4508
4509Other Alpha compilers provide the equivalent options called
4510@samp{-scope_safe} and @samp{-resumption_safe}.
4511
4512@item -mieee-conformant
4513This option marks the generated code as IEEE conformant. You must not
4514use this option unless you also specify @samp{-mtrap-precision=i} and either
4515@samp{-mfp-trap-mode=su} or @samp{-mfp-trap-mode=sui}. Its only effect
4516is to emit the line @samp{.eflag 48} in the function prologue of the
4517generated assembly file. Under DEC Unix, this has the effect that
4518IEEE-conformant math library routines will be linked in.
4519
4520@item -mbuild-constants
4521Normally GNU CC examines a 32- or 64-bit integer constant to
4522see if it can construct it from smaller constants in two or three
4523instructions. If it cannot, it will output the constant as a literal and
4524generate code to load it from the data segement at runtime.
4525
4526Use this option to require GNU CC to construct @emph{all} integer constants
4527using code, even if it takes more instructions (the maximum is six).
4528
4529You would typically use this option to build a shared library dynamic
4530loader. Itself a shared library, it must relocate itself in memory
4531before it can find the variables and constants in its own data segment.
4532@end table
4533
4534@node Clipper Options
4535@subsection Clipper Options
4536
4537These @samp{-m} options are defined for the Clipper implementations:
4538
4539@table @code
4540@item -mc300
4541Produce code for a C300 Clipper processor. This is the default.
4542
4543@itemx -mc400
4544Produce code for a C400 Clipper processor i.e. use floating point
4545registers f8..f15.
4546@end table
4547
4548@node H8/300 Options
4549@subsection H8/300 Options
4550
4551These @samp{-m} options are defined for the H8/300 implementations:
4552
4553@table @code
4554@item -mrelax
4555Shorten some address references at link time, when possible; uses the
4556linker option @samp{-relax}. @xref{H8/300,, @code{ld} and the H8/300,
4557ld.info, Using ld}, for a fuller description.
4558
4559@item -mh
4560Generate code for the H8/300H.
4561
4562@item -mint32
4563Make @code{int} data 32 bits by default.
4564
4565@item -malign-300
4566On the h8/300h, use the same alignment rules as for the h8/300.
4567The default for the h8/300h is to align longs and floats on 4 byte boundaries.
4568@samp{-malign-300} causes them to be aligned on 2 byte boundaries.
4569This option has no effect on the h8/300.
4570@end table
4571
4572@node SH Options
4573@subsection SH Options
4574
4575These @samp{-m} options are defined for the SH implementations:
4576
4577@table @code
4578@item -m1
4579Generate code for the SH1.
4580
4581@item -m2
4582Generate code for the SH2.
4583
4584@item -m3
4585Generate code for the SH3.
4586
4587@item -m3e
4588Generate code for the SH3e.
4589
4590@item -mb
4591Compile code for the processor in big endian mode.
4592
4593@item -ml
4594Compile code for the processor in little endian mode.
4595
4596@item -mrelax
4597Shorten some address references at link time, when possible; uses the
4598linker option @samp{-relax}.
4599@end table
4600
4601@node System V Options
4602@subsection Options for System V
4603
4604These additional options are available on System V Release 4 for
4605compatibility with other compilers on those systems:
4606
4607@table @code
4608@item -G
4609Create a shared object.
4610It is recommended that @samp{-symbolic} or @samp{-shared} be used instead.
4611
4612@item -Qy
4613Identify the versions of each tool used by the compiler, in a
4614@code{.ident} assembler directive in the output.
4615
4616@item -Qn
4617Refrain from adding @code{.ident} directives to the output file (this is
4618the default).
4619
4620@item -YP,@var{dirs}
4621Search the directories @var{dirs}, and no others, for libraries
4622specified with @samp{-l}.
4623
4624@item -Ym,@var{dir}
4625Look in the directory @var{dir} to find the M4 preprocessor.
4626The assembler uses this option.
4627@c This is supposed to go with a -Yd for predefined M4 macro files, but
4628@c the generic assembler that comes with Solaris takes just -Ym.
4629@end table
4630
4631@node Code Gen Options
4632@section Options for Code Generation Conventions
4633@cindex code generation conventions
4634@cindex options, code generation
4635@cindex run-time options
4636
4637These machine-independent options control the interface conventions
4638used in code generation.
4639
4640Most of them have both positive and negative forms; the negative form
4641of @samp{-ffoo} would be @samp{-fno-foo}. In the table below, only
4642one of the forms is listed---the one which is not the default. You
4643can figure out the other form by either removing @samp{no-} or adding
4644it.
4645
4646@table @code
4647@item -fpcc-struct-return
4648Return ``short'' @code{struct} and @code{union} values in memory like
4649longer ones, rather than in registers. This convention is less
4650efficient, but it has the advantage of allowing intercallability between
4651GNU CC-compiled files and files compiled with other compilers.
4652
4653The precise convention for returning structures in memory depends
4654on the target configuration macros.
4655
4656Short structures and unions are those whose size and alignment match
4657that of some integer type.
4658
4659@item -freg-struct-return
4660Use the convention that @code{struct} and @code{union} values are
4661returned in registers when possible. This is more efficient for small
4662structures than @samp{-fpcc-struct-return}.
4663
4664If you specify neither @samp{-fpcc-struct-return} nor its contrary
4665@samp{-freg-struct-return}, GNU CC defaults to whichever convention is
4666standard for the target. If there is no standard convention, GNU CC
4667defaults to @samp{-fpcc-struct-return}, except on targets where GNU CC
4668is the principal compiler. In those cases, we can choose the standard,
4669and we chose the more efficient register return alternative.
4670
4671@item -fshort-enums
4672Allocate to an @code{enum} type only as many bytes as it needs for the
4673declared range of possible values. Specifically, the @code{enum} type
4674will be equivalent to the smallest integer type which has enough room.
4675
4676@item -fshort-double
4677Use the same size for @code{double} as for @code{float}.
4678
4679@item -fshared-data
4680Requests that the data and non-@code{const} variables of this
4681compilation be shared data rather than private data. The distinction
4682makes sense only on certain operating systems, where shared data is
4683shared between processes running the same program, while private data
4684exists in one copy per process.
4685
4686@item -fno-common
4687Allocate even uninitialized global variables in the bss section of the
4688object file, rather than generating them as common blocks. This has the
4689effect that if the same variable is declared (without @code{extern}) in
4690two different compilations, you will get an error when you link them.
4691The only reason this might be useful is if you wish to verify that the
4692program will work on other systems which always work this way.
4693
4694@item -fno-ident
4695Ignore the @samp{#ident} directive.
4696
4697@item -fno-gnu-linker
4698Do not output global initializations (such as C++ constructors and
4699destructors) in the form used by the GNU linker (on systems where the GNU
4700linker is the standard method of handling them). Use this option when
4701you want to use a non-GNU linker, which also requires using the
4702@code{collect2} program to make sure the system linker includes
4703constructors and destructors. (@code{collect2} is included in the GNU CC
4704distribution.) For systems which @emph{must} use @code{collect2}, the
4705compiler driver @code{gcc} is configured to do this automatically.
4706
4707@item -finhibit-size-directive
4708Don't output a @code{.size} assembler directive, or anything else that
4709would cause trouble if the function is split in the middle, and the
4710two halves are placed at locations far apart in memory. This option is
4711used when compiling @file{crtstuff.c}; you should not need to use it
4712for anything else.
4713
4714@item -fverbose-asm
4715Put extra commentary information in the generated assembly code to
4716make it more readable. This option is generally only of use to those
4717who actually need to read the generated assembly code (perhaps while
4718debugging the compiler itself).
4719
4720@samp{-fverbose-asm} is the default. @samp{-fno-verbose-asm} causes the
4721extra information to be omitted and is useful when comparing two assembler
4722files.
4723
4724@item -fvolatile
4725Consider all memory references through pointers to be volatile.
4726
4727@item -fvolatile-global
4728Consider all memory references to extern and global data items to
4729be volatile.
4730
4731@item -fpic
4732@cindex global offset table
4733@cindex PIC
4734Generate position-independent code (PIC) suitable for use in a shared
4735library, if supported for the target machine. Such code accesses all
4736constant addresses through a global offset table (GOT). If the GOT size
4737for the linked executable exceeds a machine-specific maximum size, you
4738get an error message from the linker indicating that @samp{-fpic} does
4739not work; in that case, recompile with @samp{-fPIC} instead. (These
4740maximums are 16k on the m88k, 8k on the Sparc, and 32k on the m68k and
4741RS/6000. The 386 has no such limit.)
4742
4743Position-independent code requires special support, and therefore works
4744only on certain machines. For the 386, GNU CC supports PIC for System V
4745but not for the Sun 386i. Code generated for the IBM RS/6000 is always
4746position-independent.
4747
4748The GNU assembler does not fully support PIC. Currently, you must use
4749some other assembler in order for PIC to work. We would welcome
4750volunteers to upgrade GAS to handle this; the first part of the job is
4751to figure out what the assembler must do differently.
4752
4753@item -fPIC
4754If supported for the target machine, emit position-independent code,
4755suitable for dynamic linking and avoiding any limit on the size of the
4756global offset table. This option makes a difference on the m68k, m88k,
4757and the Sparc.
4758
4759Position-independent code requires special support, and therefore works
4760only on certain machines.
4761
4762@item -ffixed-@var{reg}
4763Treat the register named @var{reg} as a fixed register; generated code
4764should never refer to it (except perhaps as a stack pointer, frame
4765pointer or in some other fixed role).
4766
4767@var{reg} must be the name of a register. The register names accepted
4768are machine-specific and are defined in the @code{REGISTER_NAMES}
4769macro in the machine description macro file.
4770
4771This flag does not have a negative form, because it specifies a
4772three-way choice.
4773
4774@item -fcall-used-@var{reg}
4775Treat the register named @var{reg} as an allocatable register that is
4776clobbered by function calls. It may be allocated for temporaries or
4777variables that do not live across a call. Functions compiled this way
4778will not save and restore the register @var{reg}.
4779
4780Use of this flag for a register that has a fixed pervasive role in the
4781machine's execution model, such as the stack pointer or frame pointer,
4782will produce disastrous results.
4783
4784This flag does not have a negative form, because it specifies a
4785three-way choice.
4786
4787@item -fcall-saved-@var{reg}
4788Treat the register named @var{reg} as an allocatable register saved by
4789functions. It may be allocated even for temporaries or variables that
4790live across a call. Functions compiled this way will save and restore
4791the register @var{reg} if they use it.
4792
4793Use of this flag for a register that has a fixed pervasive role in the
4794machine's execution model, such as the stack pointer or frame pointer,
4795will produce disastrous results.
4796
4797A different sort of disaster will result from the use of this flag for
4798a register in which function values may be returned.
4799
4800This flag does not have a negative form, because it specifies a
4801three-way choice.
4802
4803@item -fpack-struct
4804Pack all structure members together without holes. Usually you would
4805not want to use this option, since it makes the code suboptimal, and
4806the offsets of structure members won't agree with system libraries.
4807
4808@item +e0
4809@itemx +e1
4810Control whether virtual function definitions in classes are used to
4811generate code, or only to define interfaces for their callers. (C++
4812only).
4813
4814These options are provided for compatibility with @code{cfront} 1.x
4815usage; the recommended alternative GNU C++ usage is in flux. @xref{C++
4816Interface,,Declarations and Definitions in One Header}.
4817
4818With @samp{+e0}, virtual function definitions in classes are declared
4819@code{extern}; the declaration is used only as an interface
4820specification, not to generate code for the virtual functions (in this
4821compilation).
4822
4823With @samp{+e1}, G++ actually generates the code implementing virtual
4824functions defined in the code, and makes them publicly visible.
4825@end table
4826
4827@node Environment Variables
4828@section Environment Variables Affecting GNU CC
4829@cindex environment variables
4830
4831This section describes several environment variables that affect how GNU
4832CC operates. They work by specifying directories or prefixes to use
4833when searching for various kinds of files.
4834
4835@ifclear INTERNALS
4836Note that you can also specify places to search using options such as
4837@samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These
4838take precedence over places specified using environment variables, which
4839in turn take precedence over those specified by the configuration of GNU
4840CC.
4841@end ifclear
4842@ifset INTERNALS
4843Note that you can also specify places to search using options such as
4844@samp{-B}, @samp{-I} and @samp{-L} (@pxref{Directory Options}). These
4845take precedence over places specified using environment variables, which
4846in turn take precedence over those specified by the configuration of GNU
4847CC. @xref{Driver}.
4848@end ifset
4849
4850@table @code
4851@item TMPDIR
4852@findex TMPDIR
4853If @code{TMPDIR} is set, it specifies the directory to use for temporary
4854files. GNU CC uses temporary files to hold the output of one stage of
4855compilation which is to be used as input to the next stage: for example,
4856the output of the preprocessor, which is the input to the compiler
4857proper.
4858
4859@item GCC_EXEC_PREFIX
4860@findex GCC_EXEC_PREFIX
4861If @code{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
4862names of the subprograms executed by the compiler. No slash is added
4863when this prefix is combined with the name of a subprogram, but you can
4864specify a prefix that ends with a slash if you wish.
4865
4866If GNU CC cannot find the subprogram using the specified prefix, it
4867tries looking in the usual places for the subprogram.
4868
4869The default value of @code{GCC_EXEC_PREFIX} is
4870@file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
4871of @code{prefix} when you ran the @file{configure} script.
4872
4873Other prefixes specified with @samp{-B} take precedence over this prefix.
4874
4875This prefix is also used for finding files such as @file{crt0.o} that are
4876used for linking.
4877
4878In addition, the prefix is used in an unusual way in finding the
4879directories to search for header files. For each of the standard
4880directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
4881(more precisely, with the value of @code{GCC_INCLUDE_DIR}), GNU CC tries
4882replacing that beginning with the specified prefix to produce an
4883alternate directory name. Thus, with @samp{-Bfoo/}, GNU CC will search
4884@file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
4885These alternate directories are searched first; the standard directories
4886come next.
4887
4888@item COMPILER_PATH
4889@findex COMPILER_PATH
4890The value of @code{COMPILER_PATH} is a colon-separated list of
4891directories, much like @code{PATH}. GNU CC tries the directories thus
4892specified when searching for subprograms, if it can't find the
4893subprograms using @code{GCC_EXEC_PREFIX}.
4894
4895@item LIBRARY_PATH
4896@findex LIBRARY_PATH
4897The value of @code{LIBRARY_PATH} is a colon-separated list of
4898directories, much like @code{PATH}. When configured as a native compiler,
4899GNU CC tries the directories thus specified when searching for special
4900linker files, if it can't find them using @code{GCC_EXEC_PREFIX}. Linking
4901using GNU CC also uses these directories when searching for ordinary
4902libraries for the @samp{-l} option (but directories specified with
4903@samp{-L} come first).
4904
4905@item C_INCLUDE_PATH
4906@itemx CPLUS_INCLUDE_PATH
4907@itemx OBJC_INCLUDE_PATH
4908@findex C_INCLUDE_PATH
4909@findex CPLUS_INCLUDE_PATH
4910@findex OBJC_INCLUDE_PATH
4911@c @itemx OBJCPLUS_INCLUDE_PATH
4912These environment variables pertain to particular languages. Each
4913variable's value is a colon-separated list of directories, much like
4914@code{PATH}. When GNU CC searches for header files, it tries the
4915directories listed in the variable for the language you are using, after
4916the directories specified with @samp{-I} but before the standard header
4917file directories.
4918
4919@item DEPENDENCIES_OUTPUT
4920@findex DEPENDENCIES_OUTPUT
4921@cindex dependencies for make as output
4922If this variable is set, its value specifies how to output dependencies
4923for Make based on the header files processed by the compiler. This
4924output looks much like the output from the @samp{-M} option
4925(@pxref{Preprocessor Options}), but it goes to a separate file, and is
4926in addition to the usual results of compilation.
4927
4928The value of @code{DEPENDENCIES_OUTPUT} can be just a file name, in
4929which case the Make rules are written to that file, guessing the target
4930name from the source file name. Or the value can have the form
4931@samp{@var{file} @var{target}}, in which case the rules are written to
4932file @var{file} using @var{target} as the target name.
4933@end table
4934
4935@node Running Protoize
4936@section Running Protoize
4937
4938The program @code{protoize} is an optional part of GNU C. You can use
4939it to add prototypes to a program, thus converting the program to ANSI
4940C in one respect. The companion program @code{unprotoize} does the
4941reverse: it removes argument types from any prototypes that are found.
4942
4943When you run these programs, you must specify a set of source files as
4944command line arguments. The conversion programs start out by compiling
4945these files to see what functions they define. The information gathered
4946about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
4947
4948After scanning comes actual conversion. The specified files are all
4949eligible to be converted; any files they include (whether sources or
4950just headers) are eligible as well.
4951
4952But not all the eligible files are converted. By default,
4953@code{protoize} and @code{unprotoize} convert only source and header
4954files in the current directory. You can specify additional directories
4955whose files should be converted with the @samp{-d @var{directory}}
4956option. You can also specify particular files to exclude with the
4957@samp{-x @var{file}} option. A file is converted if it is eligible, its
4958directory name matches one of the specified directory names, and its
4959name within the directory has not been excluded.
4960
4961Basic conversion with @code{protoize} consists of rewriting most
4962function definitions and function declarations to specify the types of
4963the arguments. The only ones not rewritten are those for varargs
4964functions.
4965
4966@code{protoize} optionally inserts prototype declarations at the
4967beginning of the source file, to make them available for any calls that
4968precede the function's definition. Or it can insert prototype
4969declarations with block scope in the blocks where undeclared functions
4970are called.
4971
4972Basic conversion with @code{unprotoize} consists of rewriting most
4973function declarations to remove any argument types, and rewriting
4974function definitions to the old-style pre-ANSI form.
4975
4976Both conversion programs print a warning for any function declaration or
4977definition that they can't convert. You can suppress these warnings
4978with @samp{-q}.
4979
4980The output from @code{protoize} or @code{unprotoize} replaces the
4981original source file. The original file is renamed to a name ending
4982with @samp{.save}. If the @samp{.save} file already exists, then
4983the source file is simply discarded.
4984
4985@code{protoize} and @code{unprotoize} both depend on GNU CC itself to
4986scan the program and collect information about the functions it uses.
4987So neither of these programs will work until GNU CC is installed.
4988
4989Here is a table of the options you can use with @code{protoize} and
4990@code{unprotoize}. Each option works with both programs unless
4991otherwise stated.
4992
4993@table @code
4994@item -B @var{directory}
4995Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
4996usual directory (normally @file{/usr/local/lib}). This file contains
4997prototype information about standard system functions. This option
4998applies only to @code{protoize}.
4999
5000@item -c @var{compilation-options}
5001Use @var{compilation-options} as the options when running @code{gcc} to
5002produce the @samp{.X} files. The special option @samp{-aux-info} is
5003always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
5004
5005Note that the compilation options must be given as a single argument to
5006@code{protoize} or @code{unprotoize}. If you want to specify several
5007@code{gcc} options, you must quote the entire set of compilation options
5008to make them a single word in the shell.
5009
5010There are certain @code{gcc} arguments that you cannot use, because they
5011would produce the wrong kind of output. These include @samp{-g},
5012@samp{-O}, @samp{-c}, @samp{-S}, and @samp{-o} If you include these in
5013the @var{compilation-options}, they are ignored.
5014
5015@item -C
5016Rename files to end in @samp{.C} instead of @samp{.c}.
5017This is convenient if you are converting a C program to C++.
5018This option applies only to @code{protoize}.
5019
5020@item -g
5021Add explicit global declarations. This means inserting explicit
5022declarations at the beginning of each source file for each function
5023that is called in the file and was not declared. These declarations
5024precede the first function definition that contains a call to an
5025undeclared function. This option applies only to @code{protoize}.
5026
5027@item -i @var{string}
5028Indent old-style parameter declarations with the string @var{string}.
5029This option applies only to @code{protoize}.
5030
5031@code{unprotoize} converts prototyped function definitions to old-style
5032function definitions, where the arguments are declared between the
5033argument list and the initial @samp{@{}. By default, @code{unprotoize}
5034uses five spaces as the indentation. If you want to indent with just
5035one space instead, use @samp{-i " "}.
5036
5037@item -k
5038Keep the @samp{.X} files. Normally, they are deleted after conversion
5039is finished.
5040
5041@item -l
5042Add explicit local declarations. @code{protoize} with @samp{-l} inserts
5043a prototype declaration for each function in each block which calls the
5044function without any declaration. This option applies only to
5045@code{protoize}.
5046
5047@item -n
5048Make no real changes. This mode just prints information about the conversions
5049that would have been done without @samp{-n}.
5050
5051@item -N
5052Make no @samp{.save} files. The original files are simply deleted.
5053Use this option with caution.
5054
5055@item -p @var{program}
5056Use the program @var{program} as the compiler. Normally, the name
5057@file{gcc} is used.
5058
5059@item -q
5060Work quietly. Most warnings are suppressed.
5061
5062@item -v
5063Print the version number, just like @samp{-v} for @code{gcc}.
5064@end table
5065
5066If you need special compiler options to compile one of your program's
5067source files, then you should generate that file's @samp{.X} file
5068specially, by running @code{gcc} on that source file with the
5069appropriate options and the option @samp{-aux-info}. Then run
5070@code{protoize} on the entire set of files. @code{protoize} will use
5071the existing @samp{.X} file because it is newer than the source file.
5072For example:
5073
5074@example
5075gcc -Dfoo=bar file1.c -aux-info
5076protoize *.c
5077@end example
5078
5079@noindent
5080You need to include the special files along with the rest in the
5081@code{protoize} command, even though their @samp{.X} files already
5082exist, because otherwise they won't get converted.
5083
5084@xref{Protoize Caveats}, for more information on how to use
5085@code{protoize} successfully.
5086
This page took 0.436218 seconds and 5 git commands to generate.