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