OSDN Git Service

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