OSDN Git Service

* doc/c-tree.texi, doc/contrib.texi, doc/extend.texi,
[pf3gnuchains/gcc-fork.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001 Free Software Foundation, Inc.
3 @c This is part of the GCC manual.
4 @c For copying conditions, see the file gcc.texi.
5
6 @ignore
7 @c man begin COPYRIGHT
8 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
9 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
10
11 Permission is granted to make and distribute verbatim copies of this
12 manual provided the copyright notice and this permission notice are
13 preserved on all copies.
14
15 Permission is granted to copy and distribute modified versions of this
16 manual under the conditions for verbatim copying, provided also that the
17 entire resulting derived work is distributed under the terms of a
18 permission notice identical to this one.
19
20 Permission is granted to copy and distribute translations of this manual
21 into another language, under the above conditions for modified versions,
22 except that this permission notice may be included in translations
23 approved by the Free Software Foundation instead of in the original
24 English.
25 @c man end
26 @c Set file name and title for the man page.
27 @setfilename gcc
28 @settitle GNU project C and C++ compiler
29 @c man begin SYNOPSIS
30 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
31     [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
32     [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
33     [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
34     [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
35     [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
36     [@option{-o} @var{outfile}] @var{infile}@dots{}
37
38 Only the most useful options are listed here; see below for the
39 remainder.  @samp{g++} accepts mostly the same options as @samp{gcc}.
40 @c man end
41 @c man begin SEEALSO
42 cpp(1), gcov(1), g77(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
43 and the Info entries for @file{gcc}, @file{cpp}, @file{g77}, @file{as},
44 @file{ld}, @file{binutils} and @file{gdb}.
45 @c man end
46 @c man begin BUGS
47 For instructions on reporting bugs, see
48 @w{@uref{http://gcc.gnu.org/bugs.html}}.  Use of the @command{gccbug}
49 script to report bugs is recommended.
50 @c man end
51 @c man begin AUTHOR
52 See the Info entry for @file{gcc}, or
53 @w{@uref{http://gcc.gnu.org/thanks.html}}, for contributors to GCC.
54 @c man end
55 @end ignore
56
57 @node Invoking GCC
58 @chapter GCC Command Options
59 @cindex GCC command options
60 @cindex command options
61 @cindex options, GCC command
62
63 @c man begin DESCRIPTION
64
65 When you invoke GCC, it normally does preprocessing, compilation,
66 assembly and linking.  The ``overall options'' allow you to stop this
67 process at an intermediate stage.  For example, the @option{-c} option
68 says not to run the linker.  Then the output consists of object files
69 output by the assembler.
70
71 Other options are passed on to one stage of processing.  Some options
72 control the preprocessor and others the compiler itself.  Yet other
73 options control the assembler and linker; most of these are not
74 documented here, since you rarely need to use any of them.
75
76 @cindex C compilation options
77 Most of the command line options that you can use with GCC are useful
78 for C programs; when an option is only useful with another language
79 (usually C++), the explanation says so explicitly.  If the description
80 for a particular option does not mention a source language, you can use
81 that option with all supported languages.
82
83 @cindex C++ compilation options
84 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
85 options for compiling C++ programs.
86
87 @cindex grouping options
88 @cindex options, grouping
89 The @command{gcc} program accepts options and file names as operands.  Many
90 options have multi-letter names; therefore multiple single-letter options
91 may @emph{not} be grouped: @option{-dr} is very different from @w{@samp{-d
92 -r}}.
93
94 @cindex order of options
95 @cindex options, order
96 You can mix options and other arguments.  For the most part, the order
97 you use doesn't matter.  Order does matter when you use several options
98 of the same kind; for example, if you specify @option{-L} more than once,
99 the directories are searched in the order specified.
100
101 Many options have long names starting with @samp{-f} or with
102 @samp{-W}---for example, @option{-fforce-mem},
103 @option{-fstrength-reduce}, @option{-Wformat} and so on.  Most of
104 these have both positive and negative forms; the negative form of
105 @option{-ffoo} would be @option{-fno-foo}.  This manual documents
106 only one of these two forms, whichever one is not the default.
107
108 @c man end
109
110 @xref{Option Index}, for an index to GCC's options.
111
112 @menu
113 * Option Summary::      Brief list of all options, without explanations.
114 * Overall Options::     Controlling the kind of output:
115                         an executable, object files, assembler files,
116                         or preprocessed source.
117 * Invoking G++::        Compiling C++ programs.
118 * C Dialect Options::   Controlling the variant of C language compiled.
119 * C++ Dialect Options:: Variations on C++.
120 * Objective-C Dialect Options:: Variations on Objective-C.
121 * Language Independent Options:: Controlling how diagnostics should be
122                         formatted.
123 * Warning Options::     How picky should the compiler be?
124 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
125 * Optimize Options::    How much optimization?
126 * Preprocessor Options:: Controlling header files and macro definitions.
127                          Also, getting dependency information for Make.
128 * Assembler Options::   Passing options to the assembler.
129 * Link Options::        Specifying libraries and so on.
130 * Directory Options::   Where to find header files and libraries.
131                         Where to find the compiler executable files.
132 * Spec Files::          How to pass switches to sub-processes.
133 * Target Options::      Running a cross-compiler, or an old version of GCC.
134 * Submodel Options::    Specifying minor hardware or convention variations,
135                         such as 68010 vs 68020.
136 * Code Gen Options::    Specifying conventions for function calls, data layout
137                         and register usage.
138 * Environment Variables:: Env vars that affect GCC.
139 * Running Protoize::    Automatically adding or removing function prototypes.
140 @end menu
141
142 @c man begin OPTIONS
143
144 @node Option Summary
145 @section Option Summary
146
147 Here is a summary of all the options, grouped by type.  Explanations are
148 in the following sections.
149
150 @table @emph
151 @item Overall Options
152 @xref{Overall Options,,Options Controlling the Kind of Output}.
153 @gccoptlist{
154 -c  -S  -E  -o @var{file}  -pipe  -pass-exit-codes  -x @var{language} @gol
155 -v  --target-help  --help}
156
157 @item C Language Options
158 @xref{C Dialect Options,,Options Controlling C Dialect}.
159 @gccoptlist{
160 -ansi  -std=@var{standard}  -aux-info @var{filename} @gol
161 -fno-asm  -fno-builtin @gol
162 -fhosted  -ffreestanding @gol
163 -trigraphs  -traditional  -traditional-cpp @gol
164 -fallow-single-precision  -fcond-mismatch @gol
165 -fsigned-bitfields  -fsigned-char @gol
166 -funsigned-bitfields  -funsigned-char @gol
167 -fwritable-strings  -fshort-wchar}
168
169 @item C++ Language Options
170 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
171 @gccoptlist{
172 -fno-access-control  -fcheck-new  -fconserve-space @gol
173 -fno-const-strings  -fdollars-in-identifiers @gol
174 -fno-elide-constructors @gol
175 -fno-enforce-eh-specs  -fexternal-templates @gol
176 -falt-external-templates @gol
177 -ffor-scope  -fno-for-scope  -fno-gnu-keywords  -fno-honor-std @gol
178 -fno-implicit-templates @gol
179 -fno-implicit-inline-templates @gol
180 -fno-implement-inlines  -fms-extensions @gol
181 -fno-nonansi-builtins  -fno-operator-names @gol
182 -fno-optional-diags  -fpermissive @gol
183 -frepo  -fno-rtti  -fstats  -ftemplate-depth-@var{n} @gol
184 -fuse-cxa-atexit  -fvtable-gc  -fno-weak  -nostdinc++ @gol
185 -fno-default-inline  -Wctor-dtor-privacy @gol
186 -Wnon-virtual-dtor  -Wreorder @gol
187 -Weffc++  -Wno-deprecated @gol
188 -Wno-non-template-friend  -Wold-style-cast @gol
189 -Woverloaded-virtual  -Wno-pmf-conversions @gol
190 -Wsign-promo  -Wsynth}
191
192 @item Objective-C Language Options
193 @xref{Objective-C Dialect Options,,Options Controlling Objective-C Dialect}.
194 @gccoptlist{
195 -fconstant-string-class=@var{class-name} @gol
196 -fgnu-runtime  -fnext-runtime  -gen-decls @gol
197 -Wno-protocol  -Wselector}
198
199 @item Language Independent Options
200 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
201 @gccoptlist{
202 -fmessage-length=@var{n}  @gol
203 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]}}
204
205 @item Warning Options
206 @xref{Warning Options,,Options to Request or Suppress Warnings}.
207 @gccoptlist{
208 -fsyntax-only  -pedantic  -pedantic-errors @gol
209 -w  -W  -Wall  -Waggregate-return @gol
210 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
211 -Wconversion  -Wdisabled-optimization  -Werror @gol
212 -Wfloat-equal  -Wformat  -Wformat=2 @gol
213 -Wformat-nonliteral  -Wformat-security @gol
214 -Wimplicit  -Wimplicit-int  @gol
215 -Wimplicit-function-declaration @gol
216 -Werror-implicit-function-declaration @gol
217 -Wimport  -Winline @gol
218 -Wlarger-than-@var{len}  -Wlong-long @gol
219 -Wmain  -Wmissing-braces  -Wmissing-declarations @gol
220 -Wmissing-format-attribute  -Wmissing-noreturn @gol
221 -Wmultichar  -Wno-format-extra-args  -Wno-format-y2k @gol
222 -Wno-import  -Wpacked  -Wpadded @gol
223 -Wparentheses  -Wpointer-arith  -Wredundant-decls @gol
224 -Wreturn-type  -Wsequence-point  -Wshadow @gol
225 -Wsign-compare  -Wswitch  -Wsystem-headers @gol
226 -Wtrigraphs  -Wundef  -Wuninitialized @gol
227 -Wunknown-pragmas  -Wunreachable-code @gol
228 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
229 -Wunused-value  -Wunused-variable  -Wwrite-strings}
230
231 @item C-only Warning Options
232 @gccoptlist{
233 -Wbad-function-cast  -Wmissing-prototypes  -Wnested-externs @gol
234 -Wstrict-prototypes  -Wtraditional}
235
236 @item Debugging Options
237 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
238 @gccoptlist{
239 -a  -ax  -d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
240 -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
241 -fdump-ast-original@r{[}-@var{n}@r{]} -fdump-ast-optimized@r{[}-@var{n}@r{]} @gol
242 -fmem-report  -fpretend-float @gol
243 -fprofile-arcs  -ftest-coverage  -ftime-report @gol
244 -g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2 @gol
245 -ggdb  -gstabs  -gstabs+  -gxcoff  -gxcoff+ @gol
246 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
247 -print-multi-directory  -print-multi-lib @gol
248 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
249 -save-temps  -time}
250
251 @item Optimization Options
252 @xref{Optimize Options,,Options that Control Optimization}.
253 @gccoptlist{
254 -falign-functions=@var{n}  -falign-jumps=@var{n} @gol
255 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
256 -fbranch-probabilities  -fcaller-saves @gol
257 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections  -fdce @gol
258 -fdelayed-branch  -fdelete-null-pointer-checks @gol
259 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
260 -fforce-addr  -fforce-mem  -ffunction-sections @gol
261 -fgcse  -fgcse-lm  -fgcse-sm @gol
262 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
263 -fkeep-static-consts  -fmove-all-movables @gol
264 -fno-default-inline  -fno-defer-pop @gol
265 -fno-function-cse  -fno-guess-branch-probability @gol
266 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
267 -funsafe-math-optimizations -fno-trapping-math @gol
268 -fomit-frame-pointer  -foptimize-register-move @gol
269 -foptimize-sibling-calls  -freduce-all-givs @gol
270 -fregmove  -frename-registers @gol
271 -frerun-cse-after-loop  -frerun-loop-opt @gol
272 -fschedule-insns  -fschedule-insns2 @gol
273 -fsingle-precision-constant  -fssa @gol
274 -fstrength-reduce  -fstrict-aliasing  -fthread-jumps  -ftrapv @gol
275 -funroll-all-loops  -funroll-loops  @gol
276 --param @var{name}=@var{value}
277 -O  -O0  -O1  -O2  -O3  -Os}
278
279 @item Preprocessor Options
280 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
281 @gccoptlist{
282 -$  -A@var{question}=@var{answer}  -A-@var{question}@r{[}=@var{answer}@r{]} @gol
283 -C  -dD  -dI  -dM  -dN @gol
284 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
285 -idirafter @var{dir} @gol
286 -include @var{file}  -imacros @var{file} @gol
287 -iprefix @var{file}  -iwithprefix @var{dir} @gol
288 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
289 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  -P  -remap @gol
290 -trigraphs  -undef  -U@var{macro}  -Wp\,@var{option}}
291
292 @item Assembler Option
293 @xref{Assembler Options,,Passing Options to the Assembler}.
294 @gccoptlist{
295 -Wa\,@var{option}}
296
297 @item Linker Options
298 @xref{Link Options,,Options for Linking}.
299 @gccoptlist{
300 @var{object-file-name}  -l@var{library} @gol
301 -nostartfiles  -nodefaultlibs  -nostdlib @gol
302 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
303 -Wl\,@var{option}  -Xlinker @var{option} @gol
304 -u @var{symbol}}
305
306 @item Directory Options
307 @xref{Directory Options,,Options for Directory Search}.
308 @gccoptlist{
309 -B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}}
310
311 @item Target Options
312 @c I wrote this xref this way to avoid overfull hbox. -- rms
313 @xref{Target Options}.
314 @gccoptlist{
315 -b @var{machine}  -V @var{version}}
316
317 @item Machine Dependent Options
318 @xref{Submodel Options,,Hardware Models and Configurations}.
319 @emph{M680x0 Options}
320 @gccoptlist{
321 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
322 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
323 -mfpa  -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
324 -malign-int  -mstrict-align}
325
326 @emph{M68hc1x Options}
327 @gccoptlist{
328 -m6811  -m6812  -m68hc11  -m68hc12 @gol
329 -mauto-incdec  -mshort  -msoft-reg-count=@var{count}}
330
331 @emph{VAX Options}
332 @gccoptlist{
333 -mg  -mgnu  -munix}
334
335 @emph{SPARC Options}
336 @gccoptlist{
337 -mcpu=@var{cpu-type} @gol
338 -mtune=@var{cpu-type} @gol
339 -mcmodel=@var{code-model} @gol
340 -m32  -m64 @gol
341 -mapp-regs  -mbroken-saverestore  -mcypress @gol
342 -mepilogue  -mfaster-structs  -mflat @gol
343 -mfpu  -mhard-float  -mhard-quad-float @gol
344 -mimpure-text  -mlive-g0  -mno-app-regs @gol
345 -mno-epilogue  -mno-faster-structs  -mno-flat  -mno-fpu @gol
346 -mno-impure-text  -mno-stack-bias  -mno-unaligned-doubles @gol
347 -msoft-float  -msoft-quad-float  -msparclite  -mstack-bias @gol
348 -msupersparc  -munaligned-doubles  -mv8}
349
350 @emph{Convex Options}
351 @gccoptlist{
352 -mc1  -mc2  -mc32  -mc34  -mc38 @gol
353 -margcount  -mnoargcount @gol
354 -mlong32  -mlong64 @gol
355 -mvolatile-cache  -mvolatile-nocache}
356
357 @emph{AMD29K Options}
358 @gccoptlist{
359 -m29000  -m29050  -mbw  -mnbw  -mdw  -mndw @gol
360 -mlarge  -mnormal  -msmall @gol
361 -mkernel-registers  -mno-reuse-arg-regs @gol
362 -mno-stack-check  -mno-storem-bug @gol
363 -mreuse-arg-regs  -msoft-float  -mstack-check @gol
364 -mstorem-bug  -muser-registers}
365
366 @emph{ARM Options}
367 @gccoptlist{
368 -mapcs-frame  -mno-apcs-frame @gol
369 -mapcs-26  -mapcs-32 @gol
370 -mapcs-stack-check  -mno-apcs-stack-check @gol
371 -mapcs-float  -mno-apcs-float @gol
372 -mapcs-reentrant  -mno-apcs-reentrant @gol
373 -msched-prolog  -mno-sched-prolog @gol
374 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
375 -malignment-traps  -mno-alignment-traps @gol
376 -msoft-float  -mhard-float  -mfpe @gol
377 -mthumb-interwork  -mno-thumb-interwork @gol
378 -mcpu=@var{name}  -march=@var{name}  -mfpe=@var{name}  @gol
379 -mstructure-size-boundary=@var{n} @gol
380 -mbsd -mxopen  -mno-symrename @gol
381 -mabort-on-noreturn @gol
382 -mlong-calls  -mno-long-calls @gol
383 -msingle-pic-base  -mno-single-pic-base @gol
384 -mpic-register=@var{reg} @gol
385 -mnop-fun-dllimport @gol
386 -mpoke-function-name @gol
387 -mthumb  -marm @gol
388 -mtpcs-frame  -mtpcs-leaf-frame @gol
389 -mcaller-super-interworking  -mcallee-super-interworking }
390
391 @emph{MN10200 Options}
392 @gccoptlist{
393 -mrelax}
394
395 @emph{MN10300 Options}
396 @gccoptlist{
397 -mmult-bug  -mno-mult-bug @gol
398 -mam33  -mno-am33 @gol
399 -mno-crt0  -mrelax}
400
401 @emph{M32R/D Options}
402 @gccoptlist{
403 -mcode-model=@var{model-type}  -msdata=@var{sdata-type} @gol
404 -G @var{num}}
405
406 @emph{M88K Options}
407 @gccoptlist{
408 -m88000  -m88100  -m88110  -mbig-pic @gol
409 -mcheck-zero-division  -mhandle-large-shift @gol
410 -midentify-revision  -mno-check-zero-division @gol
411 -mno-ocs-debug-info  -mno-ocs-frame-position @gol
412 -mno-optimize-arg-area  -mno-serialize-volatile @gol
413 -mno-underscores  -mocs-debug-info @gol
414 -mocs-frame-position  -moptimize-arg-area @gol
415 -mserialize-volatile  -mshort-data-@var{num}  -msvr3 @gol
416 -msvr4  -mtrap-large-shift  -muse-div-instruction @gol
417 -mversion-03.00  -mwarn-passed-structs}
418
419 @emph{RS/6000 and PowerPC Options}
420 @gccoptlist{
421 -mcpu=@var{cpu-type} @gol
422 -mtune=@var{cpu-type} @gol
423 -mpower  -mno-power  -mpower2  -mno-power2 @gol
424 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
425 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
426 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
427 -mnew-mnemonics  -mold-mnemonics @gol
428 -mfull-toc   -mminimal-toc  -mno-fop-in-toc  -mno-sum-in-toc @gol
429 -m64  -m32  -mxl-call  -mno-xl-call  -mthreads  -mpe @gol
430 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
431 -mstring  -mno-string  -mupdate  -mno-update @gol
432 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
433 -mstrict-align  -mno-strict-align  -mrelocatable @gol
434 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
435 -mtoc  -mno-toc -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
436 -mcall-aix  -mcall-sysv  -mprototype  -mno-prototype @gol
437 -msim  -mmvme  -mads  -myellowknife  -memb -msdata @gol
438 -msdata=@var{opt}  -mvxworks -G @var{num}}
439
440 @emph{RT Options}
441 @gccoptlist{
442 -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs @gol
443 -mfull-fp-blocks  -mhc-struct-return  -min-line-mul @gol
444 -mminimum-fp-blocks  -mnohc-struct-return}
445
446 @emph{MIPS Options}
447 @gccoptlist{
448 -mabicalls  -mcpu=@var{cpu-type} @gol
449 -membedded-data  -muninit-const-in-rodata @gol
450 -membedded-pic  -mfp32  -mfp64  -mgas  -mgp32  -mgp64 @gol
451 -mgpopt  -mhalf-pic  -mhard-float  -mint64  -mips1 @gol
452 -mips2  -mips3  -mips4  -mlong64  -mlong32  -mlong-calls  -mmemcpy @gol
453 -mmips-as  -mmips-tfile  -mno-abicalls @gol
454 -mno-embedded-data  -mno-uninit-const-in-rodata @gol
455 -mno-embedded-pic  -mno-gpopt  -mno-long-calls @gol
456 -mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats @gol
457 -mrnames  -msoft-float @gol
458 -m4650  -msingle-float  -mmad @gol
459 -mstats  -EL  -EB  -G @var{num}  -nocpp @gol
460 -mabi=32  -mabi=n32  -mabi=64  -mabi=eabi @gol
461 -mfix7000  -mno-crt0}
462
463 @emph{i386 Options}
464 @gccoptlist{
465 -mcpu=@var{cpu-type}  -march=@var{cpu-type} @gol
466 -mintel-syntax -mieee-fp  -mno-fancy-math-387 @gol
467 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
468 -mno-wide-multiply  -mrtd  -malign-double @gol
469 -mpreferred-stack-boundary=@var{num} @gol
470 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
471 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
472 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer}
473
474 @emph{HPPA Options}
475 @gccoptlist{
476 -march=@var{architecture-type} @gol
477 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
478 -mfast-indirect-calls  -mgas  -mjump-in-delay @gol
479 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
480 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
481 -mno-jump-in-delay  -mno-long-load-store @gol
482 -mno-portable-runtime  -mno-soft-float @gol
483 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
484 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
485 -mschedule=@var{cpu-type}  -mspace-regs}
486
487 @emph{Intel 960 Options}
488 @gccoptlist{
489 -m@var{cpu-type}  -masm-compat  -mclean-linkage @gol
490 -mcode-align  -mcomplex-addr  -mleaf-procedures @gol
491 -mic-compat  -mic2.0-compat  -mic3.0-compat @gol
492 -mintel-asm  -mno-clean-linkage  -mno-code-align @gol
493 -mno-complex-addr  -mno-leaf-procedures @gol
494 -mno-old-align  -mno-strict-align  -mno-tail-call @gol
495 -mnumerics  -mold-align  -msoft-float  -mstrict-align @gol
496 -mtail-call}
497
498 @emph{DEC Alpha Options}
499 @gccoptlist{
500 -mfp-regs  -mno-fp-regs  -mno-soft-float  -msoft-float @gol
501 -malpha-as  -mgas @gol
502 -mieee  -mieee-with-inexact  -mieee-conformant @gol
503 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
504 -mtrap-precision=@var{mode}  -mbuild-constants @gol
505 -mcpu=@var{cpu-type} @gol
506 -mbwx  -mno-bwx  -mcix  -mno-cix  -mmax  -mno-max @gol
507 -mmemory-latency=@var{time}}
508
509 @emph{Clipper Options}
510 @gccoptlist{
511 -mc300  -mc400}
512
513 @emph{H8/300 Options}
514 @gccoptlist{
515 -mrelax  -mh  -ms  -mint32  -malign-300}
516
517 @emph{SH Options}
518 @gccoptlist{
519 -m1  -m2  -m3  -m3e @gol
520 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
521 -mb  -ml  -mdalign  -mrelax @gol
522 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
523 -mieee  -misize  -mpadstruct  -mspace @gol
524 -mprefergot  -musermode}
525
526 @emph{System V Options}
527 @gccoptlist{
528 -Qy  -Qn  -YP\,@var{paths}  -Ym\,@var{dir}}
529
530 @emph{ARC Options}
531 @gccoptlist{
532 -EB  -EL @gol
533 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
534 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
535
536 @emph{TMS320C3x/C4x Options}
537 @gccoptlist{
538 -mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
539 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
540 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
541 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
542
543 @emph{V850 Options}
544 @gccoptlist{
545 -mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
546 -mprolog-function  -mno-prolog-function  -mspace @gol
547 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
548 -mv850  -mbig-switch}
549
550 @emph{NS32K Options}
551 @gccoptlist{
552 -m32032  -m32332  -m32532  -m32081  -m32381 @gol
553 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
554 -mregparam  -mnoregparam  -msb  -mnosb @gol
555 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
556
557 @emph{AVR Options}
558 @gccoptlist{
559 -mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
560 -mcall-prologues  -mno-tablejump  -mtiny-stack}
561
562 @emph{MCore Options}
563 @gccoptlist{
564 -mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
565 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
566 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
567 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
568 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
569
570 @emph{IA-64 Options}
571 @gccoptlist{
572 -mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
573 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
574 -mconstant-gp  -mauto-pic  -minline-divide-min-latency @gol
575 -minline-divide-max-throughput  -mno-dwarf2-asm @gol
576 -mfixed-range=@var{register-range}}
577
578 @item Code Generation Options
579 @xref{Code Gen Options,,Options for Code Generation Conventions}.
580 @gccoptlist{
581 -fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
582 -ffixed-@var{reg} -fexceptions @gol
583 -fnon-call-exceptions  -funwind-tables @gol
584 -finhibit-size-directive  -finstrument-functions @gol
585 -fcheck-memory-usage  -fprefix-function-name @gol
586 -fno-common  -fno-ident  -fno-gnu-linker @gol
587 -fpcc-struct-return  -fpic  -fPIC @gol
588 -freg-struct-return  -fshared-data  -fshort-enums @gol
589 -fshort-double  -fvolatile @gol
590 -fvolatile-global  -fvolatile-static @gol
591 -fverbose-asm  -fpack-struct  -fstack-check @gol
592 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
593 -fargument-alias  -fargument-noalias @gol
594 -fargument-noalias-global  -fleading-underscore}
595 @end table
596
597 @menu
598 * Overall Options::     Controlling the kind of output:
599                         an executable, object files, assembler files,
600                         or preprocessed source.
601 * C Dialect Options::   Controlling the variant of C language compiled.
602 * C++ Dialect Options:: Variations on C++.
603 * Objective-C Dialect Options:: Variations on Objective-C.
604 * Language Independent Options:: Controlling how diagnostics should be
605                         formatted.
606 * Warning Options::     How picky should the compiler be?
607 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
608 * Optimize Options::    How much optimization?
609 * Preprocessor Options:: Controlling header files and macro definitions.
610                          Also, getting dependency information for Make.
611 * Assembler Options::   Passing options to the assembler.
612 * Link Options::        Specifying libraries and so on.
613 * Directory Options::   Where to find header files and libraries.
614                         Where to find the compiler executable files.
615 * Spec Files::          How to pass switches to sub-processes.
616 * Target Options::      Running a cross-compiler, or an old version of GCC.
617 @end menu
618
619 @node Overall Options
620 @section Options Controlling the Kind of Output
621
622 Compilation can involve up to four stages: preprocessing, compilation
623 proper, assembly and linking, always in that order.  The first three
624 stages apply to an individual source file, and end by producing an
625 object file; linking combines all the object files (those newly
626 compiled, and those specified as input) into an executable file.
627
628 @cindex file name suffix
629 For any given input file, the file name suffix determines what kind of
630 compilation is done:
631
632 @table @gcctabopt
633 @item @var{file}.c
634 C source code which must be preprocessed.
635
636 @item @var{file}.i
637 C source code which should not be preprocessed.
638
639 @item @var{file}.ii
640 C++ source code which should not be preprocessed.
641
642 @item @var{file}.m
643 Objective-C source code.  Note that you must link with the library
644 @file{libobjc.a} to make an Objective-C program work.
645
646 @item @var{file}.mi
647 Objective-C source code which should not be preprocessed.
648
649 @item @var{file}.h
650 C header file (not to be compiled or linked).
651
652 @item @var{file}.cc
653 @itemx @var{file}.cp
654 @itemx @var{file}.cxx
655 @itemx @var{file}.cpp
656 @itemx @var{file}.c++
657 @itemx @var{file}.C
658 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
659 the last two letters must both be literally @samp{x}.  Likewise,
660 @samp{.C} refers to a literal capital C.
661
662 @item @var{file}.f
663 @itemx @var{file}.for
664 @itemx @var{file}.FOR
665 Fortran source code which should not be preprocessed.
666
667 @item @var{file}.F
668 @itemx @var{file}.fpp
669 @itemx @var{file}.FPP
670 Fortran source code which must be preprocessed (with the traditional
671 preprocessor).
672
673 @item @var{file}.r
674 Fortran source code which must be preprocessed with a RATFOR
675 preprocessor (not included with GCC).
676
677 @xref{Overall Options,,Options Controlling the Kind of Output, g77,
678 Using and Porting GNU Fortran}, for more details of the handling of
679 Fortran input files.
680
681 @c FIXME: Descriptions of Java file types.
682 @c @var{file}.java
683 @c @var{file}.class
684 @c @var{file}.zip
685 @c @var{file}.jar
686
687 @c GCC also knows about some suffixes for languages not yet included:
688 @c Ada:
689 @c @var{file}.ads
690 @c @var{file}.adb
691 @c @var{file}.ada
692 @c Pascal:
693 @c @var{file}.p
694 @c @var{file}.pas
695
696 @item @var{file}.ch
697 @itemx @var{file}.chi
698 CHILL source code (preprocessed with the traditional preprocessor).
699
700 @item @var{file}.s
701 Assembler code.
702
703 @item @var{file}.S
704 Assembler code which must be preprocessed.
705
706 @item @var{other}
707 An object file to be fed straight into linking.
708 Any file name with no recognized suffix is treated this way.
709 @end table
710
711 @opindex x
712 You can specify the input language explicitly with the @option{-x} option:
713
714 @table @gcctabopt
715 @item -x @var{language}
716 Specify explicitly the @var{language} for the following input files
717 (rather than letting the compiler choose a default based on the file
718 name suffix).  This option applies to all following input files until
719 the next @option{-x} option.  Possible values for @var{language} are:
720 @example
721 c  c-header  cpp-output
722 c++  c++-cpp-output
723 objective-c  objc-cpp-output
724 assembler  assembler-with-cpp
725 f77  f77-cpp-input  ratfor
726 java  chill
727 @end example
728 @c Also f77-version, for internal use only.
729
730 @item -x none
731 Turn off any specification of a language, so that subsequent files are
732 handled according to their file name suffixes (as they are if @option{-x}
733 has not been used at all).
734
735 @item -pass-exit-codes
736 @opindex pass-exit-codes
737 Normally the @command{gcc} program will exit with the code of 1 if any
738 phase of the compiler returns a non-success return code.  If you specify
739 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
740 numerically highest error produced by any phase that returned an error
741 indication.
742 @end table
743
744 If you only want some of the stages of compilation, you can use
745 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
746 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
747 @command{gcc} is to stop.  Note that some combinations (for example,
748 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
749
750 @table @gcctabopt
751 @item -c
752 @opindex c
753 Compile or assemble the source files, but do not link.  The linking
754 stage simply is not done.  The ultimate output is in the form of an
755 object file for each source file.
756
757 By default, the object file name for a source file is made by replacing
758 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
759
760 Unrecognized input files, not requiring compilation or assembly, are
761 ignored.
762
763 @item -S
764 @opindex S
765 Stop after the stage of compilation proper; do not assemble.  The output
766 is in the form of an assembler code file for each non-assembler input
767 file specified.
768
769 By default, the assembler file name for a source file is made by
770 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
771
772 Input files that don't require compilation are ignored.
773
774 @item -E
775 @opindex E
776 Stop after the preprocessing stage; do not run the compiler proper.  The
777 output is in the form of preprocessed source code, which is sent to the
778 standard output.
779
780 Input files which don't require preprocessing are ignored.
781
782 @cindex output file option
783 @item -o @var{file}
784 @opindex o
785 Place output in file @var{file}.  This applies regardless to whatever
786 sort of output is being produced, whether it be an executable file,
787 an object file, an assembler file or preprocessed C code.
788
789 Since only one output file can be specified, it does not make sense to
790 use @option{-o} when compiling more than one input file, unless you are
791 producing an executable file as output.
792
793 If @option{-o} is not specified, the default is to put an executable file
794 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
795 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
796 all preprocessed C source on standard output.@refill
797
798 @item -v
799 @opindex v
800 Print (on standard error output) the commands executed to run the stages
801 of compilation.  Also print the version number of the compiler driver
802 program and of the preprocessor and the compiler proper.
803
804 @item -pipe
805 @opindex pipe
806 Use pipes rather than temporary files for communication between the
807 various stages of compilation.  This fails to work on some systems where
808 the assembler is unable to read from a pipe; but the GNU assembler has
809 no trouble.
810
811 @item --help
812 @opindex help
813 Print (on the standard output) a description of the command line options
814 understood by @command{gcc}.  If the @option{-v} option is also specified
815 then @option{--help} will also be passed on to the various processes
816 invoked by @command{gcc}, so that they can display the command line options
817 they accept.  If the @option{-W} option is also specified then command
818 line options which have no documentation associated with them will also
819 be displayed.
820
821 @item --target-help
822 @opindex target-help
823 Print (on the standard output) a description of target specific command
824 line options for each tool.
825 @end table
826
827 @node Invoking G++
828 @section Compiling C++ Programs
829
830 @cindex suffixes for C++ source
831 @cindex C++ source file suffixes
832 C++ source files conventionally use one of the suffixes @samp{.C},
833 @samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
834 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
835 files with these names and compiles them as C++ programs even if you
836 call the compiler the same way as for compiling C programs (usually with
837 the name @command{gcc}).
838
839 @findex g++
840 @findex c++
841 However, C++ programs often require class libraries as well as a
842 compiler that understands the C++ language---and under some
843 circumstances, you might want to compile programs from standard input,
844 or otherwise without a suffix that flags them as C++ programs.
845 @command{g++} is a program that calls GCC with the default language
846 set to C++, and automatically specifies linking against the C++
847 library.  On many systems, @command{g++} is also
848 installed with the name @command{c++}.
849
850 @cindex invoking @command{g++}
851 When you compile C++ programs, you may specify many of the same
852 command-line options that you use for compiling programs in any
853 language; or command-line options meaningful for C and related
854 languages; or options that are meaningful only for C++ programs.
855 @xref{C Dialect Options,,Options Controlling C Dialect}, for
856 explanations of options for languages related to C.
857 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
858 explanations of options that are meaningful only for C++ programs.
859
860 @node C Dialect Options
861 @section Options Controlling C Dialect
862 @cindex dialect options
863 @cindex language dialect options
864 @cindex options, dialect
865
866 The following options control the dialect of C (or languages derived
867 from C, such as C++ and Objective C) that the compiler accepts:
868
869 @table @gcctabopt
870 @cindex ANSI support
871 @cindex ISO support
872 @item -ansi
873 @opindex ansi
874 In C mode, support all ISO C89 programs.  In C++ mode,
875 remove GNU extensions that conflict with ISO C++.
876
877 This turns off certain features of GCC that are incompatible with ISO
878 C (when compiling C code), or of standard C++ (when compiling C++ code),
879 such as the @code{asm} and @code{typeof} keywords, and
880 predefined macros such as @code{unix} and @code{vax} that identify the
881 type of system you are using.  It also enables the undesirable and
882 rarely used ISO trigraph feature.  For the C compiler,
883 it disables recognition of C++ style @samp{//} comments as well as
884 the @code{inline} keyword.
885
886 The alternate keywords @code{__asm__}, @code{__extension__},
887 @code{__inline__} and @code{__typeof__} continue to work despite
888 @option{-ansi}.  You would not want to use them in an ISO C program, of
889 course, but it is useful to put them in header files that might be included
890 in compilations done with @option{-ansi}.  Alternate predefined macros
891 such as @code{__unix__} and @code{__vax__} are also available, with or
892 without @option{-ansi}.
893
894 The @option{-ansi} option does not cause non-ISO programs to be
895 rejected gratuitously.  For that, @option{-pedantic} is required in
896 addition to @option{-ansi}.  @xref{Warning Options}.
897
898 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
899 option is used.  Some header files may notice this macro and refrain
900 from declaring certain functions or defining certain macros that the
901 ISO standard doesn't call for; this is to avoid interfering with any
902 programs that might use these names for other things.
903
904 Functions which would normally be builtin but do not have semantics
905 defined by ISO C (such as @code{alloca} and @code{ffs}) are not builtin
906 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
907 built-in functions provided by GNU CC}, for details of the functions
908 affected.
909
910 @item -std=
911 @opindex std
912 Determine the language standard.  A value for this option must be provided;
913 possible values are
914
915 @table @samp
916 @item iso9899:1990
917 Same as @option{-ansi}
918
919 @item iso9899:199409
920 ISO C as modified in amend. 1
921
922 @item iso9899:1999
923 ISO C99.  Note that this standard is not yet fully supported; see
924 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.
925
926 @item c89
927 same as @option{-std=iso9899:1990}
928
929 @item c99
930 same as @option{-std=iso9899:1999}
931
932 @item gnu89
933 default, iso9899:1990 + gnu extensions
934
935 @item gnu99
936 iso9899:1999 + gnu extensions
937
938 @item iso9899:199x
939 same as @option{-std=iso9899:1999}, deprecated
940
941 @item c9x
942 same as @option{-std=iso9899:1999}, deprecated
943
944 @item gnu9x
945 same as @option{-std=gnu99}, deprecated
946
947 @end table
948
949 Even when this option is not specified, you can still use some of the
950 features of newer standards in so far as they do not conflict with
951 previous C standards.  For example, you may use @code{__restrict__} even
952 when @option{-std=c99} is not specified.
953
954 The @option{-std} options specifying some version of ISO C have the same
955 effects as @option{-ansi}, except that features that were not in ISO C89
956 but are in the specified version (for example, @samp{//} comments and
957 the @code{inline} keyword in ISO C99) are not disabled.
958
959 @xref{Standards,,Language Standards Supported by GCC}, for details of
960 these standard versions.
961
962 @item -aux-info @var{filename}
963 @opindex aux-info
964 Output to the given filename prototyped declarations for all functions
965 declared and/or defined in a translation unit, including those in header
966 files.  This option is silently ignored in any language other than C.
967
968 Besides declarations, the file indicates, in comments, the origin of
969 each declaration (source file and line), whether the declaration was
970 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
971 @samp{O} for old, respectively, in the first character after the line
972 number and the colon), and whether it came from a declaration or a
973 definition (@samp{C} or @samp{F}, respectively, in the following
974 character).  In the case of function definitions, a K&R-style list of
975 arguments followed by their declarations is also provided, inside
976 comments, after the declaration.
977
978 @item -fno-asm
979 @opindex fno-asm
980 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
981 keyword, so that code can use these words as identifiers.  You can use
982 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
983 instead.  @option{-ansi} implies @option{-fno-asm}.
984
985 In C++, this switch only affects the @code{typeof} keyword, since
986 @code{asm} and @code{inline} are standard keywords.  You may want to
987 use the @option{-fno-gnu-keywords} flag instead, which has the same
988 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
989 switch only affects the @code{asm} and @code{typeof} keywords, since
990 @code{inline} is a standard keyword in ISO C99.
991
992 @item -fno-builtin
993 @opindex fno-builtin
994 @cindex builtin functions
995 Don't recognize builtin functions that do not begin with
996 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
997 functions provided by GNU CC}, for details of the functions affected,
998 including those which are not builtin functions when @option{-ansi} or
999 @option{-std} options for strict ISO C conformance are used because they
1000 do not have an ISO standard meaning.
1001
1002 GCC normally generates special code to handle certain builtin functions
1003 more efficiently; for instance, calls to @code{alloca} may become single
1004 instructions that adjust the stack directly, and calls to @code{memcpy}
1005 may become inline copy loops.  The resulting code is often both smaller
1006 and faster, but since the function calls no longer appear as such, you
1007 cannot set a breakpoint on those calls, nor can you change the behavior
1008 of the functions by linking with a different library.
1009
1010 In C++, @option{-fno-builtin} is always in effect.  The @option{-fbuiltin}
1011 option has no effect.  Therefore, in C++, the only way to get the
1012 optimization benefits of builtin functions is to call the function
1013 using the @samp{__builtin_} prefix.  The GNU C++ Standard Library uses
1014 builtin functions to implement many functions (like
1015 @code{std::strchr}), so that you automatically get efficient code.
1016
1017 @item -fhosted
1018 @opindex fhosted
1019 @cindex hosted environment
1020
1021 Assert that compilation takes place in a hosted environment.  This implies
1022 @option{-fbuiltin}.  A hosted environment is one in which the
1023 entire standard library is available, and in which @code{main} has a return
1024 type of @code{int}.  Examples are nearly everything except a kernel.
1025 This is equivalent to @option{-fno-freestanding}.
1026
1027 @item -ffreestanding
1028 @opindex ffreestanding
1029 @cindex hosted environment
1030
1031 Assert that compilation takes place in a freestanding environment.  This
1032 implies @option{-fno-builtin}.  A freestanding environment
1033 is one in which the standard library may not exist, and program startup may
1034 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1035 This is equivalent to @option{-fno-hosted}.
1036
1037 @xref{Standards,,Language Standards Supported by GCC}, for details of
1038 freestanding and hosted environments.
1039
1040 @item -trigraphs
1041 @opindex trigraphs
1042 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1043 options for strict ISO C conformance) implies @option{-trigraphs}.
1044
1045 @cindex traditional C language
1046 @cindex C language, traditional
1047 @item -traditional
1048 @opindex traditional
1049 Attempt to support some aspects of traditional C compilers.
1050 Specifically:
1051
1052 @itemize @bullet
1053 @item
1054 All @code{extern} declarations take effect globally even if they
1055 are written inside of a function definition.  This includes implicit
1056 declarations of functions.
1057
1058 @item
1059 The newer keywords @code{typeof}, @code{inline}, @code{signed}, @code{const}
1060 and @code{volatile} are not recognized.  (You can still use the
1061 alternative keywords such as @code{__typeof__}, @code{__inline__}, and
1062 so on.)
1063
1064 @item
1065 Comparisons between pointers and integers are always allowed.
1066
1067 @item
1068 Integer types @code{unsigned short} and @code{unsigned char} promote
1069 to @code{unsigned int}.
1070
1071 @item
1072 Out-of-range floating point literals are not an error.
1073
1074 @item
1075 Certain constructs which ISO regards as a single invalid preprocessing
1076 number, such as @samp{0xe-0xd}, are treated as expressions instead.
1077
1078 @item
1079 String ``constants'' are not necessarily constant; they are stored in
1080 writable space, and identical looking constants are allocated
1081 separately.  (This is the same as the effect of
1082 @option{-fwritable-strings}.)
1083
1084 @cindex @code{longjmp} and automatic variables
1085 @item
1086 All automatic variables not declared @code{register} are preserved by
1087 @code{longjmp}.  Ordinarily, GNU C follows ISO C: automatic variables
1088 not declared @code{volatile} may be clobbered.
1089
1090 @item
1091 @cindex @samp{\x}
1092 @cindex @samp{\a}
1093 @cindex escape sequences, traditional
1094 The character escape sequences @samp{\x} and @samp{\a} evaluate as the
1095 literal characters @samp{x} and @samp{a} respectively.  Without
1096 @w{@option{-traditional}}, @samp{\x} is a prefix for the hexadecimal
1097 representation of a character, and @samp{\a} produces a bell.
1098 @end itemize
1099
1100 You may wish to use @option{-fno-builtin} as well as @option{-traditional}
1101 if your program uses names that are normally GNU C builtin functions for
1102 other purposes of its own.
1103
1104 You cannot use @option{-traditional} if you include any header files that
1105 rely on ISO C features.  Some vendors are starting to ship systems with
1106 ISO C header files and you cannot use @option{-traditional} on such
1107 systems to compile files that include any system headers.
1108
1109 The @option{-traditional} option also enables @option{-traditional-cpp},
1110 which is described next.
1111
1112 @item -traditional-cpp
1113 @opindex traditional-cpp
1114 Attempt to support some aspects of traditional C preprocessors.
1115 Specifically:
1116
1117 @itemize @bullet
1118 @item
1119 Comments convert to nothing at all, rather than to a space.  This allows
1120 traditional token concatenation.
1121
1122 @item
1123 In a preprocessing directive, the @samp{#} symbol must appear as the first
1124 character of a line.
1125
1126 @item
1127 Macro arguments are recognized within string constants in a macro
1128 definition (and their values are stringified, though without additional
1129 quote marks, when they appear in such a context).  The preprocessor
1130 always considers a string constant to end at a newline.
1131
1132 @item
1133 @cindex detecting @w{@option{-traditional}}
1134 The predefined macro @code{__STDC__} is not defined when you use
1135 @option{-traditional}, but @code{__GNUC__} is (since the GNU extensions
1136 which @code{__GNUC__} indicates are not affected by
1137 @option{-traditional}).  If you need to write header files that work
1138 differently depending on whether @option{-traditional} is in use, by
1139 testing both of these predefined macros you can distinguish four
1140 situations: GNU C, traditional GNU C, other ISO C compilers, and other
1141 old C compilers.  The predefined macro @code{__STDC_VERSION__} is also
1142 not defined when you use @option{-traditional}.  @xref{Standard
1143 Predefined,,Standard Predefined Macros,cpp.info,The C Preprocessor},
1144 for more discussion of these and other predefined macros.
1145
1146 @item
1147 @cindex string constants vs newline
1148 @cindex newline vs string constants
1149 The preprocessor considers a string constant to end at a newline (unless
1150 the newline is escaped with @samp{\}).  (Without @w{@option{-traditional}},
1151 string constants can contain the newline character as typed.)
1152 @end itemize
1153
1154 @item -fcond-mismatch
1155 @opindex fcond-mismatch
1156 Allow conditional expressions with mismatched types in the second and
1157 third arguments.  The value of such an expression is void.  This option
1158 is not supported for C++.
1159
1160 @item -funsigned-char
1161 @opindex funsigned-char
1162 Let the type @code{char} be unsigned, like @code{unsigned char}.
1163
1164 Each kind of machine has a default for what @code{char} should
1165 be.  It is either like @code{unsigned char} by default or like
1166 @code{signed char} by default.
1167
1168 Ideally, a portable program should always use @code{signed char} or
1169 @code{unsigned char} when it depends on the signedness of an object.
1170 But many programs have been written to use plain @code{char} and
1171 expect it to be signed, or expect it to be unsigned, depending on the
1172 machines they were written for.  This option, and its inverse, let you
1173 make such a program work with the opposite default.
1174
1175 The type @code{char} is always a distinct type from each of
1176 @code{signed char} or @code{unsigned char}, even though its behavior
1177 is always just like one of those two.
1178
1179 @item -fsigned-char
1180 @opindex fsigned-char
1181 Let the type @code{char} be signed, like @code{signed char}.
1182
1183 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1184 the negative form of @option{-funsigned-char}.  Likewise, the option
1185 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1186
1187 @item -fsigned-bitfields
1188 @itemx -funsigned-bitfields
1189 @itemx -fno-signed-bitfields
1190 @itemx -fno-unsigned-bitfields
1191 @opindex fsigned-bitfields
1192 @opindex funsigned-bitfields
1193 @opindex fno-signed-bitfields
1194 @opindex fno-unsigned-bitfields
1195 These options control whether a bitfield is signed or unsigned, when the
1196 declaration does not use either @code{signed} or @code{unsigned}.  By
1197 default, such a bitfield is signed, because this is consistent: the
1198 basic integer types such as @code{int} are signed types.
1199
1200 However, when @option{-traditional} is used, bitfields are all unsigned
1201 no matter what.
1202
1203 @item -fwritable-strings
1204 @opindex fwritable-strings
1205 Store string constants in the writable data segment and don't uniquize
1206 them.  This is for compatibility with old programs which assume they can
1207 write into string constants.  The option @option{-traditional} also has
1208 this effect.
1209
1210 Writing into string constants is a very bad idea; ``constants'' should
1211 be constant.
1212
1213 @item -fallow-single-precision
1214 @opindex fallow-single-precision
1215 Do not promote single precision math operations to double precision,
1216 even when compiling with @option{-traditional}.
1217
1218 Traditional K&R C promotes all floating point operations to double
1219 precision, regardless of the sizes of the operands.   On the
1220 architecture for which you are compiling, single precision may be faster
1221 than double precision.   If you must use @option{-traditional}, but want
1222 to use single precision operations when the operands are single
1223 precision, use this option.   This option has no effect when compiling
1224 with ISO or GNU C conventions (the default).
1225
1226 @item -fshort-wchar
1227 @opindex fshort-wchar
1228 Override the underlying type for @samp{wchar_t} to be @samp{short
1229 unsigned int} instead of the default for the target.  This option is
1230 useful for building programs to run under WINE.
1231 @end table
1232
1233 @node C++ Dialect Options
1234 @section Options Controlling C++ Dialect
1235
1236 @cindex compiler options, C++
1237 @cindex C++ options, command line
1238 @cindex options, C++
1239 This section describes the command-line options that are only meaningful
1240 for C++ programs; but you can also use most of the GNU compiler options
1241 regardless of what language your program is in.  For example, you
1242 might compile a file @code{firstClass.C} like this:
1243
1244 @example
1245 g++ -g -frepo -O -c firstClass.C
1246 @end example
1247
1248 @noindent
1249 In this example, only @option{-frepo} is an option meant
1250 only for C++ programs; you can use the other options with any
1251 language supported by GCC.
1252
1253 Here is a list of options that are @emph{only} for compiling C++ programs:
1254
1255 @table @gcctabopt
1256 @item -fno-access-control
1257 @opindex fno-access-control
1258 Turn off all access checking.  This switch is mainly useful for working
1259 around bugs in the access control code.
1260
1261 @item -fcheck-new
1262 @opindex fcheck-new
1263 Check that the pointer returned by @code{operator new} is non-null
1264 before attempting to modify the storage allocated.  The current Working
1265 Paper requires that @code{operator new} never return a null pointer, so
1266 this check is normally unnecessary.
1267
1268 An alternative to using this option is to specify that your
1269 @code{operator new} does not throw any exceptions; if you declare it
1270 @samp{throw()}, g++ will check the return value.  See also @samp{new
1271 (nothrow)}.
1272
1273 @item -fconserve-space
1274 @opindex fconserve-space
1275 Put uninitialized or runtime-initialized global variables into the
1276 common segment, as C does.  This saves space in the executable at the
1277 cost of not diagnosing duplicate definitions.  If you compile with this
1278 flag and your program mysteriously crashes after @code{main()} has
1279 completed, you may have an object that is being destroyed twice because
1280 two definitions were merged.
1281
1282 This option is no longer useful on most targets, now that support has
1283 been added for putting variables into BSS without making them common.
1284
1285 @item -fno-const-strings
1286 @opindex fno-const-strings
1287 Give string constants type @code{char *} instead of type @code{const
1288 char *}.  By default, G++ uses type @code{const char *} as required by
1289 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1290 actually modify the value of a string constant, unless you also use
1291 @option{-fwritable-strings}.
1292
1293 This option might be removed in a future release of G++.  For maximum
1294 portability, you should structure your code so that it works with
1295 string constants that have type @code{const char *}.
1296
1297 @item -fdollars-in-identifiers
1298 @opindex fdollars-in-identifiers
1299 Accept @samp{$} in identifiers.  You can also explicitly prohibit use of
1300 @samp{$} with the option @option{-fno-dollars-in-identifiers}.  (GNU C allows
1301 @samp{$} by default on most target systems, but there are a few exceptions.)
1302 Traditional C allowed the character @samp{$} to form part of
1303 identifiers.  However, ISO C and C++ forbid @samp{$} in identifiers.
1304
1305 @item -fno-elide-constructors
1306 @opindex fno-elide-constructors
1307 The C++ standard allows an implementation to omit creating a temporary
1308 which is only used to initialize another object of the same type.
1309 Specifying this option disables that optimization, and forces g++ to
1310 call the copy constructor in all cases.
1311
1312 @item -fno-enforce-eh-specs
1313 @opindex fno-enforce-eh-specs
1314 Don't check for violation of exception specifications at runtime.  This
1315 option violates the C++ standard, but may be useful for reducing code
1316 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1317 will still optimize based on the exception specifications.
1318
1319 @item -fexternal-templates
1320 @opindex fexternal-templates
1321 Cause template instantiations to obey @samp{#pragma interface} and
1322 @samp{implementation}; template instances are emitted or not according
1323 to the location of the template definition.  @xref{Template
1324 Instantiation}, for more information.
1325
1326 This option is deprecated.
1327
1328 @item -falt-external-templates
1329 @opindex falt-external-templates
1330 Similar to @option{-fexternal-templates}, but template instances are emitted or
1331 not according to the place where they are first instantiated.
1332 @xref{Template Instantiation}, for more information.
1333
1334 This option is deprecated.
1335
1336 @item -ffor-scope
1337 @itemx -fno-for-scope
1338 @opindex ffor-scope
1339 @opindex fno-for-scope
1340 If @option{-ffor-scope} is specified, the scope of variables declared in
1341 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1342 as specified by the C++ standard.
1343 If @option{-fno-for-scope} is specified, the scope of variables declared in
1344 a @i{for-init-statement} extends to the end of the enclosing scope,
1345 as was the case in old versions of gcc, and other (traditional)
1346 implementations of C++.
1347
1348 The default if neither flag is given to follow the standard,
1349 but to allow and give a warning for old-style code that would
1350 otherwise be invalid, or have different behavior.
1351
1352 @item -fno-gnu-keywords
1353 @opindex fno-gnu-keywords
1354 Do not recognize @code{typeof} as a keyword, so that code can use this
1355 word as an identifier. You can use the keyword @code{__typeof__} instead.
1356 @option{-ansi} implies @option{-fno-gnu-keywords}.
1357
1358 @item -fno-honor-std
1359 @opindex fno-honor-std
1360 Ignore @code{namespace std}, instead of treating it as a real namespace.
1361 With this switch, the compiler will ignore
1362 @code{namespace-declarations}, @code{using-declarations},
1363 @code{using-directives}, and @code{namespace-names}, if they involve
1364 @code{std}.  
1365
1366 This option is only useful if you have manually compiled the C++
1367 run-time library with the same switch.  Otherwise, your programs will
1368 not link.  The use of this option is not recommended, and the option may
1369 be removed from a future version of G++.
1370
1371 @item -fno-implicit-templates
1372 @opindex fno-implicit-templates
1373 Never emit code for non-inline templates which are instantiated
1374 implicitly (i.e. by use); only emit code for explicit instantiations.
1375 @xref{Template Instantiation}, for more information.
1376
1377 @item -fno-implicit-inline-templates
1378 @opindex fno-implicit-inline-templates
1379 Don't emit code for implicit instantiations of inline templates, either.
1380 The default is to handle inlines differently so that compiles with and
1381 without optimization will need the same set of explicit instantiations.
1382
1383 @item -fno-implement-inlines
1384 @opindex fno-implement-inlines
1385 To save space, do not emit out-of-line copies of inline functions
1386 controlled by @samp{#pragma implementation}.  This will cause linker
1387 errors if these functions are not inlined everywhere they are called.
1388
1389 @item -fms-extensions
1390 @opindex fms-extensions
1391 Disable pedantic warnings about constructs used in MFC, such as implicit
1392 int and getting a pointer to member function via non-standard syntax.
1393
1394 @item -fno-nonansi-builtins
1395 @opindex fno-nonansi-builtins
1396 Disable builtin declarations of functions that are not mandated by
1397 ANSI/ISO C.  These include @code{ffs}, @code{alloca}, @code{_exit},
1398 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1399
1400 @item -fno-operator-names
1401 @opindex fno-operator-names
1402 Do not treat the operator name keywords @code{and}, @code{bitand},
1403 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1404 synonyms as keywords.
1405
1406 @item -fno-optional-diags
1407 @opindex fno-optional-diags
1408 Disable diagnostics that the standard says a compiler does not need to
1409 issue.  Currently, the only such diagnostic issued by g++ is the one for
1410 a name having multiple meanings within a class.
1411
1412 @item -fpermissive
1413 @opindex fpermissive
1414 Downgrade messages about nonconformant code from errors to warnings.  By
1415 default, g++ effectively sets @option{-pedantic-errors} without
1416 @option{-pedantic}; this option reverses that.  This behavior and this
1417 option are superseded by @option{-pedantic}, which works as it does for GNU C.
1418
1419 @item -frepo
1420 @opindex frepo
1421 Enable automatic template instantiation.  This option also implies
1422 @option{-fno-implicit-templates}.  @xref{Template Instantiation}, for more
1423 information.
1424
1425 @item -fno-rtti
1426 @opindex fno-rtti
1427 Disable generation of information about every class with virtual
1428 functions for use by the C++ runtime type identification features
1429 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1430 of the language, you can save some space by using this flag.  Note that
1431 exception handling uses the same information, but it will generate it as
1432 needed.
1433
1434 @item -fstats
1435 @opindex fstats
1436 Emit statistics about front-end processing at the end of the compilation.
1437 This information is generally only useful to the G++ development team.
1438
1439 @item -ftemplate-depth-@var{n}
1440 @opindex ftemplate-depth
1441 Set the maximum instantiation depth for template classes to @var{n}.
1442 A limit on the template instantiation depth is needed to detect
1443 endless recursions during template class instantiation. ANSI/ISO C++
1444 conforming programs must not rely on a maximum depth greater than 17.
1445
1446 @item -fuse-cxa-atexit
1447 @opindex fuse-cxa-atexit
1448 Register destructors for objects with static storage duration with the
1449 @code{__cxa_atexit} function rather than the @code{atexit} function.
1450 This option is required for fully standards-compliant handling of static
1451 destructors, but will only work if your C library supports
1452 @code{__cxa_atexit}.
1453
1454 @item -fvtable-gc
1455 @opindex fvtable-gc
1456 Emit special relocations for vtables and virtual function references
1457 so that the linker can identify unused virtual functions and zero out
1458 vtable slots that refer to them.  This is most useful with
1459 @option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
1460 also discard the functions themselves.
1461
1462 This optimization requires GNU as and GNU ld.  Not all systems support
1463 this option.  @option{-Wl,--gc-sections} is ignored without @option{-static}.
1464
1465 @item -fno-weak
1466 @opindex fno-weak
1467 Do not use weak symbol support, even if it is provided by the linker.
1468 By default, G++ will use weak symbols if they are available.  This
1469 option exists only for testing, and should not be used by end-users;
1470 it will result in inferior code and has no benefits.  This option may
1471 be removed in a future release of G++.
1472
1473 @item -nostdinc++
1474 @opindex nostdinc++
1475 Do not search for header files in the standard directories specific to
1476 C++, but do still search the other standard directories.  (This option
1477 is used when building the C++ library.)
1478 @end table
1479
1480 In addition, these optimization, warning, and code generation options
1481 have meanings only for C++ programs:
1482
1483 @table @gcctabopt
1484 @item -fno-default-inline
1485 @opindex fno-default-inline
1486 Do not assume @samp{inline} for functions defined inside a class scope.
1487 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1488 functions will have linkage like inline functions; they just won't be
1489 inlined by default.
1490
1491 @item -Wctor-dtor-privacy (C++ only)
1492 @opindex Wctor-dtor-privacy
1493 Warn when a class seems unusable, because all the constructors or
1494 destructors in a class are private and the class has no friends or
1495 public static member functions.
1496
1497 @item -Wnon-virtual-dtor (C++ only)
1498 @opindex Wnon-virtual-dtor
1499 Warn when a class declares a non-virtual destructor that should probably
1500 be virtual, because it looks like the class will be used polymorphically.
1501
1502 @item -Wreorder (C++ only)
1503 @opindex Wreorder
1504 @cindex reordering, warning
1505 @cindex warning for reordering of member initializers
1506 Warn when the order of member initializers given in the code does not
1507 match the order in which they must be executed.  For instance:
1508
1509 @smallexample
1510 struct A @{
1511   int i;
1512   int j;
1513   A(): j (0), i (1) @{ @}
1514 @};
1515 @end smallexample
1516
1517 Here the compiler will warn that the member initializers for @samp{i}
1518 and @samp{j} will be rearranged to match the declaration order of the
1519 members.
1520 @end table
1521
1522 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1523
1524 @table @gcctabopt
1525 @item -Weffc++ (C++ only)
1526 @opindex Weffc++
1527 Warn about violations of various style guidelines from Scott Meyers'
1528 @cite{Effective C++} books.  If you use this option, you should be aware
1529 that the standard library headers do not obey all of these guidelines;
1530 you can use @samp{grep -v} to filter out those warnings.
1531
1532 @item -Wno-deprecated (C++ only)
1533 @opindex Wno-deprecated
1534 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
1535
1536 @item -Wno-non-template-friend (C++ only)
1537 @opindex Wno-non-template-friend
1538 Disable warnings when non-templatized friend functions are declared
1539 within a template. With the advent of explicit template specification
1540 support in g++, if the name of the friend is an unqualified-id (ie,
1541 @samp{friend foo(int)}), the C++ language specification demands that the
1542 friend declare or define an ordinary, nontemplate function. (Section
1543 14.5.3). Before g++ implemented explicit specification, unqualified-ids
1544 could be interpreted as a particular specialization of a templatized
1545 function. Because this non-conforming behavior is no longer the default
1546 behavior for g++, @option{-Wnon-template-friend} allows the compiler to
1547 check existing code for potential trouble spots, and is on by default.
1548 This new compiler behavior can be turned off with
1549 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1550 but disables the helpful warning.
1551
1552 @item -Wold-style-cast (C++ only)
1553 @opindex Wold-style-cast
1554 Warn if an old-style (C-style) cast is used within a C++ program.  The
1555 new-style casts (@samp{static_cast}, @samp{reinterpret_cast}, and
1556 @samp{const_cast}) are less vulnerable to unintended effects, and much
1557 easier to grep for.
1558
1559 @item -Woverloaded-virtual (C++ only)
1560 @opindex Woverloaded-virtual
1561 @cindex overloaded virtual fn, warning
1562 @cindex warning for overloaded virtual fn
1563 Warn when a function declaration hides virtual functions from a
1564 base class.  For example, in:
1565
1566 @smallexample
1567 struct A @{
1568   virtual void f();
1569 @};
1570
1571 struct B: public A @{
1572   void f(int);
1573 @};
1574 @end smallexample
1575
1576 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1577 like this:
1578
1579 @smallexample
1580 B* b;
1581 b->f();
1582 @end smallexample
1583
1584 will fail to compile.
1585
1586 @item -Wno-pmf-conversions (C++ only)
1587 @opindex Wno-pmf-conversions
1588 Disable the diagnostic for converting a bound pointer to member function
1589 to a plain pointer.
1590
1591 @item -Wsign-promo (C++ only)
1592 @opindex Wsign-promo
1593 Warn when overload resolution chooses a promotion from unsigned or
1594 enumeral type to a signed type over a conversion to an unsigned type of
1595 the same size.  Previous versions of g++ would try to preserve
1596 unsignedness, but the standard mandates the current behavior.
1597
1598 @item -Wsynth (C++ only)
1599 @opindex Wsynth
1600 @cindex warning for synthesized methods
1601 @cindex synthesized methods, warning
1602 Warn when g++'s synthesis behavior does not match that of cfront.  For
1603 instance:
1604
1605 @smallexample
1606 struct A @{
1607   operator int ();
1608   A& operator = (int);
1609 @};
1610
1611 main ()
1612 @{
1613   A a,b;
1614   a = b;
1615 @}
1616 @end smallexample
1617
1618 In this example, g++ will synthesize a default @samp{A& operator =
1619 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1620 @end table
1621
1622 @node Objective-C Dialect Options
1623 @section Options Controlling Objective-C Dialect
1624
1625 @cindex compiler options, Objective-C
1626 @cindex Objective-C options, command line
1627 @cindex options, Objective-C
1628 This section describes the command-line options that are only meaningful
1629 for Objective-C programs; but you can also use most of the GNU compiler
1630 options regardless of what language your program is in.  For example,
1631 you might compile a file @code{some_class.m} like this:
1632
1633 @example
1634 gcc -g -fgnu-runtime -O -c some_class.m
1635 @end example
1636
1637 @noindent
1638 In this example, only @option{-fgnu-runtime} is an option meant only for
1639 Objective-C programs; you can use the other options with any language
1640 supported by GCC.
1641
1642 Here is a list of options that are @emph{only} for compiling Objective-C
1643 programs:
1644
1645 @table @gcctabopt
1646 @item -fconstant-string-class=@var{class-name}
1647 @opindex fconstant-string-class
1648 Use @var{class-name} as the name of the class to instantiate for each
1649 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1650 class name is @code{NXConstantString}.
1651
1652 @item -fgnu-runtime
1653 @opindex fgnu-runtime
1654 Generate object code compatible with the standard GNU Objective-C
1655 runtime.  This is the default for most types of systems.
1656
1657 @item -fnext-runtime
1658 @opindex fnext-runtime
1659 Generate output compatible with the NeXT runtime.  This is the default
1660 for NeXT-based systems, including Darwin and Mac OS X.
1661
1662 @item -gen-decls
1663 @opindex gen-decls
1664 Dump interface declarations for all classes seen in the source file to a
1665 file named @file{@var{sourcename}.decl}.
1666
1667 @item -Wno-protocol
1668 @opindex Wno-protocol
1669 Do not warn if methods required by a protocol are not implemented
1670 in the class adopting it.
1671
1672 @item -Wselector
1673 @opindex Wselector
1674 Warn if a selector has multiple methods of different types defined.
1675
1676 @c not documented because only avail via -Wp
1677 @c @item -print-objc-runtime-info
1678
1679 @end table
1680
1681 @node Language Independent Options
1682 @section Options to Control Diagnostic Messages Formatting
1683 @cindex options to control diagnostics formatting
1684 @cindex diagnostic messages
1685 @cindex message formatting
1686
1687 Traditionally, diagnostic messages have been formatted irrespective of
1688 the output device's aspect (e.g. its width, @dots{}).  The options described
1689 below can be used to control the diagnostic messages formatting
1690 algorithm, e.g. how many characters per line, how often source location
1691 information should be reported.  Right now, only the C++ front-end can
1692 honor these options.  However it is expected, in the near future, that
1693 the remaining front-ends would be able to digest them correctly.
1694
1695 @table @gcctabopt
1696 @item -fmessage-length=@var{n}
1697 @opindex fmessage-length
1698 Try to format error messages so that they fit on lines of about @var{n}
1699 characters.  The default is 72 characters for g++ and 0 for the rest of
1700 the front-ends supported by GCC.  If @var{n} is zero, then no
1701 line-wrapping will be done; each error message will appear on a single
1702 line.
1703
1704 @opindex fdiagnostics-show-location
1705 @item -fdiagnostics-show-location=once
1706 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1707 reporter to emit @emph{once} source location information; that is, in
1708 case the message is too long to fit on a single physical line and has to
1709 be wrapped, the source location won't be emitted (as prefix) again,
1710 over and over, in subsequent continuation lines.  This is the default
1711 behaviour.
1712
1713 @item -fdiagnostics-show-location=every-line
1714 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1715 messages reporter to emit the same source location information (as
1716 prefix) for physical lines that result from the process of breaking a
1717 a message which is too long to fit on a single line.
1718
1719 @end table
1720
1721 @node Warning Options
1722 @section Options to Request or Suppress Warnings
1723 @cindex options to control warnings
1724 @cindex warning messages
1725 @cindex messages, warning
1726 @cindex suppressing warnings
1727
1728 Warnings are diagnostic messages that report constructions which
1729 are not inherently erroneous but which are risky or suggest there
1730 may have been an error.
1731
1732 You can request many specific warnings with options beginning @samp{-W},
1733 for example @option{-Wimplicit} to request warnings on implicit
1734 declarations.  Each of these specific warning options also has a
1735 negative form beginning @samp{-Wno-} to turn off warnings;
1736 for example, @option{-Wno-implicit}.  This manual lists only one of the
1737 two forms, whichever is not the default.
1738
1739 These options control the amount and kinds of warnings produced by GCC:
1740
1741 @table @gcctabopt
1742 @cindex syntax checking
1743 @item -fsyntax-only
1744 @opindex fsyntax-only
1745 Check the code for syntax errors, but don't do anything beyond that.
1746
1747 @item -pedantic
1748 @opindex pedantic
1749 Issue all the warnings demanded by strict ISO C and ISO C++;
1750 reject all programs that use forbidden extensions, and some other
1751 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
1752 version of the ISO C standard specified by any @option{-std} option used.
1753
1754 Valid ISO C and ISO C++ programs should compile properly with or without
1755 this option (though a rare few will require @option{-ansi} or a
1756 @option{-std} option specifying the required version of ISO C).  However,
1757 without this option, certain GNU extensions and traditional C and C++
1758 features are supported as well.  With this option, they are rejected.
1759
1760 @option{-pedantic} does not cause warning messages for use of the
1761 alternate keywords whose names begin and end with @samp{__}.  Pedantic
1762 warnings are also disabled in the expression that follows
1763 @code{__extension__}.  However, only system header files should use
1764 these escape routes; application programs should avoid them.
1765 @xref{Alternate Keywords}.
1766
1767 Some users try to use @option{-pedantic} to check programs for strict ISO
1768 C conformance.  They soon find that it does not do quite what they want:
1769 it finds some non-ISO practices, but not all---only those for which
1770 ISO C @emph{requires} a diagnostic, and some others for which
1771 diagnostics have been added.
1772
1773 A feature to report any failure to conform to ISO C might be useful in
1774 some instances, but would require considerable additional work and would
1775 be quite different from @option{-pedantic}.  We don't have plans to
1776 support such a feature in the near future.
1777
1778 Where the standard specified with @option{-std} represents a GNU
1779 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
1780 corresponding @dfn{base standard}, the version of ISO C on which the GNU
1781 extended dialect is based.  Warnings from @option{-pedantic} are given
1782 where they are required by the base standard.  (It would not make sense
1783 for such warnings to be given only for features not in the specified GNU
1784 C dialect, since by definition the GNU dialects of C include all
1785 features the compiler supports with the given option, and there would be
1786 nothing to warn about.)
1787
1788 @item -pedantic-errors
1789 @opindex pedantic-errors
1790 Like @option{-pedantic}, except that errors are produced rather than
1791 warnings.
1792
1793 @item -w
1794 @opindex w
1795 Inhibit all warning messages.
1796
1797 @item -Wno-import
1798 @opindex Wno-import
1799 Inhibit warning messages about the use of @samp{#import}.
1800
1801 @item -Wchar-subscripts
1802 @opindex Wchar-subscripts
1803 Warn if an array subscript has type @code{char}.  This is a common cause
1804 of error, as programmers often forget that this type is signed on some
1805 machines.
1806
1807 @item -Wcomment
1808 @opindex Wcomment
1809 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1810 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1811
1812 @item -Wformat
1813 @opindex Wformat
1814 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1815 the arguments supplied have types appropriate to the format string
1816 specified, and that the conversions specified in the format string make
1817 sense.  This includes standard functions, and others specified by format
1818 attributes (@pxref{Function Attributes}), in the @code{printf},
1819 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
1820 not in the C standard) families.
1821
1822 The formats are checked against the format features supported by GNU
1823 libc version 2.2.  These include all ISO C89 and C99 features, as well
1824 as features from the Single Unix Specification and some BSD and GNU
1825 extensions.  Other library implementations may not support all these
1826 features; GCC does not support warning about features that go beyond a
1827 particular library's limitations.  However, if @option{-pedantic} is used
1828 with @option{-Wformat}, warnings will be given about format features not
1829 in the selected standard version (but not for @code{strfmon} formats,
1830 since those are not in any version of the C standard).  @xref{C Dialect
1831 Options,,Options Controlling C Dialect}.
1832
1833 @option{-Wformat} is included in @option{-Wall}.  For more control over some
1834 aspects of format checking, the options @option{-Wno-format-y2k},
1835 @option{-Wno-format-extra-args}, @option{-Wformat-nonliteral},
1836 @option{-Wformat-security} and @option{-Wformat=2} are available, but are
1837 not included in @option{-Wall}.
1838
1839 @item -Wno-format-y2k
1840 @opindex Wno-format-y2k
1841 If @option{-Wformat} is specified, do not warn about @code{strftime}
1842 formats which may yield only a two-digit year.
1843
1844 @item -Wno-format-extra-args
1845 @opindex Wno-format-extra-args
1846 If @option{-Wformat} is specified, do not warn about excess arguments to a
1847 @code{printf} or @code{scanf} format function.  The C standard specifies
1848 that such arguments are ignored.
1849
1850 @item -Wformat-nonliteral
1851 @opindex Wformat-nonliteral
1852 If @option{-Wformat} is specified, also warn if the format string is not a
1853 string literal and so cannot be checked, unless the format function
1854 takes its format arguments as a @code{va_list}.
1855
1856 @item -Wformat-security
1857 @opindex Wformat-security
1858 If @option{-Wformat} is specified, also warn about uses of format
1859 functions that represent possible security problems.  At present, this
1860 warns about calls to @code{printf} and @code{scanf} functions where the
1861 format string is not a string literal and there are no format arguments,
1862 as in @code{printf (foo);}.  This may be a security hole if the format
1863 string came from untrusted input and contains @samp{%n}.  (This is
1864 currently a subset of what @option{-Wformat-nonliteral} warns about, but
1865 in future warnings may be added to @option{-Wformat-security} that are not
1866 included in @option{-Wformat-nonliteral}.)
1867
1868 @item -Wformat=2
1869 @opindex Wformat=2
1870 Enable @option{-Wformat} plus format checks not included in
1871 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
1872 -Wformat-nonliteral -Wformat-security}.
1873
1874 @item -Wimplicit-int
1875 @opindex Wimplicit-int
1876 Warn when a declaration does not specify a type.
1877
1878 @item -Wimplicit-function-declaration
1879 @itemx -Werror-implicit-function-declaration
1880 @opindex Wimplicit-function-declaration
1881 @opindex Werror-implicit-function-declaration
1882 Give a warning (or error) whenever a function is used before being
1883 declared.
1884
1885 @item -Wimplicit
1886 @opindex Wimplicit
1887 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
1888
1889 @item -Wmain
1890 @opindex Wmain
1891 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
1892 function with external linkage, returning int, taking either zero
1893 arguments, two, or three arguments of appropriate types.
1894
1895 @item -Wmissing-braces
1896 @opindex Wmissing-braces
1897 Warn if an aggregate or union initializer is not fully bracketed.  In
1898 the following example, the initializer for @samp{a} is not fully
1899 bracketed, but that for @samp{b} is fully bracketed.
1900
1901 @smallexample
1902 int a[2][2] = @{ 0, 1, 2, 3 @};
1903 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
1904 @end smallexample
1905
1906 @item -Wmultichar
1907 @opindex Wmultichar
1908 Warn if a multicharacter constant (@samp{'FOOF'}) is used.  Usually they
1909 indicate a typo in the user's code, as they have implementation-defined
1910 values, and should not be used in portable code.
1911
1912 @item -Wparentheses
1913 @opindex Wparentheses
1914 Warn if parentheses are omitted in certain contexts, such
1915 as when there is an assignment in a context where a truth value
1916 is expected, or when operators are nested whose precedence people
1917 often get confused about.
1918
1919 Also warn about constructions where there may be confusion to which
1920 @code{if} statement an @code{else} branch belongs.  Here is an example of
1921 such a case:
1922
1923 @smallexample
1924 @{
1925   if (a)
1926     if (b)
1927       foo ();
1928   else
1929     bar ();
1930 @}
1931 @end smallexample
1932
1933 In C, every @code{else} branch belongs to the innermost possible @code{if}
1934 statement, which in this example is @code{if (b)}.  This is often not
1935 what the programmer expected, as illustrated in the above example by
1936 indentation the programmer chose.  When there is the potential for this
1937 confusion, GNU C will issue a warning when this flag is specified.
1938 To eliminate the warning, add explicit braces around the innermost
1939 @code{if} statement so there is no way the @code{else} could belong to
1940 the enclosing @code{if}.  The resulting code would look like this:
1941
1942 @smallexample
1943 @{
1944   if (a)
1945     @{
1946       if (b)
1947         foo ();
1948       else
1949         bar ();
1950     @}
1951 @}
1952 @end smallexample
1953
1954 @item -Wsequence-point
1955 @opindex Wsequence-point
1956 Warn about code that may have undefined semantics because of violations
1957 of sequence point rules in the C standard.
1958
1959 The C standard defines the order in which expressions in a C program are
1960 evaluated in terms of @dfn{sequence points}, which represent a partial
1961 ordering between the execution of parts of the program: those executed
1962 before the sequence point, and those executed after it.  These occur
1963 after the evaluation of a full expression (one which is not part of a
1964 larger expression), after the evaluation of the first operand of a
1965 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
1966 function is called (but after the evaluation of its arguments and the
1967 expression denoting the called function), and in certain other places.
1968 Other than as expressed by the sequence point rules, the order of
1969 evaluation of subexpressions of an expression is not specified.  All
1970 these rules describe only a partial order rather than a total order,
1971 since, for example, if two functions are called within one expression
1972 with no sequence point between them, the order in which the functions
1973 are called is not specified.  However, the standards committee have
1974 ruled that function calls do not overlap.
1975
1976 It is not specified when between sequence points modifications to the
1977 values of objects take effect.  Programs whose behavior depends on this
1978 have undefined behavior; the C standard specifies that ``Between the
1979 previous and next sequence point an object shall have its stored value
1980 modified at most once by the evaluation of an expression.  Furthermore,
1981 the prior value shall be read only to determine the value to be
1982 stored.''.  If a program breaks these rules, the results on any
1983 particular implementation are entirely unpredictable.
1984
1985 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
1986 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
1987 diagnosed by this option, and it may give an occasional false positive
1988 result, but in general it has been found fairly effective at detecting
1989 this sort of problem in programs.
1990
1991 The present implementation of this option only works for C programs.  A
1992 future implementation may also work for C++ programs.
1993
1994 There is some controversy over the precise meaning of the sequence point
1995 rules in subtle cases.  Links to papers with alternative formal definitions
1996 and other related discussions may be found on our readings page
1997 @w{@uref{http://gcc.gnu.org/readings.html}}.
1998
1999 @item -Wreturn-type
2000 @opindex Wreturn-type
2001 Warn whenever a function is defined with a return-type that defaults to
2002 @code{int}.  Also warn about any @code{return} statement with no
2003 return-value in a function whose return-type is not @code{void}.
2004
2005 For C++, a function without return type always produces a diagnostic
2006 message, even when @option{-Wno-return-type} is specified. The only
2007 exceptions are @samp{main} and functions defined in system headers.
2008
2009 @item -Wswitch
2010 @opindex Wswitch
2011 Warn whenever a @code{switch} statement has an index of enumeral type
2012 and lacks a @code{case} for one or more of the named codes of that
2013 enumeration.  (The presence of a @code{default} label prevents this
2014 warning.)  @code{case} labels outside the enumeration range also
2015 provoke warnings when this option is used.
2016
2017 @item -Wtrigraphs
2018 @opindex Wtrigraphs
2019 Warn if any trigraphs are encountered that might change the meaning of
2020 the program (trigraphs within comments are not warned about).
2021
2022 @item -Wunused-function
2023 @opindex Wunused-function
2024 Warn whenever a static function is declared but not defined or a
2025 non\-inline static function is unused.
2026
2027 @item -Wunused-label
2028 @opindex Wunused-label
2029 Warn whenever a label is declared but not used.
2030
2031 To suppress this warning use the @samp{unused} attribute
2032 (@pxref{Variable Attributes}).
2033
2034 @item -Wunused-parameter
2035 @opindex Wunused-parameter
2036 Warn whenever a function parameter is unused aside from its declaration.
2037
2038 To suppress this warning use the @samp{unused} attribute
2039 (@pxref{Variable Attributes}).
2040
2041 @item -Wunused-variable
2042 @opindex Wunused-variable
2043 Warn whenever a local variable or non-constant static variable is unused
2044 aside from its declaration
2045
2046 To suppress this warning use the @samp{unused} attribute
2047 (@pxref{Variable Attributes}).
2048
2049 @item -Wunused-value
2050 @opindex Wunused-value
2051 Warn whenever a statement computes a result that is explicitly not used.
2052
2053 To suppress this warning cast the expression to @samp{void}.
2054
2055 @item -Wunused
2056 @opindex Wunused
2057 All all the above @option{-Wunused} options combined.
2058
2059 In order to get a warning about an unused function parameter, you must
2060 either specify @samp{-W -Wunused} or separately specify
2061 @option{-Wunused-parameter}.
2062
2063 @item -Wuninitialized
2064 @opindex Wuninitialized
2065 Warn if an automatic variable is used without first being initialized or
2066 if a variable may be clobbered by a @code{setjmp} call.
2067
2068 These warnings are possible only in optimizing compilation,
2069 because they require data flow information that is computed only
2070 when optimizing.  If you don't specify @option{-O}, you simply won't
2071 get these warnings.
2072
2073 These warnings occur only for variables that are candidates for
2074 register allocation.  Therefore, they do not occur for a variable that
2075 is declared @code{volatile}, or whose address is taken, or whose size
2076 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2077 structures, unions or arrays, even when they are in registers.
2078
2079 Note that there may be no warning about a variable that is used only
2080 to compute a value that itself is never used, because such
2081 computations may be deleted by data flow analysis before the warnings
2082 are printed.
2083
2084 These warnings are made optional because GCC is not smart
2085 enough to see all the reasons why the code might be correct
2086 despite appearing to have an error.  Here is one example of how
2087 this can happen:
2088
2089 @smallexample
2090 @{
2091   int x;
2092   switch (y)
2093     @{
2094     case 1: x = 1;
2095       break;
2096     case 2: x = 4;
2097       break;
2098     case 3: x = 5;
2099     @}
2100   foo (x);
2101 @}
2102 @end smallexample
2103
2104 @noindent
2105 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2106 always initialized, but GCC doesn't know this.  Here is
2107 another common case:
2108
2109 @smallexample
2110 @{
2111   int save_y;
2112   if (change_y) save_y = y, y = new_y;
2113   @dots{}
2114   if (change_y) y = save_y;
2115 @}
2116 @end smallexample
2117
2118 @noindent
2119 This has no bug because @code{save_y} is used only if it is set.
2120
2121 @cindex @code{longjmp} warnings
2122 This option also warns when a non-volatile automatic variable might be
2123 changed by a call to @code{longjmp}.  These warnings as well are possible
2124 only in optimizing compilation.
2125
2126 The compiler sees only the calls to @code{setjmp}.  It cannot know
2127 where @code{longjmp} will be called; in fact, a signal handler could
2128 call it at any point in the code.  As a result, you may get a warning
2129 even when there is in fact no problem because @code{longjmp} cannot
2130 in fact be called at the place which would cause a problem.
2131
2132 Some spurious warnings can be avoided if you declare all the functions
2133 you use that never return as @code{noreturn}.  @xref{Function
2134 Attributes}.
2135
2136 @item -Wreorder (C++ only)
2137 @opindex Wreorder
2138 @cindex reordering, warning
2139 @cindex warning for reordering of member initializers
2140 Warn when the order of member initializers given in the code does not
2141 match the order in which they must be executed.  For instance:
2142
2143 @item -Wunknown-pragmas
2144 @opindex Wunknown-pragmas
2145 @cindex warning for unknown pragmas
2146 @cindex unknown pragmas, warning
2147 @cindex pragmas, warning of unknown
2148 Warn when a #pragma directive is encountered which is not understood by
2149 GCC.  If this command line option is used, warnings will even be issued
2150 for unknown pragmas in system header files.  This is not the case if
2151 the warnings were only enabled by the @option{-Wall} command line option.
2152
2153 @item -Wall
2154 @opindex Wall
2155 All of the above @samp{-W} options combined.  This enables all the
2156 warnings about constructions that some users consider questionable, and
2157 that are easy to avoid (or modify to prevent the warning), even in
2158 conjunction with macros.
2159
2160 @item -Wsystem-headers
2161 @opindex Wsystem-headers
2162 @cindex warnings from system headers
2163 @cindex system headers, warnings from
2164 Print warning messages for constructs found in system header files.
2165 Warnings from system headers are normally suppressed, on the assumption
2166 that they usually do not indicate real problems and would only make the
2167 compiler output harder to read.  Using this command line option tells
2168 GCC to emit warnings from system headers as if they occurred in user
2169 code.  However, note that using @option{-Wall} in conjunction with this
2170 option will @emph{not} warn about unknown pragmas in system
2171 headers---for that, @option{-Wunknown-pragmas} must also be used.
2172 @end table
2173
2174 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2175 Some of them warn about constructions that users generally do not
2176 consider questionable, but which occasionally you might wish to check
2177 for; others warn about constructions that are necessary or hard to avoid
2178 in some cases, and there is no simple way to modify the code to suppress
2179 the warning.
2180
2181 @table @gcctabopt
2182 @item -W
2183 @opindex W
2184 Print extra warning messages for these events:
2185
2186 @itemize @bullet
2187 @item
2188 A function can return either with or without a value.  (Falling
2189 off the end of the function body is considered returning without
2190 a value.)  For example, this function would evoke such a
2191 warning:
2192
2193 @smallexample
2194 @group
2195 foo (a)
2196 @{
2197   if (a > 0)
2198     return a;
2199 @}
2200 @end group
2201 @end smallexample
2202
2203 @item
2204 An expression-statement or the left-hand side of a comma expression
2205 contains no side effects.
2206 To suppress the warning, cast the unused expression to void.
2207 For example, an expression such as @samp{x[i,j]} will cause a warning,
2208 but @samp{x[(void)i,j]} will not.
2209
2210 @item
2211 An unsigned value is compared against zero with @samp{<} or @samp{<=}.
2212
2213 @item
2214 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2215 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2216 that of ordinary mathematical notation.
2217
2218 @item
2219 Storage-class specifiers like @code{static} are not the first things in
2220 a declaration.  According to the C Standard, this usage is obsolescent.
2221
2222 @item
2223 The return type of a function has a type qualifier such as @code{const}.
2224 Such a type qualifier has no effect, since the value returned by a
2225 function is not an lvalue.  (But don't warn about the GNU extension of
2226 @code{volatile void} return types.  That extension will be warned about
2227 if @option{-pedantic} is specified.)
2228
2229 @item
2230 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2231 arguments.
2232
2233 @item
2234 A comparison between signed and unsigned values could produce an
2235 incorrect result when the signed value is converted to unsigned.
2236 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2237
2238 @item
2239 An aggregate has a partly bracketed initializer.
2240 For example, the following code would evoke such a warning,
2241 because braces are missing around the initializer for @code{x.h}:
2242
2243 @smallexample
2244 struct s @{ int f, g; @};
2245 struct t @{ struct s h; int i; @};
2246 struct t x = @{ 1, 2, 3 @};
2247 @end smallexample
2248
2249 @item
2250 An aggregate has an initializer which does not initialize all members.
2251 For example, the following code would cause such a warning, because
2252 @code{x.h} would be implicitly initialized to zero:
2253
2254 @smallexample
2255 struct s @{ int f, g, h; @};
2256 struct s x = @{ 3, 4 @};
2257 @end smallexample
2258 @end itemize
2259
2260 @item -Wfloat-equal
2261 @opindex Wfloat-equal
2262 Warn if floating point values are used in equality comparisons.
2263
2264 The idea behind this is that sometimes it is convenient (for the
2265 programmer) to consider floating-point values as approximations to
2266 infinitely precise real numbers.  If you are doing this, then you need
2267 to compute (by analysing the code, or in some other way) the maximum or
2268 likely maximum error that the computation introduces, and allow for it
2269 when performing comparisons (and when producing output, but that's a
2270 different problem).  In particular, instead of testing for equality, you
2271 would check to see whether the two values have ranges that overlap; and
2272 this is done with the relational operators, so equality comparisons are
2273 probably mistaken.
2274
2275 @item -Wtraditional (C only)
2276 @opindex Wtraditional
2277 Warn about certain constructs that behave differently in traditional and
2278 ISO C.  Also warn about ISO C constructs that have no traditional C
2279 equivalent, and/or problematic constructs which should be avoided.
2280
2281 @itemize @bullet
2282 @item
2283 Macro parameters that appear within string literals in the macro body.
2284 In traditional C macro replacement takes place within string literals,
2285 but does not in ISO C.
2286
2287 @item
2288 In traditional C, some preprocessor directives did not exist.
2289 Traditional preprocessors would only consider a line to be a directive
2290 if the @samp{#} appeared in column 1 on the line.  Therefore
2291 @option{-Wtraditional} warns about directives that traditional C
2292 understands but would ignore because the @samp{#} does not appear as the
2293 first character on the line.  It also suggests you hide directives like
2294 @samp{#pragma} not understood by traditional C by indenting them.  Some
2295 traditional implementations would not recognise @samp{#elif}, so it
2296 suggests avoiding it altogether.
2297
2298 @item
2299 A function-like macro that appears without arguments.
2300
2301 @item
2302 The unary plus operator.
2303
2304 @item
2305 The `U' integer constant suffix, or the `F' or `L' floating point
2306 constant suffixes.  (Traditonal C does support the `L' suffix on integer
2307 constants.)  Note, these suffixes appear in macros defined in the system
2308 headers of most modern systems, e.g. the _MIN/_MAX macros in limits.h.
2309 Use of these macros in user code might normally lead to spurious
2310 warnings, however gcc's integrated preprocessor has enough context to
2311 avoid warning in these cases.
2312
2313 @item
2314 A function declared external in one block and then used after the end of
2315 the block.
2316
2317 @item
2318 A @code{switch} statement has an operand of type @code{long}.
2319
2320 @item
2321 A non-@code{static} function declaration follows a @code{static} one.
2322 This construct is not accepted by some traditional C compilers.
2323
2324 @item
2325 The ISO type of an integer constant has a different width or
2326 signedness from its traditional type.  This warning is only issued if
2327 the base of the constant is ten.  I.e. hexadecimal or octal values, which
2328 typically represent bit patterns, are not warned about.
2329
2330 @item
2331 Usage of ISO string concatenation is detected.
2332
2333 @item
2334 Initialization of automatic aggregates.
2335
2336 @item
2337 Identifier conflicts with labels.  Traditional C lacks a separate
2338 namespace for labels.
2339
2340 @item
2341 Initialization of unions.  If the initializer is zero, the warning is
2342 omitted.  This is done under the assumption that the zero initializer in
2343 user code appears conditioned on e.g. @code{__STDC__} to avoid missing
2344 initializer warnings and relies on default initialization to zero in the
2345 traditional C case.
2346
2347 @item
2348 Conversions by prototypes between fixed/floating point values and vice
2349 versa.  The absence of these prototypes when compiling with traditional
2350 C would cause serious problems.  This is a subset of the possible
2351 conversion warnings, for the full set use @option{-Wconversion}.
2352 @end itemize
2353
2354 @item -Wundef
2355 @opindex Wundef
2356 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2357
2358 @item -Wshadow
2359 @opindex Wshadow
2360 Warn whenever a local variable shadows another local variable, parameter or
2361 global variable or whenever a built-in function is shadowed.
2362
2363 @item -Wlarger-than-@var{len}
2364 @opindex Wlarger-than
2365 Warn whenever an object of larger than @var{len} bytes is defined.
2366
2367 @item -Wpointer-arith
2368 @opindex Wpointer-arith
2369 Warn about anything that depends on the ``size of'' a function type or
2370 of @code{void}.  GNU C assigns these types a size of 1, for
2371 convenience in calculations with @code{void *} pointers and pointers
2372 to functions.
2373
2374 @item -Wbad-function-cast (C only)
2375 @opindex Wbad-function-cast
2376 Warn whenever a function call is cast to a non-matching type.
2377 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2378
2379 @item -Wcast-qual
2380 @opindex Wcast-qual
2381 Warn whenever a pointer is cast so as to remove a type qualifier from
2382 the target type.  For example, warn if a @code{const char *} is cast
2383 to an ordinary @code{char *}.
2384
2385 @item -Wcast-align
2386 @opindex Wcast-align
2387 Warn whenever a pointer is cast such that the required alignment of the
2388 target is increased.  For example, warn if a @code{char *} is cast to
2389 an @code{int *} on machines where integers can only be accessed at
2390 two- or four-byte boundaries.
2391
2392 @item -Wwrite-strings
2393 @opindex Wwrite-strings
2394 Give string constants the type @code{const char[@var{length}]} so that
2395 copying the address of one into a non-@code{const} @code{char *}
2396 pointer will get a warning.  These warnings will help you find at
2397 compile time code that can try to write into a string constant, but
2398 only if you have been very careful about using @code{const} in
2399 declarations and prototypes.  Otherwise, it will just be a nuisance;
2400 this is why we did not make @option{-Wall} request these warnings.
2401
2402 @item -Wconversion
2403 @opindex Wconversion
2404 Warn if a prototype causes a type conversion that is different from what
2405 would happen to the same argument in the absence of a prototype.  This
2406 includes conversions of fixed point to floating and vice versa, and
2407 conversions changing the width or signedness of a fixed point argument
2408 except when the same as the default promotion.
2409
2410 Also, warn if a negative integer constant expression is implicitly
2411 converted to an unsigned type.  For example, warn about the assignment
2412 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2413 casts like @code{(unsigned) -1}.
2414
2415 @item -Wsign-compare
2416 @opindex Wsign-compare
2417 @cindex warning for comparison of signed and unsigned values
2418 @cindex comparison of signed and unsigned values, warning
2419 @cindex signed and unsigned values, comparison warning
2420 Warn when a comparison between signed and unsigned values could produce
2421 an incorrect result when the signed value is converted to unsigned.
2422 This warning is also enabled by @option{-W}; to get the other warnings
2423 of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}.
2424
2425 @item -Waggregate-return
2426 @opindex Waggregate-return
2427 Warn if any functions that return structures or unions are defined or
2428 called.  (In languages where you can return an array, this also elicits
2429 a warning.)
2430
2431 @item -Wstrict-prototypes (C only)
2432 @opindex Wstrict-prototypes
2433 Warn if a function is declared or defined without specifying the
2434 argument types.  (An old-style function definition is permitted without
2435 a warning if preceded by a declaration which specifies the argument
2436 types.)
2437
2438 @item -Wmissing-prototypes (C only)
2439 @opindex Wmissing-prototypes
2440 Warn if a global function is defined without a previous prototype
2441 declaration.  This warning is issued even if the definition itself
2442 provides a prototype.  The aim is to detect global functions that fail
2443 to be declared in header files.
2444
2445 @item -Wmissing-declarations
2446 @opindex Wmissing-declarations
2447 Warn if a global function is defined without a previous declaration.
2448 Do so even if the definition itself provides a prototype.
2449 Use this option to detect global functions that are not declared in
2450 header files.
2451
2452 @item -Wmissing-noreturn
2453 @opindex Wmissing-noreturn
2454 Warn about functions which might be candidates for attribute @code{noreturn}.
2455 Note these are only possible candidates, not absolute ones.  Care should
2456 be taken to manually verify functions actually do not ever return before
2457 adding the @code{noreturn} attribute, otherwise subtle code generation
2458 bugs could be introduced.  You will not get a warning for @code{main} in
2459 hosted C environments.
2460
2461 @item -Wmissing-format-attribute
2462 @opindex Wmissing-format-attribute
2463 @opindex Wformat
2464 If @option{-Wformat} is enabled, also warn about functions which might be
2465 candidates for @code{format} attributes.  Note these are only possible
2466 candidates, not absolute ones.  GCC will guess that @code{format}
2467 attributes might be appropriate for any function that calls a function
2468 like @code{vprintf} or @code{vscanf}, but this might not always be the
2469 case, and some functions for which @code{format} attributes are
2470 appropriate may not be detected.  This option has no effect unless
2471 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2472
2473 @item -Wpacked
2474 @opindex Wpacked
2475 Warn if a structure is given the packed attribute, but the packed
2476 attribute has no effect on the layout or size of the structure.
2477 Such structures may be mis-aligned for little benefit.  For
2478 instance, in this code, the variable @code{f.x} in @code{struct bar}
2479 will be misaligned even though @code{struct bar} does not itself
2480 have the packed attribute:
2481
2482 @smallexample
2483 @group
2484 struct foo @{
2485   int x;
2486   char a, b, c, d;
2487 @} __attribute__((packed));
2488 struct bar @{
2489   char z;
2490   struct foo f;
2491 @};
2492 @end group
2493 @end smallexample
2494
2495 @item -Wpadded
2496 @opindex Wpadded
2497 Warn if padding is included in a structure, either to align an element
2498 of the structure or to align the whole structure.  Sometimes when this
2499 happens it is possible to rearrange the fields of the structure to
2500 reduce the padding and so make the structure smaller.
2501
2502 @item -Wredundant-decls
2503 @opindex Wredundant-decls
2504 Warn if anything is declared more than once in the same scope, even in
2505 cases where multiple declaration is valid and changes nothing.
2506
2507 @item -Wnested-externs (C only)
2508 @opindex Wnested-externs
2509 Warn if an @code{extern} declaration is encountered within a function.
2510
2511 @item -Wunreachable-code
2512 @opindex Wunreachable-code
2513 Warn if the compiler detects that code will never be executed.
2514
2515 This option is intended to warn when the compiler detects that at
2516 least a whole line of source code will never be executed, because
2517 some condition is never satisfied or because it is after a
2518 procedure that never returns.
2519
2520 It is possible for this option to produce a warning even though there
2521 are circumstances under which part of the affected line can be executed,
2522 so care should be taken when removing apparently-unreachable code.
2523
2524 For instance, when a function is inlined, a warning may mean that the
2525 line is unreachable in only one inlined copy of the function.
2526
2527 This option is not made part of @option{-Wall} because in a debugging
2528 version of a program there is often substantial code which checks
2529 correct functioning of the program and is, hopefully, unreachable
2530 because the program does work.  Another common use of unreachable
2531 code is to provide behaviour which is selectable at compile-time.
2532
2533 @item -Winline
2534 @opindex Winline
2535 Warn if a function can not be inlined and it was declared as inline.
2536
2537 @item -Wlong-long
2538 @opindex Wlong-long
2539 @opindex Wno-long-long
2540 Warn if @samp{long long} type is used.  This is default.  To inhibit
2541 the warning messages, use @option{-Wno-long-long}.  Flags
2542 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2543 only when @option{-pedantic} flag is used.
2544
2545 @item -Wdisabled-optimization
2546 @opindex Wdisabled-optimization
2547 Warn if a requested optimization pass is disabled.  This warning does
2548 not generally indicate that there is anything wrong with your code; it
2549 merely indicates that GCC's optimizers were unable to handle the code
2550 effectively.  Often, the problem is that your code is too big or too
2551 complex; GCC will refuse to optimize programs when the optimization
2552 itself is likely to take inordinate amounts of time.
2553
2554 @item -Werror
2555 @opindex Werror
2556 Make all warnings into errors.
2557 @end table
2558
2559 @node Debugging Options
2560 @section Options for Debugging Your Program or GCC
2561 @cindex options, debugging
2562 @cindex debugging information options
2563
2564 GCC has various special options that are used for debugging
2565 either your program or GCC:
2566
2567 @table @gcctabopt
2568 @item -g
2569 @opindex g
2570 Produce debugging information in the operating system's native format
2571 (stabs, COFF, XCOFF, or DWARF).  GDB can work with this debugging
2572 information.
2573
2574 On most systems that use stabs format, @option{-g} enables use of extra
2575 debugging information that only GDB can use; this extra information
2576 makes debugging work better in GDB but will probably make other debuggers
2577 crash or
2578 refuse to read the program.  If you want to control for certain whether
2579 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
2580 @option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, or @option{-gdwarf-1}
2581 (see below).
2582
2583 Unlike most other C compilers, GCC allows you to use @option{-g} with
2584 @option{-O}.  The shortcuts taken by optimized code may occasionally
2585 produce surprising results: some variables you declared may not exist
2586 at all; flow of control may briefly move where you did not expect it;
2587 some statements may not be executed because they compute constant
2588 results or their values were already at hand; some statements may
2589 execute in different places because they were moved out of loops.
2590
2591 Nevertheless it proves possible to debug optimized output.  This makes
2592 it reasonable to use the optimizer for programs that might have bugs.
2593
2594 The following options are useful when GCC is generated with the
2595 capability for more than one debugging format.
2596
2597 @item -ggdb
2598 @opindex ggdb
2599 Produce debugging information for use by GDB.  This means to use the
2600 most expressive format available (DWARF 2, stabs, or the native format
2601 if neither of those are supported), including GDB extensions if at all
2602 possible.
2603
2604 @item -gstabs
2605 @opindex gstabs
2606 Produce debugging information in stabs format (if that is supported),
2607 without GDB extensions.  This is the format used by DBX on most BSD
2608 systems.  On MIPS, Alpha and System V Release 4 systems this option
2609 produces stabs debugging output which is not understood by DBX or SDB.
2610 On System V Release 4 systems this option requires the GNU assembler.
2611
2612 @item -gstabs+
2613 @opindex gstabs+
2614 Produce debugging information in stabs format (if that is supported),
2615 using GNU extensions understood only by the GNU debugger (GDB).  The
2616 use of these extensions is likely to make other debuggers crash or
2617 refuse to read the program.
2618
2619 @item -gcoff
2620 @opindex gcoff
2621 Produce debugging information in COFF format (if that is supported).
2622 This is the format used by SDB on most System V systems prior to
2623 System V Release 4.
2624
2625 @item -gxcoff
2626 @opindex gxcoff
2627 Produce debugging information in XCOFF format (if that is supported).
2628 This is the format used by the DBX debugger on IBM RS/6000 systems.
2629
2630 @item -gxcoff+
2631 @opindex gxcoff+
2632 Produce debugging information in XCOFF format (if that is supported),
2633 using GNU extensions understood only by the GNU debugger (GDB).  The
2634 use of these extensions is likely to make other debuggers crash or
2635 refuse to read the program, and may cause assemblers other than the GNU
2636 assembler (GAS) to fail with an error.
2637
2638 @item -gdwarf
2639 @opindex gdwarf
2640 Produce debugging information in DWARF version 1 format (if that is
2641 supported).  This is the format used by SDB on most System V Release 4
2642 systems.
2643
2644 @item -gdwarf+
2645 @opindex gdwarf+
2646 Produce debugging information in DWARF version 1 format (if that is
2647 supported), using GNU extensions understood only by the GNU debugger
2648 (GDB).  The use of these extensions is likely to make other debuggers
2649 crash or refuse to read the program.
2650
2651 @item -gdwarf-2
2652 @opindex gdwarf-2
2653 Produce debugging information in DWARF version 2 format (if that is
2654 supported).  This is the format used by DBX on IRIX 6.
2655
2656 @item -g@var{level}
2657 @itemx -ggdb@var{level}
2658 @itemx -gstabs@var{level}
2659 @itemx -gcoff@var{level}
2660 @itemx -gxcoff@var{level}
2661 @itemx -gdwarf@var{level}
2662 @itemx -gdwarf-2@var{level}
2663 Request debugging information and also use @var{level} to specify how
2664 much information.  The default level is 2.
2665
2666 Level 1 produces minimal information, enough for making backtraces in
2667 parts of the program that you don't plan to debug.  This includes
2668 descriptions of functions and external variables, but no information
2669 about local variables and no line numbers.
2670
2671 Level 3 includes extra information, such as all the macro definitions
2672 present in the program.  Some debuggers support macro expansion when
2673 you use @option{-g3}.
2674
2675 @cindex @code{prof}
2676 @item -p
2677 @opindex p
2678 Generate extra code to write profile information suitable for the
2679 analysis program @code{prof}.  You must use this option when compiling
2680 the source files you want data about, and you must also use it when
2681 linking.
2682
2683 @cindex @code{gprof}
2684 @item -pg
2685 @opindex pg
2686 Generate extra code to write profile information suitable for the
2687 analysis program @code{gprof}.  You must use this option when compiling
2688 the source files you want data about, and you must also use it when
2689 linking.
2690
2691 @cindex @code{tcov}
2692 @item -a
2693 @opindex a
2694 Generate extra code to write profile information for basic blocks, which will
2695 record the number of times each basic block is executed, the basic block start
2696 address, and the function name containing the basic block.  If @option{-g} is
2697 used, the line number and filename of the start of the basic block will also be
2698 recorded.  If not overridden by the machine description, the default action is
2699 to append to the text file @file{bb.out}.
2700
2701 This data could be analyzed by a program like @code{tcov}.  Note,
2702 however, that the format of the data is not what @code{tcov} expects.
2703 Eventually GNU @code{gprof} should be extended to process this data.
2704
2705 @item -Q
2706 @opindex Q
2707 Makes the compiler print out each function name as it is compiled, and
2708 print some statistics about each pass when it finishes.
2709
2710 @item -ftime-report
2711 @opindex ftime-report
2712 Makes the compiler print some statistics about the time consumed by each
2713 pass when it finishes.
2714
2715 @item -fmem-report
2716 @opindex fmem-report
2717 Makes the compiler print some statistics about permanent memory
2718 allocation when it finishes.
2719
2720 @item -ax
2721 @opindex ax
2722 Generate extra code to profile basic blocks.  Your executable will
2723 produce output that is a superset of that produced when @option{-a} is
2724 used.  Additional output is the source and target address of the basic
2725 blocks where a jump takes place, the number of times a jump is executed,
2726 and (optionally) the complete sequence of basic blocks being executed.
2727 The output is appended to file @file{bb.out}.
2728
2729 You can examine different profiling aspects without recompilation.  Your
2730 executable will read a list of function names from file @file{bb.in}.
2731 Profiling starts when a function on the list is entered and stops when
2732 that invocation is exited.  To exclude a function from profiling, prefix
2733 its name with `-'.  If a function name is not unique, you can
2734 disambiguate it by writing it in the form
2735 @samp{/path/filename.d:functionname}.  Your executable will write the
2736 available paths and filenames in file @file{bb.out}.
2737
2738 Several function names have a special meaning:
2739 @table @code
2740 @item __bb_jumps__
2741 Write source, target and frequency of jumps to file @file{bb.out}.
2742 @item __bb_hidecall__
2743 Exclude function calls from frequency count.
2744 @item __bb_showret__
2745 Include function returns in frequency count.
2746 @item __bb_trace__
2747 Write the sequence of basic blocks executed to file @file{bbtrace.gz}.
2748 The file will be compressed using the program @samp{gzip}, which must
2749 exist in your @env{PATH}.  On systems without the @samp{popen}
2750 function, the file will be named @file{bbtrace} and will not be
2751 compressed.  @strong{Profiling for even a few seconds on these systems
2752 will produce a very large file.}  Note: @code{__bb_hidecall__} and
2753 @code{__bb_showret__} will not affect the sequence written to
2754 @file{bbtrace.gz}.
2755 @end table
2756
2757 Here's a short example using different profiling parameters
2758 in file @file{bb.in}.  Assume function @code{foo} consists of basic blocks
2759 1 and 2 and is called twice from block 3 of function @code{main}.  After
2760 the calls, block 3 transfers control to block 4 of @code{main}.
2761
2762 With @code{__bb_trace__} and @code{main} contained in file @file{bb.in},
2763 the following sequence of blocks is written to file @file{bbtrace.gz}:
2764 0 3 1 2 1 2 4.  The return from block 2 to block 3 is not shown, because
2765 the return is to a point inside the block and not to the top.  The
2766 block address 0 always indicates, that control is transferred
2767 to the trace from somewhere outside the observed functions.  With
2768 @samp{-foo} added to @file{bb.in}, the blocks of function
2769 @code{foo} are removed from the trace, so only 0 3 4 remains.
2770
2771 With @code{__bb_jumps__} and @code{main} contained in file @file{bb.in},
2772 jump frequencies will be written to file @file{bb.out}.  The
2773 frequencies are obtained by constructing a trace of blocks
2774 and incrementing a counter for every neighbouring pair of blocks
2775 in the trace.  The trace 0 3 1 2 1 2 4 displays the following
2776 frequencies:
2777
2778 @example
2779 Jump from block 0x0 to block 0x3 executed 1 time(s)
2780 Jump from block 0x3 to block 0x1 executed 1 time(s)
2781 Jump from block 0x1 to block 0x2 executed 2 time(s)
2782 Jump from block 0x2 to block 0x1 executed 1 time(s)
2783 Jump from block 0x2 to block 0x4 executed 1 time(s)
2784 @end example
2785
2786 With @code{__bb_hidecall__}, control transfer due to call instructions
2787 is removed from the trace, that is the trace is cut into three parts: 0
2788 3 4, 0 1 2 and 0 1 2.  With @code{__bb_showret__}, control transfer due
2789 to return instructions is added to the trace.  The trace becomes: 0 3 1
2790 2 3 1 2 3 4.  Note, that this trace is not the same, as the sequence
2791 written to @file{bbtrace.gz}.  It is solely used for counting jump
2792 frequencies.
2793
2794 @item -fprofile-arcs
2795 @opindex fprofile-arcs
2796 Instrument @dfn{arcs} during compilation.  For each function of your
2797 program, GCC creates a program flow graph, then finds a spanning tree
2798 for the graph.  Only arcs that are not on the spanning tree have to be
2799 instrumented: the compiler adds code to count the number of times that these
2800 arcs are executed.  When an arc is the only exit or only entrance to a
2801 block, the instrumentation code can be added to the block; otherwise, a
2802 new basic block must be created to hold the instrumentation code.
2803
2804 Since not every arc in the program must be instrumented, programs
2805 compiled with this option run faster than programs compiled with
2806 @option{-a}, which adds instrumentation code to every basic block in the
2807 program.  The tradeoff: since @code{gcov} does not have
2808 execution counts for all branches, it must start with the execution
2809 counts for the instrumented branches, and then iterate over the program
2810 flow graph until the entire graph has been solved.  Hence, @code{gcov}
2811 runs a little more slowly than a program which uses information from
2812 @option{-a}.
2813
2814 @option{-fprofile-arcs} also makes it possible to estimate branch
2815 probabilities, and to calculate basic block execution counts.  In
2816 general, basic block execution counts do not give enough information to
2817 estimate all branch probabilities.  When the compiled program exits, it
2818 saves the arc execution counts to a file called
2819 @file{@var{sourcename}.da}.  Use the compiler option
2820 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
2821 Control Optimization}) when recompiling, to optimize using estimated
2822 branch probabilities.
2823
2824 @need 2000
2825 @item -ftest-coverage
2826 @opindex ftest-coverage
2827 Create data files for the @code{gcov} code-coverage utility
2828 (@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}).
2829 The data file names begin with the name of your source file:
2830
2831 @table @gcctabopt
2832 @item @var{sourcename}.bb
2833 A mapping from basic blocks to line numbers, which @code{gcov} uses to
2834 associate basic block execution counts with line numbers.
2835
2836 @item @var{sourcename}.bbg
2837 A list of all arcs in the program flow graph.  This allows @code{gcov}
2838 to reconstruct the program flow graph, so that it can compute all basic
2839 block and arc execution counts from the information in the
2840 @code{@var{sourcename}.da} file (this last file is the output from
2841 @option{-fprofile-arcs}).
2842 @end table
2843
2844 @item -d@var{letters}
2845 @opindex d
2846 Says to make debugging dumps during compilation at times specified by
2847 @var{letters}.  This is used for debugging the compiler.  The file names
2848 for most of the dumps are made by appending a pass number and a word to
2849 the source file name (e.g.  @file{foo.c.00.rtl} or @file{foo.c.01.sibling}).
2850 Here are the possible letters for use in @var{letters}, and their meanings:
2851
2852 @table @samp
2853 @item A
2854 @opindex dA
2855 Annotate the assembler output with miscellaneous debugging information.
2856 @item b
2857 @opindex db
2858 Dump after computing branch probabilities, to @file{@var{file}.11.bp}.
2859 @item B
2860 @opindex dB
2861 Dump after block reordering, to @file{@var{file}.26.bbro}.
2862 @item c
2863 @opindex dc
2864 Dump after instruction combination, to the file @file{@var{file}.14.combine}.
2865 @item C
2866 @opindex dC
2867 Dump after the first if conversion, to the file @file{@var{file}.15.ce}.
2868 @item d
2869 @opindex dd
2870 Dump after delayed branch scheduling, to @file{@var{file}.29.dbr}.
2871 @item D
2872 @opindex dD
2873 Dump all macro definitions, at the end of preprocessing, in addition to
2874 normal output.
2875 @item e
2876 @opindex de
2877 Dump after SSA optimizations, to @file{@var{file}.05.ssa} and
2878 @file{@var{file}.06.ussa}.
2879 @item E
2880 @opindex dE
2881 Dump after the second if conversion, to @file{@var{file}.24.ce2}.
2882 @item f
2883 @opindex df
2884 Dump after life analysis, to @file{@var{file}.13.life}.
2885 @item F
2886 @opindex dF
2887 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.04.addressof}.
2888 @item g
2889 @opindex dg
2890 Dump after global register allocation, to @file{@var{file}.19.greg}.
2891 @item o
2892 @opindex do
2893 Dump after post-reload CSE and other optimizations, to @file{@var{file}.20.postreload}.
2894 @item G
2895 @opindex dG
2896 Dump after GCSE, to @file{@var{file}.08.gcse}.
2897 @item i
2898 @opindex di
2899 Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
2900 @item j
2901 @opindex dj
2902 Dump after the first jump optimization, to @file{@var{file}.02.jump}.
2903 @item J
2904 @opindex dJ
2905 Dump after the last jump optimization, to @file{@var{file}.27.jump2}.
2906 @item k
2907 @opindex dk
2908 Dump after conversion from registers to stack, to @file{@var{file}.29.stack}.
2909 @item l
2910 @opindex dl
2911 Dump after local register allocation, to @file{@var{file}.18.lreg}.
2912 @item L
2913 @opindex dL
2914 Dump after loop optimization, to @file{@var{file}.09.loop}.
2915 @item M
2916 @opindex dM
2917 Dump after performing the machine dependent reorganisation pass, to
2918 @file{@var{file}.28.mach}.
2919 @item n
2920 @opindex dn
2921 Dump after register renumbering, to @file{@var{file}.23.rnreg}.
2922 @item N
2923 @opindex dN
2924 Dump after the register move pass, to @file{@var{file}.16.regmove}.
2925 @item r
2926 @opindex dr
2927 Dump after RTL generation, to @file{@var{file}.00.rtl}.
2928 @item R
2929 @opindex dR
2930 Dump after the second instruction scheduling pass, to
2931 @file{@var{file}.25.sched2}.
2932 @item s
2933 @opindex ds
2934 Dump after CSE (including the jump optimization that sometimes follows
2935 CSE), to @file{@var{file}.03.cse}.
2936 @item S
2937 @opindex dS
2938 Dump after the first instruction scheduling pass, to
2939 @file{@var{file}.17.sched}.
2940 @item t
2941 @opindex dt
2942 Dump after the second CSE pass (including the jump optimization that
2943 sometimes follows CSE), to @file{@var{file}.10.cse2}.
2944 @item w
2945 @opindex dw
2946 Dump after the second flow pass, to @file{@var{file}.21.flow2}.
2947 @item X
2948 @opindex dX
2949 Dump after dead code elimination, to @file{@var{file}.06.dce}.
2950 @item z
2951 @opindex dz
2952 Dump after the peephole pass, to @file{@var{file}.22.peephole2}.
2953 @item a
2954 @opindex da
2955 Produce all the dumps listed above.
2956 @item m
2957 @opindex dm
2958 Print statistics on memory usage, at the end of the run, to
2959 standard error.
2960 @item p
2961 @opindex dp
2962 Annotate the assembler output with a comment indicating which
2963 pattern and alternative was used.  The length of each instruction is
2964 also printed.
2965 @item P
2966 @opindex dP
2967 Dump the RTL in the assembler output as a comment before each instruction.
2968 Also turns on @option{-dp} annotation.
2969 @item v
2970 @opindex dv
2971 For each of the other indicated dump files (except for
2972 @file{@var{file}.00.rtl}), dump a representation of the control flow graph
2973 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
2974 @item x
2975 @opindex dx
2976 Just generate RTL for a function instead of compiling it.  Usually used
2977 with @samp{r}.
2978 @item y
2979 @opindex dy
2980 Dump debugging information during parsing, to standard error.
2981 @end table
2982
2983 @item -fdump-unnumbered
2984 @opindex fdump-unnumbered
2985 When doing debugging dumps (see @option{-d} option above), suppress instruction
2986 numbers and line number note output.  This makes it more feasible to
2987 use diff on debugging dumps for compiler invocations with different
2988 options, in particular with and without @option{-g}.
2989
2990 @item -fdump-translation-unit (C and C++ only)
2991 @item -fdump-translation-unit-@var{number} (C and C++ only)
2992 @opindex fdump-translation-unit
2993 Dump a representation of the tree structure for the entire translation
2994 unit to a file. The file name is made by appending @file{.tu} to the
2995 source file name. If the @samp{-@var{number}} form is used, @var{number}
2996 controls the details of the dump as described for the @option{-fdump-tree} options.
2997
2998 @item -fdump-class-hierarchy (C++ only)
2999 @item -fdump-class-hierarchy-@var{number} (C++ only)
3000 @opindex fdump-class-hierarchy
3001 Dump a representation of each class's hierarchy and virtual function
3002 table layout to a file. The file name is made by appending @file{.class}
3003 to the source file name. If the @samp{-@var{number}} form is used, @var{number}
3004 controls the details of the dump as described for the @option{-fdump-tree}
3005 options.
3006
3007 @item -fdump-ast-@var{switch} (C++ only)
3008 @item -fdump-ast-@var{switch}-@var{number} (C++ only)
3009 @opindex fdump-ast
3010 Control the dumping at various stages of processing the abstract syntax
3011 tree to a file. The file name is generated by appending a switch
3012 specific suffix to the source file name. If the @samp{-@var{number}} form is
3013 used, @var{number} is a bit mask which controls the details of the
3014 dump. The following bits are meaningful (these are not set symbolically,
3015 as the primary function of these dumps is for debugging gcc itself):
3016
3017 @table @samp
3018 @item bit0 (1)
3019 Print the address of each node. Usually this is not meaningful as it
3020 changes according to the environment and source file.
3021 @item bit1 (2)
3022 Inhibit dumping of members of a scope or body of a function, unless they
3023 are reachable by some other path.
3024 @end table
3025
3026 The following tree dumps are possible:
3027 @table @samp
3028 @item original
3029 Dump before any tree based optimization, to @file{@var{file}.original}.
3030 @item optimized
3031 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3032 @end table
3033
3034 @item -fpretend-float
3035 @opindex fpretend-float
3036 When running a cross-compiler, pretend that the target machine uses the
3037 same floating point format as the host machine.  This causes incorrect
3038 output of the actual floating constants, but the actual instruction
3039 sequence will probably be the same as GCC would make when running on
3040 the target machine.
3041
3042 @item -save-temps
3043 @opindex save-temps
3044 Store the usual ``temporary'' intermediate files permanently; place them
3045 in the current directory and name them based on the source file.  Thus,
3046 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3047 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3048 preprocessed @file{foo.i} output file even though the compiler now
3049 normally uses an integrated preprocessor.
3050
3051 @item -time
3052 @opindex time
3053 Report the CPU time taken by each subprocess in the compilation
3054 sequence.  For C source files, this is the compiler proper and assembler
3055 (plus the linker if linking is done).  The output looks like this:
3056
3057 @smallexample
3058 # cc1 0.12 0.01
3059 # as 0.00 0.01
3060 @end smallexample
3061
3062 The first number on each line is the ``user time,'' that is time spent
3063 executing the program itself.  The second number is ``system time,''
3064 time spent executing operating system routines on behalf of the program.
3065 Both numbers are in seconds.
3066
3067 @item -print-file-name=@var{library}
3068 @opindex print-file-name
3069 Print the full absolute name of the library file @var{library} that
3070 would be used when linking---and don't do anything else.  With this
3071 option, GCC does not compile or link anything; it just prints the
3072 file name.
3073
3074 @item -print-multi-directory
3075 @opindex print-multi-directory
3076 Print the directory name corresponding to the multilib selected by any
3077 other switches present in the command line.  This directory is supposed
3078 to exist in @env{GCC_EXEC_PREFIX}.
3079
3080 @item -print-multi-lib
3081 @opindex print-multi-lib
3082 Print the mapping from multilib directory names to compiler switches
3083 that enable them.  The directory name is separated from the switches by
3084 @samp{;}, and each switch starts with an @samp{@@} instead of the
3085 @samp{-}, without spaces between multiple switches.  This is supposed to
3086 ease shell-processing.
3087
3088 @item -print-prog-name=@var{program}
3089 @opindex print-prog-name
3090 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3091
3092 @item -print-libgcc-file-name
3093 @opindex print-libgcc-file-name
3094 Same as @option{-print-file-name=libgcc.a}.
3095
3096 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3097 but you do want to link with @file{libgcc.a}.  You can do
3098
3099 @example
3100 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3101 @end example
3102
3103 @item -print-search-dirs
3104 @opindex print-search-dirs
3105 Print the name of the configured installation directory and a list of
3106 program and library directories gcc will search---and don't do anything else.
3107
3108 This is useful when gcc prints the error message
3109 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3110 To resolve this you either need to put @file{cpp0} and the other compiler
3111 components where gcc expects to find them, or you can set the environment
3112 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3113 Don't forget the trailing '/'.
3114 @xref{Environment Variables}.
3115
3116 @item -dumpmachine
3117 @opindex dumpmachine
3118 Print the compiler's target machine (for example,
3119 @samp{i686-pc-linux-gnu})---and don't do anything else.
3120
3121 @item -dumpversion
3122 @opindex dumpversion
3123 Print the compiler version (for example, @samp{3.0})---and don't do
3124 anything else.
3125
3126 @item -dumpspecs
3127 @opindex dumpspecs
3128 Print the compiler's built-in specs---and don't do anything else.  (This
3129 is used when GCC itself is being built.)  @xref{Spec Files}.
3130 @end table
3131
3132 @node Optimize Options
3133 @section Options That Control Optimization
3134 @cindex optimize options
3135 @cindex options, optimization
3136
3137 These options control various sorts of optimizations:
3138
3139 @table @gcctabopt
3140 @item -O
3141 @itemx -O1
3142 @opindex O
3143 @opindex O1
3144 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3145 more memory for a large function.
3146
3147 Without @option{-O}, the compiler's goal is to reduce the cost of
3148 compilation and to make debugging produce the expected results.
3149 Statements are independent: if you stop the program with a breakpoint
3150 between statements, you can then assign a new value to any variable or
3151 change the program counter to any other statement in the function and
3152 get exactly the results you would expect from the source code.
3153
3154 Without @option{-O}, the compiler only allocates variables declared
3155 @code{register} in registers.  The resulting compiled code is a little
3156 worse than produced by PCC without @option{-O}.
3157
3158 With @option{-O}, the compiler tries to reduce code size and execution
3159 time.
3160
3161 When you specify @option{-O}, the compiler turns on @option{-fthread-jumps}
3162 and @option{-fdefer-pop} on all machines.  The compiler turns on
3163 @option{-fdelayed-branch} on machines that have delay slots, and
3164 @option{-fomit-frame-pointer} on machines that can support debugging even
3165 without a frame pointer.  On some machines the compiler also turns
3166 on other flags.@refill
3167
3168 @item -O2
3169 @opindex O2
3170 Optimize even more.  GCC performs nearly all supported optimizations
3171 that do not involve a space-speed tradeoff.  The compiler does not
3172 perform loop unrolling or function inlining when you specify @option{-O2}.
3173 As compared to @option{-O}, this option increases both compilation time
3174 and the performance of the generated code.
3175
3176 @option{-O2} turns on all optional optimizations except for loop unrolling,
3177 function inlining, and register renaming.  It also turns on the
3178 @option{-fforce-mem} option on all machines and frame pointer elimination
3179 on machines where doing so does not interfere with debugging.
3180
3181 @item -O3
3182 @opindex O3
3183 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3184 @option{-O2} and also turns on the @option{-finline-functions} and
3185 @option{-frename-registers} options.
3186
3187 @item -O0
3188 @opindex O0
3189 Do not optimize.
3190
3191 @item -Os
3192 @opindex Os
3193 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3194 do not typically increase code size.  It also performs further
3195 optimizations designed to reduce code size.
3196
3197 If you use multiple @option{-O} options, with or without level numbers,
3198 the last such option is the one that is effective.
3199 @end table
3200
3201 Options of the form @option{-f@var{flag}} specify machine-independent
3202 flags.  Most flags have both positive and negative forms; the negative
3203 form of @option{-ffoo} would be @option{-fno-foo}.  In the table below,
3204 only one of the forms is listed---the one which is not the default.
3205 You can figure out the other form by either removing @samp{no-} or
3206 adding it.
3207
3208 @table @gcctabopt
3209 @item -ffloat-store
3210 @opindex ffloat-store
3211 Do not store floating point variables in registers, and inhibit other
3212 options that might change whether a floating point value is taken from a
3213 register or memory.
3214
3215 @cindex floating point precision
3216 This option prevents undesirable excess precision on machines such as
3217 the 68000 where the floating registers (of the 68881) keep more
3218 precision than a @code{double} is supposed to have.  Similarly for the
3219 x86 architecture.  For most programs, the excess precision does only
3220 good, but a few programs rely on the precise definition of IEEE floating
3221 point.  Use @option{-ffloat-store} for such programs, after modifying
3222 them to store all pertinent intermediate computations into variables.
3223
3224 @item -fno-default-inline
3225 @opindex fno-default-inline
3226 Do not make member functions inline by default merely because they are
3227 defined inside the class scope (C++ only).  Otherwise, when you specify
3228 @w{@option{-O}}, member functions defined inside class scope are compiled
3229 inline by default; i.e., you don't need to add @samp{inline} in front of
3230 the member function name.
3231
3232 @item -fno-defer-pop
3233 @opindex fno-defer-pop
3234 Always pop the arguments to each function call as soon as that function
3235 returns.  For machines which must pop arguments after a function call,
3236 the compiler normally lets arguments accumulate on the stack for several
3237 function calls and pops them all at once.
3238
3239 @item -fforce-mem
3240 @opindex fforce-mem
3241 Force memory operands to be copied into registers before doing
3242 arithmetic on them.  This produces better code by making all memory
3243 references potential common subexpressions.  When they are not common
3244 subexpressions, instruction combination should eliminate the separate
3245 register-load.  The @option{-O2} option turns on this option.
3246
3247 @item -fforce-addr
3248 @opindex fforce-addr
3249 Force memory address constants to be copied into registers before
3250 doing arithmetic on them.  This may produce better code just as
3251 @option{-fforce-mem} may.
3252
3253 @item -fomit-frame-pointer
3254 @opindex fomit-frame-pointer
3255 Don't keep the frame pointer in a register for functions that
3256 don't need one.  This avoids the instructions to save, set up and
3257 restore frame pointers; it also makes an extra register available
3258 in many functions.  @strong{It also makes debugging impossible on
3259 some machines.}
3260
3261 @ifset INTERNALS
3262 On some machines, such as the Vax, this flag has no effect, because
3263 the standard calling sequence automatically handles the frame pointer
3264 and nothing is saved by pretending it doesn't exist.  The
3265 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3266 whether a target machine supports this flag.  @xref{Registers}.@refill
3267 @end ifset
3268 @ifclear INTERNALS
3269 On some machines, such as the Vax, this flag has no effect, because
3270 the standard calling sequence automatically handles the frame pointer
3271 and nothing is saved by pretending it doesn't exist.  The
3272 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3273 whether a target machine supports this flag.  @xref{Registers,,Register
3274 Usage, gcc.info, Using and Porting GCC}.@refill
3275 @end ifclear
3276
3277 @item -foptimize-sibling-calls
3278 @opindex foptimize-sibling-calls
3279 Optimize sibling and tail recursive calls.
3280
3281 @item -ftrapv
3282 @opindex ftrapv
3283 This option generates traps for signed overflow on addition, subtraction,
3284 multiplication operations.
3285
3286 @item -fno-inline
3287 @opindex fno-inline
3288 Don't pay attention to the @code{inline} keyword.  Normally this option
3289 is used to keep the compiler from expanding any functions inline.
3290 Note that if you are not optimizing, no functions can be expanded inline.
3291
3292 @item -finline-functions
3293 @opindex finline-functions
3294 Integrate all simple functions into their callers.  The compiler
3295 heuristically decides which functions are simple enough to be worth
3296 integrating in this way.
3297
3298 If all calls to a given function are integrated, and the function is
3299 declared @code{static}, then the function is normally not output as
3300 assembler code in its own right.
3301
3302 @item -finline-limit=@var{n}
3303 @opindex finline-limit
3304 By default, gcc limits the size of functions that can be inlined.  This flag
3305 allows the control of this limit for functions that are explicitly marked as
3306 inline (ie marked with the inline keyword or defined within the class
3307 definition in c++).  @var{n} is the size of functions that can be inlined in
3308 number of pseudo instructions (not counting parameter handling).  The default
3309 value of n is 10000.  Increasing this value can result in more inlined code at
3310 the cost of compilation time and memory consumption.  Decreasing usually makes
3311 the compilation faster and less code will be inlined (which presumably
3312 means slower programs).  This option is particularly useful for programs that
3313 use inlining heavily such as those based on recursive templates with c++.
3314
3315 @emph{Note:} pseudo instruction represents, in this particular context, an
3316 abstract measurement of function's size.  In no way, it represents a count
3317 of assembly instructions and as such its exact meaning might change from one
3318 release to an another.
3319
3320 @item -fkeep-inline-functions
3321 @opindex fkeep-inline-functions
3322 Even if all calls to a given function are integrated, and the function
3323 is declared @code{static}, nevertheless output a separate run-time
3324 callable version of the function.  This switch does not affect
3325 @code{extern inline} functions.
3326
3327 @item -fkeep-static-consts
3328 @opindex fkeep-static-consts
3329 Emit variables declared @code{static const} when optimization isn't turned
3330 on, even if the variables aren't referenced.
3331
3332 GCC enables this option by default.  If you want to force the compiler to
3333 check if the variable was referenced, regardless of whether or not
3334 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3335
3336 @item -fno-function-cse
3337 @opindex fno-function-cse
3338 Do not put function addresses in registers; make each instruction that
3339 calls a constant function contain the function's address explicitly.
3340
3341 This option results in less efficient code, but some strange hacks
3342 that alter the assembler output may be confused by the optimizations
3343 performed when this option is not used.
3344
3345 @item -ffast-math
3346 @opindex ffast-math
3347 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations},
3348 and @option{-fno-trapping-math}.
3349
3350 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
3351
3352 This option should never be turned on by any @option{-O} option since
3353 it can result in incorrect output for programs which depend on
3354 an exact implementation of IEEE or ISO rules/specifications for
3355 math functions.
3356
3357 @item -fno-math-errno
3358 @opindex fno-math-errno
3359 Do not set ERRNO after calling math functions that are executed
3360 with a single instruction, e.g., sqrt.  A program that relies on
3361 IEEE exceptions for math error handling may want to use this flag
3362 for speed while maintaining IEEE arithmetic compatibility.
3363
3364 This option should never be turned on by any @option{-O} option since
3365 it can result in incorrect output for programs which depend on
3366 an exact implementation of IEEE or ISO rules/specifications for
3367 math functions.
3368
3369 The default is @option{-fmath-errno}.  The @option{-ffast-math} option
3370 sets @option{-fno-math-errno}.
3371
3372 @item -funsafe-math-optimizations
3373 @opindex funsafe-math-optimizations
3374 Allow optimizations for floating-point arithmetic that (a) assume
3375 that arguments and results are valid and (b) may violate IEEE or
3376 ANSI standards.
3377
3378 This option should never be turned on by any @option{-O} option since
3379 it can result in incorrect output for programs which depend on
3380 an exact implementation of IEEE or ISO rules/specifications for
3381 math functions.
3382
3383 The default is @option{-fno-unsafe-math-optimizations}.  The
3384 @option{-ffast-math} option sets @option{-funsafe-math-optimizations}.
3385
3386 @item -fno-trapping-math
3387 @opindex fno-trapping-math
3388 Compile code assuming that floating-point operations cannot generate
3389 user-visible traps.  Setting this option may allow faster code
3390 if one relies on ``non-stop'' IEEE arithmetic, for example.
3391
3392 This option should never be turned on by any @option{-O} option since
3393 it can result in incorrect output for programs which depend on
3394 an exact implementation of IEEE or ISO rules/specifications for
3395 math functions.
3396
3397 The default is @option{-ftrapping-math}.  The @option{-ffast-math}
3398 option sets @option{-fno-trapping-math}.
3399 @end table
3400
3401 @c following causes underfulls.. they don't look great, but we deal.
3402 @c --mew 26jan93
3403 The following options control specific optimizations.  The @option{-O2}
3404 option turns on all of these optimizations except @option{-funroll-loops}
3405 and @option{-funroll-all-loops}.  On most machines, the @option{-O} option
3406 turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options,
3407 but specific machines may handle it differently.
3408
3409 You can use the following flags in the rare cases when ``fine-tuning''
3410 of optimizations to be performed is desired.
3411
3412 @table @gcctabopt
3413 @item -fstrength-reduce
3414 @opindex fstrength-reduce
3415 Perform the optimizations of loop strength reduction and
3416 elimination of iteration variables.
3417
3418 @item -fthread-jumps
3419 @opindex fthread-jumps
3420 Perform optimizations where we check to see if a jump branches to a
3421 location where another comparison subsumed by the first is found.  If
3422 so, the first branch is redirected to either the destination of the
3423 second branch or a point immediately following it, depending on whether
3424 the condition is known to be true or false.
3425
3426 @item -fcse-follow-jumps
3427 @opindex fcse-follow-jumps
3428 In common subexpression elimination, scan through jump instructions
3429 when the target of the jump is not reached by any other path.  For
3430 example, when CSE encounters an @code{if} statement with an
3431 @code{else} clause, CSE will follow the jump when the condition
3432 tested is false.
3433
3434 @item -fcse-skip-blocks
3435 @opindex fcse-skip-blocks
3436 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3437 follow jumps which conditionally skip over blocks.  When CSE
3438 encounters a simple @code{if} statement with no else clause,
3439 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3440 body of the @code{if}.
3441
3442 @item -frerun-cse-after-loop
3443 @opindex frerun-cse-after-loop
3444 Re-run common subexpression elimination after loop optimizations has been
3445 performed.
3446
3447 @item -frerun-loop-opt
3448 @opindex frerun-loop-opt
3449 Run the loop optimizer twice.
3450
3451 @item -fgcse
3452 @opindex fgcse
3453 Perform a global common subexpression elimination pass.
3454 This pass also performs global constant and copy propagation.
3455
3456 @item -fgcse-lm
3457 @opindex fgcse-lm
3458 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3459 attempt to move loads which are only killed by stores into themselves. This
3460 allows a loop containing a load/store sequence to be changed to a load outside
3461 the loop, and a copy/store within the loop.
3462
3463 @item -fgcse-sm
3464 @opindex fgcse-sm
3465 When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
3466 subexpression elimination. This pass will attempt to move stores out of loops.
3467 When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
3468 can be changed to a load before the loop and a store after the loop.
3469
3470 @item -fdelete-null-pointer-checks
3471 @opindex fdelete-null-pointer-checks
3472 Use global dataflow analysis to identify and eliminate useless null
3473 pointer checks.  Programs which rely on NULL pointer dereferences @emph{not}
3474 halting the program may not work properly with this option.  Use
3475 -fno-delete-null-pointer-checks to disable this optimizing for programs
3476 which depend on that behavior.
3477
3478 @item -fexpensive-optimizations
3479 @opindex fexpensive-optimizations
3480 Perform a number of minor optimizations that are relatively expensive.
3481
3482 @item -foptimize-register-move
3483 @itemx -fregmove
3484 @opindex foptimize-register-move
3485 @opindex fregmove
3486 Attempt to reassign register numbers in move instructions and as
3487 operands of other simple instructions in order to maximize the amount of
3488 register tying.  This is especially helpful on machines with two-operand
3489 instructions.  GCC enables this optimization by default with @option{-O2}
3490 or higher.
3491
3492 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
3493 optimization.
3494
3495 @item -fdelayed-branch
3496 @opindex fdelayed-branch
3497 If supported for the target machine, attempt to reorder instructions
3498 to exploit instruction slots available after delayed branch
3499 instructions.
3500
3501 @item -fschedule-insns
3502 @opindex fschedule-insns
3503 If supported for the target machine, attempt to reorder instructions to
3504 eliminate execution stalls due to required data being unavailable.  This
3505 helps machines that have slow floating point or memory load instructions
3506 by allowing other instructions to be issued until the result of the load
3507 or floating point instruction is required.
3508
3509 @item -fschedule-insns2
3510 @opindex fschedule-insns2
3511 Similar to @option{-fschedule-insns}, but requests an additional pass of
3512 instruction scheduling after register allocation has been done.  This is
3513 especially useful on machines with a relatively small number of
3514 registers and where memory load instructions take more than one cycle.
3515
3516 @item -ffunction-sections
3517 @itemx -fdata-sections
3518 @opindex ffunction-sections
3519 @opindex fdata-sections
3520 Place each function or data item into its own section in the output
3521 file if the target supports arbitrary sections.  The name of the
3522 function or the name of the data item determines the section's name
3523 in the output file.
3524
3525 Use these options on systems where the linker can perform optimizations
3526 to improve locality of reference in the instruction space.  HPPA
3527 processors running HP-UX and Sparc processors running Solaris 2 have
3528 linkers with such optimizations.  Other systems using the ELF object format
3529 as well as AIX may have these optimizations in the future.
3530
3531 Only use these options when there are significant benefits from doing
3532 so.  When you specify these options, the assembler and linker will
3533 create larger object and executable files and will also be slower.
3534 You will not be able to use @code{gprof} on all systems if you
3535 specify this option and you may have problems with debugging if
3536 you specify both this option and @option{-g}.
3537
3538 @item -fcaller-saves
3539 @opindex fcaller-saves
3540 Enable values to be allocated in registers that will be clobbered by
3541 function calls, by emitting extra instructions to save and restore the
3542 registers around such calls.  Such allocation is done only when it
3543 seems to result in better code than would otherwise be produced.
3544
3545 This option is always enabled by default on certain machines, usually
3546 those which have no call-preserved registers to use instead.
3547
3548 For all machines, optimization level 2 and higher enables this flag by
3549 default.
3550
3551 @item -funroll-loops
3552 @opindex funroll-loops
3553 Perform the optimization of loop unrolling.  This is only done for loops
3554 whose number of iterations can be determined at compile time or run time.
3555 @option{-funroll-loops} implies both @option{-fstrength-reduce} and
3556 @option{-frerun-cse-after-loop}.
3557
3558 @item -funroll-all-loops
3559 @opindex funroll-all-loops
3560 Perform the optimization of loop unrolling.  This is done for all loops
3561 and usually makes programs run more slowly.  @option{-funroll-all-loops}
3562 implies @option{-fstrength-reduce} as well as @option{-frerun-cse-after-loop}.
3563
3564 @item -fmove-all-movables
3565 @opindex fmove-all-movables
3566 Forces all invariant computations in loops to be moved
3567 outside the loop.
3568
3569 @item -freduce-all-givs
3570 @opindex freduce-all-givs
3571 Forces all general-induction variables in loops to be
3572 strength-reduced.
3573
3574 @emph{Note:} When compiling programs written in Fortran,
3575 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
3576 by default when you use the optimizer.
3577
3578 These options may generate better or worse code; results are highly
3579 dependent on the structure of loops within the source code.
3580
3581 These two options are intended to be removed someday, once
3582 they have helped determine the efficacy of various
3583 approaches to improving loop optimizations.
3584
3585 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
3586 know how use of these options affects
3587 the performance of your production code.
3588 We're very interested in code that runs @emph{slower}
3589 when these options are @emph{enabled}.
3590
3591 @item -fno-peephole
3592 @itemx -fno-peephole2
3593 @opindex fno-peephole
3594 @opindex fno-peephole2
3595 Disable any machine-specific peephole optimizations.  The difference
3596 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
3597 are implemented in the compiler; some targets use one, some use the
3598 other, a few use both.
3599
3600 @item -fbranch-probabilities
3601 @opindex fbranch-probabilities
3602 After running a program compiled with @option{-fprofile-arcs}
3603 (@pxref{Debugging Options,, Options for Debugging Your Program or
3604 @command{gcc}}), you can compile it a second time using
3605 @option{-fbranch-probabilities}, to improve optimizations based on
3606 guessing the path a branch might take.
3607
3608 @ifset INTERNALS
3609 With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
3610 note on the first instruction of each basic block, and a
3611 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
3612 These can be used to improve optimization.  Currently, they are only
3613 used in one place: in @file{reorg.c}, instead of guessing which path a
3614 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
3615 exactly determine which path is taken more often.
3616 @end ifset
3617
3618 @item -fno-guess-branch-probability
3619 @opindex fno-guess-branch-probability
3620 Sometimes gcc will opt to guess branch probabilities when none are
3621 available from either profile directed feedback (@option{-fprofile-arcs})
3622 or @samp{__builtin_expect}.  In a hard real-time system, people don't
3623 want different runs of the compiler to produce code that has different
3624 behavior; minimizing non-determinism is of paramount import.  This
3625 switch allows users to reduce non-determinism, possibly at the expense
3626 of inferior optimization.
3627
3628 @item -fstrict-aliasing
3629 @opindex fstrict-aliasing
3630 Allows the compiler to assume the strictest aliasing rules applicable to
3631 the language being compiled.  For C (and C++), this activates
3632 optimizations based on the type of expressions.  In particular, an
3633 object of one type is assumed never to reside at the same address as an
3634 object of a different type, unless the types are almost the same.  For
3635 example, an @code{unsigned int} can alias an @code{int}, but not a
3636 @code{void*} or a @code{double}.  A character type may alias any other
3637 type.
3638
3639 Pay special attention to code like this:
3640 @example
3641 union a_union @{
3642   int i;
3643   double d;
3644 @};
3645
3646 int f() @{
3647   a_union t;
3648   t.d = 3.0;
3649   return t.i;
3650 @}
3651 @end example
3652 The practice of reading from a different union member than the one most
3653 recently written to (called ``type-punning'') is common.  Even with
3654 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
3655 is accessed through the union type.  So, the code above will work as
3656 expected.  However, this code might not:
3657 @example
3658 int f() @{
3659   a_union t;
3660   int* ip;
3661   t.d = 3.0;
3662   ip = &t.i;
3663   return *ip;
3664 @}
3665 @end example
3666
3667 @ifset INTERNALS
3668 Every language that wishes to perform language-specific alias analysis
3669 should define a function that computes, given an @code{tree}
3670 node, an alias set for the node.  Nodes in different alias sets are not
3671 allowed to alias.  For an example, see the C front-end function
3672 @code{c_get_alias_set}.
3673 @end ifset
3674
3675 @item -falign-functions
3676 @itemx -falign-functions=@var{n}
3677 @opindex falign-functions
3678 Align the start of functions to the next power-of-two greater than
3679 @var{n}, skipping up to @var{n} bytes.  For instance,
3680 @option{-falign-functions=32} aligns functions to the next 32-byte
3681 boundary, but @option{-falign-functions=24} would align to the next
3682 32-byte boundary only if this can be done by skipping 23 bytes or less.
3683
3684 @option{-fno-align-functions} and @option{-falign-functions=1} are
3685 equivalent and mean that functions will not be aligned.
3686
3687 Some assemblers only support this flag when @var{n} is a power of two;
3688 in that case, it is rounded up.
3689
3690 If @var{n} is not specified, use a machine-dependent default.
3691
3692 @item -falign-labels
3693 @itemx -falign-labels=@var{n}
3694 @opindex falign-labels
3695 Align all branch targets to a power-of-two boundary, skipping up to
3696 @var{n} bytes like @option{-falign-functions}.  This option can easily
3697 make code slower, because it must insert dummy operations for when the
3698 branch target is reached in the usual flow of the code.
3699
3700 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
3701 are greater than this value, then their values are used instead.
3702
3703 If @var{n} is not specified, use a machine-dependent default which is
3704 very likely to be @samp{1}, meaning no alignment.
3705
3706 @item -falign-loops
3707 @itemx -falign-loops=@var{n}
3708 @opindex falign-loops
3709 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
3710 like @option{-falign-functions}.  The hope is that the loop will be
3711 executed many times, which will make up for any execution of the dummy
3712 operations.
3713
3714 If @var{n} is not specified, use a machine-dependent default.
3715
3716 @item -falign-jumps
3717 @itemx -falign-jumps=@var{n}
3718 @opindex falign-jumps
3719 Align branch targets to a power-of-two boundary, for branch targets
3720 where the targets can only be reached by jumping, skipping up to @var{n}
3721 bytes like @option{-falign-functions}.  In this case, no dummy operations
3722 need be executed.
3723
3724 If @var{n} is not specified, use a machine-dependent default.
3725
3726 @item -fssa
3727 @opindex fssa
3728 Perform optimizations in static single assignment form.  Each function's
3729 flow graph is translated into SSA form, optimizations are performed, and
3730 the flow graph is translated back from SSA form.  Users should not
3731 specify this option, since it is not yet ready for production use.
3732
3733 @item -fdce
3734 @opindex fdce
3735 Perform dead-code elimination in SSA form.  Requires @option{-fssa}.  Like
3736 @option{-fssa}, this is an experimental feature.
3737
3738 @item -fsingle-precision-constant
3739 @opindex fsingle-precision-constant
3740 Treat floating point constant as single precision constant instead of
3741 implicitly converting it to double precision constant.
3742
3743 @item -frename-registers
3744 @opindex frename-registers
3745 Attempt to avoid false dependancies in scheduled code by making use
3746 of registers left over after register allocation.  This optimization
3747 will most benefit processors with lots of registers.  It can, however,
3748 make debugging impossible, since variables will no longer stay in
3749 a ``home register''.
3750
3751 @item --param @var{name}=@var{value}
3752 @opindex param
3753 In some places, GCC uses various constants to control the amount of
3754 optimization that is done.  For example, GCC will not inline functions
3755 that contain more that a certain number of instructions.  You can
3756 control some of these constants on the command-line using the
3757 @option{--param} option.
3758
3759 In each case, the @var{value} is a integer.  The allowable choices for
3760 @var{name} are given in the following table:
3761
3762 @table @gcctabopt
3763 @item max-delay-slot-insn-search
3764 The maximum number of instructions to consider when looking for an
3765 instruction to fill a delay slot.  If more than this arbitrary number of
3766 instructions is searched, the time savings from filling the delay slot
3767 will be minimal so stop searching.  Increasing values mean more
3768 aggressive optimization, making the compile time increase with probably
3769 small improvement in executable run time.
3770
3771 @item max-delay-slot-live-search
3772 When trying to fill delay slots, the maximum number of instructions to
3773 consider when searching for a block with valid live register
3774 information.  Increasing this arbitrarily chosen value means more
3775 aggressive optimization, increasing the compile time.  This parameter
3776 should be removed when the delay slot code is rewritten to maintain the
3777 control-flow graph.
3778
3779 @item max-gcse-memory
3780 The approximate maximum amount of memory that will be allocated in
3781 order to perform the global common subexpression elimination
3782 optimization.  If more memory than specified is required, the
3783 optimization will not be done.
3784
3785 @item max-inline-insns
3786 If an function contains more than this many instructions, it
3787 will not be inlined.  This option is precisely equivalent to
3788 @option{-finline-limit}.
3789
3790 @end table
3791 @end table
3792
3793 @node Preprocessor Options
3794 @section Options Controlling the Preprocessor
3795 @cindex preprocessor options
3796 @cindex options, preprocessor
3797
3798 These options control the C preprocessor, which is run on each C source
3799 file before actual compilation.
3800
3801 If you use the @option{-E} option, nothing is done except preprocessing.
3802 Some of these options make sense only together with @option{-E} because
3803 they cause the preprocessor output to be unsuitable for actual
3804 compilation.
3805
3806 @table @gcctabopt
3807 @item -include @var{file}
3808 @opindex include
3809 Process @var{file} as input before processing the regular input file.
3810 In effect, the contents of @var{file} are compiled first.  Any @option{-D}
3811 and @option{-U} options on the command line are always processed before
3812 @option{-include @var{file}}, regardless of the order in which they are
3813 written.  All the @option{-include} and @option{-imacros} options are
3814 processed in the order in which they are written.
3815
3816 @item -imacros @var{file}
3817 @opindex imacros
3818 Process @var{file} as input, discarding the resulting output, before
3819 processing the regular input file.  Because the output generated from
3820 @var{file} is discarded, the only effect of @option{-imacros @var{file}}
3821 is to make the macros defined in @var{file} available for use in the
3822 main input.  All the @option{-include} and @option{-imacros} options are
3823 processed in the order in which they are written.
3824
3825 @item -idirafter @var{dir}
3826 @opindex idirafter
3827 @cindex second include path
3828 Add the directory @var{dir} to the second include path.  The directories
3829 on the second include path are searched when a header file is not found
3830 in any of the directories in the main include path (the one that
3831 @option{-I} adds to).
3832
3833 @item -iprefix @var{prefix}
3834 @opindex iprefix
3835 Specify @var{prefix} as the prefix for subsequent @option{-iwithprefix}
3836 options.
3837
3838 @item -iwithprefix @var{dir}
3839 @opindex iwithprefix
3840 Add a directory to the second include path.  The directory's name is
3841 made by concatenating @var{prefix} and @var{dir}, where @var{prefix} was
3842 specified previously with @option{-iprefix}.  If you have not specified a
3843 prefix yet, the directory containing the installed passes of the
3844 compiler is used as the default.
3845
3846 @item -iwithprefixbefore @var{dir}
3847 @opindex iwithprefixbefore
3848 Add a directory to the main include path.  The directory's name is made
3849 by concatenating @var{prefix} and @var{dir}, as in the case of
3850 @option{-iwithprefix}.
3851
3852 @item -isystem @var{dir}
3853 @opindex isystem
3854 Add a directory to the beginning of the second include path, marking it
3855 as a system directory, so that it gets the same special treatment as
3856 is applied to the standard system directories.
3857
3858 @item -nostdinc
3859 @opindex nostdinc
3860 Do not search the standard system directories for header files.  Only
3861 the directories you have specified with @option{-I} options (and the
3862 current directory, if appropriate) are searched.  @xref{Directory
3863 Options}, for information on @option{-I}.
3864
3865 By using both @option{-nostdinc} and @option{-I-}, you can limit the include-file
3866 search path to only those directories you specify explicitly.
3867
3868 @item -remap
3869 @opindex remap
3870 When searching for a header file in a directory, remap file names if a
3871 file named @file{header.gcc} exists in that directory.  This can be used
3872 to work around limitations of file systems with file name restrictions.
3873 The @file{header.gcc} file should contain a series of lines with two
3874 tokens on each line: the first token is the name to map, and the second
3875 token is the actual name to use.
3876
3877 @item -undef
3878 @opindex undef
3879 Do not predefine any nonstandard macros.  (Including architecture flags).
3880
3881 @item -E
3882 @opindex E
3883 Run only the C preprocessor.  Preprocess all the C source files
3884 specified and output the results to standard output or to the
3885 specified output file.
3886
3887 @item -C
3888 @opindex C
3889 Tell the preprocessor not to discard comments.  Used with the
3890 @option{-E} option.
3891
3892 @item -P
3893 @opindex P
3894 Tell the preprocessor not to generate @samp{#line} directives.
3895 Used with the @option{-E} option.
3896
3897 @cindex make
3898 @cindex dependencies, make
3899 @item -M
3900 @opindex M
3901 Instead of outputting the result of preprocessing, output a rule
3902 suitable for @code{make} describing the dependencies of the main source
3903 file.  The preprocessor outputs one @code{make} rule containing the
3904 object file name for that source file, a colon, and the names of all the
3905 included files.  Unless overridden explicitly, the object file name
3906 consists of the basename of the source file with any suffix replaced with
3907 object file suffix. If there are many included files then the
3908 rule is split into several lines using @samp{\}-newline.
3909
3910 @option{-M} implies @option{-E}.
3911
3912 @item -MM
3913 @opindex MM
3914 Like @option{-M}, but mention only the files included with @samp{#include
3915 "@var{file}"}.  System header files included with @samp{#include
3916 <@var{file}>} are omitted.
3917
3918 @item -MD
3919 @opindex MD
3920 Like @option{-M} but the dependency information is written to a file
3921 rather than stdout.  @code{gcc} will use the same file name and
3922 directory as the object file, but with the suffix @file{.d} instead.
3923
3924 This is in addition to compiling the main file as specified---@option{-MD}
3925 does not inhibit ordinary compilation the way @option{-M} does,
3926 unless you also specify @option{-MG}.
3927
3928 With Mach, you can use the utility @code{md} to merge multiple
3929 dependency files into a single dependency file suitable for using with
3930 the @samp{make} command.
3931
3932 @item -MMD
3933 @opindex MMD
3934 Like @option{-MD} except mention only user header files, not system
3935 -header files.
3936
3937 @item -MF @var{file}
3938 @opindex MF
3939 When used with @option{-M} or @option{-MM}, specifies a file to write the
3940 dependencies to.  This allows the preprocessor to write the preprocessed
3941 file to stdout normally.  If no @option{-MF} switch is given, CPP sends
3942 the rules to stdout and suppresses normal preprocessed output.
3943
3944 Another way to specify output of a @code{make} rule is by setting
3945 the environment variable @env{DEPENDENCIES_OUTPUT} (@pxref{Environment
3946 Variables}).
3947
3948 @item -MG
3949 @opindex MG
3950 When used with @option{-M} or @option{-MM}, @option{-MG} says to treat missing
3951 header files as generated files and assume they live in the same
3952 directory as the source file.  It suppresses preprocessed output, as a
3953 missing header file is ordinarily an error.
3954
3955 This feature is used in automatic updating of makefiles.
3956
3957 @item -MP
3958 @opindex MP
3959 This option instructs CPP to add a phony target for each dependency
3960 other than the main file, causing each to depend on nothing.  These
3961 dummy rules work around errors @code{make} gives if you remove header
3962 files without updating the @code{Makefile} to match.
3963
3964 This is typical output:-
3965
3966 @smallexample
3967 /tmp/test.o: /tmp/test.c /tmp/test.h
3968
3969 /tmp/test.h:
3970 @end smallexample
3971
3972 @item -MQ @var{target}
3973 @item -MT @var{target}
3974 @opindex MQ
3975 @opindex MT
3976 By default CPP uses the main file name, including any path, and appends
3977 the object suffix, normally ``.o'', to it to obtain the name of the
3978 target for dependency generation.  With @option{-MT} you can specify a
3979 target yourself, overriding the default one.
3980
3981 If you want multiple targets, you can specify them as a single argument
3982 to @option{-MT}, or use multiple @option{-MT} options.
3983
3984 The targets you specify are output in the order they appear on the
3985 command line.  @option{-MQ} is identical to @option{-MT}, except that the
3986 target name is quoted for Make, but with @option{-MT} it isn't.  For
3987 example, @option{-MT '$(objpfx)foo.o'} gives
3988
3989 @smallexample
3990 $(objpfx)foo.o: /tmp/foo.c
3991 @end smallexample
3992
3993 but @option{-MQ '$(objpfx)foo.o'} gives
3994
3995 @smallexample
3996 $$(objpfx)foo.o: /tmp/foo.c
3997 @end smallexample
3998
3999 The default target is automatically quoted, as if it were given with
4000 @option{-MQ}.
4001
4002 @item -H
4003 @opindex H
4004 Print the name of each header file used, in addition to other normal
4005 activities.
4006
4007 @item -A@var{question}(@var{answer})
4008 @opindex A
4009 Assert the answer @var{answer} for @var{question}, in case it is tested
4010 with a preprocessing conditional such as @samp{#if
4011 #@var{question}(@var{answer})}.  @option{-A-} disables the standard
4012 assertions that normally describe the target machine.
4013
4014 @item -D@var{macro}
4015 @opindex D
4016 Define macro @var{macro} with the string @samp{1} as its definition.
4017
4018 @item -D@var{macro}=@var{defn}
4019 Define macro @var{macro} as @var{defn}.  All instances of @option{-D} on
4020 the command line are processed before any @option{-U} options.
4021
4022 Any @option{-D} and @option{-U} options on the command line are processed in
4023 order, and always before @option{-imacros @var{file}}, regardless of the
4024 order in which they are written.
4025
4026 @item -U@var{macro}
4027 @opindex U
4028 Undefine macro @var{macro}.  @option{-U} options are evaluated after all
4029 @option{-D} options, but before any @option{-include} and @option{-imacros}
4030 options.
4031
4032 Any @option{-D} and @option{-U} options on the command line are processed in
4033 order, and always before @option{-imacros @var{file}}, regardless of the
4034 order in which they are written.
4035
4036 @item -dM
4037 @opindex dM
4038 Tell the preprocessor to output only a list of the macro definitions
4039 that are in effect at the end of preprocessing.  Used with the @option{-E}
4040 option.
4041
4042 @item -dD
4043 @opindex dD
4044 Tell the preprocessing to pass all macro definitions into the output, in
4045 their proper sequence in the rest of the output.
4046
4047 @item -dN
4048 @opindex dN
4049 Like @option{-dD} except that the macro arguments and contents are omitted.
4050 Only @samp{#define @var{name}} is included in the output.
4051
4052 @item -dI
4053 @opindex dI
4054 Output @samp{#include} directives in addition to the result of
4055 preprocessing.
4056
4057 @item -fpreprocessed
4058 @opindex fpreprocessed
4059 Indicate to the preprocessor that the input file has already been
4060 preprocessed.  This suppresses things like macro expansion, trigraph
4061 conversion, escaped newline splicing, and processing of most directives.
4062 In this mode the integrated preprocessor is little more than a tokenizer
4063 for the front ends.
4064
4065 @option{-fpreprocessed} is implicit if the input file has one of the
4066 extensions @samp{i}, @samp{ii} or @samp{mi} indicating it has already
4067 been preprocessed.
4068
4069 @item -trigraphs
4070 @opindex trigraphs
4071 Process ISO standard trigraph sequences.  These are three-character
4072 sequences, all starting with @samp{??}, that are defined by ISO C to
4073 stand for single characters.  For example, @samp{??/} stands for
4074 @samp{\}, so @samp{'??/n'} is a character constant for a newline.  By
4075 default, GCC ignores trigraphs, but in standard-conforming modes it
4076 converts them.  See the @option{-std} and @option{-ansi} options.
4077
4078 The nine trigraph sequences are
4079 @table @samp
4080 @item ??(
4081 -> @samp{[}
4082
4083 @item ??)
4084 -> @samp{]}
4085
4086 @item ??<
4087 -> @samp{@{}
4088
4089 @item ??>
4090 -> @samp{@}}
4091
4092 @item ??=
4093 -> @samp{#}
4094
4095 @item ??/
4096 -> @samp{\}
4097
4098 @item ??'
4099 -> @samp{^}
4100
4101 @item ??!
4102 -> @samp{|}
4103
4104 @item ??-
4105 -> @samp{~}
4106
4107 @end table
4108
4109 Trigraph support is not popular, so many compilers do not implement it
4110 properly.  Portable code should not rely on trigraphs being either
4111 converted or ignored.
4112
4113 @item -Wp\,@var{option}
4114 @opindex Wp
4115 Pass @var{option} as an option to the preprocessor.  If @var{option}
4116 contains commas, it is split into multiple options at the commas.
4117 @end table
4118
4119 @node Assembler Options
4120 @section Passing Options to the Assembler
4121
4122 @c prevent bad page break with this line
4123 You can pass options to the assembler.
4124
4125 @table @gcctabopt
4126 @item -Wa\,@var{option}
4127 @opindex Wa
4128 Pass @var{option} as an option to the assembler.  If @var{option}
4129 contains commas, it is split into multiple options at the commas.
4130 @end table
4131
4132 @node Link Options
4133 @section Options for Linking
4134 @cindex link options
4135 @cindex options, linking
4136
4137 These options come into play when the compiler links object files into
4138 an executable output file.  They are meaningless if the compiler is
4139 not doing a link step.
4140
4141 @table @gcctabopt
4142 @cindex file names
4143 @item @var{object-file-name}
4144 A file name that does not end in a special recognized suffix is
4145 considered to name an object file or library.  (Object files are
4146 distinguished from libraries by the linker according to the file
4147 contents.)  If linking is done, these object files are used as input
4148 to the linker.
4149
4150 @item -c
4151 @itemx -S
4152 @itemx -E
4153 @opindex c
4154 @opindex S
4155 @opindex E
4156 If any of these options is used, then the linker is not run, and
4157 object file names should not be used as arguments.  @xref{Overall
4158 Options}.
4159
4160 @cindex Libraries
4161 @item -l@var{library}
4162 @itemx -l @var{library}
4163 @opindex l
4164 Search the library named @var{library} when linking.  (The second
4165 alternative with the library as a separate argument is only for
4166 POSIX compliance and is not recommended.)
4167
4168 It makes a difference where in the command you write this option; the
4169 linker searches and processes libraries and object files in the order they
4170 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4171 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
4172 to functions in @samp{z}, those functions may not be loaded.
4173
4174 The linker searches a standard list of directories for the library,
4175 which is actually a file named @file{lib@var{library}.a}.  The linker
4176 then uses this file as if it had been specified precisely by name.
4177
4178 The directories searched include several standard system directories
4179 plus any that you specify with @option{-L}.
4180
4181 Normally the files found this way are library files---archive files
4182 whose members are object files.  The linker handles an archive file by
4183 scanning through it for members which define symbols that have so far
4184 been referenced but not defined.  But if the file that is found is an
4185 ordinary object file, it is linked in the usual fashion.  The only
4186 difference between using an @option{-l} option and specifying a file name
4187 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
4188 and searches several directories.
4189
4190 @item -lobjc
4191 @opindex lobjc
4192 You need this special case of the @option{-l} option in order to
4193 link an Objective C program.
4194
4195 @item -nostartfiles
4196 @opindex nostartfiles
4197 Do not use the standard system startup files when linking.
4198 The standard system libraries are used normally, unless @option{-nostdlib}
4199 or @option{-nodefaultlibs} is used.
4200
4201 @item -nodefaultlibs
4202 @opindex nodefaultlibs
4203 Do not use the standard system libraries when linking.
4204 Only the libraries you specify will be passed to the linker.
4205 The standard startup files are used normally, unless @option{-nostartfiles}
4206 is used.  The compiler may generate calls to memcmp, memset, and memcpy
4207 for System V (and ISO C) environments or to bcopy and bzero for
4208 BSD environments.  These entries are usually resolved by entries in
4209 libc.  These entry points should be supplied through some other
4210 mechanism when this option is specified.
4211
4212 @item -nostdlib
4213 @opindex nostdlib
4214 Do not use the standard system startup files or libraries when linking.
4215 No startup files and only the libraries you specify will be passed to
4216 the linker. The compiler may generate calls to memcmp, memset, and memcpy
4217 for System V (and ISO C) environments or to bcopy and bzero for
4218 BSD environments.  These entries are usually resolved by entries in
4219 libc.  These entry points should be supplied through some other
4220 mechanism when this option is specified.
4221
4222 @cindex @option{-lgcc}, use with @option{-nostdlib}
4223 @cindex @option{-nostdlib} and unresolved references
4224 @cindex unresolved references and @option{-nostdlib}
4225 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
4226 @cindex @option{-nodefaultlibs} and unresolved references
4227 @cindex unresolved references and @option{-nodefaultlibs}
4228 One of the standard libraries bypassed by @option{-nostdlib} and
4229 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
4230 that GCC uses to overcome shortcomings of particular machines, or special
4231 needs for some languages.
4232 @ifset INTERNALS
4233 (@xref{Interface,,Interfacing to GCC Output}, for more discussion of
4234 @file{libgcc.a}.)
4235 @end ifset
4236 @ifclear INTERNALS
4237 (@xref{Interface,,Interfacing to GCC Output,gcc.info,Porting GCC},
4238 for more discussion of @file{libgcc.a}.)
4239 @end ifclear
4240 In most cases, you need @file{libgcc.a} even when you want to avoid
4241 other standard libraries.  In other words, when you specify @option{-nostdlib}
4242 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
4243 This ensures that you have no unresolved references to internal GCC
4244 library subroutines.  (For example, @samp{__main}, used to ensure C++
4245 constructors will be called; @pxref{Collect2,,@command{collect2}}.)
4246
4247 @item -s
4248 @opindex s
4249 Remove all symbol table and relocation information from the executable.
4250
4251 @item -static
4252 @opindex static
4253 On systems that support dynamic linking, this prevents linking with the shared
4254 libraries.  On other systems, this option has no effect.
4255
4256 @item -shared
4257 @opindex shared
4258 Produce a shared object which can then be linked with other objects to
4259 form an executable.  Not all systems support this option.  For predictable
4260 results, you must also specify the same set of options that were used to
4261 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
4262 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
4263 needs to build supplementary stub code for constructors to work. On
4264 multi-libbed systems, @samp{gcc -shared} must select the correct support
4265 libraries to link against.  Failing to supply the correct flags may lead
4266 to subtle defects. Supplying them in cases where they are not necessary
4267 is innocuous.}
4268
4269 @item -shared-libgcc
4270 @itemx -static-libgcc
4271 @opindex shared-libgcc
4272 @opindex static-libgcc
4273 On systems that provide @file{libgcc} as a shared library, these options
4274 force the use of either the shared or static version respectively.
4275 If no shared version of @file{libgcc} was built when the compiler was
4276 configured, these options have no effect.
4277
4278 There are several situations in which an application should use the
4279 shared @file{libgcc} instead of the static version.  The most common
4280 of these is when the application wishes to throw and catch exceptions
4281 across different shared libraries.  In that case, each of the libraries
4282 as well as the application itself should use the shared @file{libgcc}.
4283
4284 Therefore, whenever you specify the @option{-shared} option, the GCC
4285 driver automatically adds @option{-shared-libgcc}, unless you explicitly
4286 specify @option{-static-libgcc}.  The G++ driver automatically adds
4287 @option{-shared-libgcc} when you build a main executable as well because
4288 for C++ programs that is typically the right thing to do.
4289 (Exception-handling will not work reliably otherwise.)
4290
4291 However, when linking a main executable written in C, you must
4292 explicitly say @option{-shared-libgcc} if you want to use the shared
4293 @file{libgcc}.
4294
4295 @item -symbolic
4296 @opindex symbolic
4297 Bind references to global symbols when building a shared object.  Warn
4298 about any unresolved references (unless overridden by the link editor
4299 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
4300 this option.
4301
4302 @item -Xlinker @var{option}
4303 @opindex Xlinker
4304 Pass @var{option} as an option to the linker.  You can use this to
4305 supply system-specific linker options which GCC does not know how to
4306 recognize.
4307
4308 If you want to pass an option that takes an argument, you must use
4309 @option{-Xlinker} twice, once for the option and once for the argument.
4310 For example, to pass @option{-assert definitions}, you must write
4311 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
4312 @option{-Xlinker "-assert definitions"}, because this passes the entire
4313 string as a single argument, which is not what the linker expects.
4314
4315 @item -Wl\,@var{option}
4316 @opindex Wl
4317 Pass @var{option} as an option to the linker.  If @var{option} contains
4318 commas, it is split into multiple options at the commas.
4319
4320 @item -u @var{symbol}
4321 @opindex u
4322 Pretend the symbol @var{symbol} is undefined, to force linking of
4323 library modules to define it.  You can use @option{-u} multiple times with
4324 different symbols to force loading of additional library modules.
4325 @end table
4326
4327 @node Directory Options
4328 @section Options for Directory Search
4329 @cindex directory options
4330 @cindex options, directory search
4331 @cindex search path
4332
4333 These options specify directories to search for header files, for
4334 libraries and for parts of the compiler:
4335
4336 @table @gcctabopt
4337 @item -I@var{dir}
4338 @opindex I
4339 Add the directory @var{dir} to the head of the list of directories to be
4340 searched for header files.  This can be used to override a system header
4341 file, substituting your own version, since these directories are
4342 searched before the system header file directories.  However, you should
4343 not use this option to add directories that contain vendor-supplied
4344 system header files (use @option{-isystem} for that). If you use more than
4345 one @option{-I} option, the directories are scanned in left-to-right
4346 order; the standard system directories come after.
4347
4348 @item -I-
4349 @opindex I-
4350 Any directories you specify with @option{-I} options before the @option{-I-}
4351 option are searched only for the case of @samp{#include "@var{file}"};
4352 they are not searched for @samp{#include <@var{file}>}.
4353
4354 If additional directories are specified with @option{-I} options after
4355 the @option{-I-}, these directories are searched for all @samp{#include}
4356 directives.  (Ordinarily @emph{all} @option{-I} directories are used
4357 this way.)
4358
4359 In addition, the @option{-I-} option inhibits the use of the current
4360 directory (where the current input file came from) as the first search
4361 directory for @samp{#include "@var{file}"}.  There is no way to
4362 override this effect of @option{-I-}.  With @option{-I.} you can specify
4363 searching the directory which was current when the compiler was
4364 invoked.  That is not exactly the same as what the preprocessor does
4365 by default, but it is often satisfactory.
4366
4367 @option{-I-} does not inhibit the use of the standard system directories
4368 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
4369 independent.
4370
4371 @item -L@var{dir}
4372 @opindex L
4373 Add directory @var{dir} to the list of directories to be searched
4374 for @option{-l}.
4375
4376 @item -B@var{prefix}
4377 @opindex B
4378 This option specifies where to find the executables, libraries,
4379 include files, and data files of the compiler itself.
4380
4381 The compiler driver program runs one or more of the subprograms
4382 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
4383 @var{prefix} as a prefix for each program it tries to run, both with and
4384 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
4385
4386 For each subprogram to be run, the compiler driver first tries the
4387 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
4388 was not specified, the driver tries two standard prefixes, which are
4389 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
4390 those results in a file name that is found, the unmodified program
4391 name is searched for using the directories specified in your
4392 @env{PATH} environment variable.
4393
4394 @option{-B} prefixes that effectively specify directory names also apply
4395 to libraries in the linker, because the compiler translates these
4396 options into @option{-L} options for the linker.  They also apply to
4397 includes files in the preprocessor, because the compiler translates these
4398 options into @option{-isystem} options for the preprocessor.  In this case,
4399 the compiler appends @samp{include} to the prefix.
4400
4401 The run-time support file @file{libgcc.a} can also be searched for using
4402 the @option{-B} prefix, if needed.  If it is not found there, the two
4403 standard prefixes above are tried, and that is all.  The file is left
4404 out of the link if it is not found by those means.
4405
4406 Another way to specify a prefix much like the @option{-B} prefix is to use
4407 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
4408 Variables}.
4409
4410 @item -specs=@var{file}
4411 @opindex specs
4412 Process @var{file} after the compiler reads in the standard @file{specs}
4413 file, in order to override the defaults that the @file{gcc} driver
4414 program uses when determining what switches to pass to @file{cc1},
4415 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
4416 @option{-specs=@var{file}} can be specified on the command line, and they
4417 are processed in order, from left to right.
4418 @end table
4419
4420 @c man end
4421
4422 @node Spec Files
4423 @section Specifying subprocesses and the switches to pass to them
4424 @cindex Spec Files
4425 @command{gcc} is a driver program.  It performs its job by invoking a
4426 sequence of other programs to do the work of compiling, assembling and
4427 linking.  GCC interprets its command-line parameters and uses these to
4428 deduce which programs it should invoke, and which command-line options
4429 it ought to place on their command lines.  This behaviour is controlled
4430 by @dfn{spec strings}.  In most cases there is one spec string for each
4431 program that GCC can invoke, but a few programs have multiple spec
4432 strings to control their behaviour.  The spec strings built into GCC can
4433 be overridden by using the @option{-specs=} command-line switch to specify
4434 a spec file.
4435
4436 @dfn{Spec files} are plaintext files that are used to construct spec
4437 strings.  They consist of a sequence of directives separated by blank
4438 lines.  The type of directive is determined by the first non-whitespace
4439 character on the line and it can be one of the following:
4440
4441 @table @code
4442 @item %@var{command}
4443 Issues a @var{command} to the spec file processor.  The commands that can
4444 appear here are:
4445
4446 @table @code
4447 @item %include <@var{file}>
4448 @cindex %include
4449 Search for @var{file} and insert its text at the current point in the
4450 specs file.
4451
4452 @item %include_noerr <@var{file}>
4453 @cindex %include_noerr
4454 Just like @samp{%include}, but do not generate an error message if the include
4455 file cannot be found.
4456
4457 @item %rename @var{old_name} @var{new_name}
4458 @cindex %rename
4459 Rename the spec string @var{old_name} to @var{new_name}.
4460
4461 @end table
4462
4463 @item *[@var{spec_name}]:
4464 This tells the compiler to create, override or delete the named spec
4465 string.  All lines after this directive up to the next directive or
4466 blank line are considered to be the text for the spec string.  If this
4467 results in an empty string then the spec will be deleted.  (Or, if the
4468 spec did not exist, then nothing will happened.)  Otherwise, if the spec
4469 does not currently exist a new spec will be created.  If the spec does
4470 exist then its contents will be overridden by the text of this
4471 directive, unless the first character of that text is the @samp{+}
4472 character, in which case the text will be appended to the spec.
4473
4474 @item [@var{suffix}]:
4475 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
4476 and up to the next directive or blank line are considered to make up the
4477 spec string for the indicated suffix.  When the compiler encounters an
4478 input file with the named suffix, it will processes the spec string in
4479 order to work out how to compile that file.  For example:
4480
4481 @smallexample
4482 .ZZ:
4483 z-compile -input %i
4484 @end smallexample
4485
4486 This says that any input file whose name ends in @samp{.ZZ} should be
4487 passed to the program @samp{z-compile}, which should be invoked with the
4488 command-line switch @option{-input} and with the result of performing the
4489 @samp{%i} substitution.  (See below.)
4490
4491 As an alternative to providing a spec string, the text that follows a
4492 suffix directive can be one of the following:
4493
4494 @table @code
4495 @item @@@var{language}
4496 This says that the suffix is an alias for a known @var{language}.  This is
4497 similar to using the @option{-x} command-line switch to GCC to specify a
4498 language explicitly.  For example:
4499
4500 @smallexample
4501 .ZZ:
4502 @@c++
4503 @end smallexample
4504
4505 Says that .ZZ files are, in fact, C++ source files.
4506
4507 @item #@var{name}
4508 This causes an error messages saying:
4509
4510 @smallexample
4511 @var{name} compiler not installed on this system.
4512 @end smallexample
4513 @end table
4514
4515 GCC already has an extensive list of suffixes built into it.
4516 This directive will add an entry to the end of the list of suffixes, but
4517 since the list is searched from the end backwards, it is effectively
4518 possible to override earlier entries using this technique.
4519
4520 @end table
4521
4522 GCC has the following spec strings built into it.  Spec files can
4523 override these strings or create their own.  Note that individual
4524 targets can also add their own spec strings to this list.
4525
4526 @smallexample
4527 asm          Options to pass to the assembler
4528 asm_final    Options to pass to the assembler post-processor
4529 cpp          Options to pass to the C preprocessor
4530 cc1          Options to pass to the C compiler
4531 cc1plus      Options to pass to the C++ compiler
4532 endfile      Object files to include at the end of the link
4533 link         Options to pass to the linker
4534 lib          Libraries to include on the command line to the linker
4535 libgcc       Decides which GCC support library to pass to the linker
4536 linker       Sets the name of the linker
4537 predefines   Defines to be passed to the C preprocessor
4538 signed_char  Defines to pass to CPP to say whether @code{char} is signed
4539              by default
4540 startfile    Object files to include at the start of the link
4541 @end smallexample
4542
4543 Here is a small example of a spec file:
4544
4545 @smallexample
4546 %rename lib                 old_lib
4547
4548 *lib:
4549 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
4550 @end smallexample
4551
4552 This example renames the spec called @samp{lib} to @samp{old_lib} and
4553 then overrides the previous definition of @samp{lib} with a new one.
4554 The new definition adds in some extra command-line options before
4555 including the text of the old definition.
4556
4557 @dfn{Spec strings} are a list of command-line options to be passed to their
4558 corresponding program.  In addition, the spec strings can contain
4559 @samp{%}-prefixed sequences to substitute variable text or to
4560 conditionally insert text into the command line.  Using these constructs
4561 it is possible to generate quite complex command lines.
4562
4563 Here is a table of all defined @samp{%}-sequences for spec
4564 strings.  Note that spaces are not generated automatically around the
4565 results of expanding these sequences.  Therefore you can concatenate them
4566 together or combine them with constant text in a single argument.
4567
4568 @table @code
4569 @item %%
4570 Substitute one @samp{%} into the program name or argument.
4571
4572 @item %i
4573 Substitute the name of the input file being processed.
4574
4575 @item %b
4576 Substitute the basename of the input file being processed.
4577 This is the substring up to (and not including) the last period
4578 and not including the directory.
4579
4580 @item %B
4581 This is the same as @samp{%b}, but include the file suffix (text after
4582 the last period).
4583
4584 @item %d
4585 Marks the argument containing or following the @samp{%d} as a
4586 temporary file name, so that that file will be deleted if GCC exits
4587 successfully.  Unlike @samp{%g}, this contributes no text to the
4588 argument.
4589
4590 @item %g@var{suffix}
4591 Substitute a file name that has suffix @var{suffix} and is chosen
4592 once per compilation, and mark the argument in the same way as
4593 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
4594 name is now chosen in a way that is hard to predict even when previously
4595 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
4596 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
4597 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
4598 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
4599 was simply substituted with a file name chosen once per compilation,
4600 without regard to any appended suffix (which was therefore treated
4601 just like ordinary text), making such attacks more likely to succeed.
4602
4603 @item %u@var{suffix}
4604 Like @samp{%g}, but generates a new temporary file name even if
4605 @samp{%u@var{suffix}} was already seen.
4606
4607 @item %U@var{suffix}
4608 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
4609 new one if there is no such last file name.  In the absence of any
4610 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
4611 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
4612 would involve the generation of two distinct file names, one
4613 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
4614 simply substituted with a file name chosen for the previous @samp{%u},
4615 without regard to any appended suffix.
4616
4617 @item %j@var{SUFFIX}
4618 Substitutes the name of the HOST_BIT_BUCKET, if any, and if it is
4619 writable, and if save-temps is off; otherwise, substitute the name
4620 of a temporary file, just like @samp{%u}.  This temporary file is not
4621 meant for communication between processes, but rather as a junk
4622 disposal mechanism.
4623
4624 @item %.@var{SUFFIX}
4625 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
4626 when it is subsequently output with @samp{%*}. @var{SUFFIX} is
4627 terminated by the next space or %.
4628
4629 @item %w
4630 Marks the argument containing or following the @samp{%w} as the
4631 designated output file of this compilation.  This puts the argument
4632 into the sequence of arguments that @samp{%o} will substitute later.
4633
4634 @item %o
4635 Substitutes the names of all the output files, with spaces
4636 automatically placed around them.  You should write spaces
4637 around the @samp{%o} as well or the results are undefined.
4638 @samp{%o} is for use in the specs for running the linker.
4639 Input files whose names have no recognized suffix are not compiled
4640 at all, but they are included among the output files, so they will
4641 be linked.
4642
4643 @item %O
4644 Substitutes the suffix for object files.  Note that this is
4645 handled specially when it immediately follows @samp{%g, %u, or %U},
4646 because of the need for those to form complete file names.  The
4647 handling is such that @samp{%O} is treated exactly as if it had already
4648 been substituted, except that @samp{%g, %u, and %U} do not currently
4649 support additional @var{suffix} characters following @samp{%O} as they would
4650 following, for example, @samp{.o}.
4651
4652 @item %p
4653 Substitutes the standard macro predefinitions for the
4654 current target machine.  Use this when running @code{cpp}.
4655
4656 @item %P
4657 Like @samp{%p}, but puts @samp{__} before and after the name of each
4658 predefined macro, except for macros that start with @samp{__} or with
4659 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
4660 C.
4661
4662 @item %I
4663 Substitute a @option{-iprefix} option made from GCC_EXEC_PREFIX.
4664
4665 @item %s
4666 Current argument is the name of a library or startup file of some sort.
4667 Search for that file in a standard list of directories and substitute
4668 the full name found.
4669
4670 @item %e@var{str}
4671 Print @var{str} as an error message.  @var{str} is terminated by a newline.
4672 Use this when inconsistent options are detected.
4673
4674 @item %|
4675 Output @samp{-} if the input for the current command is coming from a pipe.
4676
4677 @item %(@var{name})
4678 Substitute the contents of spec string @var{name} at this point.
4679
4680 @item %[@var{name}]
4681 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
4682
4683 @item %x@{@var{option}@}
4684 Accumulate an option for @samp{%X}.
4685
4686 @item %X
4687 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
4688 spec string.
4689
4690 @item %Y
4691 Output the accumulated assembler options specified by @option{-Wa}.
4692
4693 @item %Z
4694 Output the accumulated preprocessor options specified by @option{-Wp}.
4695
4696 @item %v1
4697 Substitute the major version number of GCC.
4698 (For version 2.9.5, this is 2.)
4699
4700 @item %v2
4701 Substitute the minor version number of GCC.
4702 (For version 2.9.5, this is 9.)
4703
4704 @item %v3
4705 Substitute the patch level number of GCC.
4706 (For version 2.9.5, this is 5.)
4707
4708 @item %a
4709 Process the @code{asm} spec.  This is used to compute the
4710 switches to be passed to the assembler.
4711
4712 @item %A
4713 Process the @code{asm_final} spec.  This is a spec string for
4714 passing switches to an assembler post-processor, if such a program is
4715 needed.
4716
4717 @item %l
4718 Process the @code{link} spec.  This is the spec for computing the
4719 command line passed to the linker.  Typically it will make use of the
4720 @samp{%L %G %S %D and %E} sequences.
4721
4722 @item %D
4723 Dump out a @option{-L} option for each directory that GCC believes might
4724 contain startup files.  If the target supports multilibs then the
4725 current multilib directory will be prepended to each of these paths.
4726
4727 @item %M
4728 Output the multilib directory with directory seperators replaced with
4729 @samp{_}.  If multilib directories are not set, or the multilib directory is
4730 @file{.} then this option emits nothing.
4731
4732 @item %L
4733 Process the @code{lib} spec.  This is a spec string for deciding which
4734 libraries should be included on the command line to the linker.
4735
4736 @item %G
4737 Process the @code{libgcc} spec.  This is a spec string for deciding
4738 which GCC support library should be included on the command line to the linker.
4739
4740 @item %S
4741 Process the @code{startfile} spec.  This is a spec for deciding which
4742 object files should be the first ones passed to the linker.  Typically
4743 this might be a file named @file{crt0.o}.
4744
4745 @item %E
4746 Process the @code{endfile} spec.  This is a spec string that specifies
4747 the last object files that will be passed to the linker.
4748
4749 @item %C
4750 Process the @code{cpp} spec.  This is used to construct the arguments
4751 to be passed to the C preprocessor.
4752
4753 @item %c
4754 Process the @code{signed_char} spec.  This is intended to be used
4755 to tell cpp whether a char is signed.  It typically has the definition:
4756 @smallexample
4757 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
4758 @end smallexample
4759
4760 @item %1
4761 Process the @code{cc1} spec.  This is used to construct the options to be
4762 passed to the actual C compiler (@samp{cc1}).
4763
4764 @item %2
4765 Process the @code{cc1plus} spec.  This is used to construct the options to be
4766 passed to the actual C++ compiler (@samp{cc1plus}).
4767
4768 @item %*
4769 Substitute the variable part of a matched option.  See below.
4770 Note that each comma in the substituted string is replaced by
4771 a single space.
4772
4773 @item %@{@code{S}@}
4774 Substitutes the @code{-S} switch, if that switch was given to GCC.
4775 If that switch was not specified, this substitutes nothing.  Note that
4776 the leading dash is omitted when specifying this option, and it is
4777 automatically inserted if the substitution is performed.  Thus the spec
4778 string @samp{%@{foo@}} would match the command-line option @option{-foo}
4779 and would output the command line option @option{-foo}.
4780
4781 @item %W@{@code{S}@}
4782 Like %@{@code{S}@} but mark last argument supplied within as a file to be
4783 deleted on failure.
4784
4785 @item %@{@code{S}*@}
4786 Substitutes all the switches specified to GCC whose names start
4787 with @code{-S}, but which also take an argument.  This is used for
4788 switches like @option{-o}, @option{-D}, @option{-I}, etc.
4789 GCC considers @option{-o foo} as being
4790 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
4791 text, including the space.  Thus two arguments would be generated.
4792
4793 @item %@{^@code{S}*@}
4794 Like %@{@code{S}*@}, but don't put a blank between a switch and its
4795 argument.  Thus %@{^o*@} would only generate one argument, not two.
4796
4797 @item %@{@code{S}*&@code{T}*@}
4798 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
4799 (the order of @code{S} and @code{T} in the spec is not significant).
4800 There can be any number of ampersand-separated variables; for each the
4801 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
4802
4803 @item %@{<@code{S}@}
4804 Remove all occurrences of @code{-S} from the command line.  Note---this
4805 command is position dependent.  @samp{%} commands in the spec string
4806 before this option will see @code{-S}, @samp{%} commands in the spec
4807 string after this option will not.
4808
4809 @item %@{@code{S}*:@code{X}@}
4810 Substitutes @code{X} if one or more switches whose names start with
4811 @code{-S} are specified to GCC.  Note that the tail part of the
4812 @code{-S} option (i.e. the part matched by the @samp{*}) will be substituted
4813 for each occurrence of @samp{%*} within @code{X}.
4814
4815 @item %@{@code{S}:@code{X}@}
4816 Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC.
4817
4818 @item %@{!@code{S}:@code{X}@}
4819 Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC.
4820
4821 @item %@{|@code{S}:@code{X}@}
4822 Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}.
4823
4824 @item %@{|!@code{S}:@code{X}@}
4825 Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}.
4826
4827 @item %@{.@code{S}:@code{X}@}
4828 Substitutes @code{X}, but only if processing a file with suffix @code{S}.
4829
4830 @item %@{!.@code{S}:@code{X}@}
4831 Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}.
4832
4833 @item %@{@code{S}|@code{P}:@code{X}@}
4834 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC.  This may be
4835 combined with @samp{!} and @samp{.} sequences as well, although they
4836 have a stronger binding than the @samp{|}.  For example a spec string
4837 like this:
4838
4839 @smallexample
4840 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
4841 @end smallexample
4842
4843 will output the following command-line options from the following input
4844 command-line options:
4845
4846 @smallexample
4847 fred.c        -foo -baz
4848 jim.d         -bar -boggle
4849 -d fred.c     -foo -baz -boggle
4850 -d jim.d      -bar -baz -boggle
4851 @end smallexample
4852
4853 @end table
4854
4855 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or
4856 %@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs
4857 or spaces, or even newlines.  They are processed as usual, as described
4858 above.
4859
4860 The @option{-O}, @option{-f}, @option{-m}, and @option{-W}
4861 switches are handled specifically in these
4862 constructs.  If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or
4863 @option{-W} switch is found later in the command line, the earlier switch
4864 value is ignored, except with @{@code{S}*@} where @code{S} is just one
4865 letter, which passes all matching options.
4866
4867 The character @samp{|} at the beginning of the predicate text is used to indicate
4868 that a command should be piped to the following command, but only if @option{-pipe}
4869 is specified.
4870
4871 It is built into GCC which switches take arguments and which do not.
4872 (You might think it would be useful to generalize this to allow each
4873 compiler's spec to say which switches take arguments.  But this cannot
4874 be done in a consistent fashion.  GCC cannot even decide which input
4875 files have been specified without knowing which switches take arguments,
4876 and it must know which input files to compile in order to tell which
4877 compilers to run).
4878
4879 GCC also knows implicitly that arguments starting in @option{-l} are to be
4880 treated as compiler output files, and passed to the linker in their
4881 proper position among the other output files.
4882
4883 @c man begin OPTIONS
4884
4885 @node Target Options
4886 @section Specifying Target Machine and Compiler Version
4887 @cindex target options
4888 @cindex cross compiling
4889 @cindex specifying machine version
4890 @cindex specifying compiler version and target machine
4891 @cindex compiler version, specifying
4892 @cindex target machine, specifying
4893
4894 By default, GCC compiles code for the same type of machine that you
4895 are using.  However, it can also be installed as a cross-compiler, to
4896 compile for some other type of machine.  In fact, several different
4897 configurations of GCC, for different target machines, can be
4898 installed side by side.  Then you specify which one to use with the
4899 @option{-b} option.
4900
4901 In addition, older and newer versions of GCC can be installed side
4902 by side.  One of them (probably the newest) will be the default, but
4903 you may sometimes wish to use another.
4904
4905 @table @gcctabopt
4906 @item -b @var{machine}
4907 @opindex b
4908 The argument @var{machine} specifies the target machine for compilation.
4909 This is useful when you have installed GCC as a cross-compiler.
4910
4911 The value to use for @var{machine} is the same as was specified as the
4912 machine type when configuring GCC as a cross-compiler.  For
4913 example, if a cross-compiler was configured with @samp{configure
4914 i386v}, meaning to compile for an 80386 running System V, then you
4915 would specify @option{-b i386v} to run that cross compiler.
4916
4917 When you do not specify @option{-b}, it normally means to compile for
4918 the same type of machine that you are using.
4919
4920 @item -V @var{version}
4921 @opindex V
4922 The argument @var{version} specifies which version of GCC to run.
4923 This is useful when multiple versions are installed.  For example,
4924 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
4925
4926 The default version, when you do not specify @option{-V}, is the last
4927 version of GCC that you installed.
4928 @end table
4929
4930 The @option{-b} and @option{-V} options actually work by controlling part of
4931 the file name used for the executable files and libraries used for
4932 compilation.  A given version of GCC, for a given target machine, is
4933 normally kept in the directory @file{/usr/local/lib/gcc-lib/@var{machine}/@var{version}}.@refill
4934
4935 Thus, sites can customize the effect of @option{-b} or @option{-V} either by
4936 changing the names of these directories or adding alternate names (or
4937 symbolic links).  If in directory @file{/usr/local/lib/gcc-lib/} the
4938 file @file{80386} is a link to the file @file{i386v}, then @option{-b
4939 80386} becomes an alias for @option{-b i386v}.
4940
4941 In one respect, the @option{-b} or @option{-V} do not completely change
4942 to a different compiler: the top-level driver program @command{gcc}
4943 that you originally invoked continues to run and invoke the other
4944 executables (preprocessor, compiler per se, assembler and linker)
4945 that do the real work.  However, since no real work is done in the
4946 driver program, it usually does not matter that the driver program
4947 in use is not the one for the specified target.  It is common for the
4948 interface to the other executables to change incompatibly between
4949 compiler versions, so unless the version specified is very close to that
4950 of the driver (for example, @option{-V 3.0} with a driver program from GCC
4951 version 3.0.1), use of @option{-V} may not work; for example, using
4952 @option{-V 2.95.2} will not work with a driver program from GCC 3.0.
4953
4954 The only way that the driver program depends on the target machine is
4955 in the parsing and handling of special machine-specific options.
4956 However, this is controlled by a file which is found, along with the
4957 other executables, in the directory for the specified version and
4958 target machine.  As a result, a single installed driver program adapts
4959 to any specified target machine, and sufficiently similar compiler
4960 versions.
4961
4962 The driver program executable does control one significant thing,
4963 however: the default version and target machine.  Therefore, you can
4964 install different instances of the driver program, compiled for
4965 different targets or versions, under different names.
4966
4967 For example, if the driver for version 2.0 is installed as @command{ogcc}
4968 and that for version 2.1 is installed as @command{gcc}, then the command
4969 @command{gcc} will use version 2.1 by default, while @command{ogcc} will use
4970 2.0 by default.  However, you can choose either version with either
4971 command with the @option{-V} option.
4972
4973 @node Submodel Options
4974 @section Hardware Models and Configurations
4975 @cindex submodel options
4976 @cindex specifying hardware config
4977 @cindex hardware models and configurations, specifying
4978 @cindex machine dependent options
4979
4980 Earlier we discussed the standard option @option{-b} which chooses among
4981 different installed compilers for completely different target
4982 machines, such as Vax vs. 68000 vs. 80386.
4983
4984 In addition, each of these target machine types can have its own
4985 special options, starting with @samp{-m}, to choose among various
4986 hardware models or configurations---for example, 68010 vs 68020,
4987 floating coprocessor or none.  A single installed version of the
4988 compiler can compile for any model or configuration, according to the
4989 options specified.
4990
4991 Some configurations of the compiler also support additional special
4992 options, usually for compatibility with other compilers on the same
4993 platform.
4994
4995 @ifset INTERNALS
4996 These options are defined by the macro @code{TARGET_SWITCHES} in the
4997 machine description.  The default for the options is also defined by
4998 that macro, which enables you to change the defaults.
4999 @end ifset
5000
5001 @menu
5002 * M680x0 Options::
5003 * M68hc1x Options::
5004 * VAX Options::
5005 * SPARC Options::
5006 * Convex Options::
5007 * AMD29K Options::
5008 * ARM Options::
5009 * MN10200 Options::
5010 * MN10300 Options::
5011 * M32R/D Options::
5012 * M88K Options::
5013 * RS/6000 and PowerPC Options::
5014 * RT Options::
5015 * MIPS Options::
5016 * i386 Options::
5017 * HPPA Options::
5018 * Intel 960 Options::
5019 * DEC Alpha Options::
5020 * Clipper Options::
5021 * H8/300 Options::
5022 * SH Options::
5023 * System V Options::
5024 * TMS320C3x/C4x Options::
5025 * V850 Options::
5026 * ARC Options::
5027 * NS32K Options::
5028 * AVR Options::
5029 * MCore Options::
5030 * IA-64 Options::
5031 * D30V Options::
5032 @end menu
5033
5034 @node M680x0 Options
5035 @subsection M680x0 Options
5036 @cindex M680x0 options
5037
5038 These are the @samp{-m} options defined for the 68000 series.  The default
5039 values for these options depends on which style of 68000 was selected when
5040 the compiler was configured; the defaults for the most common choices are
5041 given below.
5042
5043 @table @gcctabopt
5044 @item -m68000
5045 @itemx -mc68000
5046 @opindex m68000
5047 @opindex mc68000
5048 Generate output for a 68000.  This is the default
5049 when the compiler is configured for 68000-based systems.
5050
5051 Use this option for microcontrollers with a 68000 or EC000 core,
5052 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5053
5054 @item -m68020
5055 @itemx -mc68020
5056 @opindex m68020
5057 @opindex mc68020
5058 Generate output for a 68020.  This is the default
5059 when the compiler is configured for 68020-based systems.
5060
5061 @item -m68881
5062 @opindex m68881
5063 Generate output containing 68881 instructions for floating point.
5064 This is the default for most 68020 systems unless @option{--nfp} was
5065 specified when the compiler was configured.
5066
5067 @item -m68030
5068 @opindex m68030
5069 Generate output for a 68030.  This is the default when the compiler is
5070 configured for 68030-based systems.
5071
5072 @item -m68040
5073 @opindex m68040
5074 Generate output for a 68040.  This is the default when the compiler is
5075 configured for 68040-based systems.
5076
5077 This option inhibits the use of 68881/68882 instructions that have to be
5078 emulated by software on the 68040.  Use this option if your 68040 does not
5079 have code to emulate those instructions.
5080
5081 @item -m68060
5082 @opindex m68060
5083 Generate output for a 68060.  This is the default when the compiler is
5084 configured for 68060-based systems.
5085
5086 This option inhibits the use of 68020 and 68881/68882 instructions that
5087 have to be emulated by software on the 68060.  Use this option if your 68060
5088 does not have code to emulate those instructions.
5089
5090 @item -mcpu32
5091 @opindex mcpu32
5092 Generate output for a CPU32. This is the default
5093 when the compiler is configured for CPU32-based systems.
5094
5095 Use this option for microcontrollers with a
5096 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5097 68336, 68340, 68341, 68349 and 68360.
5098
5099 @item -m5200
5100 @opindex m5200
5101 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5102 when the compiler is configured for 520X-based systems.
5103
5104 Use this option for microcontroller with a 5200 core, including
5105 the MCF5202, MCF5203, MCF5204 and MCF5202.
5106
5107
5108 @item -m68020-40
5109 @opindex m68020-40
5110 Generate output for a 68040, without using any of the new instructions.
5111 This results in code which can run relatively efficiently on either a
5112 68020/68881 or a 68030 or a 68040.  The generated code does use the
5113 68881 instructions that are emulated on the 68040.
5114
5115 @item -m68020-60
5116 @opindex m68020-60
5117 Generate output for a 68060, without using any of the new instructions.
5118 This results in code which can run relatively efficiently on either a
5119 68020/68881 or a 68030 or a 68040.  The generated code does use the
5120 68881 instructions that are emulated on the 68060.
5121
5122 @item -mfpa
5123 @opindex mfpa
5124 Generate output containing Sun FPA instructions for floating point.
5125
5126 @item -msoft-float
5127 @opindex msoft-float
5128 Generate output containing library calls for floating point.
5129 @strong{Warning:} the requisite libraries are not available for all m68k
5130 targets.  Normally the facilities of the machine's usual C compiler are
5131 used, but this can't be done directly in cross-compilation.  You must
5132 make your own arrangements to provide suitable library functions for
5133 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5134 @samp{m68k-*-coff} do provide software floating point support.
5135
5136 @item -mshort
5137 @opindex mshort
5138 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5139
5140 @item -mnobitfield
5141 @opindex mnobitfield
5142 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5143 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
5144
5145 @item -mbitfield
5146 @opindex mbitfield
5147 Do use the bit-field instructions.  The @option{-m68020} option implies
5148 @option{-mbitfield}.  This is the default if you use a configuration
5149 designed for a 68020.
5150
5151 @item -mrtd
5152 @opindex mrtd
5153 Use a different function-calling convention, in which functions
5154 that take a fixed number of arguments return with the @code{rtd}
5155 instruction, which pops their arguments while returning.  This
5156 saves one instruction in the caller since there is no need to pop
5157 the arguments there.
5158
5159 This calling convention is incompatible with the one normally
5160 used on Unix, so you cannot use it if you need to call libraries
5161 compiled with the Unix compiler.
5162
5163 Also, you must provide function prototypes for all functions that
5164 take variable numbers of arguments (including @code{printf});
5165 otherwise incorrect code will be generated for calls to those
5166 functions.
5167
5168 In addition, seriously incorrect code will result if you call a
5169 function with too many arguments.  (Normally, extra arguments are
5170 harmlessly ignored.)
5171
5172 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
5173 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
5174
5175 @item -malign-int
5176 @itemx -mno-align-int
5177 @opindex malign-int
5178 @opindex mno-align-int
5179 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
5180 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
5181 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
5182 Aligning variables on 32-bit boundaries produces code that runs somewhat
5183 faster on processors with 32-bit busses at the expense of more memory.
5184
5185 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
5186 align structures containing the above types  differently than
5187 most published application binary interface specifications for the m68k.
5188
5189 @item -mpcrel
5190 @opindex mpcrel
5191 Use the pc-relative addressing mode of the 68000 directly, instead of
5192 using a global offset table.  At present, this option implies @option{-fpic},
5193 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
5194 not presently supported with @option{-mpcrel}, though this could be supported for
5195 68020 and higher processors.
5196
5197 @item -mno-strict-align
5198 @itemx -mstrict-align
5199 @opindex mno-strict-align
5200 @opindex mstrict-align
5201 Do not (do) assume that unaligned memory references will be handled by
5202 the system.
5203
5204 @end table
5205
5206 @node M68hc1x Options
5207 @subsection M68hc1x Options
5208 @cindex M68hc1x options
5209
5210 These are the @samp{-m} options defined for the 68hc11 and 68hc12
5211 microcontrollers.  The default values for these options depends on
5212 which style of microcontroller was selected when the compiler was configured;
5213 the defaults for the most common choices are given below.
5214
5215 @table @gcctabopt
5216 @item -m6811
5217 @itemx -m68hc11
5218 @opindex m6811
5219 @opindex m68hc11
5220 Generate output for a 68HC11.  This is the default
5221 when the compiler is configured for 68HC11-based systems.
5222
5223 @item -m6812
5224 @itemx -m68hc12
5225 @opindex m6812
5226 @opindex m68hc12
5227 Generate output for a 68HC12.  This is the default
5228 when the compiler is configured for 68HC12-based systems.
5229
5230 @item -mauto-incdec
5231 @opindex mauto-incdec
5232 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
5233 addressing modes.
5234
5235 @item -mshort
5236 @opindex mshort
5237 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5238
5239 @item -msoft-reg-count=@var{count}
5240 @opindex msoft-reg-count
5241 Specify the number of pseudo-soft registers which are used for the
5242 code generation.  The maximum number is 32.  Using more pseudo-soft
5243 register may or may not result in better code depending on the program.
5244 The default is 4 for 68HC11 and 2 for 68HC12.
5245
5246 @end table
5247
5248 @node VAX Options
5249 @subsection VAX Options
5250 @cindex VAX options
5251
5252 These @samp{-m} options are defined for the Vax:
5253
5254 @table @gcctabopt
5255 @item -munix
5256 @opindex munix
5257 Do not output certain jump instructions (@code{aobleq} and so on)
5258 that the Unix assembler for the Vax cannot handle across long
5259 ranges.
5260
5261 @item -mgnu
5262 @opindex mgnu
5263 Do output those jump instructions, on the assumption that you
5264 will assemble with the GNU assembler.
5265
5266 @item -mg
5267 @opindex mg
5268 Output code for g-format floating point numbers instead of d-format.
5269 @end table
5270
5271 @node SPARC Options
5272 @subsection SPARC Options
5273 @cindex SPARC options
5274
5275 These @samp{-m} switches are supported on the SPARC:
5276
5277 @table @gcctabopt
5278 @item -mno-app-regs
5279 @itemx -mapp-regs
5280 @opindex mno-app-regs
5281 @opindex mapp-regs
5282 Specify @option{-mapp-regs} to generate output using the global registers
5283 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
5284 is the default.
5285
5286 To be fully SVR4 ABI compliant at the cost of some performance loss,
5287 specify @option{-mno-app-regs}.  You should compile libraries and system
5288 software with this option.
5289
5290 @item -mfpu
5291 @itemx -mhard-float
5292 @opindex mfpu
5293 @opindex mhard-float
5294 Generate output containing floating point instructions.  This is the
5295 default.
5296
5297 @item -mno-fpu
5298 @itemx -msoft-float
5299 @opindex mno-fpu
5300 @opindex msoft-float
5301 Generate output containing library calls for floating point.
5302 @strong{Warning:} the requisite libraries are not available for all SPARC
5303 targets.  Normally the facilities of the machine's usual C compiler are
5304 used, but this cannot be done directly in cross-compilation.  You must make
5305 your own arrangements to provide suitable library functions for
5306 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
5307 @samp{sparclite-*-*} do provide software floating point support.
5308
5309 @option{-msoft-float} changes the calling convention in the output file;
5310 therefore, it is only useful if you compile @emph{all} of a program with
5311 this option.  In particular, you need to compile @file{libgcc.a}, the
5312 library that comes with GCC, with @option{-msoft-float} in order for
5313 this to work.
5314
5315 @item -mhard-quad-float
5316 @opindex mhard-quad-float
5317 Generate output containing quad-word (long double) floating point
5318 instructions.
5319
5320 @item -msoft-quad-float
5321 @opindex msoft-quad-float
5322 Generate output containing library calls for quad-word (long double)
5323 floating point instructions.  The functions called are those specified
5324 in the SPARC ABI.  This is the default.
5325
5326 As of this writing, there are no sparc implementations that have hardware
5327 support for the quad-word floating point instructions.  They all invoke
5328 a trap handler for one of these instructions, and then the trap handler
5329 emulates the effect of the instruction.  Because of the trap handler overhead,
5330 this is much slower than calling the ABI library routines.  Thus the
5331 @option{-msoft-quad-float} option is the default.
5332
5333 @item -mno-epilogue
5334 @itemx -mepilogue
5335 @opindex mno-epilogue
5336 @opindex mepilogue
5337 With @option{-mepilogue} (the default), the compiler always emits code for
5338 function exit at the end of each function.  Any function exit in
5339 the middle of the function (such as a return statement in C) will
5340 generate a jump to the exit code at the end of the function.
5341
5342 With @option{-mno-epilogue}, the compiler tries to emit exit code inline
5343 at every function exit.
5344
5345 @item -mno-flat
5346 @itemx -mflat
5347 @opindex mno-flat
5348 @opindex mflat
5349 With @option{-mflat}, the compiler does not generate save/restore instructions
5350 and will use a ``flat'' or single register window calling convention.
5351 This model uses %i7 as the frame pointer and is compatible with the normal
5352 register window model.  Code from either may be intermixed.
5353 The local registers and the input registers (0-5) are still treated as
5354 ``call saved'' registers and will be saved on the stack as necessary.
5355
5356 With @option{-mno-flat} (the default), the compiler emits save/restore
5357 instructions (except for leaf functions) and is the normal mode of operation.
5358
5359 @item -mno-unaligned-doubles
5360 @itemx -munaligned-doubles
5361 @opindex mno-unaligned-doubles
5362 @opindex munaligned-doubles
5363 Assume that doubles have 8 byte alignment.  This is the default.
5364
5365 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
5366 alignment only if they are contained in another type, or if they have an
5367 absolute address.  Otherwise, it assumes they have 4 byte alignment.
5368 Specifying this option avoids some rare compatibility problems with code
5369 generated by other compilers.  It is not the default because it results
5370 in a performance loss, especially for floating point code.
5371
5372 @item -mno-faster-structs
5373 @itemx -mfaster-structs
5374 @opindex mno-faster-structs
5375 @opindex mfaster-structs
5376 With @option{-mfaster-structs}, the compiler assumes that structures
5377 should have 8 byte alignment.  This enables the use of pairs of
5378 @code{ldd} and @code{std} instructions for copies in structure
5379 assignment, in place of twice as many @code{ld} and @code{st} pairs.
5380 However, the use of this changed alignment directly violates the Sparc
5381 ABI.  Thus, it's intended only for use on targets where the developer
5382 acknowledges that their resulting code will not be directly in line with
5383 the rules of the ABI.
5384
5385 @item -mv8
5386 @itemx -msparclite
5387 @opindex mv8
5388 @opindex msparclite
5389 These two options select variations on the SPARC architecture.
5390
5391 By default (unless specifically configured for the Fujitsu SPARClite),
5392 GCC generates code for the v7 variant of the SPARC architecture.
5393
5394 @option{-mv8} will give you SPARC v8 code.  The only difference from v7
5395 code is that the compiler emits the integer multiply and integer
5396 divide instructions which exist in SPARC v8 but not in SPARC v7.
5397
5398 @option{-msparclite} will give you SPARClite code.  This adds the integer
5399 multiply, integer divide step and scan (@code{ffs}) instructions which
5400 exist in SPARClite but not in SPARC v7.
5401
5402 These options are deprecated and will be deleted in a future GCC release.
5403 They have been replaced with @option{-mcpu=xxx}.
5404
5405 @item -mcypress
5406 @itemx -msupersparc
5407 @opindex mcypress
5408 @opindex msupersparc
5409 These two options select the processor for which the code is optimised.
5410
5411 With @option{-mcypress} (the default), the compiler optimizes code for the
5412 Cypress CY7C602 chip, as used in the SparcStation/SparcServer 3xx series.
5413 This is also appropriate for the older SparcStation 1, 2, IPX etc.
5414
5415 With @option{-msupersparc} the compiler optimizes code for the SuperSparc cpu, as
5416 used in the SparcStation 10, 1000 and 2000 series. This flag also enables use
5417 of the full SPARC v8 instruction set.
5418
5419 These options are deprecated and will be deleted in a future GCC release.
5420 They have been replaced with @option{-mcpu=xxx}.
5421
5422 @item -mcpu=@var{cpu_type}
5423 @opindex mcpu
5424 Set the instruction set, register set, and instruction scheduling parameters
5425 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
5426 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
5427 @samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
5428 @samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}.
5429
5430 Default instruction scheduling parameters are used for values that select
5431 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
5432 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
5433
5434 Here is a list of each supported architecture and their supported
5435 implementations.
5436
5437 @smallexample
5438     v7:             cypress
5439     v8:             supersparc, hypersparc
5440     sparclite:      f930, f934, sparclite86x
5441     sparclet:       tsc701
5442     v9:             ultrasparc
5443 @end smallexample
5444
5445 @item -mtune=@var{cpu_type}
5446 @opindex mtune
5447 Set the instruction scheduling parameters for machine type
5448 @var{cpu_type}, but do not set the instruction set or register set that the
5449 option @option{-mcpu=@var{cpu_type}} would.
5450
5451 The same values for @option{-mcpu=@var{cpu_type}} are used for
5452 @option{-mtune=@var{cpu_type}}, though the only useful values are those that
5453 select a particular cpu implementation: @samp{cypress}, @samp{supersparc},
5454 @samp{hypersparc}, @samp{f930}, @samp{f934}, @samp{sparclite86x},
5455 @samp{tsc701}, @samp{ultrasparc}.
5456
5457 @end table
5458
5459 These @samp{-m} switches are supported in addition to the above
5460 on the SPARCLET processor.
5461
5462 @table @gcctabopt
5463 @item -mlittle-endian
5464 @opindex mlittle-endian
5465 Generate code for a processor running in little-endian mode.
5466
5467 @item -mlive-g0
5468 @opindex mlive-g0
5469 Treat register @code{%g0} as a normal register.
5470 GCC will continue to clobber it as necessary but will not assume
5471 it always reads as 0.
5472
5473 @item -mbroken-saverestore
5474 @opindex mbroken-saverestore
5475 Generate code that does not use non-trivial forms of the @code{save} and
5476 @code{restore} instructions.  Early versions of the SPARCLET processor do
5477 not correctly handle @code{save} and @code{restore} instructions used with
5478 arguments.  They correctly handle them used without arguments.  A @code{save}
5479 instruction used without arguments increments the current window pointer
5480 but does not allocate a new stack frame.  It is assumed that the window
5481 overflow trap handler will properly handle this case as will interrupt
5482 handlers.
5483 @end table
5484
5485 These @samp{-m} switches are supported in addition to the above
5486 on SPARC V9 processors in 64-bit environments.
5487
5488 @table @gcctabopt
5489 @item -mlittle-endian
5490 @opindex mlittle-endian
5491 Generate code for a processor running in little-endian mode.
5492
5493 @item -m32
5494 @itemx -m64
5495 @opindex m32
5496 @opindex m64
5497 Generate code for a 32-bit or 64-bit environment.
5498 The 32-bit environment sets int, long and pointer to 32 bits.
5499 The 64-bit environment sets int to 32 bits and long and pointer
5500 to 64 bits.
5501
5502 @item -mcmodel=medlow
5503 @opindex mcmodel=medlow
5504 Generate code for the Medium/Low code model: the program must be linked
5505 in the low 32 bits of the address space.  Pointers are 64 bits.
5506 Programs can be statically or dynamically linked.
5507
5508 @item -mcmodel=medmid
5509 @opindex mcmodel=medmid
5510 Generate code for the Medium/Middle code model: the program must be linked
5511 in the low 44 bits of the address space, the text segment must be less than
5512 2G bytes, and data segment must be within 2G of the text segment.
5513 Pointers are 64 bits.
5514
5515 @item -mcmodel=medany
5516 @opindex mcmodel=medany
5517 Generate code for the Medium/Anywhere code model: the program may be linked
5518 anywhere in the address space, the text segment must be less than
5519 2G bytes, and data segment must be within 2G of the text segment.
5520 Pointers are 64 bits.
5521
5522 @item -mcmodel=embmedany
5523 @opindex mcmodel=embmedany
5524 Generate code for the Medium/Anywhere code model for embedded systems:
5525 assume a 32-bit text and a 32-bit data segment, both starting anywhere
5526 (determined at link time).  Register %g4 points to the base of the
5527 data segment.  Pointers are still 64 bits.
5528 Programs are statically linked, PIC is not supported.
5529
5530 @item -mstack-bias
5531 @itemx -mno-stack-bias
5532 @opindex mstack-bias
5533 @opindex mno-stack-bias
5534 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
5535 frame pointer if present, are offset by @minus{}2047 which must be added back
5536 when making stack frame references.
5537 Otherwise, assume no such offset is present.
5538 @end table
5539
5540 @node Convex Options
5541 @subsection Convex Options
5542 @cindex Convex options
5543
5544 These @samp{-m} options are defined for Convex:
5545
5546 @table @gcctabopt
5547 @item -mc1
5548 @opindex mc1
5549 Generate output for C1.  The code will run on any Convex machine.
5550 The preprocessor symbol @code{__convex__c1__} is defined.
5551
5552 @item -mc2
5553 @opindex mc2
5554 Generate output for C2.  Uses instructions not available on C1.
5555 Scheduling and other optimizations are chosen for max performance on C2.
5556 The preprocessor symbol @code{__convex_c2__} is defined.
5557
5558 @item -mc32
5559 @opindex mc32
5560 Generate output for C32xx.  Uses instructions not available on C1.
5561 Scheduling and other optimizations are chosen for max performance on C32.
5562 The preprocessor symbol @code{__convex_c32__} is defined.
5563
5564 @item -mc34
5565 @opindex mc34
5566 Generate output for C34xx.  Uses instructions not available on C1.
5567 Scheduling and other optimizations are chosen for max performance on C34.
5568 The preprocessor symbol @code{__convex_c34__} is defined.
5569
5570 @item -mc38
5571 @opindex mc38
5572 Generate output for C38xx.  Uses instructions not available on C1.
5573 Scheduling and other optimizations are chosen for max performance on C38.
5574 The preprocessor symbol @code{__convex_c38__} is defined.
5575
5576 @item -margcount
5577 @opindex margcount
5578 Generate code which puts an argument count in the word preceding each
5579 argument list.  This is compatible with regular CC, and a few programs
5580 may need the argument count word.  GDB and other source-level debuggers
5581 do not need it; this info is in the symbol table.
5582
5583 @item -mnoargcount
5584 @opindex mnoargcount
5585 Omit the argument count word.  This is the default.
5586
5587 @item -mvolatile-cache
5588 @opindex mvolatile-cache
5589 Allow volatile references to be cached.  This is the default.
5590
5591 @item -mvolatile-nocache
5592 @opindex mvolatile-nocache
5593 Volatile references bypass the data cache, going all the way to memory.
5594 This is only needed for multi-processor code that does not use standard
5595 synchronization instructions.  Making non-volatile references to volatile
5596 locations will not necessarily work.
5597
5598 @item -mlong32
5599 @opindex mlong32
5600 Type long is 32 bits, the same as type int.  This is the default.
5601
5602 @item -mlong64
5603 @opindex mlong64
5604 Type long is 64 bits, the same as type long long.  This option is useless,
5605 because no library support exists for it.
5606 @end table
5607
5608 @node AMD29K Options
5609 @subsection AMD29K Options
5610 @cindex AMD29K options
5611
5612 These @samp{-m} options are defined for the AMD Am29000:
5613
5614 @table @gcctabopt
5615 @item -mdw
5616 @opindex mdw
5617 @cindex DW bit (29k)
5618 Generate code that assumes the @code{DW} bit is set, i.e., that byte and
5619 halfword operations are directly supported by the hardware.  This is the
5620 default.
5621
5622 @item -mndw
5623 @opindex mndw
5624 Generate code that assumes the @code{DW} bit is not set.
5625
5626 @item -mbw
5627 @opindex mbw
5628 @cindex byte writes (29k)
5629 Generate code that assumes the system supports byte and halfword write
5630 operations.  This is the default.
5631
5632 @item -mnbw
5633 @opindex mnbw
5634 Generate code that assumes the systems does not support byte and
5635 halfword write operations.  @option{-mnbw} implies @option{-mndw}.
5636
5637 @item -msmall
5638 @opindex msmall
5639 @cindex memory model (29k)
5640 Use a small memory model that assumes that all function addresses are
5641 either within a single 256 KB segment or at an absolute address of less
5642 than 256k.  This allows the @code{call} instruction to be used instead
5643 of a @code{const}, @code{consth}, @code{calli} sequence.
5644
5645 @item -mnormal
5646 @opindex mnormal
5647 Use the normal memory model: Generate @code{call} instructions only when
5648 calling functions in the same file and @code{calli} instructions
5649 otherwise.  This works if each file occupies less than 256 KB but allows
5650 the entire executable to be larger than 256 KB.  This is the default.
5651
5652 @item -mlarge
5653 @opindex mlarge
5654 Always use @code{calli} instructions.  Specify this option if you expect
5655 a single file to compile into more than 256 KB of code.
5656
5657 @item -m29050
5658 @opindex m29050
5659 @cindex processor selection (29k)
5660 Generate code for the Am29050.
5661
5662 @item -m29000
5663 @opindex m29000
5664 Generate code for the Am29000.  This is the default.
5665
5666 @item -mkernel-registers
5667 @opindex mkernel-registers
5668 @cindex kernel and user registers (29k)
5669 Generate references to registers @code{gr64-gr95} instead of to
5670 registers @code{gr96-gr127}.  This option can be used when compiling
5671 kernel code that wants a set of global registers disjoint from that used
5672 by user-mode code.
5673
5674 Note that when this option is used, register names in @samp{-f} flags
5675 must use the normal, user-mode, names.
5676
5677 @item -muser-registers
5678 @opindex muser-registers
5679 Use the normal set of global registers, @code{gr96-gr127}.  This is the
5680 default.
5681
5682 @item -mstack-check
5683 @itemx -mno-stack-check
5684 @opindex mstack-check
5685 @opindex mno-stack-check
5686 @cindex stack checks (29k)
5687 Insert (or do not insert) a call to @code{__msp_check} after each stack
5688 adjustment.  This is often used for kernel code.
5689
5690 @item -mstorem-bug
5691 @itemx -mno-storem-bug
5692 @opindex mstorem-bug
5693 @opindex mno-storem-bug
5694 @cindex storem bug (29k)
5695 @option{-mstorem-bug} handles 29k processors which cannot handle the
5696 separation of a mtsrim insn and a storem instruction (most 29000 chips
5697 to date, but not the 29050).
5698
5699 @item -mno-reuse-arg-regs
5700 @itemx -mreuse-arg-regs
5701 @opindex mno-reuse-arg-regs
5702 @opindex mreuse-arg-regs
5703 @option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
5704 registers for copying out arguments.  This helps detect calling a function
5705 with fewer arguments than it was declared with.
5706
5707 @item -mno-impure-text
5708 @itemx -mimpure-text
5709 @opindex mno-impure-text
5710 @opindex mimpure-text
5711 @option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to
5712 not pass @option{-assert pure-text} to the linker when linking a shared object.
5713
5714 @item -msoft-float
5715 @opindex msoft-float
5716 Generate output containing library calls for floating point.
5717 @strong{Warning:} the requisite libraries are not part of GCC.
5718 Normally the facilities of the machine's usual C compiler are used, but
5719 this can't be done directly in cross-compilation.  You must make your
5720 own arrangements to provide suitable library functions for
5721 cross-compilation.
5722
5723 @item -mno-multm
5724 @opindex mno-multm
5725 Do not generate multm or multmu instructions.  This is useful for some embedded
5726 systems which do not have trap handlers for these instructions.
5727 @end table
5728
5729 @node ARM Options
5730 @subsection ARM Options
5731 @cindex ARM options
5732
5733 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
5734 architectures:
5735
5736 @table @gcctabopt
5737 @item -mapcs-frame
5738 @opindex mapcs-frame
5739 Generate a stack frame that is compliant with the ARM Procedure Call
5740 Standard for all functions, even if this is not strictly necessary for
5741 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
5742 with this option will cause the stack frames not to be generated for
5743 leaf functions.  The default is @option{-mno-apcs-frame}.
5744
5745 @item -mapcs
5746 @opindex mapcs
5747 This is a synonym for @option{-mapcs-frame}.
5748
5749 @item -mapcs-26
5750 @opindex mapcs-26
5751 Generate code for a processor running with a 26-bit program counter,
5752 and conforming to the function calling standards for the APCS 26-bit
5753 option.  This option replaces the @option{-m2} and @option{-m3} options
5754 of previous releases of the compiler.
5755
5756 @item -mapcs-32
5757 @opindex mapcs-32
5758 Generate code for a processor running with a 32-bit program counter,
5759 and conforming to the function calling standards for the APCS 32-bit
5760 option.  This option replaces the @option{-m6} option of previous releases
5761 of the compiler.
5762
5763 @ignore
5764 @c not currently implemented
5765 @item -mapcs-stack-check
5766 @opindex mapcs-stack-check
5767 Generate code to check the amount of stack space available upon entry to
5768 every function (that actually uses some stack space).  If there is
5769 insufficient space available then either the function
5770 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
5771 called, depending upon the amount of stack space required.  The run time
5772 system is required to provide these functions.  The default is
5773 @option{-mno-apcs-stack-check}, since this produces smaller code.
5774
5775 @c not currently implemented
5776 @item -mapcs-float
5777 @opindex mapcs-float
5778 Pass floating point arguments using the float point registers.  This is
5779 one of the variants of the APCS.  This option is recommended if the
5780 target hardware has a floating point unit or if a lot of floating point
5781 arithmetic is going to be performed by the code.  The default is
5782 @option{-mno-apcs-float}, since integer only code is slightly increased in
5783 size if @option{-mapcs-float} is used.
5784
5785 @c not currently implemented
5786 @item -mapcs-reentrant
5787 @opindex mapcs-reentrant
5788 Generate reentrant, position independent code.  The default is
5789 @option{-mno-apcs-reentrant}.
5790 @end ignore
5791
5792 @item -mthumb-interwork
5793 @opindex mthumb-interwork
5794 Generate code which supports calling between the ARM and Thumb
5795 instruction sets.  Without this option the two instruction sets cannot
5796 be reliably used inside one program.  The default is
5797 @option{-mno-thumb-interwork}, since slightly larger code is generated
5798 when @option{-mthumb-interwork} is specified.
5799
5800 @item -mno-sched-prolog
5801 @opindex mno-sched-prolog
5802 Prevent the reordering of instructions in the function prolog, or the
5803 merging of those instruction with the instructions in the function's
5804 body.  This means that all functions will start with a recognizable set
5805 of instructions (or in fact one of a choice from a small set of
5806 different function prologues), and this information can be used to
5807 locate the start if functions inside an executable piece of code.  The
5808 default is @option{-msched-prolog}.
5809
5810 @item -mhard-float
5811 @opindex mhard-float
5812 Generate output containing floating point instructions.  This is the
5813 default.
5814
5815 @item -msoft-float
5816 @opindex msoft-float
5817 Generate output containing library calls for floating point.
5818 @strong{Warning:} the requisite libraries are not available for all ARM
5819 targets.  Normally the facilities of the machine's usual C compiler are
5820 used, but this cannot be done directly in cross-compilation.  You must make
5821 your own arrangements to provide suitable library functions for
5822 cross-compilation.
5823
5824 @option{-msoft-float} changes the calling convention in the output file;
5825 therefore, it is only useful if you compile @emph{all} of a program with
5826 this option.  In particular, you need to compile @file{libgcc.a}, the
5827 library that comes with GCC, with @option{-msoft-float} in order for
5828 this to work.
5829
5830 @item -mlittle-endian
5831 @opindex mlittle-endian
5832 Generate code for a processor running in little-endian mode.  This is
5833 the default for all standard configurations.
5834
5835 @item -mbig-endian
5836 @opindex mbig-endian
5837 Generate code for a processor running in big-endian mode; the default is
5838 to compile code for a little-endian processor.
5839
5840 @item -mwords-little-endian
5841 @opindex mwords-little-endian
5842 This option only applies when generating code for big-endian processors.
5843 Generate code for a little-endian word order but a big-endian byte
5844 order.  That is, a byte order of the form @samp{32107654}.  Note: this
5845 option should only be used if you require compatibility with code for
5846 big-endian ARM processors generated by versions of the compiler prior to
5847 2.8.
5848
5849 @item -malignment-traps
5850 @opindex malignment-traps
5851 Generate code that will not trap if the MMU has alignment traps enabled.
5852 On ARM architectures prior to ARMv4, there were no instructions to
5853 access half-word objects stored in memory.  However, when reading from
5854 memory a feature of the ARM architecture allows a word load to be used,
5855 even if the address is unaligned, and the processor core will rotate the
5856 data as it is being loaded.  This option tells the compiler that such
5857 misaligned accesses will cause a MMU trap and that it should instead
5858 synthesise the access as a series of byte accesses.  The compiler can
5859 still use word accesses to load half-word data if it knows that the
5860 address is aligned to a word boundary.
5861
5862 This option is ignored when compiling for ARM architecture 4 or later,
5863 since these processors have instructions to directly access half-word
5864 objects in memory.
5865
5866 @item -mno-alignment-traps
5867 @opindex mno-alignment-traps
5868 Generate code that assumes that the MMU will not trap unaligned
5869 accesses.  This produces better code when the target instruction set
5870 does not have half-word memory operations (i.e. implementations prior to
5871 ARMv4).
5872
5873 Note that you cannot use this option to access unaligned word objects,
5874 since the processor will only fetch one 32-bit aligned object from
5875 memory.
5876
5877 The default setting for most targets is @option{-mno-alignment-traps}, since
5878 this produces better code when there are no half-word memory
5879 instructions available.
5880
5881 @item -mshort-load-bytes
5882 @itemx -mno-short-load-words
5883 @opindex mshort-load-bytes
5884 @opindex mno-short-load-words
5885 These are deprecated aliases for @option{-malignment-traps}.
5886
5887 @item -mno-short-load-bytes
5888 @itemx -mshort-load-words
5889 @opindex mno-short-load-bytes
5890 @opindex mshort-load-words
5891 This are deprecated aliases for @option{-mno-alignment-traps}.
5892
5893 @item -mbsd
5894 @opindex mbsd
5895 This option only applies to RISC iX.  Emulate the native BSD-mode
5896 compiler.  This is the default if @option{-ansi} is not specified.
5897
5898 @item -mxopen
5899 @opindex mxopen
5900 This option only applies to RISC iX.  Emulate the native X/Open-mode
5901 compiler.
5902
5903 @item -mno-symrename
5904 @opindex mno-symrename
5905 This option only applies to RISC iX.  Do not run the assembler
5906 post-processor, @samp{symrename}, after code has been assembled.
5907 Normally it is necessary to modify some of the standard symbols in
5908 preparation for linking with the RISC iX C library; this option
5909 suppresses this pass.  The post-processor is never run when the
5910 compiler is built for cross-compilation.
5911
5912 @item -mcpu=@var{name}
5913 @opindex mcpu
5914 This specifies the name of the target ARM processor.  GCC uses this name
5915 to determine what kind of instructions it can emit when generating
5916 assembly code.  Permissible names are: arm2, arm250, arm3, arm6, arm60,
5917 arm600, arm610, arm620, arm7, arm7m, arm7d, arm7dm, arm7di, arm7dmi,
5918 arm70, arm700, arm700i, arm710, arm710c, arm7100, arm7500, arm7500fe,
5919 arm7tdmi, arm8, strongarm, strongarm110, strongarm1100, arm8, arm810,
5920 arm9, arm9e, arm920, arm920t, arm940t, arm9tdmi, arm10tdmi, arm1020t,
5921 xscale.
5922
5923 @itemx -mtune=@var{name}
5924 @opindex mtune
5925 This option is very similar to the @option{-mcpu=} option, except that
5926 instead of specifying the actual target processor type, and hence
5927 restricting which instructions can be used, it specifies that GCC should
5928 tune the performance of the code as if the target were of the type
5929 specified in this option, but still choosing the instructions that it
5930 will generate based on the cpu specified by a @option{-mcpu=} option.
5931 For some ARM implementations better performance can be obtained by using
5932 this option.
5933
5934 @item -march=@var{name}
5935 @opindex march
5936 This specifies the name of the target ARM architecture.  GCC uses this
5937 name to determine what kind of instructions it can emit when generating
5938 assembly code.  This option can be used in conjunction with or instead
5939 of the @option{-mcpu=} option.  Permissible names are: armv2, armv2a,
5940 armv3, armv3m, armv4, armv4t, armv5, armv5t, armv5te.
5941
5942 @item -mfpe=@var{number}
5943 @itemx -mfp=@var{number}
5944 @opindex mfpe
5945 @opindex mfp
5946 This specifies the version of the floating point emulation available on
5947 the target.  Permissible values are 2 and 3.  @option{-mfp=} is a synonym
5948 for @option{-mfpe=}, for compatibility with older versions of GCC.
5949
5950 @item -mstructure-size-boundary=@var{n}
5951 @opindex mstructure-size-boundary
5952 The size of all structures and unions will be rounded up to a multiple
5953 of the number of bits set by this option.  Permissible values are 8 and
5954 32.  The default value varies for different toolchains.  For the COFF
5955 targeted toolchain the default value is 8.  Specifying the larger number
5956 can produce faster, more efficient code, but can also increase the size
5957 of the program.  The two values are potentially incompatible.  Code
5958 compiled with one value cannot necessarily expect to work with code or
5959 libraries compiled with the other value, if they exchange information
5960 using structures or unions.
5961
5962 @item -mabort-on-noreturn
5963 @opindex mabort-on-noreturn
5964 Generate a call to the function @code{abort} at the end of a
5965 @code{noreturn} function.  It will be executed if the function tries to
5966 return.
5967
5968 @item -mlong-calls
5969 @itemx -mno-long-calls
5970 @opindex mlong-calls
5971 @opindex mno-long-calls
5972 Tells the compiler to perform function calls by first loading the
5973 address of the function into a register and then performing a subroutine
5974 call on this register.  This switch is needed if the target function
5975 will lie outside of the 64 megabyte addressing range of the offset based
5976 version of subroutine call instruction.
5977
5978 Even if this switch is enabled, not all function calls will be turned
5979 into long calls.  The heuristic is that static functions, functions
5980 which have the @samp{short-call} attribute, functions that are inside
5981 the scope of a @samp{#pragma no_long_calls} directive and functions whose
5982 definitions have already been compiled within the current compilation
5983 unit, will not be turned into long calls.  The exception to this rule is
5984 that weak function definitions, functions with the @samp{long-call}
5985 attribute or the @samp{section} attribute, and functions that are within
5986 the scope of a @samp{#pragma long_calls} directive, will always be
5987 turned into long calls.
5988
5989 This feature is not enabled by default.  Specifying
5990 @option{-mno-long-calls} will restore the default behaviour, as will
5991 placing the function calls within the scope of a @samp{#pragma
5992 long_calls_off} directive.  Note these switches have no effect on how
5993 the compiler generates code to handle function calls via function
5994 pointers.
5995
5996 @item -mnop-fun-dllimport
5997 @opindex mnop-fun-dllimport
5998 Disable support for the @emph{dllimport} attribute.
5999
6000 @item -msingle-pic-base
6001 @opindex msingle-pic-base
6002 Treat the register used for PIC addressing as read-only, rather than
6003 loading it in the prologue for each function.  The run-time system is
6004 responsible for initialising this register with an appropriate value
6005 before execution begins.
6006
6007 @item -mpic-register=@var{reg}
6008 @opindex mpic-register
6009 Specify the register to be used for PIC addressing.  The default is R10
6010 unless stack-checking is enabled, when R9 is used.
6011
6012 @item -mpoke-function-name
6013 @opindex mpoke-function-name
6014 Write the name of each function into the text section, directly
6015 preceding the function prologue.  The generated code is similar to this:
6016
6017 @smallexample
6018      t0
6019          .ascii "arm_poke_function_name", 0
6020          .align
6021      t1
6022          .word 0xff000000 + (t1 - t0)
6023      arm_poke_function_name
6024          mov     ip, sp
6025          stmfd   sp!, @{fp, ip, lr, pc@}
6026          sub     fp, ip, #4
6027 @end smallexample
6028
6029 When performing a stack backtrace, code can inspect the value of
6030 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6031 location @code{pc - 12} and the top 8 bits are set, then we know that
6032 there is a function name embedded immediately preceding this location
6033 and has length @code{((pc[-3]) & 0xff000000)}.
6034
6035 @item -mthumb
6036 @opindex mthumb
6037 Generate code for the 16-bit Thumb instruction set.  The default is to
6038 use the 32-bit ARM instruction set.
6039
6040 @item -mtpcs-frame
6041 @opindex mtpcs-frame
6042 Generate a stack frame that is compliant with the Thumb Procedure Call
6043 Standard for all non-leaf functions.  (A leaf function is one that does
6044 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6045
6046 @item -mtpcs-leaf-frame
6047 @opindex mtpcs-leaf-frame
6048 Generate a stack frame that is compliant with the Thumb Procedure Call
6049 Standard for all leaf functions.  (A leaf function is one that does
6050 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6051
6052 @item -mcallee-super-interworking
6053 @opindex mcallee-super-interworking
6054 Gives all externally visible functions in the file being compiled an ARM
6055 instruction set header which switches to Thumb mode before executing the
6056 rest of the function.  This allows these functions to be called from
6057 non-interworking code.
6058
6059 @item -mcaller-super-interworking
6060 @opindex mcaller-super-interworking
6061 Allows calls via function pointers (including virtual functions) to
6062 execute correctly regardless of whether the target code has been
6063 compiled for interworking or not.  There is a small overhead in the cost
6064 of executing a function pointer if this option is enabled.
6065
6066 @end table
6067
6068 @node MN10200 Options
6069 @subsection MN10200 Options
6070 @cindex MN10200 options
6071 These @option{-m} options are defined for Matsushita MN10200 architectures:
6072 @table @gcctabopt
6073
6074 @item -mrelax
6075 @opindex mrelax
6076 Indicate to the linker that it should perform a relaxation optimization pass
6077 to shorten branches, calls and absolute memory addresses.  This option only
6078 has an effect when used on the command line for the final link step.
6079
6080 This option makes symbolic debugging impossible.
6081 @end table
6082
6083 @node MN10300 Options
6084 @subsection MN10300 Options
6085 @cindex MN10300 options
6086 These @option{-m} options are defined for Matsushita MN10300 architectures:
6087
6088 @table @gcctabopt
6089 @item -mmult-bug
6090 @opindex mmult-bug
6091 Generate code to avoid bugs in the multiply instructions for the MN10300
6092 processors.  This is the default.
6093
6094 @item -mno-mult-bug
6095 @opindex mno-mult-bug
6096 Do not generate code to avoid bugs in the multiply instructions for the
6097 MN10300 processors.
6098
6099 @item -mam33
6100 @opindex mam33
6101 Generate code which uses features specific to the AM33 processor.
6102
6103 @item -mno-am33
6104 @opindex mno-am33
6105 Do not generate code which uses features specific to the AM33 processor.  This
6106 is the default.
6107
6108 @item -mno-crt0
6109 @opindex mno-crt0
6110 Do not link in the C run-time initialization object file.
6111
6112 @item -mrelax
6113 @opindex mrelax
6114 Indicate to the linker that it should perform a relaxation optimization pass
6115 to shorten branches, calls and absolute memory addresses.  This option only
6116 has an effect when used on the command line for the final link step.
6117
6118 This option makes symbolic debugging impossible.
6119 @end table
6120
6121
6122 @node M32R/D Options
6123 @subsection M32R/D Options
6124 @cindex M32R/D options
6125
6126 These @option{-m} options are defined for Mitsubishi M32R/D architectures:
6127
6128 @table @gcctabopt
6129 @item -mcode-model=small
6130 @opindex mcode-model=small
6131 Assume all objects live in the lower 16MB of memory (so that their addresses
6132 can be loaded with the @code{ld24} instruction), and assume all subroutines
6133 are reachable with the @code{bl} instruction.
6134 This is the default.
6135
6136 The addressability of a particular object can be set with the
6137 @code{model} attribute.
6138
6139 @item -mcode-model=medium
6140 @opindex mcode-model=medium
6141 Assume objects may be anywhere in the 32-bit address space (the compiler
6142 will generate @code{seth/add3} instructions to load their addresses), and
6143 assume all subroutines are reachable with the @code{bl} instruction.
6144
6145 @item -mcode-model=large
6146 @opindex mcode-model=large
6147 Assume objects may be anywhere in the 32-bit address space (the compiler
6148 will generate @code{seth/add3} instructions to load their addresses), and
6149 assume subroutines may not be reachable with the @code{bl} instruction
6150 (the compiler will generate the much slower @code{seth/add3/jl}
6151 instruction sequence).
6152
6153 @item -msdata=none
6154 @opindex msdata=none
6155 Disable use of the small data area.  Variables will be put into
6156 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6157 @code{section} attribute has been specified).
6158 This is the default.
6159
6160 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6161 Objects may be explicitly put in the small data area with the
6162 @code{section} attribute using one of these sections.
6163
6164 @item -msdata=sdata
6165 @opindex msdata=sdata
6166 Put small global and static data in the small data area, but do not
6167 generate special code to reference them.
6168
6169 @item -msdata=use
6170 @opindex msdata=use
6171 Put small global and static data in the small data area, and generate
6172 special instructions to reference them.
6173
6174 @item -G @var{num}
6175 @opindex G
6176 @cindex smaller data references
6177 Put global and static objects less than or equal to @var{num} bytes
6178 into the small data or bss sections instead of the normal data or bss
6179 sections.  The default value of @var{num} is 8.
6180 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6181 for this option to have any effect.
6182
6183 All modules should be compiled with the same @option{-G @var{num}} value.
6184 Compiling with different values of @var{num} may or may not work; if it
6185 doesn't the linker will give an error message---incorrect code will not be
6186 generated.
6187
6188 @end table
6189
6190 @node M88K Options
6191 @subsection M88K Options
6192 @cindex M88k options
6193
6194 These @samp{-m} options are defined for Motorola 88k architectures:
6195
6196 @table @gcctabopt
6197 @item -m88000
6198 @opindex m88000
6199 Generate code that works well on both the m88100 and the
6200 m88110.
6201
6202 @item -m88100
6203 @opindex m88100
6204 Generate code that works best for the m88100, but that also
6205 runs on the m88110.
6206
6207 @item -m88110
6208 @opindex m88110
6209 Generate code that works best for the m88110, and may not run
6210 on the m88100.
6211
6212 @item -mbig-pic
6213 @opindex mbig-pic
6214 Obsolete option to be removed from the next revision.
6215 Use @option{-fPIC}.
6216
6217 @item -midentify-revision
6218 @opindex midentify-revision
6219 @cindex identifying source, compiler (88k)
6220 Include an @code{ident} directive in the assembler output recording the
6221 source file name, compiler name and version, timestamp, and compilation
6222 flags used.
6223
6224 @item -mno-underscores
6225 @opindex mno-underscores
6226 @cindex underscores, avoiding (88k)
6227 In assembler output, emit symbol names without adding an underscore
6228 character at the beginning of each name.  The default is to use an
6229 underscore as prefix on each name.
6230
6231 @item -mocs-debug-info
6232 @itemx -mno-ocs-debug-info
6233 @opindex mocs-debug-info
6234 @opindex mno-ocs-debug-info
6235 @cindex OCS (88k)
6236 @cindex debugging, 88k OCS
6237 Include (or omit) additional debugging information (about registers used
6238 in each stack frame) as specified in the 88open Object Compatibility
6239 Standard, ``OCS''.  This extra information allows debugging of code that
6240 has had the frame pointer eliminated.  The default for DG/UX, SVr4, and
6241 Delta 88 SVr3.2 is to include this information; other 88k configurations
6242 omit this information by default.
6243
6244 @item -mocs-frame-position
6245 @opindex mocs-frame-position
6246 @cindex register positions in frame (88k)
6247 When emitting COFF debugging information for automatic variables and
6248 parameters stored on the stack, use the offset from the canonical frame
6249 address, which is the stack pointer (register 31) on entry to the
6250 function.  The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
6251 @option{-mocs-frame-position}; other 88k configurations have the default
6252 @option{-mno-ocs-frame-position}.
6253
6254 @item -mno-ocs-frame-position
6255 @opindex mno-ocs-frame-position
6256 @cindex register positions in frame (88k)
6257 When emitting COFF debugging information for automatic variables and
6258 parameters stored on the stack, use the offset from the frame pointer
6259 register (register 30).  When this option is in effect, the frame
6260 pointer is not eliminated when debugging information is selected by the
6261 -g switch.
6262
6263 @item -moptimize-arg-area
6264 @itemx -mno-optimize-arg-area
6265 @opindex moptimize-arg-area
6266 @opindex mno-optimize-arg-area
6267 @cindex arguments in frame (88k)
6268 Control how function arguments are stored in stack frames.
6269 @option{-moptimize-arg-area} saves space by optimizing them, but this
6270 conflicts with the 88open specifications.  The opposite alternative,
6271 @option{-mno-optimize-arg-area}, agrees with 88open standards.  By default
6272 GCC does not optimize the argument area.
6273
6274 @item -mshort-data-@var{num}
6275 @opindex mshort-data
6276 @cindex smaller data references (88k)
6277 @cindex r0-relative references (88k)
6278 Generate smaller data references by making them relative to @code{r0},
6279 which allows loading a value using a single instruction (rather than the
6280 usual two).  You control which data references are affected by
6281 specifying @var{num} with this option.  For example, if you specify
6282 @option{-mshort-data-512}, then the data references affected are those
6283 involving displacements of less than 512 bytes.
6284 @option{-mshort-data-@var{num}} is not effective for @var{num} greater
6285 than 64k.
6286
6287 @item -mserialize-volatile
6288 @opindex mserialize-volatile
6289 @itemx -mno-serialize-volatile
6290 @opindex mno-serialize-volatile
6291 @cindex sequential consistency on 88k
6292 Do, or don't, generate code to guarantee sequential consistency
6293 of volatile memory references.  By default, consistency is
6294 guaranteed.
6295
6296 The order of memory references made by the MC88110 processor does
6297 not always match the order of the instructions requesting those
6298 references.  In particular, a load instruction may execute before
6299 a preceding store instruction.  Such reordering violates
6300 sequential consistency of volatile memory references, when there
6301 are multiple processors.   When consistency must be guaranteed,
6302 GNU C generates special instructions, as needed, to force
6303 execution in the proper order.
6304
6305 The MC88100 processor does not reorder memory references and so
6306 always provides sequential consistency.  However, by default, GNU
6307 C generates the special instructions to guarantee consistency
6308 even when you use @option{-m88100}, so that the code may be run on an
6309 MC88110 processor.  If you intend to run your code only on the
6310 MC88100 processor, you may use @option{-mno-serialize-volatile}.
6311
6312 The extra code generated to guarantee consistency may affect the
6313 performance of your application.  If you know that you can safely
6314 forgo this guarantee, you may use @option{-mno-serialize-volatile}.
6315
6316 @item -msvr4
6317 @itemx -msvr3
6318 @opindex msvr4
6319 @opindex msvr3
6320 @cindex assembler syntax, 88k
6321 @cindex SVr4
6322 Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions
6323 related to System V release 4 (SVr4).  This controls the following:
6324
6325 @enumerate
6326 @item
6327 Which variant of the assembler syntax to emit.
6328 @item
6329 @option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
6330 that is used on System V release 4.
6331 @item
6332 @option{-msvr4} makes GCC issue additional declaration directives used in
6333 SVr4.
6334 @end enumerate
6335
6336 @option{-msvr4} is the default for the m88k-motorola-sysv4 and
6337 m88k-dg-dgux m88k configurations. @option{-msvr3} is the default for all
6338 other m88k configurations.
6339
6340 @item -mversion-03.00
6341 @opindex mversion-03.00
6342 This option is obsolete, and is ignored.
6343 @c ??? which asm syntax better for GAS?  option there too?
6344
6345 @item -mno-check-zero-division
6346 @itemx -mcheck-zero-division
6347 @opindex mno-check-zero-division
6348 @opindex mcheck-zero-division
6349 @cindex zero division on 88k
6350 Do, or don't, generate code to guarantee that integer division by
6351 zero will be detected.  By default, detection is guaranteed.
6352
6353 Some models of the MC88100 processor fail to trap upon integer
6354 division by zero under certain conditions.  By default, when
6355 compiling code that might be run on such a processor, GNU C
6356 generates code that explicitly checks for zero-valued divisors
6357 and traps with exception number 503 when one is detected.  Use of
6358 mno-check-zero-division suppresses such checking for code
6359 generated to run on an MC88100 processor.
6360
6361 GNU C assumes that the MC88110 processor correctly detects all
6362 instances of integer division by zero.  When @option{-m88110} is
6363 specified, both @option{-mcheck-zero-division} and
6364 @option{-mno-check-zero-division} are ignored, and no explicit checks for
6365 zero-valued divisors are generated.
6366
6367 @item -muse-div-instruction
6368 @opindex muse-div-instruction
6369 @cindex divide instruction, 88k
6370 Use the div instruction for signed integer division on the
6371 MC88100 processor.  By default, the div instruction is not used.
6372
6373 On the MC88100 processor the signed integer division instruction
6374 div) traps to the operating system on a negative operand.  The
6375 operating system transparently completes the operation, but at a
6376 large cost in execution time.  By default, when compiling code
6377 that might be run on an MC88100 processor, GNU C emulates signed
6378 integer division using the unsigned integer division instruction
6379 divu), thereby avoiding the large penalty of a trap to the
6380 operating system.  Such emulation has its own, smaller, execution
6381 cost in both time and space.  To the extent that your code's
6382 important signed integer division operations are performed on two
6383 nonnegative operands, it may be desirable to use the div
6384 instruction directly.
6385
6386 On the MC88110 processor the div instruction (also known as the
6387 divs instruction) processes negative operands without trapping to
6388 the operating system.  When @option{-m88110} is specified,
6389 @option{-muse-div-instruction} is ignored, and the div instruction is used
6390 for signed integer division.
6391
6392 Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined.  In
6393 particular, the behavior of such a division with and without
6394 @option{-muse-div-instruction} may differ.
6395
6396 @item -mtrap-large-shift
6397 @itemx -mhandle-large-shift
6398 @opindex mtrap-large-shift
6399 @opindex mhandle-large-shift
6400 @cindex bit shift overflow (88k)
6401 @cindex large bit shifts (88k)
6402 Include code to detect bit-shifts of more than 31 bits; respectively,
6403 trap such shifts or emit code to handle them properly.  By default GCC
6404 makes no special provision for large bit shifts.
6405
6406 @item -mwarn-passed-structs
6407 @opindex mwarn-passed-structs
6408 @cindex structure passing (88k)
6409 Warn when a function passes a struct as an argument or result.
6410 Structure-passing conventions have changed during the evolution of the C
6411 language, and are often the source of portability problems.  By default,
6412 GCC issues no such warning.
6413 @end table
6414
6415 @node RS/6000 and PowerPC Options
6416 @subsection IBM RS/6000 and PowerPC Options
6417 @cindex RS/6000 and PowerPC Options
6418 @cindex IBM RS/6000 and PowerPC Options
6419
6420 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6421 @table @gcctabopt
6422 @item -mpower
6423 @itemx -mno-power
6424 @itemx -mpower2
6425 @itemx -mno-power2
6426 @itemx -mpowerpc
6427 @itemx -mno-powerpc
6428 @itemx -mpowerpc-gpopt
6429 @itemx -mno-powerpc-gpopt
6430 @itemx -mpowerpc-gfxopt
6431 @itemx -mno-powerpc-gfxopt
6432 @itemx -mpowerpc64
6433 @itemx -mno-powerpc64
6434 @opindex mpower
6435 @opindex mno-power
6436 @opindex mpower2
6437 @opindex mno-power2
6438 @opindex mpowerpc
6439 @opindex mno-powerpc
6440 @opindex mpowerpc-gpopt
6441 @opindex mno-powerpc-gpopt
6442 @opindex mpowerpc-gfxopt
6443 @opindex mno-powerpc-gfxopt
6444 @opindex mpowerpc64
6445 @opindex mno-powerpc64
6446 GCC supports two related instruction set architectures for the
6447 RS/6000 and PowerPC.  The @dfn{POWER} instruction set are those
6448 instructions supported by the @samp{rios} chip set used in the original
6449 RS/6000 systems and the @dfn{PowerPC} instruction set is the
6450 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
6451 the IBM 4xx microprocessors.
6452
6453 Neither architecture is a subset of the other.  However there is a
6454 large common subset of instructions supported by both.  An MQ
6455 register is included in processors supporting the POWER architecture.
6456
6457 You use these options to specify which instructions are available on the
6458 processor you are using.  The default value of these options is
6459 determined when configuring GCC.  Specifying the
6460 @option{-mcpu=@var{cpu_type}} overrides the specification of these
6461 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
6462 rather than the options listed above.
6463
6464 The @option{-mpower} option allows GCC to generate instructions that
6465 are found only in the POWER architecture and to use the MQ register.
6466 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
6467 to generate instructions that are present in the POWER2 architecture but
6468 not the original POWER architecture.
6469
6470 The @option{-mpowerpc} option allows GCC to generate instructions that
6471 are found only in the 32-bit subset of the PowerPC architecture.
6472 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
6473 GCC to use the optional PowerPC architecture instructions in the
6474 General Purpose group, including floating-point square root.  Specifying
6475 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
6476 use the optional PowerPC architecture instructions in the Graphics
6477 group, including floating-point select.
6478
6479 The @option{-mpowerpc64} option allows GCC to generate the additional
6480 64-bit instructions that are found in the full PowerPC64 architecture
6481 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
6482 @option{-mno-powerpc64}.
6483
6484 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
6485 will use only the instructions in the common subset of both
6486 architectures plus some special AIX common-mode calls, and will not use
6487 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
6488 permits GCC to use any instruction from either architecture and to
6489 allow use of the MQ register; specify this for the Motorola MPC601.
6490
6491 @item -mnew-mnemonics
6492 @itemx -mold-mnemonics
6493 @opindex mnew-mnemonics
6494 @opindex mold-mnemonics
6495 Select which mnemonics to use in the generated assembler code.
6496 @option{-mnew-mnemonics} requests output that uses the assembler mnemonics
6497 defined for the PowerPC architecture, while @option{-mold-mnemonics}
6498 requests the assembler mnemonics defined for the POWER architecture.
6499 Instructions defined in only one architecture have only one mnemonic;
6500 GCC uses that mnemonic irrespective of which of these options is
6501 specified.
6502
6503 GCC defaults to the mnemonics appropriate for the architecture in
6504 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
6505 value of these option.  Unless you are building a cross-compiler, you
6506 should normally not specify either @option{-mnew-mnemonics} or
6507 @option{-mold-mnemonics}, but should instead accept the default.
6508
6509 @item -mcpu=@var{cpu_type}
6510 @opindex mcpu
6511 Set architecture type, register usage, choice of mnemonics, and
6512 instruction scheduling parameters for machine type @var{cpu_type}.
6513 Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
6514 @samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
6515 @samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
6516 @samp{630}, @samp{740}, @samp{750}, @samp{power}, @samp{power2},
6517 @samp{powerpc}, @samp{403}, @samp{505}, @samp{801}, @samp{821},
6518 @samp{823}, and @samp{860} and @samp{common}.  @option{-mcpu=power},
6519 @option{-mcpu=power2}, @option{-mcpu=powerpc}, and @option{-mcpu=powerpc64}
6520 specify generic POWER, POWER2, pure 32-bit PowerPC (i.e., not MPC601),
6521 and 64-bit PowerPC architecture machine types, with an appropriate,
6522 generic processor model assumed for scheduling purposes.@refill
6523
6524 Specifying any of the following options:
6525 @option{-mcpu=rios1}, @option{-mcpu=rios2}, @option{-mcpu=rsc},
6526 @option{-mcpu=power}, or @option{-mcpu=power2}
6527 enables the @option{-mpower} option and disables the @option{-mpowerpc} option;
6528 @option{-mcpu=601} enables both the @option{-mpower} and @option{-mpowerpc} options.
6529 All of @option{-mcpu=rs64a}, @option{-mcpu=602}, @option{-mcpu=603},
6530 @option{-mcpu=603e}, @option{-mcpu=604}, @option{-mcpu=620}, @option{-mcpu=630},
6531 @option{-mcpu=740}, and @option{-mcpu=750}
6532 enable the @option{-mpowerpc} option and disable the @option{-mpower} option.
6533 Exactly similarly, all of @option{-mcpu=403},
6534 @option{-mcpu=505}, @option{-mcpu=821}, @option{-mcpu=860} and @option{-mcpu=powerpc}
6535 enable the @option{-mpowerpc} option and disable the @option{-mpower} option.
6536 @option{-mcpu=common} disables both the
6537 @option{-mpower} and @option{-mpowerpc} options.@refill
6538
6539 AIX versions 4 or greater selects @option{-mcpu=common} by default, so
6540 that code will operate on all members of the RS/6000 POWER and PowerPC
6541 families.  In that case, GCC will use only the instructions in the
6542 common subset of both architectures plus some special AIX common-mode
6543 calls, and will not use the MQ register.  GCC assumes a generic
6544 processor model for scheduling purposes.
6545
6546 Specifying any of the options @option{-mcpu=rios1}, @option{-mcpu=rios2},
6547 @option{-mcpu=rsc}, @option{-mcpu=power}, or @option{-mcpu=power2} also
6548 disables the @samp{new-mnemonics} option.  Specifying @option{-mcpu=601},
6549 @option{-mcpu=602}, @option{-mcpu=603}, @option{-mcpu=603e}, @option{-mcpu=604},
6550 @option{-mcpu=620}, @option{-mcpu=630}, @option{-mcpu=403}, @option{-mcpu=505},
6551 @option{-mcpu=821}, @option{-mcpu=860} or @option{-mcpu=powerpc} also enables
6552 the @samp{new-mnemonics} option.@refill
6553
6554 Specifying @option{-mcpu=403}, @option{-mcpu=821}, or @option{-mcpu=860} also
6555 enables the @option{-msoft-float} option.
6556
6557 @item -mtune=@var{cpu_type}
6558 @opindex mtune
6559 Set the instruction scheduling parameters for machine type
6560 @var{cpu_type}, but do not set the architecture type, register usage,
6561 choice of mnemonics like @option{-mcpu=@var{cpu_type}} would.  The same
6562 values for @var{cpu_type} are used for @option{-mtune=@var{cpu_type}} as
6563 for @option{-mcpu=@var{cpu_type}}.  The @option{-mtune=@var{cpu_type}}
6564 option overrides the @option{-mcpu=@var{cpu_type}} option in terms of
6565 instruction scheduling parameters.
6566
6567 @item -mfull-toc
6568 @itemx -mno-fp-in-toc
6569 @itemx -mno-sum-in-toc
6570 @itemx -mminimal-toc
6571 @opindex mfull-toc
6572 @opindex mno-fp-in-toc
6573 @opindex mno-sum-in-toc
6574 @opindex mminimal-toc
6575 Modify generation of the TOC (Table Of Contents), which is created for
6576 every executable file.  The @option{-mfull-toc} option is selected by
6577 default.  In that case, GCC will allocate at least one TOC entry for
6578 each unique non-automatic variable reference in your program.  GCC
6579 will also place floating-point constants in the TOC.  However, only
6580 16,384 entries are available in the TOC.
6581
6582 If you receive a linker error message that saying you have overflowed
6583 the available TOC space, you can reduce the amount of TOC space used
6584 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
6585 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
6586 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
6587 generate code to calculate the sum of an address and a constant at
6588 run-time instead of putting that sum into the TOC.  You may specify one
6589 or both of these options.  Each causes GCC to produce very slightly
6590 slower and larger code at the expense of conserving TOC space.
6591
6592 If you still run out of space in the TOC even when you specify both of
6593 these options, specify @option{-mminimal-toc} instead.  This option causes
6594 GCC to make only one TOC entry for every file.  When you specify this
6595 option, GCC will produce code that is slower and larger but which
6596 uses extremely little TOC space.  You may wish to use this option
6597 only on files that contain less frequently executed code. @refill
6598
6599 @item -maix64
6600 @itemx -maix32
6601 @opindex maix64
6602 @opindex maix32
6603 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
6604 @code{long} type, and the infrastructure needed to support them.
6605 Specifying @option{-maix64} implies @option{-mpowerpc64} and
6606 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
6607 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
6608
6609 @item -mxl-call
6610 @itemx -mno-xl-call
6611 @opindex mxl-call
6612 @opindex mno-xl-call
6613 On AIX, pass floating-point arguments to prototyped functions beyond the
6614 register save area (RSA) on the stack in addition to argument FPRs.  The
6615 AIX calling convention was extended but not initially documented to
6616 handle an obscure K&R C case of calling a function that takes the
6617 address of its arguments with fewer arguments than declared.  AIX XL
6618 compilers access floating point arguments which do not fit in the
6619 RSA from the stack when a subroutine is compiled without
6620 optimization.  Because always storing floating-point arguments on the
6621 stack is inefficient and rarely needed, this option is not enabled by
6622 default and only is necessary when calling subroutines compiled by AIX
6623 XL compilers without optimization.
6624
6625 @item -mthreads
6626 @opindex mthreads
6627 Support @dfn{AIX Threads}.  Link an application written to use
6628 @dfn{pthreads} with special libraries and startup code to enable the
6629 application to run.
6630
6631 @item -mpe
6632 @opindex mpe
6633 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE).  Link an
6634 application written to use message passing with special startup code to
6635 enable the application to run.  The system must have PE installed in the
6636 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
6637 must be overridden with the @option{-specs=} option to specify the
6638 appropriate directory location.  The Parallel Environment does not
6639 support threads, so the @option{-mpe} option and the @option{-mthreads}
6640 option are incompatible.
6641
6642 @item -msoft-float
6643 @itemx -mhard-float
6644 @opindex msoft-float
6645 @opindex mhard-float
6646 Generate code that does not use (uses) the floating-point register set.
6647 Software floating point emulation is provided if you use the
6648 @option{-msoft-float} option, and pass the option to GCC when linking.
6649
6650 @item -mmultiple
6651 @itemx -mno-multiple
6652 @opindex mmultiple
6653 @opindex mno-multiple
6654 Generate code that uses (does not use) the load multiple word
6655 instructions and the store multiple word instructions.  These
6656 instructions are generated by default on POWER systems, and not
6657 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
6658 endian PowerPC systems, since those instructions do not work when the
6659 processor is in little endian mode.  The exceptions are PPC740 and
6660 PPC750 which permit the instructions usage in little endian mode.
6661
6662 @item -mstring
6663 @itemx -mno-string
6664 @opindex mstring
6665 @opindex mno-string
6666 Generate code that uses (does not use) the load string instructions
6667 and the store string word instructions to save multiple registers and
6668 do small block moves.  These instructions are generated by default on
6669 POWER systems, and not generated on PowerPC systems.  Do not use
6670 @option{-mstring} on little endian PowerPC systems, since those
6671 instructions do not work when the processor is in little endian mode.
6672 The exceptions are PPC740 and PPC750 which permit the instructions
6673 usage in little endian mode.
6674
6675 @item -mupdate
6676 @itemx -mno-update
6677 @opindex mupdate
6678 @opindex mno-update
6679 Generate code that uses (does not use) the load or store instructions
6680 that update the base register to the address of the calculated memory
6681 location.  These instructions are generated by default.  If you use
6682 @option{-mno-update}, there is a small window between the time that the
6683 stack pointer is updated and the address of the previous frame is
6684 stored, which means code that walks the stack frame across interrupts or
6685 signals may get corrupted data.
6686
6687 @item -mfused-madd
6688 @itemx -mno-fused-madd
6689 @opindex mfused-madd
6690 @opindex mno-fused-madd
6691 Generate code that uses (does not use) the floating point multiply and
6692 accumulate instructions.  These instructions are generated by default if
6693 hardware floating is used.
6694
6695 @item -mno-bit-align
6696 @itemx -mbit-align
6697 @opindex mno-bit-align
6698 @opindex mbit-align
6699 On System V.4 and embedded PowerPC systems do not (do) force structures
6700 and unions that contain bit fields to be aligned to the base type of the
6701 bit field.
6702
6703 For example, by default a structure containing nothing but 8
6704 @code{unsigned} bitfields of length 1 would be aligned to a 4 byte
6705 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
6706 the structure would be aligned to a 1 byte boundary and be one byte in
6707 size.
6708
6709 @item -mno-strict-align
6710 @itemx -mstrict-align
6711 @opindex mno-strict-align
6712 @opindex mstrict-align
6713 On System V.4 and embedded PowerPC systems do not (do) assume that
6714 unaligned memory references will be handled by the system.
6715
6716 @item -mrelocatable
6717 @itemx -mno-relocatable
6718 @opindex mrelocatable
6719 @opindex mno-relocatable
6720 On embedded PowerPC systems generate code that allows (does not allow)
6721 the program to be relocated to a different address at runtime.  If you
6722 use @option{-mrelocatable} on any module, all objects linked together must
6723 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
6724
6725 @item -mrelocatable-lib
6726 @itemx -mno-relocatable-lib
6727 @opindex mrelocatable-lib
6728 @opindex mno-relocatable-lib
6729 On embedded PowerPC systems generate code that allows (does not allow)
6730 the program to be relocated to a different address at runtime.  Modules
6731 compiled with @option{-mrelocatable-lib} can be linked with either modules
6732 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
6733 with modules compiled with the @option{-mrelocatable} options.
6734
6735 @item -mno-toc
6736 @itemx -mtoc
6737 @opindex mno-toc
6738 @opindex mtoc
6739 On System V.4 and embedded PowerPC systems do not (do) assume that
6740 register 2 contains a pointer to a global area pointing to the addresses
6741 used in the program.
6742
6743 @item -mlittle
6744 @itemx -mlittle-endian
6745 @opindex mlittle
6746 @opindex mlittle-endian
6747 On System V.4 and embedded PowerPC systems compile code for the
6748 processor in little endian mode.  The @option{-mlittle-endian} option is
6749 the same as @option{-mlittle}.
6750
6751 @item -mbig
6752 @itemx -mbig-endian
6753 @opindex mbig
6754 @opindex mbig-endian
6755 On System V.4 and embedded PowerPC systems compile code for the
6756 processor in big endian mode.  The @option{-mbig-endian} option is
6757 the same as @option{-mbig}.
6758
6759 @item -mcall-sysv
6760 @opindex mcall-sysv
6761 On System V.4 and embedded PowerPC systems compile code using calling
6762 conventions that adheres to the March 1995 draft of the System V
6763 Application Binary Interface, PowerPC processor supplement.  This is the
6764 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
6765
6766 @item -mcall-sysv-eabi
6767 @opindex mcall-sysv-eabi
6768 Specify both @option{-mcall-sysv} and @option{-meabi} options.
6769
6770 @item -mcall-sysv-noeabi
6771 @opindex mcall-sysv-noeabi
6772 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
6773
6774 @item -mcall-aix
6775 @opindex mcall-aix
6776 On System V.4 and embedded PowerPC systems compile code using calling
6777 conventions that are similar to those used on AIX.  This is the
6778 default if you configured GCC using @samp{powerpc-*-eabiaix}.
6779
6780 @item -mcall-solaris
6781 @opindex mcall-solaris
6782 On System V.4 and embedded PowerPC systems compile code for the Solaris
6783 operating system.
6784
6785 @item -mcall-linux
6786 @opindex mcall-linux
6787 On System V.4 and embedded PowerPC systems compile code for the
6788 Linux-based GNU system.
6789
6790 @item -mprototype
6791 @itemx -mno-prototype
6792 @opindex mprototype
6793 @opindex mno-prototype
6794 On System V.4 and embedded PowerPC systems assume that all calls to
6795 variable argument functions are properly prototyped.  Otherwise, the
6796 compiler must insert an instruction before every non prototyped call to
6797 set or clear bit 6 of the condition code register (@var{CR}) to
6798 indicate whether floating point values were passed in the floating point
6799 registers in case the function takes a variable arguments.  With
6800 @option{-mprototype}, only calls to prototyped variable argument functions
6801 will set or clear the bit.
6802
6803 @item -msim
6804 @opindex msim
6805 On embedded PowerPC systems, assume that the startup module is called
6806 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
6807 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
6808 configurations.
6809
6810 @item -mmvme
6811 @opindex mmvme
6812 On embedded PowerPC systems, assume that the startup module is called
6813 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
6814 @file{libc.a}.
6815
6816 @item -mads
6817 @opindex mads
6818 On embedded PowerPC systems, assume that the startup module is called
6819 @file{crt0.o} and the standard C libraries are @file{libads.a} and
6820 @file{libc.a}.
6821
6822 @item -myellowknife
6823 @opindex myellowknife
6824 On embedded PowerPC systems, assume that the startup module is called
6825 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
6826 @file{libc.a}.
6827
6828 @item -mvxworks
6829 @opindex mvxworks
6830 On System V.4 and embedded PowerPC systems, specify that you are
6831 compiling for a VxWorks system.
6832
6833 @item -memb
6834 @opindex memb
6835 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
6836 header to indicate that @samp{eabi} extended relocations are used.
6837
6838 @item -meabi
6839 @itemx -mno-eabi
6840 @opindex meabi
6841 @opindex mno-eabi
6842 On System V.4 and embedded PowerPC systems do (do not) adhere to the
6843 Embedded Applications Binary Interface (eabi) which is a set of
6844 modifications to the System V.4 specifications.  Selecting @option{-meabi}
6845 means that the stack is aligned to an 8 byte boundary, a function
6846 @code{__eabi} is called to from @code{main} to set up the eabi
6847 environment, and the @option{-msdata} option can use both @code{r2} and
6848 @code{r13} to point to two separate small data areas.  Selecting
6849 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
6850 do not call an initialization function from @code{main}, and the
6851 @option{-msdata} option will only use @code{r13} to point to a single
6852 small data area.  The @option{-meabi} option is on by default if you
6853 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
6854
6855 @item -msdata=eabi
6856 @opindex msdata=eabi
6857 On System V.4 and embedded PowerPC systems, put small initialized
6858 @code{const} global and static data in the @samp{.sdata2} section, which
6859 is pointed to by register @code{r2}.  Put small initialized
6860 non-@code{const} global and static data in the @samp{.sdata} section,
6861 which is pointed to by register @code{r13}.  Put small uninitialized
6862 global and static data in the @samp{.sbss} section, which is adjacent to
6863 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
6864 incompatible with the @option{-mrelocatable} option.  The
6865 @option{-msdata=eabi} option also sets the @option{-memb} option.
6866
6867 @item -msdata=sysv
6868 @opindex msdata=sysv
6869 On System V.4 and embedded PowerPC systems, put small global and static
6870 data in the @samp{.sdata} section, which is pointed to by register
6871 @code{r13}.  Put small uninitialized global and static data in the
6872 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
6873 The @option{-msdata=sysv} option is incompatible with the
6874 @option{-mrelocatable} option.
6875
6876 @item -msdata=default
6877 @itemx -msdata
6878 @opindex msdata=default
6879 @opindex msdata
6880 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
6881 compile code the same as @option{-msdata=eabi}, otherwise compile code the
6882 same as @option{-msdata=sysv}.
6883
6884 @item -msdata-data
6885 @opindex msdata-data
6886 On System V.4 and embedded PowerPC systems, put small global and static
6887 data in the @samp{.sdata} section.  Put small uninitialized global and
6888 static data in the @samp{.sbss} section.  Do not use register @code{r13}
6889 to address small data however.  This is the default behavior unless
6890 other @option{-msdata} options are used.
6891
6892 @item -msdata=none
6893 @itemx -mno-sdata
6894 @opindex msdata=none
6895 @opindex mno-sdata
6896 On embedded PowerPC systems, put all initialized global and static data
6897 in the @samp{.data} section, and all uninitialized data in the
6898 @samp{.bss} section.
6899
6900 @item -G @var{num}
6901 @opindex G
6902 @cindex smaller data references (PowerPC)
6903 @cindex .sdata/.sdata2 references (PowerPC)
6904 On embedded PowerPC systems, put global and static items less than or
6905 equal to @var{num} bytes into the small data or bss sections instead of
6906 the normal data or bss section.  By default, @var{num} is 8.  The
6907 @option{-G @var{num}} switch is also passed to the linker.
6908 All modules should be compiled with the same @option{-G @var{num}} value.
6909
6910 @item -mregnames
6911 @itemx -mno-regnames
6912 @opindex mregnames
6913 @opindex mno-regnames
6914 On System V.4 and embedded PowerPC systems do (do not) emit register
6915 names in the assembly language output using symbolic forms.
6916
6917 @end table
6918
6919 @node RT Options
6920 @subsection IBM RT Options
6921 @cindex RT options
6922 @cindex IBM RT options
6923
6924 These @samp{-m} options are defined for the IBM RT PC:
6925
6926 @table @gcctabopt
6927 @item -min-line-mul
6928 @opindex min-line-mul
6929 Use an in-line code sequence for integer multiplies.  This is the
6930 default.
6931
6932 @item -mcall-lib-mul
6933 @opindex mcall-lib-mul
6934 Call @code{lmul$$} for integer multiples.
6935
6936 @item -mfull-fp-blocks
6937 @opindex mfull-fp-blocks
6938 Generate full-size floating point data blocks, including the minimum
6939 amount of scratch space recommended by IBM.  This is the default.
6940
6941 @item -mminimum-fp-blocks
6942 @opindex mminimum-fp-blocks
6943 Do not include extra scratch space in floating point data blocks.  This
6944 results in smaller code, but slower execution, since scratch space must
6945 be allocated dynamically.
6946
6947 @cindex @file{varargs.h} and RT PC
6948 @cindex @file{stdarg.h} and RT PC
6949 @item -mfp-arg-in-fpregs
6950 @opindex mfp-arg-in-fpregs
6951 Use a calling sequence incompatible with the IBM calling convention in
6952 which floating point arguments are passed in floating point registers.
6953 Note that @code{varargs.h} and @code{stdargs.h} will not work with
6954 floating point operands if this option is specified.
6955
6956 @item -mfp-arg-in-gregs
6957 @opindex mfp-arg-in-gregs
6958 Use the normal calling convention for floating point arguments.  This is
6959 the default.
6960
6961 @item -mhc-struct-return
6962 @opindex mhc-struct-return
6963 Return structures of more than one word in memory, rather than in a
6964 register.  This provides compatibility with the MetaWare HighC (hc)
6965 compiler.  Use the option @option{-fpcc-struct-return} for compatibility
6966 with the Portable C Compiler (pcc).
6967
6968 @item -mnohc-struct-return
6969 @opindex mnohc-struct-return
6970 Return some structures of more than one word in registers, when
6971 convenient.  This is the default.  For compatibility with the
6972 IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
6973 option @option{-mhc-struct-return}.
6974 @end table
6975
6976 @node MIPS Options
6977 @subsection MIPS Options
6978 @cindex MIPS options
6979
6980 These @samp{-m} options are defined for the MIPS family of computers:
6981
6982 @table @gcctabopt
6983 @item -mcpu=@var{cpu-type}
6984 @opindex mcpu
6985 Assume the defaults for the machine type @var{cpu-type} when scheduling
6986 instructions.  The choices for @var{cpu-type} are @samp{r2000}, @samp{r3000},
6987 @samp{r3900}, @samp{r4000}, @samp{r4100}, @samp{r4300}, @samp{r4400},
6988 @samp{r4600}, @samp{r4650}, @samp{r5000}, @samp{r6000}, @samp{r8000},
6989 and @samp{orion}.  Additionally, the @samp{r2000}, @samp{r3000},
6990 @samp{r4000}, @samp{r5000}, and @samp{r6000} can be abbreviated as
6991 @samp{r2k} (or @samp{r2K}), @samp{r3k}, etc.  While picking a specific
6992 @var{cpu-type} will schedule things appropriately for that particular
6993 chip, the compiler will not generate any code that does not meet level 1
6994 of the MIPS ISA (instruction set architecture) without a @option{-mipsX}
6995 or @option{-mabi} switch being used.
6996
6997 @item -mips1
6998 @opindex mips1
6999 Issue instructions from level 1 of the MIPS ISA.  This is the default.
7000 @samp{r3000} is the default @var{cpu-type} at this ISA level.
7001
7002 @item -mips2
7003 @opindex mips2
7004 Issue instructions from level 2 of the MIPS ISA (branch likely, square
7005 root instructions).  @samp{r6000} is the default @var{cpu-type} at this
7006 ISA level.
7007
7008 @item -mips3
7009 @opindex mips3
7010 Issue instructions from level 3 of the MIPS ISA (64-bit instructions).
7011 @samp{r4000} is the default @var{cpu-type} at this ISA level.
7012
7013 @item -mips4
7014 @opindex mips4
7015 Issue instructions from level 4 of the MIPS ISA (conditional move,
7016 prefetch, enhanced FPU instructions).  @samp{r8000} is the default
7017 @var{cpu-type} at this ISA level.
7018
7019 @item -mfp32
7020 @opindex mfp32
7021 Assume that 32 32-bit floating point registers are available.  This is
7022 the default.
7023
7024 @item -mfp64
7025 @opindex mfp64
7026 Assume that 32 64-bit floating point registers are available.  This is
7027 the default when the @option{-mips3} option is used.
7028
7029 @item -mgp32
7030 @opindex mgp32
7031 Assume that 32 32-bit general purpose registers are available.  This is
7032 the default.
7033
7034 @item -mgp64
7035 @opindex mgp64
7036 Assume that 32 64-bit general purpose registers are available.  This is
7037 the default when the @option{-mips3} option is used.
7038
7039 @item -mint64
7040 @opindex mint64
7041 Force int and long types to be 64 bits wide.  See @option{-mlong32} for an
7042 explanation of the default, and the width of pointers.
7043
7044 @item -mlong64
7045 @opindex mlong64
7046 Force long types to be 64 bits wide.  See @option{-mlong32} for an
7047 explanation of the default, and the width of pointers.
7048
7049 @item -mlong32
7050 @opindex mlong32
7051 Force long, int, and pointer types to be 32 bits wide.
7052
7053 If none of @option{-mlong32}, @option{-mlong64}, or @option{-mint64} are set,
7054 the size of ints, longs, and pointers depends on the ABI and ISA chosen.
7055 For @option{-mabi=32}, and @option{-mabi=n32}, ints and longs are 32 bits
7056 wide.  For @option{-mabi=64}, ints are 32 bits, and longs are 64 bits wide.
7057 For @option{-mabi=eabi} and either @option{-mips1} or @option{-mips2}, ints
7058 and longs are 32 bits wide.  For @option{-mabi=eabi} and higher ISAs, ints
7059 are 32 bits, and longs are 64 bits wide.  The width of pointer types is
7060 the smaller of the width of longs or the width of general purpose
7061 registers (which in turn depends on the ISA).
7062
7063 @item -mabi=32
7064 @itemx -mabi=o64
7065 @itemx -mabi=n32
7066 @itemx -mabi=64
7067 @itemx -mabi=eabi
7068 @opindex mabi=32
7069 @opindex mabi=o64
7070 @opindex mabi=n32
7071 @opindex mabi=64
7072 @opindex mabi=eabi
7073 Generate code for the indicated ABI.  The default instruction level is
7074 @option{-mips1} for @samp{32}, @option{-mips3} for @samp{n32}, and
7075 @option{-mips4} otherwise.  Conversely, with @option{-mips1} or
7076 @option{-mips2}, the default ABI is @samp{32}; otherwise, the default ABI
7077 is @samp{64}.
7078
7079 @item -mmips-as
7080 @opindex mmips-as
7081 Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
7082 add normal debug information.  This is the default for all
7083 platforms except for the OSF/1 reference platform, using the OSF/rose
7084 object format.  If the either of the @option{-gstabs} or @option{-gstabs+}
7085 switches are used, the @file{mips-tfile} program will encapsulate the
7086 stabs within MIPS ECOFF.
7087
7088 @item -mgas
7089 @opindex mgas
7090 Generate code for the GNU assembler.  This is the default on the OSF/1
7091 reference platform, using the OSF/rose object format.  Also, this is
7092 the default if the configure option @option{--with-gnu-as} is used.
7093
7094 @item -msplit-addresses
7095 @itemx -mno-split-addresses
7096 @opindex msplit-addresses
7097 @opindex mno-split-addresses
7098 Generate code to load the high and low parts of address constants separately.
7099 This allows @code{gcc} to optimize away redundant loads of the high order
7100 bits of addresses.  This optimization requires GNU as and GNU ld.
7101 This optimization is enabled by default for some embedded targets where
7102 GNU as and GNU ld are standard.
7103
7104 @item -mrnames
7105 @itemx -mno-rnames
7106 @opindex mrnames
7107 @opindex mno-rnames
7108 The @option{-mrnames} switch says to output code using the MIPS software
7109 names for the registers, instead of the hardware names (ie, @var{a0}
7110 instead of @var{$4}).  The only known assembler that supports this option
7111 is the Algorithmics assembler.
7112
7113 @item -mgpopt
7114 @itemx -mno-gpopt
7115 @opindex mgpopt
7116 @opindex mno-gpopt
7117 The @option{-mgpopt} switch says to write all of the data declarations
7118 before the instructions in the text section, this allows the MIPS
7119 assembler to generate one word memory references instead of using two
7120 words for short global or static data items.  This is on by default if
7121 optimization is selected.
7122
7123 @item -mstats
7124 @itemx -mno-stats
7125 @opindex mstats
7126 @opindex mno-stats
7127 For each non-inline function processed, the @option{-mstats} switch
7128 causes the compiler to emit one line to the standard error file to
7129 print statistics about the program (number of registers saved, stack
7130 size, etc.).
7131
7132 @item -mmemcpy
7133 @itemx -mno-memcpy
7134 @opindex mmemcpy
7135 @opindex mno-memcpy
7136 The @option{-mmemcpy} switch makes all block moves call the appropriate
7137 string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
7138 generating inline code.
7139
7140 @item -mmips-tfile
7141 @itemx -mno-mips-tfile
7142 @opindex mmips-tfile
7143 @opindex mno-mips-tfile
7144 The @option{-mno-mips-tfile} switch causes the compiler not
7145 postprocess the object file with the @file{mips-tfile} program,
7146 after the MIPS assembler has generated it to add debug support.  If
7147 @file{mips-tfile} is not run, then no local variables will be
7148 available to the debugger.  In addition, @file{stage2} and
7149 @file{stage3} objects will have the temporary file names passed to the
7150 assembler embedded in the object file, which means the objects will
7151 not compare the same.  The @option{-mno-mips-tfile} switch should only
7152 be used when there are bugs in the @file{mips-tfile} program that
7153 prevents compilation.
7154
7155 @item -msoft-float
7156 @opindex msoft-float
7157 Generate output containing library calls for floating point.
7158 @strong{Warning:} the requisite libraries are not part of GCC.
7159 Normally the facilities of the machine's usual C compiler are used, but
7160 this can't be done directly in cross-compilation.  You must make your
7161 own arrangements to provide suitable library functions for
7162 cross-compilation.
7163
7164 @item -mhard-float
7165 @opindex mhard-float
7166 Generate output containing floating point instructions.  This is the
7167 default if you use the unmodified sources.
7168
7169 @item -mabicalls
7170 @itemx -mno-abicalls
7171 @opindex mabicalls
7172 @opindex mno-abicalls
7173 Emit (or do not emit) the pseudo operations @samp{.abicalls},
7174 @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
7175 position independent code.
7176
7177 @item -mlong-calls
7178 @itemx -mno-long-calls
7179 @opindex mlong-calls
7180 @opindex mno-long-calls
7181 Do all calls with the @samp{JALR} instruction, which requires
7182 loading up a function's address into a register before the call.
7183 You need to use this switch, if you call outside of the current
7184 512 megabyte segment to functions that are not through pointers.
7185
7186 @item -mhalf-pic
7187 @itemx -mno-half-pic
7188 @opindex mhalf-pic
7189 @opindex mno-half-pic
7190 Put pointers to extern references into the data section and load them
7191 up, rather than put the references in the text section.
7192
7193 @item -membedded-pic
7194 @itemx -mno-embedded-pic
7195 @opindex membedded-pic
7196 @opindex mno-embedded-pic
7197 Generate PIC code suitable for some embedded systems.  All calls are
7198 made using PC relative address, and all data is addressed using the $gp
7199 register.  No more than 65536 bytes of global data may be used.  This
7200 requires GNU as and GNU ld which do most of the work.  This currently
7201 only works on targets which use ECOFF; it does not work with ELF.
7202
7203 @item -membedded-data
7204 @itemx -mno-embedded-data
7205 @opindex membedded-data
7206 @opindex mno-embedded-data
7207 Allocate variables to the read-only data section first if possible, then
7208 next in the small data section if possible, otherwise in data.  This gives
7209 slightly slower code than the default, but reduces the amount of RAM required
7210 when executing, and thus may be preferred for some embedded systems.
7211
7212 @item -muninit-const-in-rodata
7213 @itemx -mno-uninit-const-in-rodata
7214 @opindex muninit-const-in-rodata
7215 @opindex mno-uninit-const-in-rodata
7216 When used together with @option{-membedded-data}, it will always store uninitialized
7217 const variables in the read-only data section.
7218
7219 @item -msingle-float
7220 @itemx -mdouble-float
7221 @opindex msingle-float
7222 @opindex mdouble-float
7223 The @option{-msingle-float} switch tells gcc to assume that the floating
7224 point coprocessor only supports single precision operations, as on the
7225 @samp{r4650} chip.  The @option{-mdouble-float} switch permits gcc to use
7226 double precision operations.  This is the default.
7227
7228 @item -mmad
7229 @itemx -mno-mad
7230 @opindex mmad
7231 @opindex mno-mad
7232 Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
7233 as on the @samp{r4650} chip.
7234
7235 @item -m4650
7236 @opindex m4650
7237 Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
7238 @option{-mcpu=r4650}.
7239
7240 @item -mips16
7241 @itemx -mno-mips16
7242 @opindex mips16
7243 @opindex mno-mips16
7244 Enable 16-bit instructions.
7245
7246 @item -mentry
7247 @opindex mentry
7248 Use the entry and exit pseudo ops.  This option can only be used with
7249 @option{-mips16}.
7250
7251 @item -EL
7252 @opindex EL
7253 Compile code for the processor in little endian mode.
7254 The requisite libraries are assumed to exist.
7255
7256 @item -EB
7257 @opindex EB
7258 Compile code for the processor in big endian mode.
7259 The requisite libraries are assumed to exist.
7260
7261 @item -G @var{num}
7262 @opindex G
7263 @cindex smaller data references (MIPS)
7264 @cindex gp-relative references (MIPS)
7265 Put global and static items less than or equal to @var{num} bytes into
7266 the small data or bss sections instead of the normal data or bss
7267 section.  This allows the assembler to emit one word memory reference
7268 instructions based on the global pointer (@var{gp} or @var{$28}),
7269 instead of the normal two words used.  By default, @var{num} is 8 when
7270 the MIPS assembler is used, and 0 when the GNU assembler is used.  The
7271 @option{-G @var{num}} switch is also passed to the assembler and linker.
7272 All modules should be compiled with the same @option{-G @var{num}}
7273 value.
7274
7275 @item -nocpp
7276 @opindex nocpp
7277 Tell the MIPS assembler to not run its preprocessor over user
7278 assembler files (with a @samp{.s} suffix) when assembling them.
7279
7280 @item -mfix7000
7281 @opindex mfix7000
7282 Pass an option to gas which will cause nops to be inserted if
7283 the read of the destination register of an mfhi or mflo instruction
7284 occurs in the following two instructions.
7285
7286 @item -no-crt0
7287 @opindex no-crt0
7288 Do not include the default crt0.
7289 @end table
7290
7291 @ifset INTERNALS
7292 These options are defined by the macro
7293 @code{TARGET_SWITCHES} in the machine description.  The default for the
7294 options is also defined by that macro, which enables you to change the
7295 defaults.
7296 @end ifset
7297
7298 @node i386 Options
7299 @subsection Intel 386 Options
7300 @cindex i386 Options
7301 @cindex Intel 386 Options
7302
7303 These @samp{-m} options are defined for the i386 family of computers:
7304
7305 @table @gcctabopt
7306 @item -mcpu=@var{cpu-type}
7307 @opindex mcpu
7308 Assume the defaults for the machine type @var{cpu-type} when scheduling
7309 instructions.  The choices for @var{cpu-type} are @samp{i386},
7310 @samp{i486}, @samp{i586}, @samp{i686}, @samp{pentium},
7311 @samp{pentiumpro}, @samp{pentium4}, @samp{k6}, and @samp{athlon}
7312
7313 While picking a specific @var{cpu-type} will schedule things appropriately
7314 for that particular chip, the compiler will not generate any code that
7315 does not run on the i386 without the @option{-march=@var{cpu-type}} option
7316 being used.  @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
7317 is equivalent to @samp{pentiumpro}.  @samp{k6} and @samp{athlon} are the
7318 AMD chips as opposed to the Intel ones.
7319
7320 @item -march=@var{cpu-type}
7321 @opindex march
7322 Generate instructions for the machine type @var{cpu-type}.  The choices
7323 for @var{cpu-type} are the same as for @option{-mcpu}.  Moreover,
7324 specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}.
7325
7326 @item -m386
7327 @itemx -m486
7328 @itemx -mpentium
7329 @itemx -mpentiumpro
7330 @opindex m386
7331 @opindex m486
7332 @opindex mpentium
7333 @opindex mpentiumpro
7334 Synonyms for @option{-mcpu=i386}, @option{-mcpu=i486}, @option{-mcpu=pentium}, and @option{-mcpu=pentiumpro}
7335 respectively.  These synonyms are deprecated.
7336
7337 @item -mintel-syntax
7338 @opindex mintel-syntax
7339 Emit assembly using Intel syntax opcodes instead of AT&T syntax.
7340
7341 @item -mieee-fp
7342 @itemx -mno-ieee-fp
7343 @opindex mieee-fp
7344 @opindex mno-ieee-fp
7345 Control whether or not the compiler uses IEEE floating point
7346 comparisons.  These handle correctly the case where the result of a
7347 comparison is unordered.
7348
7349 @item -msoft-float
7350 @opindex msoft-float
7351 Generate output containing library calls for floating point.
7352 @strong{Warning:} the requisite libraries are not part of GCC.
7353 Normally the facilities of the machine's usual C compiler are used, but
7354 this can't be done directly in cross-compilation.  You must make your
7355 own arrangements to provide suitable library functions for
7356 cross-compilation.
7357
7358 On machines where a function returns floating point results in the 80387
7359 register stack, some floating point opcodes may be emitted even if
7360 @option{-msoft-float} is used.
7361
7362 @item -mno-fp-ret-in-387
7363 @opindex mno-fp-ret-in-387
7364 Do not use the FPU registers for return values of functions.
7365
7366 The usual calling convention has functions return values of types
7367 @code{float} and @code{double} in an FPU register, even if there
7368 is no FPU.  The idea is that the operating system should emulate
7369 an FPU.
7370
7371 The option @option{-mno-fp-ret-in-387} causes such values to be returned
7372 in ordinary CPU registers instead.
7373
7374 @item -mno-fancy-math-387
7375 @opindex mno-fancy-math-387
7376 Some 387 emulators do not support the @code{sin}, @code{cos} and
7377 @code{sqrt} instructions for the 387.  Specify this option to avoid
7378 generating those instructions. This option is the default on FreeBSD.
7379 As of revision 2.6.1, these instructions are not generated unless you
7380 also use the @option{-funsafe-math-optimizations} switch.
7381
7382 @item -malign-double
7383 @itemx -mno-align-double
7384 @opindex malign-double
7385 @opindex mno-align-double
7386 Control whether GCC aligns @code{double}, @code{long double}, and
7387 @code{long long} variables on a two word boundary or a one word
7388 boundary.  Aligning @code{double} variables on a two word boundary will
7389 produce code that runs somewhat faster on a @samp{Pentium} at the
7390 expense of more memory.
7391
7392 @item -m128bit-long-double
7393 @itemx -m128bit-long-double
7394 @opindex m128bit-long-double
7395 @opindex m128bit-long-double
7396 Control the size of @code{long double} type. i386 application binary interface
7397 specify the size to be 12 bytes, while modern architectures (Pentium and newer)
7398 preffer @code{long double} aligned to 8 or 16 byte boundary.  This is
7399 impossible to reach with 12 byte long doubles in the array accesses.
7400
7401 @strong{Warning:} if you use the @option{-m128bit-long-double} switch, the
7402 structures and arrays containing @code{long double} will change their size as
7403 well as function calling convention for function taking @code{long double}
7404 will be modified.
7405
7406 @item -m96bit-long-double
7407 @itemx -m96bit-long-double
7408 @opindex m96bit-long-double
7409 @opindex m96bit-long-double
7410 Set the size of @code{long double} to 96 bits as required by the i386
7411 application binary interface.  This is the default.
7412
7413 @item -msvr3-shlib
7414 @itemx -mno-svr3-shlib
7415 @opindex msvr3-shlib
7416 @opindex mno-svr3-shlib
7417 Control whether GCC places uninitialized locals into @code{bss} or
7418 @code{data}.  @option{-msvr3-shlib} places these locals into @code{bss}.
7419 These options are meaningful only on System V Release 3.
7420
7421 @item -mno-wide-multiply
7422 @itemx -mwide-multiply
7423 @opindex mno-wide-multiply
7424 @opindex mwide-multiply
7425 Control whether GCC uses the @code{mul} and @code{imul} that produce
7426 64-bit results in @code{eax:edx} from 32-bit operands to do @code{long
7427 long} multiplies and 32-bit division by constants.
7428
7429 @item -mrtd
7430 @opindex mrtd
7431 Use a different function-calling convention, in which functions that
7432 take a fixed number of arguments return with the @code{ret} @var{num}
7433 instruction, which pops their arguments while returning.  This saves one
7434 instruction in the caller since there is no need to pop the arguments
7435 there.
7436
7437 You can specify that an individual function is called with this calling
7438 sequence with the function attribute @samp{stdcall}.  You can also
7439 override the @option{-mrtd} option by using the function attribute
7440 @samp{cdecl}.  @xref{Function Attributes}.
7441
7442 @strong{Warning:} this calling convention is incompatible with the one
7443 normally used on Unix, so you cannot use it if you need to call
7444 libraries compiled with the Unix compiler.
7445
7446 Also, you must provide function prototypes for all functions that
7447 take variable numbers of arguments (including @code{printf});
7448 otherwise incorrect code will be generated for calls to those
7449 functions.
7450
7451 In addition, seriously incorrect code will result if you call a
7452 function with too many arguments.  (Normally, extra arguments are
7453 harmlessly ignored.)
7454
7455 @item -mregparm=@var{num}
7456 @opindex mregparm
7457 Control how many registers are used to pass integer arguments.  By
7458 default, no registers are used to pass arguments, and at most 3
7459 registers can be used.  You can control this behavior for a specific
7460 function by using the function attribute @samp{regparm}.
7461 @xref{Function Attributes}.
7462
7463 @strong{Warning:} if you use this switch, and
7464 @var{num} is nonzero, then you must build all modules with the same
7465 value, including any libraries.  This includes the system libraries and
7466 startup modules.
7467
7468 @item -mpreferred-stack-boundary=@var{num}
7469 @opindex mpreferred-stack-boundary
7470 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
7471 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
7472 the default is 4 (16 bytes or 128 bits).
7473
7474 The stack is required to be aligned on a 4 byte boundary.  On Pentium
7475 and PentiumPro, @code{double} and @code{long double} values should be
7476 aligned to an 8 byte boundary (see @option{-malign-double}) or suffer
7477 significant run time performance penalties.  On Pentium III, the
7478 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
7479 penalties if it is not 16 byte aligned.
7480
7481 To ensure proper alignment of this values on the stack, the stack boundary
7482 must be as aligned as that required by any value stored on the stack.
7483 Further, every function must be generated such that it keeps the stack
7484 aligned.  Thus calling a function compiled with a higher preferred
7485 stack boundary from a function compiled with a lower preferred stack
7486 boundary will most likely misalign the stack.  It is recommended that
7487 libraries that use callbacks always use the default setting.
7488
7489 This extra alignment does consume extra stack space.  Code that is sensitive
7490 to stack space usage, such as embedded systems and operating system kernels,
7491 may want to reduce the preferred alignment to
7492 @option{-mpreferred-stack-boundary=2}.
7493
7494 @item -mpush-args
7495 @opindex mpush-args
7496 Use PUSH operations to store outgoing parameters. This method is shorter
7497 and usually equally fast as method using SUB/MOV operations and is enabled
7498 by default. In some cases disabling it may improve performance because of
7499 improved scheduling and reduced dependencies.
7500
7501 @item -maccumulate-outgoing-args
7502 @opindex maccumulate-outgoing-args
7503 If enabled, the maximum amount of space required for outgoing arguments will be
7504 computed in the function prologue. This in faster on most modern CPUs
7505 because of reduced dependencies, improved scheduling and reduced stack usage
7506 when preferred stack boundary is not equal to 2.  The drawback is a notable
7507 increase in code size. This switch implies @option{-mno-push-args}.
7508
7509 @item -mthreads
7510 @opindex mthreads
7511 Support thread-safe exception handling on @samp{Mingw32}. Code that relies
7512 on thread-safe exception handling must compile and link all code with the
7513 @option{-mthreads} option. When compiling, @option{-mthreads} defines
7514 @option{-D_MT}; when linking, it links in a special thread helper library
7515 @option{-lmingwthrd} which cleans up per thread exception handling data.
7516
7517 @item -mno-align-stringops
7518 @opindex mno-align-stringops
7519 Do not align destination of inlined string operations. This switch reduces
7520 code size and improves performance in case the destination is already aligned,
7521 but gcc don't know about it.
7522
7523 @item -minline-all-stringops
7524 @opindex minline-all-stringops
7525 By default GCC inlines string operations only when destination is known to be
7526 aligned at least to 4 byte boundary. This enables more inlining, increase code
7527 size, but may improve performance of code that depends on fast memcpy, strlen
7528 and memset for short lengths.
7529
7530 @item -momit-leaf-frame-pointer
7531 @opindex momit-leaf-frame-pointer
7532 Don't keep the frame pointer in a register for leaf functions.  This
7533 avoids the instructions to save, set up and restore frame pointers and
7534 makes an extra register available in leaf functions.  The option
7535 @option{-fomit-frame-pointer} removes the frame pointer for all functions
7536 which might make debugging harder.
7537 @end table
7538
7539 @node HPPA Options
7540 @subsection HPPA Options
7541 @cindex HPPA Options
7542
7543 These @samp{-m} options are defined for the HPPA family of computers:
7544
7545 @table @gcctabopt
7546 @item -march=@var{architecture-type}
7547 @opindex march
7548 Generate code for the specified architecture.  The choices for
7549 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
7550 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
7551 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
7552 architecture option for your machine.  Code compiled for lower numbered
7553 architectures will run on higher numbered architectures, but not the
7554 other way around.
7555
7556 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
7557 next release of binutils (current is 2.9.1) will probably contain PA 2.0
7558 support.
7559
7560 @item -mpa-risc-1-0
7561 @itemx -mpa-risc-1-1
7562 @itemx -mpa-risc-2-0
7563 @opindex mpa-risc-1-0
7564 @opindex mpa-risc-1-1
7565 @opindex mpa-risc-2-0
7566 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
7567
7568 @item -mbig-switch
7569 @opindex mbig-switch
7570 Generate code suitable for big switch tables.  Use this option only if
7571 the assembler/linker complain about out of range branches within a switch
7572 table.
7573
7574 @item -mjump-in-delay
7575 @opindex mjump-in-delay
7576 Fill delay slots of function calls with unconditional jump instructions
7577 by modifying the return pointer for the function call to be the target
7578 of the conditional jump.
7579
7580 @item -mdisable-fpregs
7581 @opindex mdisable-fpregs
7582 Prevent floating point registers from being used in any manner.  This is
7583 necessary for compiling kernels which perform lazy context switching of
7584 floating point registers.  If you use this option and attempt to perform
7585 floating point operations, the compiler will abort.
7586
7587 @item -mdisable-indexing
7588 @opindex mdisable-indexing
7589 Prevent the compiler from using indexing address modes.  This avoids some
7590 rather obscure problems when compiling MIG generated code under MACH.
7591
7592 @item -mno-space-regs
7593 @opindex mno-space-regs
7594 Generate code that assumes the target has no space registers.  This allows
7595 GCC to generate faster indirect calls and use unscaled index address modes.
7596
7597 Such code is suitable for level 0 PA systems and kernels.
7598
7599 @item -mfast-indirect-calls
7600 @opindex mfast-indirect-calls
7601 Generate code that assumes calls never cross space boundaries.  This
7602 allows GCC to emit code which performs faster indirect calls.
7603
7604 This option will not work in the presence of shared libraries or nested
7605 functions.
7606
7607 @item -mlong-load-store
7608 @opindex mlong-load-store
7609 Generate 3-instruction load and store sequences as sometimes required by
7610 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
7611 the HP compilers.
7612
7613 @item -mportable-runtime
7614 @opindex mportable-runtime
7615 Use the portable calling conventions proposed by HP for ELF systems.
7616
7617 @item -mgas
7618 @opindex mgas
7619 Enable the use of assembler directives only GAS understands.
7620
7621 @item -mschedule=@var{cpu-type}
7622 @opindex mschedule
7623 Schedule code according to the constraints for the machine type
7624 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
7625 @samp{7100}, @samp{7100LC}, @samp{7200}, and @samp{8000}.  Refer to
7626 @file{/usr/lib/sched.models} on an HP-UX system to determine the
7627 proper scheduling option for your machine.
7628
7629 @item -mlinker-opt
7630 @opindex mlinker-opt
7631 Enable the optimization pass in the HPUX linker.  Note this makes symbolic
7632 debugging impossible.  It also triggers a bug in the HPUX 8 and HPUX 9 linkers
7633 in which they give bogus error messages when linking some programs.
7634
7635 @item -msoft-float
7636 @opindex msoft-float
7637 Generate output containing library calls for floating point.
7638 @strong{Warning:} the requisite libraries are not available for all HPPA
7639 targets.  Normally the facilities of the machine's usual C compiler are
7640 used, but this cannot be done directly in cross-compilation.  You must make
7641 your own arrangements to provide suitable library functions for
7642 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
7643 does provide software floating point support.
7644
7645 @option{-msoft-float} changes the calling convention in the output file;
7646 therefore, it is only useful if you compile @emph{all} of a program with
7647 this option.  In particular, you need to compile @file{libgcc.a}, the
7648 library that comes with GCC, with @option{-msoft-float} in order for
7649 this to work.
7650 @end table
7651
7652 @node Intel 960 Options
7653 @subsection Intel 960 Options
7654
7655 These @samp{-m} options are defined for the Intel 960 implementations:
7656
7657 @table @gcctabopt
7658 @item -m@var{cpu-type}
7659 @opindex mka
7660 @opindex mkb
7661 @opindex mmc
7662 @opindex mca
7663 @opindex mcf
7664 @opindex msa
7665 @opindex msb
7666 Assume the defaults for the machine type @var{cpu-type} for some of
7667 the other options, including instruction scheduling, floating point
7668 support, and addressing modes.  The choices for @var{cpu-type} are
7669 @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
7670 @samp{sa}, and @samp{sb}.
7671 The default is
7672 @samp{kb}.
7673
7674 @item -mnumerics
7675 @itemx -msoft-float
7676 @opindex mnumerics
7677 @opindex msoft-float
7678 The @option{-mnumerics} option indicates that the processor does support
7679 floating-point instructions.  The @option{-msoft-float} option indicates
7680 that floating-point support should not be assumed.
7681
7682 @item -mleaf-procedures
7683 @itemx -mno-leaf-procedures
7684 @opindex mleaf-procedures
7685 @opindex mno-leaf-procedures
7686 Do (or do not) attempt to alter leaf procedures to be callable with the
7687 @code{bal} instruction as well as @code{call}.  This will result in more
7688 efficient code for explicit calls when the @code{bal} instruction can be
7689 substituted by the assembler or linker, but less efficient code in other
7690 cases, such as calls via function pointers, or using a linker that doesn't
7691 support this optimization.
7692
7693 @item -mtail-call
7694 @itemx -mno-tail-call
7695 @opindex mtail-call
7696 @opindex mno-tail-call
7697 Do (or do not) make additional attempts (beyond those of the
7698 machine-independent portions of the compiler) to optimize tail-recursive
7699 calls into branches.  You may not want to do this because the detection of
7700 cases where this is not valid is not totally complete.  The default is
7701 @option{-mno-tail-call}.
7702
7703 @item -mcomplex-addr
7704 @itemx -mno-complex-addr
7705 @opindex mcomplex-addr
7706 @opindex mno-complex-addr
7707 Assume (or do not assume) that the use of a complex addressing mode is a
7708 win on this implementation of the i960.  Complex addressing modes may not
7709 be worthwhile on the K-series, but they definitely are on the C-series.
7710 The default is currently @option{-mcomplex-addr} for all processors except
7711 the CB and CC.
7712
7713 @item -mcode-align
7714 @itemx -mno-code-align
7715 @opindex mcode-align
7716 @opindex mno-code-align
7717 Align code to 8-byte boundaries for faster fetching (or don't bother).
7718 Currently turned on by default for C-series implementations only.
7719
7720 @ignore
7721 @item -mclean-linkage
7722 @itemx -mno-clean-linkage
7723 @opindex mclean-linkage
7724 @opindex mno-clean-linkage
7725 These options are not fully implemented.
7726 @end ignore
7727
7728 @item -mic-compat
7729 @itemx -mic2.0-compat
7730 @itemx -mic3.0-compat
7731 @opindex mic-compat
7732 @opindex mic2.0-compat
7733 @opindex mic3.0-compat
7734 Enable compatibility with iC960 v2.0 or v3.0.
7735
7736 @item -masm-compat
7737 @itemx -mintel-asm
7738 @opindex masm-compat
7739 @opindex mintel-asm
7740 Enable compatibility with the iC960 assembler.
7741
7742 @item -mstrict-align
7743 @itemx -mno-strict-align
7744 @opindex mstrict-align
7745 @opindex mno-strict-align
7746 Do not permit (do permit) unaligned accesses.
7747
7748 @item -mold-align
7749 @opindex mold-align
7750 Enable structure-alignment compatibility with Intel's gcc release version
7751 1.3 (based on gcc 1.37).  This option implies @option{-mstrict-align}.
7752
7753 @item -mlong-double-64
7754 @opindex mlong-double-64
7755 Implement type @samp{long double} as 64-bit floating point numbers.
7756 Without the option @samp{long double} is implemented by 80-bit
7757 floating point numbers.  The only reason we have it because there is
7758 no 128-bit @samp{long double} support in @samp{fp-bit.c} yet.  So it
7759 is only useful for people using soft-float targets.  Otherwise, we
7760 should recommend against use of it.
7761
7762 @end table
7763
7764 @node DEC Alpha Options
7765 @subsection DEC Alpha Options
7766
7767 These @samp{-m} options are defined for the DEC Alpha implementations:
7768
7769 @table @gcctabopt
7770 @item -mno-soft-float
7771 @itemx -msoft-float
7772 @opindex mno-soft-float
7773 @opindex msoft-float
7774 Use (do not use) the hardware floating-point instructions for
7775 floating-point operations.  When @option{-msoft-float} is specified,
7776 functions in @file{libgcc.a} will be used to perform floating-point
7777 operations.  Unless they are replaced by routines that emulate the
7778 floating-point operations, or compiled in such a way as to call such
7779 emulations routines, these routines will issue floating-point
7780 operations.   If you are compiling for an Alpha without floating-point
7781 operations, you must ensure that the library is built so as not to call
7782 them.
7783
7784 Note that Alpha implementations without floating-point operations are
7785 required to have floating-point registers.
7786
7787 @item -mfp-reg
7788 @itemx -mno-fp-regs
7789 @opindex mfp-reg
7790 @opindex mno-fp-regs
7791 Generate code that uses (does not use) the floating-point register set.
7792 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
7793 register set is not used, floating point operands are passed in integer
7794 registers as if they were integers and floating-point results are passed
7795 in $0 instead of $f0.  This is a non-standard calling sequence, so any
7796 function with a floating-point argument or return value called by code
7797 compiled with @option{-mno-fp-regs} must also be compiled with that
7798 option.
7799
7800 A typical use of this option is building a kernel that does not use,
7801 and hence need not save and restore, any floating-point registers.
7802
7803 @item -mieee
7804 @opindex mieee
7805 The Alpha architecture implements floating-point hardware optimized for
7806 maximum performance.  It is mostly compliant with the IEEE floating
7807 point standard.  However, for full compliance, software assistance is
7808 required.  This option generates code fully IEEE compliant code
7809 @emph{except} that the @var{inexact-flag} is not maintained (see below).
7810 If this option is turned on, the CPP macro @code{_IEEE_FP} is defined
7811 during compilation.  The option is a shorthand for: @option{-D_IEEE_FP
7812 -mfp-trap-mode=su -mtrap-precision=i -mieee-conformant}.  The resulting
7813 code is less efficient but is able to correctly support denormalized
7814 numbers and exceptional IEEE values such as not-a-number and plus/minus
7815 infinity.  Other Alpha compilers call this option
7816 @option{-ieee_with_no_inexact}.
7817
7818 @item -mieee-with-inexact
7819 @opindex mieee-with-inexact
7820 @c overfull hbox here --bob 22 jul96
7821 @c original text between ignore ... end ignore
7822 @ignore
7823 This is like @option{-mieee} except the generated code also maintains the
7824 IEEE @var{inexact-flag}.  Turning on this option causes the generated
7825 code to implement fully-compliant IEEE math.  The option is a shorthand
7826 for @option{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus @option{-mieee-conformant},
7827 @option{-mfp-trap-mode=sui}, and @option{-mtrap-precision=i}.  On some Alpha
7828 implementations the resulting code may execute significantly slower than
7829 the code generated by default.  Since there is very little code that
7830 depends on the @var{inexact-flag}, you should normally not specify this
7831 option.  Other Alpha compilers call this option
7832 @option{-ieee_with_inexact}.
7833 @end ignore
7834 @c            changed paragraph
7835 This is like @option{-mieee} except the generated code also maintains the
7836 IEEE @var{inexact-flag}.  Turning on this option causes the generated
7837 code to implement fully-compliant IEEE math.  The option is a shorthand
7838 for @option{-D_IEEE_FP -D_IEEE_FP_INEXACT} plus the three following:
7839 @option{-mieee-conformant},
7840 @option{-mfp-trap-mode=sui},
7841 and @option{-mtrap-precision=i}.
7842 On some Alpha implementations the resulting code may execute
7843 significantly slower than the code generated by default.  Since there
7844 is very little code that depends on the @var{inexact-flag}, you should
7845 normally not specify this option.  Other Alpha compilers call this
7846 option @option{-ieee_with_inexact}.
7847 @c             end changes to prevent overfull hboxes
7848
7849 @item -mfp-trap-mode=@var{trap-mode}
7850 @opindex mfp-trap-mode
7851 This option controls what floating-point related traps are enabled.
7852 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
7853 The trap mode can be set to one of four values:
7854
7855 @table @samp
7856 @item n
7857 This is the default (normal) setting.  The only traps that are enabled
7858 are the ones that cannot be disabled in software (e.g., division by zero
7859 trap).
7860
7861 @item u
7862 In addition to the traps enabled by @samp{n}, underflow traps are enabled
7863 as well.
7864
7865 @item su
7866 Like @samp{su}, but the instructions are marked to be safe for software
7867 completion (see Alpha architecture manual for details).
7868
7869 @item sui
7870 Like @samp{su}, but inexact traps are enabled as well.
7871 @end table
7872
7873 @item -mfp-rounding-mode=@var{rounding-mode}
7874 @opindex mfp-rounding-mode
7875 Selects the IEEE rounding mode.  Other Alpha compilers call this option
7876 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
7877 of:
7878
7879 @table @samp
7880 @item n
7881 Normal IEEE rounding mode.  Floating point numbers are rounded towards
7882 the nearest machine number or towards the even machine number in case
7883 of a tie.
7884
7885 @item m
7886 Round towards minus infinity.
7887
7888 @item c
7889 Chopped rounding mode.  Floating point numbers are rounded towards zero.
7890
7891 @item d
7892 Dynamic rounding mode.  A field in the floating point control register
7893 (@var{fpcr}, see Alpha architecture reference manual) controls the
7894 rounding mode in effect.  The C library initializes this register for
7895 rounding towards plus infinity.  Thus, unless your program modifies the
7896 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
7897 @end table
7898
7899 @item -mtrap-precision=@var{trap-precision}
7900 @opindex mtrap-precision
7901 In the Alpha architecture, floating point traps are imprecise.  This
7902 means without software assistance it is impossible to recover from a
7903 floating trap and program execution normally needs to be terminated.
7904 GCC can generate code that can assist operating system trap handlers
7905 in determining the exact location that caused a floating point trap.
7906 Depending on the requirements of an application, different levels of
7907 precisions can be selected:
7908
7909 @table @samp
7910 @item p
7911 Program precision.  This option is the default and means a trap handler
7912 can only identify which program caused a floating point exception.
7913
7914 @item f
7915 Function precision.  The trap handler can determine the function that
7916 caused a floating point exception.
7917
7918 @item i
7919 Instruction precision.  The trap handler can determine the exact
7920 instruction that caused a floating point exception.
7921 @end table
7922
7923 Other Alpha compilers provide the equivalent options called
7924 @option{-scope_safe} and @option{-resumption_safe}.
7925
7926 @item -mieee-conformant
7927 @opindex mieee-conformant
7928 This option marks the generated code as IEEE conformant.  You must not
7929 use this option unless you also specify @option{-mtrap-precision=i} and either
7930 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
7931 is to emit the line @samp{.eflag 48} in the function prologue of the
7932 generated assembly file.  Under DEC Unix, this has the effect that
7933 IEEE-conformant math library routines will be linked in.
7934
7935 @item -mbuild-constants
7936 @opindex mbuild-constants
7937 Normally GCC examines a 32- or 64-bit integer constant to
7938 see if it can construct it from smaller constants in two or three
7939 instructions.  If it cannot, it will output the constant as a literal and
7940 generate code to load it from the data segment at runtime.
7941
7942 Use this option to require GCC to construct @emph{all} integer constants
7943 using code, even if it takes more instructions (the maximum is six).
7944
7945 You would typically use this option to build a shared library dynamic
7946 loader.  Itself a shared library, it must relocate itself in memory
7947 before it can find the variables and constants in its own data segment.
7948
7949 @item -malpha-as
7950 @itemx -mgas
7951 @opindex malpha-as
7952 @opindex mgas
7953 Select whether to generate code to be assembled by the vendor-supplied
7954 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
7955
7956 @item -mbwx
7957 @itemx -mno-bwx
7958 @itemx -mcix
7959 @itemx -mno-cix
7960 @itemx -mmax
7961 @itemx -mno-max
7962 @opindex mbwx
7963 @opindex mno-bwx
7964 @opindex mcix
7965 @opindex mno-cix
7966 @opindex mmax
7967 @opindex mno-max
7968 Indicate whether GCC should generate code to use the optional BWX,
7969 CIX, and MAX instruction sets.  The default is to use the instruction sets
7970 supported by the CPU type specified via @option{-mcpu=} option or that
7971 of the CPU on which GCC was built if none was specified.
7972
7973 @item -mcpu=@var{cpu_type}
7974 @opindex mcpu
7975 Set the instruction set, register set, and instruction scheduling
7976 parameters for machine type @var{cpu_type}.  You can specify either the
7977 @samp{EV} style name or the corresponding chip number.  GCC
7978 supports scheduling parameters for the EV4 and EV5 family of processors
7979 and will choose the default values for the instruction set from
7980 the processor you specify.  If you do not specify a processor type,
7981 GCC will default to the processor on which the compiler was built.
7982
7983 Supported values for @var{cpu_type} are
7984
7985 @table @samp
7986 @item ev4
7987 @itemx 21064
7988 Schedules as an EV4 and has no instruction set extensions.
7989
7990 @item ev5
7991 @itemx 21164
7992 Schedules as an EV5 and has no instruction set extensions.
7993
7994 @item ev56
7995 @itemx 21164a
7996 Schedules as an EV5 and supports the BWX extension.
7997
7998 @item pca56
7999 @itemx 21164pc
8000 @itemx 21164PC
8001 Schedules as an EV5 and supports the BWX and MAX extensions.
8002
8003 @item ev6
8004 @itemx 21264
8005 Schedules as an EV5 (until Digital releases the scheduling parameters
8006 for the EV6) and supports the BWX, CIX, and MAX extensions.
8007 @end table
8008
8009 @item -mmemory-latency=@var{time}
8010 @opindex mmemory-latency
8011 Sets the latency the scheduler should assume for typical memory
8012 references as seen by the application.  This number is highly
8013 dependent on the memory access patterns used by the application
8014 and the size of the external cache on the machine.
8015
8016 Valid options for @var{time} are
8017
8018 @table @samp
8019 @item @var{number}
8020 A decimal number representing clock cycles.
8021
8022 @item L1
8023 @itemx L2
8024 @itemx L3
8025 @itemx main
8026 The compiler contains estimates of the number of clock cycles for
8027 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8028 (also called Dcache, Scache, and Bcache), as well as to main memory.
8029 Note that L3 is only valid for EV5.
8030
8031 @end table
8032 @end table
8033
8034 @node Clipper Options
8035 @subsection Clipper Options
8036
8037 These @samp{-m} options are defined for the Clipper implementations:
8038
8039 @table @gcctabopt
8040 @item -mc300
8041 @opindex mc300
8042 Produce code for a C300 Clipper processor. This is the default.
8043
8044 @item -mc400
8045 @opindex mc400
8046 Produce code for a C400 Clipper processor i.e. use floating point
8047 registers f8---f15.
8048 @end table
8049
8050 @node H8/300 Options
8051 @subsection H8/300 Options
8052
8053 These @samp{-m} options are defined for the H8/300 implementations:
8054
8055 @table @gcctabopt
8056 @item -mrelax
8057 @opindex mrelax
8058 Shorten some address references at link time, when possible; uses the
8059 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8060 ld.info, Using ld}, for a fuller description.
8061
8062 @item -mh
8063 @opindex mh
8064 Generate code for the H8/300H.
8065
8066 @item -ms
8067 @opindex ms
8068 Generate code for the H8/S.
8069
8070 @item -ms2600
8071 @opindex ms2600
8072 Generate code for the H8/S2600.  This switch must be used with @option{-ms}.
8073
8074 @item -mint32
8075 @opindex mint32
8076 Make @code{int} data 32 bits by default.
8077
8078 @item -malign-300
8079 @opindex malign-300
8080 On the H8/300H and H8/S, use the same alignment rules as for the H8/300.
8081 The default for the H8/300H and H8/S is to align longs and floats on 4
8082 byte boundaries.
8083 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
8084 This option has no effect on the H8/300.
8085 @end table
8086
8087 @node SH Options
8088 @subsection SH Options
8089
8090 These @samp{-m} options are defined for the SH implementations:
8091
8092 @table @gcctabopt
8093 @item -m1
8094 @opindex m1
8095 Generate code for the SH1.
8096
8097 @item -m2
8098 @opindex m2
8099 Generate code for the SH2.
8100
8101 @item -m3
8102 @opindex m3
8103 Generate code for the SH3.
8104
8105 @item -m3e
8106 @opindex m3e
8107 Generate code for the SH3e.
8108
8109 @item -m4-nofpu
8110 @opindex m4-nofpu
8111 Generate code for the SH4 without a floating-point unit.
8112
8113 @item -m4-single-only
8114 @opindex m4-single-only
8115 Generate code for the SH4 with a floating-point unit that only
8116 supports single-precision arithmentic.
8117
8118 @item -m4-single
8119 @opindex m4-single
8120 Generate code for the SH4 assuming the floating-point unit is in
8121 single-precision mode by default.
8122
8123 @item -m4
8124 @opindex m4
8125 Generate code for the SH4.
8126
8127 @item -mb
8128 @opindex mb
8129 Compile code for the processor in big endian mode.
8130
8131 @item -ml
8132 @opindex ml
8133 Compile code for the processor in little endian mode.
8134
8135 @item -mdalign
8136 @opindex mdalign
8137 Align doubles at 64-bit boundaries.  Note that this changes the calling
8138 conventions, and thus some functions from the standard C library will
8139 not work unless you recompile it first with @option{-mdalign}.
8140
8141 @item -mrelax
8142 @opindex mrelax
8143 Shorten some address references at link time, when possible; uses the
8144 linker option @option{-relax}.
8145
8146 @item -mbigtable
8147 @opindex mbigtable
8148 Use 32-bit offsets in @code{switch} tables.  The default is to use
8149 16-bit offsets.
8150
8151 @item -mfmovd
8152 @opindex mfmovd
8153 Enable the use of the instruction @code{fmovd}.
8154
8155 @item -mhitachi
8156 @opindex mhitachi
8157 Comply with the calling conventions defined by Hitachi.
8158
8159 @item -mnomacsave
8160 @opindex mnomacsave
8161 Mark the @code{MAC} register as call-clobbered, even if
8162 @option{-mhitachi} is given.
8163
8164 @item -mieee
8165 @opindex mieee
8166 Increase IEEE-compliance of floating-point code.
8167
8168 @item -misize
8169 @opindex misize
8170 Dump instruction size and location in the assembly code.
8171
8172 @item -mpadstruct
8173 @opindex mpadstruct
8174 This option is deprecated.  It pads structures to multiple of 4 bytes,
8175 which is incompatible with the SH ABI.
8176
8177 @item -mspace
8178 @opindex mspace
8179 Optimize for space instead of speed.  Implied by @option{-Os}.
8180
8181 @item -mprefergot
8182 @opindex mprefergot
8183 When generating position-independent code, emit function calls using
8184 the Global Offset Table instead of the Procedure Linkage Table.
8185
8186 @item -musermode
8187 @opindex musermode
8188 Generate a library function call to invalidate instruction cache
8189 entries, after fixing up a trampoline.  This library function call
8190 doesn't assume it can write to the whole memory address space.  This
8191 is the default when the target is @code{sh-*-linux*}.
8192 @end table
8193
8194 @node System V Options
8195 @subsection Options for System V
8196
8197 These additional options are available on System V Release 4 for
8198 compatibility with other compilers on those systems:
8199
8200 @table @gcctabopt
8201 @item -G
8202 @opindex G
8203 Create a shared object.
8204 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
8205
8206 @item -Qy
8207 @opindex Qy
8208 Identify the versions of each tool used by the compiler, in a
8209 @code{.ident} assembler directive in the output.
8210
8211 @item -Qn
8212 @opindex Qn
8213 Refrain from adding @code{.ident} directives to the output file (this is
8214 the default).
8215
8216 @item -YP\,@var{dirs}
8217 @opindex YP
8218 Search the directories @var{dirs}, and no others, for libraries
8219 specified with @option{-l}.
8220
8221 @item -Ym\,@var{dir}
8222 @opindex Ym
8223 Look in the directory @var{dir} to find the M4 preprocessor.
8224 The assembler uses this option.
8225 @c This is supposed to go with a -Yd for predefined M4 macro files, but
8226 @c the generic assembler that comes with Solaris takes just -Ym.
8227 @end table
8228
8229 @node TMS320C3x/C4x Options
8230 @subsection TMS320C3x/C4x Options
8231 @cindex TMS320C3x/C4x Options
8232
8233 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
8234
8235 @table @gcctabopt
8236
8237 @item -mcpu=@var{cpu_type}
8238 @opindex mcpu
8239 Set the instruction set, register set, and instruction scheduling
8240 parameters for machine type @var{cpu_type}.  Supported values for
8241 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
8242 @samp{c44}.  The default is @samp{c40} to generate code for the
8243 TMS320C40.
8244
8245 @item -mbig-memory
8246 @item -mbig
8247 @itemx -msmall-memory
8248 @itemx -msmall
8249 @opindex mbig-memory
8250 @opindex mbig
8251 @opindex msmall-memory
8252 @opindex msmall
8253 Generates code for the big or small memory model.  The small memory
8254 model assumed that all data fits into one 64K word page.  At run-time
8255 the data page (DP) register must be set to point to the 64K page
8256 containing the .bss and .data program sections.  The big memory model is
8257 the default and requires reloading of the DP register for every direct
8258 memory access.
8259
8260 @item -mbk
8261 @itemx -mno-bk
8262 @opindex mbk
8263 @opindex mno-bk
8264 Allow (disallow) allocation of general integer operands into the block
8265 count register BK.
8266
8267 @item -mdb
8268 @itemx -mno-db
8269 @opindex mdb
8270 @opindex mno-db
8271 Enable (disable) generation of code using decrement and branch,
8272 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
8273 on the safe side, this is disabled for the C3x, since the maximum
8274 iteration count on the C3x is 2^23 + 1 (but who iterates loops more than
8275 2^23 times on the C3x?).  Note that GCC will try to reverse a loop so
8276 that it can utilise the decrement and branch instruction, but will give
8277 up if there is more than one memory reference in the loop.  Thus a loop
8278 where the loop counter is decremented can generate slightly more
8279 efficient code, in cases where the RPTB instruction cannot be utilised.
8280
8281 @item -mdp-isr-reload
8282 @itemx -mparanoid
8283 @opindex mdp-isr-reload
8284 @opindex mparanoid
8285 Force the DP register to be saved on entry to an interrupt service
8286 routine (ISR), reloaded to point to the data section, and restored on
8287 exit from the ISR.  This should not be required unless someone has
8288 violated the small memory model by modifying the DP register, say within
8289 an object library.
8290
8291 @item -mmpyi
8292 @itemx -mno-mpyi
8293 @opindex mmpyi
8294 @opindex mno-mpyi
8295 For the C3x use the 24-bit MPYI instruction for integer multiplies
8296 instead of a library call to guarantee 32-bit results.  Note that if one
8297 of the operands is a constant, then the multiplication will be performed
8298 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
8299 then squaring operations are performed inline instead of a library call.
8300
8301 @item -mfast-fix
8302 @itemx -mno-fast-fix
8303 @opindex mfast-fix
8304 @opindex mno-fast-fix
8305 The C3x/C4x FIX instruction to convert a floating point value to an
8306 integer value chooses the nearest integer less than or equal to the
8307 floating point value rather than to the nearest integer.  Thus if the
8308 floating point number is negative, the result will be incorrectly
8309 truncated an additional code is necessary to detect and correct this
8310 case.  This option can be used to disable generation of the additional
8311 code required to correct the result.
8312
8313 @item -mrptb
8314 @itemx -mno-rptb
8315 @opindex mrptb
8316 @opindex mno-rptb
8317 Enable (disable) generation of repeat block sequences using the RPTB
8318 instruction for zero overhead looping.  The RPTB construct is only used
8319 for innermost loops that do not call functions or jump across the loop
8320 boundaries.  There is no advantage having nested RPTB loops due to the
8321 overhead required to save and restore the RC, RS, and RE registers.
8322 This is enabled by default with @option{-O2}.
8323
8324 @item -mrpts=@var{count}
8325 @itemx -mno-rpts
8326 @opindex mrpts
8327 @opindex mno-rpts
8328 Enable (disable) the use of the single instruction repeat instruction
8329 RPTS.  If a repeat block contains a single instruction, and the loop
8330 count can be guaranteed to be less than the value @var{count}, GCC will
8331 emit a RPTS instruction instead of a RPTB.  If no value is specified,
8332 then a RPTS will be emitted even if the loop count cannot be determined
8333 at compile time.  Note that the repeated instruction following RPTS does
8334 not have to be reloaded from memory each iteration, thus freeing up the
8335 CPU buses for operands.  However, since interrupts are blocked by this
8336 instruction, it is disabled by default.
8337
8338 @item -mloop-unsigned
8339 @itemx -mno-loop-unsigned
8340 @opindex mloop-unsigned
8341 @opindex mno-loop-unsigned
8342 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
8343 is 2^31 + 1 since these instructions test if the iteration count is
8344 negative to terminate the loop.  If the iteration count is unsigned
8345 there is a possibility than the 2^31 + 1 maximum iteration count may be
8346 exceeded.  This switch allows an unsigned iteration count.
8347
8348 @item -mti
8349 @opindex mti
8350 Try to emit an assembler syntax that the TI assembler (asm30) is happy
8351 with.  This also enforces compatibility with the API employed by the TI
8352 C3x C compiler.  For example, long doubles are passed as structures
8353 rather than in floating point registers.
8354
8355 @item -mregparm
8356 @itemx -mmemparm
8357 @opindex mregparm
8358 @opindex mmemparm
8359 Generate code that uses registers (stack) for passing arguments to functions.
8360 By default, arguments are passed in registers where possible rather
8361 than by pushing arguments on to the stack.
8362
8363 @item -mparallel-insns
8364 @itemx -mno-parallel-insns
8365 @opindex mparallel-insns
8366 @opindex mno-parallel-insns
8367 Allow the generation of parallel instructions.  This is enabled by
8368 default with @option{-O2}.
8369
8370 @item -mparallel-mpy
8371 @itemx -mno-parallel-mpy
8372 @opindex mparallel-mpy
8373 @opindex mno-parallel-mpy
8374 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
8375 provided @option{-mparallel-insns} is also specified.  These instructions have
8376 tight register constraints which can pessimize the code generation
8377 of large functions.
8378
8379 @end table
8380
8381 @node V850 Options
8382 @subsection V850 Options
8383 @cindex V850 Options
8384
8385 These @samp{-m} options are defined for V850 implementations:
8386
8387 @table @gcctabopt
8388 @item -mlong-calls
8389 @itemx -mno-long-calls
8390 @opindex mlong-calls
8391 @opindex mno-long-calls
8392 Treat all calls as being far away (near).  If calls are assumed to be
8393 far away, the compiler will always load the functions address up into a
8394 register, and call indirect through the pointer.
8395
8396 @item -mno-ep
8397 @itemx -mep
8398 @opindex mno-ep
8399 @opindex mep
8400 Do not optimize (do optimize) basic blocks that use the same index
8401 pointer 4 or more times to copy pointer into the @code{ep} register, and
8402 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
8403 option is on by default if you optimize.
8404
8405 @item -mno-prolog-function
8406 @itemx -mprolog-function
8407 @opindex mno-prolog-function
8408 @opindex mprolog-function
8409 Do not use (do use) external functions to save and restore registers at
8410 the prolog and epilog of a function.  The external functions are slower,
8411 but use less code space if more than one function saves the same number
8412 of registers.  The @option{-mprolog-function} option is on by default if
8413 you optimize.
8414
8415 @item -mspace
8416 @opindex mspace
8417 Try to make the code as small as possible.  At present, this just turns
8418 on the @option{-mep} and @option{-mprolog-function} options.
8419
8420 @item -mtda=@var{n}
8421 @opindex mtda
8422 Put static or global variables whose size is @var{n} bytes or less into
8423 the tiny data area that register @code{ep} points to.  The tiny data
8424 area can hold up to 256 bytes in total (128 bytes for byte references).
8425
8426 @item -msda=@var{n}
8427 @opindex msda
8428 Put static or global variables whose size is @var{n} bytes or less into
8429 the small data area that register @code{gp} points to.  The small data
8430 area can hold up to 64 kilobytes.
8431
8432 @item -mzda=@var{n}
8433 @opindex mzda
8434 Put static or global variables whose size is @var{n} bytes or less into
8435 the first 32 kilobytes of memory.
8436
8437 @item -mv850
8438 @opindex mv850
8439 Specify that the target processor is the V850.
8440
8441 @item -mbig-switch
8442 @opindex mbig-switch
8443 Generate code suitable for big switch tables.  Use this option only if
8444 the assembler/linker complain about out of range branches within a switch
8445 table.
8446 @end table
8447
8448 @node ARC Options
8449 @subsection ARC Options
8450 @cindex ARC Options
8451
8452 These options are defined for ARC implementations:
8453
8454 @table @gcctabopt
8455 @item -EL
8456 @opindex EL
8457 Compile code for little endian mode.  This is the default.
8458
8459 @item -EB
8460 @opindex EB
8461 Compile code for big endian mode.
8462
8463 @item -mmangle-cpu
8464 @opindex mmangle-cpu
8465 Prepend the name of the cpu to all public symbol names.
8466 In multiple-processor systems, there are many ARC variants with different
8467 instruction and register set characteristics.  This flag prevents code
8468 compiled for one cpu to be linked with code compiled for another.
8469 No facility exists for handling variants that are ``almost identical''.
8470 This is an all or nothing option.
8471
8472 @item -mcpu=@var{cpu}
8473 @opindex mcpu
8474 Compile code for ARC variant @var{cpu}.
8475 Which variants are supported depend on the configuration.
8476 All variants support @option{-mcpu=base}, this is the default.
8477
8478 @item -mtext=@var{text-section}
8479 @itemx -mdata=@var{data-section}
8480 @itemx -mrodata=@var{readonly-data-section}
8481 @opindex mtext
8482 @opindex mdata
8483 @opindex mrodata
8484 Put functions, data, and readonly data in @var{text-section},
8485 @var{data-section}, and @var{readonly-data-section} respectively
8486 by default.  This can be overridden with the @code{section} attribute.
8487 @xref{Variable Attributes}.
8488
8489 @end table
8490
8491 @node NS32K Options
8492 @subsection NS32K Options
8493 @cindex NS32K options
8494
8495 These are the @samp{-m} options defined for the 32000 series.  The default
8496 values for these options depends on which style of 32000 was selected when
8497 the compiler was configured; the defaults for the most common choices are
8498 given below.
8499
8500 @table @gcctabopt
8501 @item -m32032
8502 @itemx -m32032
8503 @opindex m32032
8504 @opindex m32032
8505 Generate output for a 32032.  This is the default
8506 when the compiler is configured for 32032 and 32016 based systems.
8507
8508 @item -m32332
8509 @itemx -m32332
8510 @opindex m32332
8511 @opindex m32332
8512 Generate output for a 32332.  This is the default
8513 when the compiler is configured for 32332-based systems.
8514
8515 @item -m32532
8516 @itemx -m32532
8517 @opindex m32532
8518 @opindex m32532
8519 Generate output for a 32532.  This is the default
8520 when the compiler is configured for 32532-based systems.
8521
8522 @item -m32081
8523 @opindex m32081
8524 Generate output containing 32081 instructions for floating point.
8525 This is the default for all systems.
8526
8527 @item -m32381
8528 @opindex m32381
8529 Generate output containing 32381 instructions for floating point.  This
8530 also implies @option{-m32081}. The 32381 is only compatible with the 32332
8531 and 32532 cpus. This is the default for the pc532-netbsd configuration.
8532
8533 @item -mmulti-add
8534 @opindex mmulti-add
8535 Try and generate multiply-add floating point instructions @code{polyF}
8536 and @code{dotF}. This option is only available if the @option{-m32381}
8537 option is in effect. Using these instructions requires changes to to
8538 register allocation which generally has a negative impact on
8539 performance.  This option should only be enabled when compiling code
8540 particularly likely to make heavy use of multiply-add instructions.
8541
8542 @item -mnomulti-add
8543 @opindex mnomulti-add
8544 Do not try and generate multiply-add floating point instructions
8545 @code{polyF} and @code{dotF}. This is the default on all platforms.
8546
8547 @item -msoft-float
8548 @opindex msoft-float
8549 Generate output containing library calls for floating point.
8550 @strong{Warning:} the requisite libraries may not be available.
8551
8552 @item -mnobitfield
8553 @opindex mnobitfield
8554 Do not use the bit-field instructions. On some machines it is faster to
8555 use shifting and masking operations. This is the default for the pc532.
8556
8557 @item -mbitfield
8558 @opindex mbitfield
8559 Do use the bit-field instructions. This is the default for all platforms
8560 except the pc532.
8561
8562 @item -mrtd
8563 @opindex mrtd
8564 Use a different function-calling convention, in which functions
8565 that take a fixed number of arguments return pop their
8566 arguments on return with the @code{ret} instruction.
8567
8568 This calling convention is incompatible with the one normally
8569 used on Unix, so you cannot use it if you need to call libraries
8570 compiled with the Unix compiler.
8571
8572 Also, you must provide function prototypes for all functions that
8573 take variable numbers of arguments (including @code{printf});
8574 otherwise incorrect code will be generated for calls to those
8575 functions.
8576
8577 In addition, seriously incorrect code will result if you call a
8578 function with too many arguments.  (Normally, extra arguments are
8579 harmlessly ignored.)
8580
8581 This option takes its name from the 680x0 @code{rtd} instruction.
8582
8583
8584 @item -mregparam
8585 @opindex mregparam
8586 Use a different function-calling convention where the first two arguments
8587 are passed in registers.
8588
8589 This calling convention is incompatible with the one normally
8590 used on Unix, so you cannot use it if you need to call libraries
8591 compiled with the Unix compiler.
8592
8593 @item -mnoregparam
8594 @opindex mnoregparam
8595 Do not pass any arguments in registers. This is the default for all
8596 targets.
8597
8598 @item -msb
8599 @opindex msb
8600 It is OK to use the sb as an index register which is always loaded with
8601 zero. This is the default for the pc532-netbsd target.
8602
8603 @item -mnosb
8604 @opindex mnosb
8605 The sb register is not available for use or has not been initialized to
8606 zero by the run time system. This is the default for all targets except
8607 the pc532-netbsd. It is also implied whenever @option{-mhimem} or
8608 @option{-fpic} is set.
8609
8610 @item -mhimem
8611 @opindex mhimem
8612 Many ns32000 series addressing modes use displacements of up to 512MB.
8613 If an address is above 512MB then displacements from zero can not be used.
8614 This option causes code to be generated which can be loaded above 512MB.
8615 This may be useful for operating systems or ROM code.
8616
8617 @item -mnohimem
8618 @opindex mnohimem
8619 Assume code will be loaded in the first 512MB of virtual address space.
8620 This is the default for all platforms.
8621
8622
8623 @end table
8624
8625 @node AVR Options
8626 @subsection AVR Options
8627 @cindex AVR Options
8628
8629 These options are defined for AVR implementations:
8630
8631 @table @gcctabopt
8632 @item -mmcu=@var{mcu}
8633 @opindex mmcu
8634 Specify ATMEL AVR instruction set or MCU type.
8635
8636 Instruction set avr1 is for the minimal AVR core, not supported by the C
8637 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
8638 attiny11, attiny12, attiny15, attiny28).
8639
8640 Instruction set avr2 (default) is for the classic AVR core with up to
8641 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
8642 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
8643 at90c8534, at90s8535).
8644
8645 Instruction set avr3 is for the classic AVR core with up to 128K program
8646 memory space (MCU types: atmega103, atmega603).
8647
8648 Instruction set avr4 is for the enhanced AVR core with up to 8K program
8649 memory space (MCU types: atmega83, atmega85).
8650
8651 Instruction set avr5 is for the enhanced AVR core with up to 128K program
8652 memory space (MCU types: atmega161, atmega163, atmega32, at94k).
8653
8654 @item -msize
8655 @opindex msize
8656 Output instruction sizes to the asm file.
8657
8658 @item -minit-stack=@var{N}
8659 @opindex minit-stack
8660 Specify the initial stack address, which may be a symbol or numeric value,
8661 __stack is the default.
8662
8663 @item -mno-interrupts
8664 @opindex mno-interrupts
8665 Generated code is not compatible with hardware interrupts.
8666 Code size will be smaller.
8667
8668 @item -mcall-prologues
8669 @opindex mcall-prologues
8670 Functions prologues/epilogues expanded as call to appropriate
8671 subroutines. Code size will be smaller.
8672
8673 @item -mno-tablejump
8674 @opindex mno-tablejump
8675 Do not generate tablejump insns which sometimes increase code size.
8676
8677 @item -mtiny-stack
8678 @opindex mtiny-stack
8679 Change only the low 8 bits of the stack pointer.
8680 @end table
8681
8682 @node MCore Options
8683 @subsection MCore Options
8684 @cindex MCore options
8685
8686 These are the @samp{-m} options defined for the Motorola M*Core
8687 processors.
8688
8689 @table @gcctabopt
8690
8691 @item -mhardlit
8692 @itemx -mhardlit
8693 @itemx -mno-hardlit
8694 @opindex mhardlit
8695 @opindex mhardlit
8696 @opindex mno-hardlit
8697 Inline constants into the code stream if it can be done in two
8698 instructions or less.
8699
8700 @item -mdiv
8701 @itemx -mdiv
8702 @itemx -mno-div
8703 @opindex mdiv
8704 @opindex mdiv
8705 @opindex mno-div
8706 Use the divide instruction.  (Enabled by default).
8707
8708 @item -mrelax-immediate
8709 @itemx -mrelax-immediate
8710 @itemx -mno-relax-immediate
8711 @opindex mrelax-immediate
8712 @opindex mrelax-immediate
8713 @opindex mno-relax-immediate
8714 Allow arbitrary sized immediates in bit operations.
8715
8716 @item -mwide-bitfields
8717 @itemx -mwide-bitfields
8718 @itemx -mno-wide-bitfields
8719 @opindex mwide-bitfields
8720 @opindex mwide-bitfields
8721 @opindex mno-wide-bitfields
8722 Always treat bitfields as int-sized.
8723
8724 @item -m4byte-functions
8725 @itemx -m4byte-functions
8726 @itemx -mno-4byte-functions
8727 @opindex m4byte-functions
8728 @opindex m4byte-functions
8729 @opindex mno-4byte-functions
8730 Force all functions to be aligned to a four byte boundary.
8731
8732 @item -mcallgraph-data
8733 @itemx -mcallgraph-data
8734 @itemx -mno-callgraph-data
8735 @opindex mcallgraph-data
8736 @opindex mcallgraph-data
8737 @opindex mno-callgraph-data
8738 Emit callgraph information.
8739
8740 @item -mslow-bytes
8741 @itemx -mslow-bytes
8742 @itemx -mno-slow-bytes
8743 @opindex mslow-bytes
8744 @opindex mslow-bytes
8745 @opindex mno-slow-bytes
8746 Prefer word access when reading byte quantities.
8747
8748 @item -mlittle-endian
8749 @itemx -mlittle-endian
8750 @itemx -mbig-endian
8751 @opindex mlittle-endian
8752 @opindex mlittle-endian
8753 @opindex mbig-endian
8754 Generate code for a little endian target.
8755
8756 @item -m210
8757 @itemx -m210
8758 @itemx -m340
8759 @opindex m210
8760 @opindex m210
8761 @opindex m340
8762 Generate code for the 210 processor.
8763 @end table
8764
8765 @node IA-64 Options
8766 @subsection IA-64 Options
8767 @cindex IA-64 Options
8768
8769 These are the @samp{-m} options defined for the Intel IA-64 architecture.
8770
8771 @table @gcctabopt
8772 @item -mbig-endian
8773 @opindex mbig-endian
8774 Generate code for a big endian target.  This is the default for HPUX.
8775
8776 @item -mlittle-endian
8777 @opindex mlittle-endian
8778 Generate code for a little endian target.  This is the default for AIX5
8779 and Linux.
8780
8781 @item -mgnu-as
8782 @itemx -mno-gnu-as
8783 @opindex mgnu-as
8784 @opindex mno-gnu-as
8785 Generate (or don't) code for the GNU assembler.  This is the default.
8786 @c Also, this is the default if the configure option @option{--with-gnu-as}
8787 @c is used.
8788
8789 @item -mgnu-ld
8790 @itemx -mno-gnu-ld
8791 @opindex mgnu-ld
8792 @opindex mno-gnu-ld
8793 Generate (or don't) code for the GNU linker.  This is the default.
8794 @c Also, this is the default if the configure option @option{--with-gnu-ld}
8795 @c is used.
8796
8797 @item -mno-pic
8798 @opindex mno-pic
8799 Generate code that does not use a global pointer register.  The result
8800 is not position independent code, and violates the IA-64 ABI.
8801
8802 @item -mvolatile-asm-stop
8803 @itemx -mno-volatile-asm-stop
8804 @opindex mvolatile-asm-stop
8805 @opindex mno-volatile-asm-stop
8806 Generate (or don't) a stop bit immediately before and after volatile asm
8807 statements.
8808
8809 @item -mb-step
8810 @opindex mb-step
8811 Generate code that works around Itanium B step errata.
8812
8813 @item -mregister-names
8814 @itemx -mno-register-names
8815 @opindex mregister-names
8816 @opindex mno-register-names
8817 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
8818 the stacked registers.  This may make assembler output more readable.
8819
8820 @item -mno-sdata
8821 @itemx -msdata
8822 @opindex mno-sdata
8823 @opindex msdata
8824 Disable (or enable) optimizations that use the small data section.  This may
8825 be useful for working around optimizer bugs.
8826
8827 @item -mconstant-gp
8828 @opindex mconstant-gp
8829 Generate code that uses a single constant global pointer value.  This is
8830 useful when compiling kernel code.
8831
8832 @item -mauto-pic
8833 @opindex mauto-pic
8834 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
8835 This is useful when compiling firmware code.
8836
8837 @item -minline-divide-min-latency
8838 @opindex minline-divide-min-latency
8839 Generate code for inline divides using the minimum latency algorithm.
8840
8841 @item -minline-divide-max-throughput
8842 @opindex minline-divide-max-throughput
8843 Generate code for inline divides using the maximum throughput algorithm.
8844
8845 @item -mno-dwarf2-asm
8846 @itemx -mdwarf2-asm
8847 @opindex mno-dwarf2-asm
8848 @opindex mdwarf2-asm
8849 Don't (or do) generate assembler code for the DWARF2 line number debugging
8850 info.  This may be useful when not using the GNU assembler.
8851
8852 @item -mfixed-range=@var{register-range}
8853 @opindex mfixed-range
8854 Generate code treating the given register range as fixed registers.
8855 A fixed register is one that the register allocator can not use.  This is
8856 useful when compiling kernel code.  A register range is specified as
8857 two registers separated by a dash.  Multiple register ranges can be
8858 specified separated by a comma.
8859 @end table
8860
8861 @node D30V Options
8862 @subsection D30V Options
8863 @cindex D30V Options
8864
8865 These @samp{-m} options are defined for D30V implementations:
8866
8867 @table @gcctabopt
8868 @item -mextmem
8869 @opindex mextmem
8870 Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
8871 @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
8872 memory, which starts at location @code{0x80000000}.
8873
8874 @item -mextmemory
8875 @opindex mextmemory
8876 Same as the @option{-mextmem} switch.
8877
8878 @item -monchip
8879 @opindex monchip
8880 Link the @samp{.text} section into onchip text memory, which starts at
8881 location @code{0x0}.  Also link @samp{.data}, @samp{.bss},
8882 @samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
8883 into onchip data memory, which starts at location @code{0x20000000}.
8884
8885 @item -mno-asm-optimize
8886 @itemx -masm-optimize
8887 @opindex mno-asm-optimize
8888 @opindex masm-optimize
8889 Disable (enable) passing @option{-O} to the assembler when optimizing.
8890 The assembler uses the @option{-O} option to automatically parallelize
8891 adjacent short instructions where possible.
8892
8893 @item -mbranch-cost=@var{n}
8894 @opindex mbranch-cost
8895 Increase the internal costs of branches to @var{n}.  Higher costs means
8896 that the compiler will issue more instructions to avoid doing a branch.
8897 The default is 2.
8898
8899 @item -mcond-exec=@var{n}
8900 @opindex mcond-exec
8901 Specify the maximum number of conditionally executed instructions that
8902 replace a branch.  The default is 4.
8903 @end table
8904
8905 @node Code Gen Options
8906 @section Options for Code Generation Conventions
8907 @cindex code generation conventions
8908 @cindex options, code generation
8909 @cindex run-time options
8910
8911 These machine-independent options control the interface conventions
8912 used in code generation.
8913
8914 Most of them have both positive and negative forms; the negative form
8915 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
8916 one of the forms is listed---the one which is not the default.  You
8917 can figure out the other form by either removing @samp{no-} or adding
8918 it.
8919
8920 @table @gcctabopt
8921 @item -fexceptions
8922 @opindex fexceptions
8923 Enable exception handling. Generates extra code needed to propagate
8924 exceptions.  For some targets, this implies GNU CC will generate frame
8925 unwind information for all functions, which can produce significant data
8926 size overhead, although it does not affect execution.  If you do not
8927 specify this option, GNU CC will enable it by default for languages like
8928 C++ which normally require exception handling, and disable it for
8929 languages like C that do not normally require it.  However, you may need
8930 to enable this option when compiling C code that needs to interoperate
8931 properly with exception handlers written in C++.  You may also wish to
8932 disable this option if you are compiling older C++ programs that don't
8933 use exception handling.
8934
8935 @item -fnon-call-exceptions
8936 @opindex fnon-call-exceptions
8937 Generate code that allows trapping instructions to throw exceptions.
8938 Note that this requires platform-specific runtime support that does
8939 not exist everywhere.  Moreover, it only allows @emph{trapping}
8940 instructions to throw exceptions, i.e. memory references or floating
8941 point instructions.  It does not allow exceptions to be thrown from
8942 arbitrary signal handlers such as @code{SIGALRM}.
8943
8944 @item -funwind-tables
8945 @opindex funwind-tables
8946 Similar to @option{-fexceptions}, except that it will just generate any needed
8947 static data, but will not affect the generated code in any other way.
8948 You will normally not enable this option; instead, a language processor
8949 that needs this handling would enable it on your behalf.
8950
8951 @item -fpcc-struct-return
8952 @opindex fpcc-struct-return
8953 Return ``short'' @code{struct} and @code{union} values in memory like
8954 longer ones, rather than in registers.  This convention is less
8955 efficient, but it has the advantage of allowing intercallability between
8956 GCC-compiled files and files compiled with other compilers.
8957
8958 The precise convention for returning structures in memory depends
8959 on the target configuration macros.
8960
8961 Short structures and unions are those whose size and alignment match
8962 that of some integer type.
8963
8964 @item -freg-struct-return
8965 @opindex freg-struct-return
8966 Use the convention that @code{struct} and @code{union} values are
8967 returned in registers when possible.  This is more efficient for small
8968 structures than @option{-fpcc-struct-return}.
8969
8970 If you specify neither @option{-fpcc-struct-return} nor its contrary
8971 @option{-freg-struct-return}, GCC defaults to whichever convention is
8972 standard for the target.  If there is no standard convention, GCC
8973 defaults to @option{-fpcc-struct-return}, except on targets where GCC
8974 is the principal compiler.  In those cases, we can choose the standard,
8975 and we chose the more efficient register return alternative.
8976
8977 @item -fshort-enums
8978 @opindex fshort-enums
8979 Allocate to an @code{enum} type only as many bytes as it needs for the
8980 declared range of possible values.  Specifically, the @code{enum} type
8981 will be equivalent to the smallest integer type which has enough room.
8982
8983 @item -fshort-double
8984 @opindex fshort-double
8985 Use the same size for @code{double} as for @code{float}.
8986
8987 @item -fshared-data
8988 @opindex fshared-data
8989 Requests that the data and non-@code{const} variables of this
8990 compilation be shared data rather than private data.  The distinction
8991 makes sense only on certain operating systems, where shared data is
8992 shared between processes running the same program, while private data
8993 exists in one copy per process.
8994
8995 @item -fno-common
8996 @opindex fno-common
8997 In C, allocate even uninitialized global variables in the data section of the
8998 object file, rather than generating them as common blocks.  This has the
8999 effect that if the same variable is declared (without @code{extern}) in
9000 two different compilations, you will get an error when you link them.
9001 The only reason this might be useful is if you wish to verify that the
9002 program will work on other systems which always work this way.
9003
9004 @item -fno-ident
9005 @opindex fno-ident
9006 Ignore the @samp{#ident} directive.
9007
9008 @item -fno-gnu-linker
9009 @opindex fno-gnu-linker
9010 Do not output global initializations (such as C++ constructors and
9011 destructors) in the form used by the GNU linker (on systems where the GNU
9012 linker is the standard method of handling them).  Use this option when
9013 you want to use a non-GNU linker, which also requires using the
9014 @command{collect2} program to make sure the system linker includes
9015 constructors and destructors.  (@command{collect2} is included in the GCC
9016 distribution.)  For systems which @emph{must} use @command{collect2}, the
9017 compiler driver @command{gcc} is configured to do this automatically.
9018
9019 @item -finhibit-size-directive
9020 @opindex finhibit-size-directive
9021 Don't output a @code{.size} assembler directive, or anything else that
9022 would cause trouble if the function is split in the middle, and the
9023 two halves are placed at locations far apart in memory.  This option is
9024 used when compiling @file{crtstuff.c}; you should not need to use it
9025 for anything else.
9026
9027 @item -fverbose-asm
9028 @opindex fverbose-asm
9029 Put extra commentary information in the generated assembly code to
9030 make it more readable.  This option is generally only of use to those
9031 who actually need to read the generated assembly code (perhaps while
9032 debugging the compiler itself).
9033
9034 @option{-fno-verbose-asm}, the default, causes the
9035 extra information to be omitted and is useful when comparing two assembler
9036 files.
9037
9038 @item -fvolatile
9039 @opindex fvolatile
9040 Consider all memory references through pointers to be volatile.
9041
9042 @item -fvolatile-global
9043 @opindex fvolatile-global
9044 Consider all memory references to extern and global data items to
9045 be volatile.  GCC does not consider static data items to be volatile
9046 because of this switch.
9047
9048 @item -fvolatile-static
9049 @opindex fvolatile-static
9050 Consider all memory references to static data to be volatile.
9051
9052 @item -fpic
9053 @opindex fpic
9054 @cindex global offset table
9055 @cindex PIC
9056 Generate position-independent code (PIC) suitable for use in a shared
9057 library, if supported for the target machine.  Such code accesses all
9058 constant addresses through a global offset table (GOT).  The dynamic
9059 loader resolves the GOT entries when the program starts (the dynamic
9060 loader is not part of GCC; it is part of the operating system).  If
9061 the GOT size for the linked executable exceeds a machine-specific
9062 maximum size, you get an error message from the linker indicating that
9063 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
9064 instead.  (These maximums are 16k on the m88k, 8k on the Sparc, and 32k
9065 on the m68k and RS/6000.  The 386 has no such limit.)
9066
9067 Position-independent code requires special support, and therefore works
9068 only on certain machines.  For the 386, GCC supports PIC for System V
9069 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
9070 position-independent.
9071
9072 @item -fPIC
9073 @opindex fPIC
9074 If supported for the target machine, emit position-independent code,
9075 suitable for dynamic linking and avoiding any limit on the size of the
9076 global offset table.  This option makes a difference on the m68k, m88k,
9077 and the Sparc.
9078
9079 Position-independent code requires special support, and therefore works
9080 only on certain machines.
9081
9082 @item -ffixed-@var{reg}
9083 @opindex ffixed
9084 Treat the register named @var{reg} as a fixed register; generated code
9085 should never refer to it (except perhaps as a stack pointer, frame
9086 pointer or in some other fixed role).
9087
9088 @var{reg} must be the name of a register.  The register names accepted
9089 are machine-specific and are defined in the @code{REGISTER_NAMES}
9090 macro in the machine description macro file.
9091
9092 This flag does not have a negative form, because it specifies a
9093 three-way choice.
9094
9095 @item -fcall-used-@var{reg}
9096 @opindex fcall-used
9097 Treat the register named @var{reg} as an allocable register that is
9098 clobbered by function calls.  It may be allocated for temporaries or
9099 variables that do not live across a call.  Functions compiled this way
9100 will not save and restore the register @var{reg}.
9101
9102 It is an error to used this flag with the frame pointer or stack pointer.
9103 Use of this flag for other registers that have fixed pervasive roles in
9104 the machine's execution model will produce disastrous results.
9105
9106 This flag does not have a negative form, because it specifies a
9107 three-way choice.
9108
9109 @item -fcall-saved-@var{reg}
9110 @opindex fcall-saved
9111 Treat the register named @var{reg} as an allocable register saved by
9112 functions.  It may be allocated even for temporaries or variables that
9113 live across a call.  Functions compiled this way will save and restore
9114 the register @var{reg} if they use it.
9115
9116 It is an error to used this flag with the frame pointer or stack pointer.
9117 Use of this flag for other registers that have fixed pervasive roles in
9118 the machine's execution model will produce disastrous results.
9119
9120 A different sort of disaster will result from the use of this flag for
9121 a register in which function values may be returned.
9122
9123 This flag does not have a negative form, because it specifies a
9124 three-way choice.
9125
9126 @item -fpack-struct
9127 @opindex fpack-struct
9128 Pack all structure members together without holes.  Usually you would
9129 not want to use this option, since it makes the code suboptimal, and
9130 the offsets of structure members won't agree with system libraries.
9131
9132 @item -fcheck-memory-usage
9133 @opindex fcheck-memory-usage
9134 Generate extra code to check each memory access.  GCC will generate
9135 code that is suitable for a detector of bad memory accesses such as
9136 @file{Checker}.
9137
9138 Normally, you should compile all, or none, of your code with this option.
9139
9140 If you do mix code compiled with and without this option,
9141 you must ensure that all code that has side effects
9142 and that is called by code compiled with this option
9143 is, itself, compiled with this option.
9144 If you do not, you might get erroneous messages from the detector.
9145
9146 If you use functions from a library that have side-effects (such as
9147 @code{read}), you might not be able to recompile the library and
9148 specify this option.  In that case, you can enable the
9149 @option{-fprefix-function-name} option, which requests GCC to encapsulate
9150 your code and make other functions look as if they were compiled with
9151 @option{-fcheck-memory-usage}.  This is done by calling ``stubs'',
9152 which are provided by the detector.  If you cannot find or build
9153 stubs for every function you call, you might have to specify
9154 @option{-fcheck-memory-usage} without @option{-fprefix-function-name}.
9155
9156 If you specify this option, you can not use the @code{asm} or
9157 @code{__asm__} keywords in functions with memory checking enabled.  GNU
9158 CC cannot understand what the @code{asm} statement may do, and therefore
9159 cannot generate the appropriate code, so it will reject it.  However, if
9160 you specify the function attribute @code{no_check_memory_usage}
9161 (@pxref{Function Attributes}), GNU CC will disable memory checking within a
9162 function; you may use @code{asm} statements inside such functions.  You
9163 may have an inline expansion of a non-checked function within a checked
9164 function; in that case GNU CC will not generate checks for the inlined
9165 function's memory accesses.
9166
9167 If you move your @code{asm} statements to non-checked inline functions
9168 and they do access memory, you can add calls to the support code in your
9169 inline function, to indicate any reads, writes, or copies being done.
9170 These calls would be similar to those done in the stubs described above.
9171
9172 @item -fprefix-function-name
9173 @opindex fprefix-function-name
9174 Request GCC to add a prefix to the symbols generated for function names.
9175 GCC adds a prefix to the names of functions defined as well as
9176 functions called.  Code compiled with this option and code compiled
9177 without the option can't be linked together, unless stubs are used.
9178
9179 If you compile the following code with @option{-fprefix-function-name}
9180 @example
9181 extern void bar (int);
9182 void
9183 foo (int a)
9184 @{
9185   return bar (a + 5);
9186 @}
9187 @end example
9188
9189 @noindent
9190 GCC will compile the code as if it was written:
9191 @example
9192 extern void prefix_bar (int);
9193 void
9194 prefix_foo (int a)
9195 @{
9196   return prefix_bar (a + 5);
9197 @}
9198 @end example
9199 This option is designed to be used with @option{-fcheck-memory-usage}.
9200
9201 @item -finstrument-functions
9202 @opindex finstrument-functions
9203 Generate instrumentation calls for entry and exit to functions.  Just
9204 after function entry and just before function exit, the following
9205 profiling functions will be called with the address of the current
9206 function and its call site.  (On some platforms,
9207 @code{__builtin_return_address} does not work beyond the current
9208 function, so the call site information may not be available to the
9209 profiling functions otherwise.)
9210
9211 @example
9212 void __cyg_profile_func_enter (void *this_fn,
9213                                void *call_site);
9214 void __cyg_profile_func_exit  (void *this_fn,
9215                                void *call_site);
9216 @end example
9217
9218 The first argument is the address of the start of the current function,
9219 which may be looked up exactly in the symbol table.
9220
9221 This instrumentation is also done for functions expanded inline in other
9222 functions.  The profiling calls will indicate where, conceptually, the
9223 inline function is entered and exited.  This means that addressable
9224 versions of such functions must be available.  If all your uses of a
9225 function are expanded inline, this may mean an additional expansion of
9226 code size.  If you use @samp{extern inline} in your C code, an
9227 addressable version of such functions must be provided.  (This is
9228 normally the case anyways, but if you get lucky and the optimizer always
9229 expands the functions inline, you might have gotten away without
9230 providing static copies.)
9231
9232 A function may be given the attribute @code{no_instrument_function}, in
9233 which case this instrumentation will not be done.  This can be used, for
9234 example, for the profiling functions listed above, high-priority
9235 interrupt routines, and any functions from which the profiling functions
9236 cannot safely be called (perhaps signal handlers, if the profiling
9237 routines generate output or allocate memory).
9238
9239 @item -fstack-check
9240 @opindex fstack-check
9241 Generate code to verify that you do not go beyond the boundary of the
9242 stack.  You should specify this flag if you are running in an
9243 environment with multiple threads, but only rarely need to specify it in
9244 a single-threaded environment since stack overflow is automatically
9245 detected on nearly all systems if there is only one stack.
9246
9247 Note that this switch does not actually cause checking to be done; the
9248 operating system must do that.  The switch causes generation of code
9249 to ensure that the operating system sees the stack being extended.
9250
9251 @item -fstack-limit-register=@var{reg}
9252 @itemx -fstack-limit-symbol=@var{sym}
9253 @itemx -fno-stack-limit
9254 @opindex fstack-limit-register
9255 @opindex fstack-limit-symbol
9256 @opindex fno-stack-limit
9257 Generate code to ensure that the stack does not grow beyond a certain value,
9258 either the value of a register or the address of a symbol.  If the stack
9259 would grow beyond the value, a signal is raised.  For most targets,
9260 the signal is raised before the stack overruns the boundary, so
9261 it is possible to catch the signal without taking special precautions.
9262
9263 For instance, if the stack starts at address @samp{0x80000000} and grows
9264 downwards you can use the flags
9265 @samp{-fstack-limit-symbol=__stack_limit
9266 -Wl,--defsym,__stack_limit=0x7ffe0000} which will enforce a stack
9267 limit of 128K.
9268
9269 @cindex aliasing of parameters
9270 @cindex parameters, aliased
9271 @item -fargument-alias
9272 @itemx -fargument-noalias
9273 @itemx -fargument-noalias-global
9274 @opindex fargument-alias
9275 @opindex fargument-noalias
9276 @opindex fargument-noalias-global
9277 Specify the possible relationships among parameters and between
9278 parameters and global data.
9279
9280 @option{-fargument-alias} specifies that arguments (parameters) may
9281 alias each other and may alias global storage.
9282 @option{-fargument-noalias} specifies that arguments do not alias
9283 each other, but may alias global storage.
9284 @option{-fargument-noalias-global} specifies that arguments do not
9285 alias each other and do not alias global storage.
9286
9287 Each language will automatically use whatever option is required by
9288 the language standard.  You should not need to use these options yourself.
9289
9290 @item -fleading-underscore
9291 @opindex fleading-underscore
9292 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
9293 change the way C symbols are represented in the object file.  One use
9294 is to help link with legacy assembly code.
9295
9296 Be warned that you should know what you are doing when invoking this
9297 option, and that not all targets provide complete support for it.
9298 @end table
9299
9300 @c man end
9301
9302 @node Environment Variables
9303 @section Environment Variables Affecting GCC
9304 @cindex environment variables
9305
9306 @c man begin ENVIRONMENT
9307
9308 This section describes several environment variables that affect how GCC
9309 operates.  Some of them work by specifying directories or prefixes to use
9310 when searching for various kinds of files. Some are used to specify other
9311 aspects of the compilation environment.
9312
9313 @ifclear INTERNALS
9314 Note that you can also specify places to search using options such as
9315 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
9316 take precedence over places specified using environment variables, which
9317 in turn take precedence over those specified by the configuration of GCC.
9318
9319 @end ifclear
9320 @ifset INTERNALS
9321 Note that you can also specify places to search using options such as
9322 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
9323 take precedence over places specified using environment variables, which
9324 in turn take precedence over those specified by the configuration of GCC.
9325 @xref{Driver}.
9326 @end ifset
9327
9328 @table @env
9329 @item LANG
9330 @itemx LC_CTYPE
9331 @c @itemx LC_COLLATE
9332 @itemx LC_MESSAGES
9333 @c @itemx LC_MONETARY
9334 @c @itemx LC_NUMERIC
9335 @c @itemx LC_TIME
9336 @itemx LC_ALL
9337 @findex LANG
9338 @findex LC_CTYPE
9339 @c @findex LC_COLLATE
9340 @findex LC_MESSAGES
9341 @c @findex LC_MONETARY
9342 @c @findex LC_NUMERIC
9343 @c @findex LC_TIME
9344 @findex LC_ALL
9345 @cindex locale
9346 These environment variables control the way that GCC uses
9347 localization information that allow GCC to work with different
9348 national conventions.  GCC inspects the locale categories
9349 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
9350 so.  These locale categories can be set to any value supported by your
9351 installation.  A typical value is @samp{en_UK} for English in the United
9352 Kingdom.
9353
9354 The @env{LC_CTYPE} environment variable specifies character
9355 classification.  GCC uses it to determine the character boundaries in
9356 a string; this is needed for some multibyte encodings that contain quote
9357 and escape characters that would otherwise be interpreted as a string
9358 end or escape.
9359
9360 The @env{LC_MESSAGES} environment variable specifies the language to
9361 use in diagnostic messages.
9362
9363 If the @env{LC_ALL} environment variable is set, it overrides the value
9364 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
9365 and @env{LC_MESSAGES} default to the value of the @env{LANG}
9366 environment variable.  If none of these variables are set, GCC
9367 defaults to traditional C English behavior.
9368
9369 @item TMPDIR
9370 @findex TMPDIR
9371 If @env{TMPDIR} is set, it specifies the directory to use for temporary
9372 files.  GCC uses temporary files to hold the output of one stage of
9373 compilation which is to be used as input to the next stage: for example,
9374 the output of the preprocessor, which is the input to the compiler
9375 proper.
9376
9377 @item GCC_EXEC_PREFIX
9378 @findex GCC_EXEC_PREFIX
9379 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
9380 names of the subprograms executed by the compiler.  No slash is added
9381 when this prefix is combined with the name of a subprogram, but you can
9382 specify a prefix that ends with a slash if you wish.
9383
9384 If @env{GCC_EXEC_PREFIX} is not set, GNU CC will attempt to figure out
9385 an appropriate prefix to use based on the pathname it was invoked with.
9386
9387 If GCC cannot find the subprogram using the specified prefix, it
9388 tries looking in the usual places for the subprogram.
9389
9390 The default value of @env{GCC_EXEC_PREFIX} is
9391 @file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
9392 of @code{prefix} when you ran the @file{configure} script.
9393
9394 Other prefixes specified with @option{-B} take precedence over this prefix.
9395
9396 This prefix is also used for finding files such as @file{crt0.o} that are
9397 used for linking.
9398
9399 In addition, the prefix is used in an unusual way in finding the
9400 directories to search for header files.  For each of the standard
9401 directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
9402 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
9403 replacing that beginning with the specified prefix to produce an
9404 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
9405 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
9406 These alternate directories are searched first; the standard directories
9407 come next.
9408
9409 @item COMPILER_PATH
9410 @findex COMPILER_PATH
9411 The value of @env{COMPILER_PATH} is a colon-separated list of
9412 directories, much like @env{PATH}.  GCC tries the directories thus
9413 specified when searching for subprograms, if it can't find the
9414 subprograms using @env{GCC_EXEC_PREFIX}.
9415
9416 @item LIBRARY_PATH
9417 @findex LIBRARY_PATH
9418 The value of @env{LIBRARY_PATH} is a colon-separated list of
9419 directories, much like @env{PATH}.  When configured as a native compiler,
9420 GCC tries the directories thus specified when searching for special
9421 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
9422 using GCC also uses these directories when searching for ordinary
9423 libraries for the @option{-l} option (but directories specified with
9424 @option{-L} come first).
9425
9426 @item C_INCLUDE_PATH
9427 @itemx CPLUS_INCLUDE_PATH
9428 @itemx OBJC_INCLUDE_PATH
9429 @findex C_INCLUDE_PATH
9430 @findex CPLUS_INCLUDE_PATH
9431 @findex OBJC_INCLUDE_PATH
9432 @c @itemx OBJCPLUS_INCLUDE_PATH
9433 These environment variables pertain to particular languages.  Each
9434 variable's value is a colon-separated list of directories, much like
9435 @env{PATH}.  When GCC searches for header files, it tries the
9436 directories listed in the variable for the language you are using, after
9437 the directories specified with @option{-I} but before the standard header
9438 file directories.
9439
9440 @item DEPENDENCIES_OUTPUT
9441 @findex DEPENDENCIES_OUTPUT
9442 @cindex dependencies for make as output
9443 If this variable is set, its value specifies how to output dependencies
9444 for Make based on the header files processed by the compiler.  This
9445 output looks much like the output from the @option{-M} option
9446 (@pxref{Preprocessor Options}), but it goes to a separate file, and is
9447 in addition to the usual results of compilation.
9448
9449 The value of @env{DEPENDENCIES_OUTPUT} can be just a file name, in
9450 which case the Make rules are written to that file, guessing the target
9451 name from the source file name.  Or the value can have the form
9452 @samp{@var{file} @var{target}}, in which case the rules are written to
9453 file @var{file} using @var{target} as the target name.
9454
9455 @item LANG
9456 @findex LANG
9457 @cindex locale definition
9458 This variable is used to pass locale information to the compiler. One way in
9459 which this information is used is to determine the character set to be used
9460 when character literals, string literals and comments are parsed in C and C++.
9461 When the compiler is configured to allow multibyte characters,
9462 the following values for @env{LANG} are recognized:
9463
9464 @table @samp
9465 @item C-JIS
9466 Recognize JIS characters.
9467 @item C-SJIS
9468 Recognize SJIS characters.
9469 @item C-EUCJP
9470 Recognize EUCJP characters.
9471 @end table
9472
9473 If @env{LANG} is not defined, or if it has some other value, then the
9474 compiler will use mblen and mbtowc as defined by the default locale to
9475 recognize and translate multibyte characters.
9476 @end table
9477
9478 @c man end
9479
9480 @node Running Protoize
9481 @section Running Protoize
9482
9483 The program @code{protoize} is an optional part of GNU C.  You can use
9484 it to add prototypes to a program, thus converting the program to ISO
9485 C in one respect.  The companion program @code{unprotoize} does the
9486 reverse: it removes argument types from any prototypes that are found.
9487
9488 When you run these programs, you must specify a set of source files as
9489 command line arguments.  The conversion programs start out by compiling
9490 these files to see what functions they define.  The information gathered
9491 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
9492
9493 After scanning comes actual conversion.  The specified files are all
9494 eligible to be converted; any files they include (whether sources or
9495 just headers) are eligible as well.
9496
9497 But not all the eligible files are converted.  By default,
9498 @code{protoize} and @code{unprotoize} convert only source and header
9499 files in the current directory.  You can specify additional directories
9500 whose files should be converted with the @option{-d @var{directory}}
9501 option.  You can also specify particular files to exclude with the
9502 @option{-x @var{file}} option.  A file is converted if it is eligible, its
9503 directory name matches one of the specified directory names, and its
9504 name within the directory has not been excluded.
9505
9506 Basic conversion with @code{protoize} consists of rewriting most
9507 function definitions and function declarations to specify the types of
9508 the arguments.  The only ones not rewritten are those for varargs
9509 functions.
9510
9511 @code{protoize} optionally inserts prototype declarations at the
9512 beginning of the source file, to make them available for any calls that
9513 precede the function's definition.  Or it can insert prototype
9514 declarations with block scope in the blocks where undeclared functions
9515 are called.
9516
9517 Basic conversion with @code{unprotoize} consists of rewriting most
9518 function declarations to remove any argument types, and rewriting
9519 function definitions to the old-style pre-ISO form.
9520
9521 Both conversion programs print a warning for any function declaration or
9522 definition that they can't convert.  You can suppress these warnings
9523 with @option{-q}.
9524
9525 The output from @code{protoize} or @code{unprotoize} replaces the
9526 original source file.  The original file is renamed to a name ending
9527 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
9528 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
9529 for DOS) file already exists, then the source file is simply discarded.
9530
9531 @code{protoize} and @code{unprotoize} both depend on GCC itself to
9532 scan the program and collect information about the functions it uses.
9533 So neither of these programs will work until GCC is installed.
9534
9535 Here is a table of the options you can use with @code{protoize} and
9536 @code{unprotoize}.  Each option works with both programs unless
9537 otherwise stated.
9538
9539 @table @code
9540 @item -B @var{directory}
9541 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
9542 usual directory (normally @file{/usr/local/lib}).  This file contains
9543 prototype information about standard system functions.  This option
9544 applies only to @code{protoize}.
9545
9546 @item -c @var{compilation-options}
9547 Use  @var{compilation-options} as the options when running @code{gcc} to
9548 produce the @samp{.X} files.  The special option @option{-aux-info} is
9549 always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
9550
9551 Note that the compilation options must be given as a single argument to
9552 @code{protoize} or @code{unprotoize}.  If you want to specify several
9553 @code{gcc} options, you must quote the entire set of compilation options
9554 to make them a single word in the shell.
9555
9556 There are certain @code{gcc} arguments that you cannot use, because they
9557 would produce the wrong kind of output.  These include @option{-g},
9558 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
9559 the @var{compilation-options}, they are ignored.
9560
9561 @item -C
9562 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
9563 systems) instead of @samp{.c}.  This is convenient if you are converting
9564 a C program to C++.  This option applies only to @code{protoize}.
9565
9566 @item -g
9567 Add explicit global declarations.  This means inserting explicit
9568 declarations at the beginning of each source file for each function
9569 that is called in the file and was not declared.  These declarations
9570 precede the first function definition that contains a call to an
9571 undeclared function.  This option applies only to @code{protoize}.
9572
9573 @item -i @var{string}
9574 Indent old-style parameter declarations with the string @var{string}.
9575 This option applies only to @code{protoize}.
9576
9577 @code{unprotoize} converts prototyped function definitions to old-style
9578 function definitions, where the arguments are declared between the
9579 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
9580 uses five spaces as the indentation.  If you want to indent with just
9581 one space instead, use @option{-i " "}.
9582
9583 @item -k
9584 Keep the @samp{.X} files.  Normally, they are deleted after conversion
9585 is finished.
9586
9587 @item -l
9588 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
9589 a prototype declaration for each function in each block which calls the
9590 function without any declaration.  This option applies only to
9591 @code{protoize}.
9592
9593 @item -n
9594 Make no real changes.  This mode just prints information about the conversions
9595 that would have been done without @option{-n}.
9596
9597 @item -N
9598 Make no @samp{.save} files.  The original files are simply deleted.
9599 Use this option with caution.
9600
9601 @item -p @var{program}
9602 Use the program @var{program} as the compiler.  Normally, the name
9603 @file{gcc} is used.
9604
9605 @item -q
9606 Work quietly.  Most warnings are suppressed.
9607
9608 @item -v
9609 Print the version number, just like @option{-v} for @code{gcc}.
9610 @end table
9611
9612 If you need special compiler options to compile one of your program's
9613 source files, then you should generate that file's @samp{.X} file
9614 specially, by running @code{gcc} on that source file with the
9615 appropriate options and the option @option{-aux-info}.  Then run
9616 @code{protoize} on the entire set of files.  @code{protoize} will use
9617 the existing @samp{.X} file because it is newer than the source file.
9618 For example:
9619
9620 @example
9621 gcc -Dfoo=bar file1.c -aux-info file1.X
9622 protoize *.c
9623 @end example
9624
9625 @noindent
9626 You need to include the special files along with the rest in the
9627 @code{protoize} command, even though their @samp{.X} files already
9628 exist, because otherwise they won't get converted.
9629
9630 @xref{Protoize Caveats}, for more information on how to use
9631 @code{protoize} successfully.