OSDN Git Service

7d994b19c5b7c20508d3a964771e9a524b7b1fe8
[pf3gnuchains/gcc-fork.git] / gcc / doc / invoke.texi
1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 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  -###  --help  --target-help  --version}
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}
173
174 @item C++ Language Options
175 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
176 @gccoptlist{
177 -fabi-version=@var{n} -fno-access-control  -fcheck-new @gol
178 -fconserve-space -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 -Wabi -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 -Wundeclared-selector}
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 @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  -Wstrict-aliasing @gol
232 -Wswitch  -Wswitch-default -Wswitch-enum @gol
233 -Wsystem-headers -Wtrigraphs  -Wundef  -Wuninitialized @gol
234 -Wunknown-pragmas  -Wunreachable-code @gol
235 -Wunused  -Wunused-function  -Wunused-label  -Wunused-parameter @gol
236 -Wunused-value  -Wunused-variable  -Wwrite-strings}
237
238 @item C-only Warning Options
239 @gccoptlist{
240 -Wbad-function-cast  -Wmissing-declarations @gol
241 -Wmissing-prototypes  -Wnested-externs @gol
242 -Wstrict-prototypes  -Wtraditional}
243
244 @item Debugging Options
245 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
246 @gccoptlist{
247 -d@var{letters}  -dumpspecs  -dumpmachine  -dumpversion @gol
248 -fdump-unnumbered -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
249 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
250 -fdump-tree-original@r{[}-@var{n}@r{]} -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
251 -fdump-tree-inlined@r{[}-@var{n}@r{]} @gol
252 -feliminate-dwarf2-dups  -fmem-report @gol
253 -fprofile-arcs  -fsched-verbose=@var{n} @gol
254 -ftest-coverage  -ftime-report @gol
255 -g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-1  -gdwarf-1+  -gdwarf-2 @gol
256 -ggdb  -gstabs  -gstabs+  -gvms  -gxcoff  -gxcoff+ @gol
257 -p  -pg  -print-file-name=@var{library}  -print-libgcc-file-name @gol
258 -print-multi-directory  -print-multi-lib @gol
259 -print-prog-name=@var{program}  -print-search-dirs  -Q @gol
260 -save-temps  -time}
261
262 @item Optimization Options
263 @xref{Optimize Options,,Options that Control Optimization}.
264 @gccoptlist{
265 -falign-functions=@var{n}  -falign-jumps=@var{n} @gol
266 -falign-labels=@var{n}  -falign-loops=@var{n}  @gol
267 -fbounds-check @gol
268 -fbranch-probabilities  -fcaller-saves -fcprop-registers @gol
269 -fcse-follow-jumps  -fcse-skip-blocks  -fdata-sections @gol
270 -fdelayed-branch  -fdelete-null-pointer-checks @gol
271 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
272 -fforce-addr  -fforce-mem  -ffunction-sections @gol
273 -fgcse  -fgcse-lm  -fgcse-sm -floop-optimize -fcrossjumping @gol
274 -fif-conversion -fif-conversion2 @gol
275 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
276 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
277 -fmove-all-movables  -fnew-ra  -fno-branch-count-reg @gol
278 -fno-default-inline  -fno-defer-pop @gol
279 -fno-function-cse  -fno-guess-branch-probability @gol
280 -fno-inline  -fno-math-errno  -fno-peephole  -fno-peephole2 @gol
281 -funsafe-math-optimizations -ffinite-math-only @gol
282 -fno-trapping-math -fno-zero-initialized-in-bss @gol
283 -fomit-frame-pointer  -foptimize-register-move @gol
284 -foptimize-sibling-calls  -fprefetch-loop-arrays @gol
285 -freduce-all-givs -fregmove  -frename-registers @gol
286 -freorder-blocks -freorder-functions @gol
287 -frerun-cse-after-loop  -frerun-loop-opt @gol
288 -fschedule-insns  -fschedule-insns2 @gol
289 -fno-sched-interblock  -fno-sched-spec  -fsched-spec-load @gol
290 -fsched-spec-load-dangerous  -fsignaling-nans @gol
291 -fsingle-precision-constant  -fssa -fssa-ccp -fssa-dce @gol
292 -fstrength-reduce  -fstrict-aliasing  -ftracer -fthread-jumps @gol
293 -ftrapv -funroll-all-loops  -funroll-loops  @gol
294 --param @var{name}=@var{value}
295 -O  -O0  -O1  -O2  -O3  -Os}
296
297 @item Preprocessor Options
298 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
299 @gccoptlist{
300 -$  -A@var{question}=@var{answer}  -A-@var{question}@r{[}=@var{answer}@r{]} @gol
301 -C  -dD  -dI  -dM  -dN @gol
302 -D@var{macro}@r{[}=@var{defn}@r{]}  -E  -H @gol
303 -idirafter @var{dir} @gol
304 -include @var{file}  -imacros @var{file} @gol
305 -iprefix @var{file}  -iwithprefix @var{dir} @gol
306 -iwithprefixbefore @var{dir}  -isystem @var{dir} @gol
307 -M  -MM  -MF  -MG  -MP  -MQ  -MT  -nostdinc  -P  -remap @gol
308 -trigraphs  -undef  -U@var{macro}  -Wp,@var{option}}
309
310 @item Assembler Option
311 @xref{Assembler Options,,Passing Options to the Assembler}.
312 @gccoptlist{
313 -Wa,@var{option}}
314
315 @item Linker Options
316 @xref{Link Options,,Options for Linking}.
317 @gccoptlist{
318 @var{object-file-name}  -l@var{library} @gol
319 -nostartfiles  -nodefaultlibs  -nostdlib @gol
320 -s  -static  -static-libgcc  -shared  -shared-libgcc  -symbolic @gol
321 -Wl,@var{option}  -Xlinker @var{option} @gol
322 -u @var{symbol}}
323
324 @item Directory Options
325 @xref{Directory Options,,Options for Directory Search}.
326 @gccoptlist{
327 -B@var{prefix}  -I@var{dir}  -I-  -L@var{dir}  -specs=@var{file}}
328
329 @item Target Options
330 @c I wrote this xref this way to avoid overfull hbox. -- rms
331 @xref{Target Options}.
332 @gccoptlist{
333 -V @var{version} -b @var{machine}}
334
335 @item Machine Dependent Options
336 @xref{Submodel Options,,Hardware Models and Configurations}.
337
338 @emph{M680x0 Options}
339 @gccoptlist{
340 -m68000  -m68020  -m68020-40  -m68020-60  -m68030  -m68040 @gol
341 -m68060  -mcpu32  -m5200  -m68881  -mbitfield  -mc68000  -mc68020   @gol
342 -mfpa  -mnobitfield  -mrtd  -mshort  -msoft-float  -mpcrel @gol
343 -malign-int  -mstrict-align}
344
345 @emph{M68hc1x Options}
346 @gccoptlist{
347 -m6811  -m6812  -m68hc11  -m68hc12 @gol
348 -mauto-incdec  -minmax  -mlong-calls  -mshort @gol
349 -msoft-reg-count=@var{count}}
350
351 @emph{VAX Options}
352 @gccoptlist{
353 -mg  -mgnu  -munix}
354
355 @emph{SPARC Options}
356 @gccoptlist{
357 -mcpu=@var{cpu-type} @gol
358 -mtune=@var{cpu-type} @gol
359 -mcmodel=@var{code-model} @gol
360 -m32  -m64 @gol
361 -mapp-regs  -mbroken-saverestore  -mcypress @gol
362 -mfaster-structs  -mflat @gol
363 -mfpu  -mhard-float  -mhard-quad-float @gol
364 -mimpure-text  -mlive-g0  -mno-app-regs @gol
365 -mno-faster-structs  -mno-flat  -mno-fpu @gol
366 -mno-impure-text  -mno-stack-bias  -mno-unaligned-doubles @gol
367 -msoft-float  -msoft-quad-float  -msparclite  -mstack-bias @gol
368 -msupersparc  -munaligned-doubles  -mv8}
369
370 @emph{Convex Options}
371 @gccoptlist{
372 -mc1  -mc2  -mc32  -mc34  -mc38 @gol
373 -margcount  -mnoargcount @gol
374 -mlong32  -mlong64 @gol
375 -mvolatile-cache  -mvolatile-nocache}
376
377 @emph{AMD29K Options}
378 @gccoptlist{
379 -m29000  -m29050  -mbw  -mnbw  -mdw  -mndw @gol
380 -mlarge  -mnormal  -msmall @gol
381 -mkernel-registers  -mno-reuse-arg-regs @gol
382 -mno-stack-check  -mno-storem-bug @gol
383 -mreuse-arg-regs  -msoft-float  -mstack-check @gol
384 -mstorem-bug  -muser-registers}
385
386 @emph{ARM Options}
387 @gccoptlist{
388 -mapcs-frame  -mno-apcs-frame @gol
389 -mapcs-26  -mapcs-32 @gol
390 -mapcs-stack-check  -mno-apcs-stack-check @gol
391 -mapcs-float  -mno-apcs-float @gol
392 -mapcs-reentrant  -mno-apcs-reentrant @gol
393 -msched-prolog  -mno-sched-prolog @gol
394 -mlittle-endian  -mbig-endian  -mwords-little-endian @gol
395 -malignment-traps  -mno-alignment-traps @gol
396 -msoft-float  -mhard-float  -mfpe @gol
397 -mthumb-interwork  -mno-thumb-interwork @gol
398 -mcpu=@var{name}  -march=@var{name}  -mfpe=@var{name}  @gol
399 -mstructure-size-boundary=@var{n} @gol
400 -mbsd -mxopen  -mno-symrename @gol
401 -mabort-on-noreturn @gol
402 -mlong-calls  -mno-long-calls @gol
403 -msingle-pic-base  -mno-single-pic-base @gol
404 -mpic-register=@var{reg} @gol
405 -mnop-fun-dllimport @gol
406 -mpoke-function-name @gol
407 -mthumb  -marm @gol
408 -mtpcs-frame  -mtpcs-leaf-frame @gol
409 -mcaller-super-interworking  -mcallee-super-interworking }
410
411 @emph{MN10200 Options}
412 @gccoptlist{
413 -mrelax}
414
415 @emph{MN10300 Options}
416 @gccoptlist{
417 -mmult-bug  -mno-mult-bug @gol
418 -mam33  -mno-am33 @gol
419 -mno-crt0  -mrelax}
420
421 @emph{M32R/D Options}
422 @gccoptlist{
423 -m32rx -m32r -mcode-model=@var{model-type}  -msdata=@var{sdata-type} @gol
424 -G @var{num}}
425
426 @emph{M88K Options}
427 @gccoptlist{
428 -m88000  -m88100  -m88110  -mbig-pic @gol
429 -mcheck-zero-division  -mhandle-large-shift @gol
430 -midentify-revision  -mno-check-zero-division @gol
431 -mno-ocs-debug-info  -mno-ocs-frame-position @gol
432 -mno-optimize-arg-area  -mno-serialize-volatile @gol
433 -mno-underscores  -mocs-debug-info @gol
434 -mocs-frame-position  -moptimize-arg-area @gol
435 -mserialize-volatile  -mshort-data-@var{num}  -msvr3 @gol
436 -msvr4  -mtrap-large-shift  -muse-div-instruction @gol
437 -mversion-03.00  -mwarn-passed-structs}
438
439 @emph{RS/6000 and PowerPC Options}
440 @gccoptlist{
441 -mcpu=@var{cpu-type} @gol
442 -mtune=@var{cpu-type} @gol
443 -mpower  -mno-power  -mpower2  -mno-power2 @gol
444 -mpowerpc  -mpowerpc64  -mno-powerpc @gol
445 -maltivec -mno-altivec @gol
446 -mpowerpc-gpopt  -mno-powerpc-gpopt @gol
447 -mpowerpc-gfxopt  -mno-powerpc-gfxopt @gol
448 -mnew-mnemonics  -mold-mnemonics @gol
449 -mfull-toc   -mminimal-toc  -mno-fp-in-toc  -mno-sum-in-toc @gol
450 -m64  -m32  -mxl-call  -mno-xl-call  -mpe @gol
451 -msoft-float  -mhard-float  -mmultiple  -mno-multiple @gol
452 -mstring  -mno-string  -mupdate  -mno-update @gol
453 -mfused-madd  -mno-fused-madd  -mbit-align  -mno-bit-align @gol
454 -mstrict-align  -mno-strict-align  -mrelocatable @gol
455 -mno-relocatable  -mrelocatable-lib  -mno-relocatable-lib @gol
456 -mtoc  -mno-toc -mlittle  -mlittle-endian  -mbig  -mbig-endian @gol
457 -mcall-aix -mcall-sysv -mcall-netbsd @gol
458 -maix-struct-return -msvr4-struct-return @gol
459 -mabi=altivec -mabi=no-altivec @gol
460 -mabi=spe -mabi=no-spe @gol
461 -misel=yes -misel=no @gol
462 -mprototype  -mno-prototype @gol
463 -msim  -mmvme  -mads  -myellowknife  -memb -msdata @gol
464 -msdata=@var{opt}  -mvxworks -mwindiss -G @var{num} -pthread}
465
466 @emph{RT Options}
467 @gccoptlist{
468 -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs @gol
469 -mfull-fp-blocks  -mhc-struct-return  -min-line-mul @gol
470 -mminimum-fp-blocks  -mnohc-struct-return}
471
472 @emph{MIPS Options}
473 @gccoptlist{
474 -mabicalls -march=@var{cpu-type} -mtune=@var{cpu=type} @gol
475 -mcpu=@var{cpu-type} -membedded-data  -muninit-const-in-rodata @gol
476 -membedded-pic  -mfp32  -mfp64  -mfused-madd  -mno-fused-madd @gol
477 -mgas  -mgp32  -mgp64 @gol
478 -mgpopt  -mhalf-pic  -mhard-float  -mint64  -mips1 @gol
479 -mips2  -mips3  -mips4  -mlong64  -mlong32  -mlong-calls  -mmemcpy @gol
480 -mmips-as  -mmips-tfile  -mno-abicalls @gol
481 -mno-embedded-data  -mno-uninit-const-in-rodata @gol
482 -mno-embedded-pic  -mno-gpopt  -mno-long-calls @gol
483 -mno-memcpy  -mno-mips-tfile  -mno-rnames  -mno-stats @gol
484 -mrnames  -msoft-float @gol
485 -m4650  -msingle-float  -mmad @gol
486 -mstats  -EL  -EB  -G @var{num}  -nocpp @gol
487 -mabi=32  -mabi=n32  -mabi=64  -mabi=eabi @gol
488 -mfix7000  -mno-crt0 -mflush-func=@var{func} -mno-flush-func @gol
489 -mbranch-likely -mno-branch-likely}
490
491 @emph{i386 and x86-64 Options}
492 @gccoptlist{
493 -mcpu=@var{cpu-type}  -march=@var{cpu-type} -mfpmath=@var{unit} @gol
494 -masm=@var{dialect}  -mno-fancy-math-387 @gol
495 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
496 -mno-wide-multiply  -mrtd  -malign-double @gol
497 -mpreferred-stack-boundary=@var{num} @gol
498 -mmmx  -msse -msse2 -m3dnow @gol
499 -mthreads  -mno-align-stringops  -minline-all-stringops @gol
500 -mpush-args  -maccumulate-outgoing-args  -m128bit-long-double @gol
501 -m96bit-long-double  -mregparm=@var{num}  -momit-leaf-frame-pointer @gol
502 -mno-red-zone@gol
503 -mcmodel=@var{code-model} @gol
504 -m32 -m64}
505
506 @emph{HPPA Options}
507 @gccoptlist{
508 -march=@var{architecture-type} @gol
509 -mbig-switch  -mdisable-fpregs  -mdisable-indexing @gol
510 -mfast-indirect-calls  -mgas  -mgnu-ld -mhp-ld @gol
511 -mjump-in-delay -mlinker-opt -mlong-calls @gol
512 -mlong-load-store  -mno-big-switch  -mno-disable-fpregs @gol
513 -mno-disable-indexing  -mno-fast-indirect-calls  -mno-gas @gol
514 -mno-jump-in-delay  -mno-long-load-store @gol
515 -mno-portable-runtime  -mno-soft-float @gol
516 -mno-space-regs  -msoft-float  -mpa-risc-1-0 @gol
517 -mpa-risc-1-1  -mpa-risc-2-0  -mportable-runtime @gol
518 -mschedule=@var{cpu-type}  -mspace-regs -msio -mwsio}
519
520 @emph{Intel 960 Options}
521 @gccoptlist{
522 -m@var{cpu-type}  -masm-compat  -mclean-linkage @gol
523 -mcode-align  -mcomplex-addr  -mleaf-procedures @gol
524 -mic-compat  -mic2.0-compat  -mic3.0-compat @gol
525 -mintel-asm  -mno-clean-linkage  -mno-code-align @gol
526 -mno-complex-addr  -mno-leaf-procedures @gol
527 -mno-old-align  -mno-strict-align  -mno-tail-call @gol
528 -mnumerics  -mold-align  -msoft-float  -mstrict-align @gol
529 -mtail-call}
530
531 @emph{DEC Alpha Options}
532 @gccoptlist{
533 -mno-fp-regs  -msoft-float  -malpha-as  -mgas @gol
534 -mieee  -mieee-with-inexact  -mieee-conformant @gol
535 -mfp-trap-mode=@var{mode}  -mfp-rounding-mode=@var{mode} @gol
536 -mtrap-precision=@var{mode}  -mbuild-constants @gol
537 -mcpu=@var{cpu-type}  -mtune=@var{cpu-type} @gol
538 -mbwx  -mmax  -mfix  -mcix @gol
539 -mfloat-vax  -mfloat-ieee @gol
540 -mexplicit-relocs  -msmall-data  -mlarge-data @gol
541 -mmemory-latency=@var{time}}
542
543 @emph{DEC Alpha/VMS Options}
544 @gccoptlist{
545 -mvms-return-codes}
546
547 @emph{Clipper Options}
548 @gccoptlist{
549 -mc300  -mc400}
550
551 @emph{H8/300 Options}
552 @gccoptlist{
553 -mrelax  -mh  -ms  -mint32  -malign-300}
554
555 @emph{SH Options}
556 @gccoptlist{
557 -m1  -m2  -m3  -m3e @gol
558 -m4-nofpu  -m4-single-only  -m4-single  -m4 @gol
559 -m5-64media -m5-64media-nofpu @gol
560 -m5-32media -m5-32media-nofpu @gol
561 -m5-compact -m5-compact-nofpu @gol
562 -mb  -ml  -mdalign  -mrelax @gol
563 -mbigtable  -mfmovd  -mhitachi  -mnomacsave @gol
564 -mieee  -misize  -mpadstruct  -mspace @gol
565 -mprefergot  -musermode}
566
567 @emph{System V Options}
568 @gccoptlist{
569 -Qy  -Qn  -YP,@var{paths}  -Ym,@var{dir}}
570
571 @emph{ARC Options}
572 @gccoptlist{
573 -EB  -EL @gol
574 -mmangle-cpu  -mcpu=@var{cpu}  -mtext=@var{text-section} @gol
575 -mdata=@var{data-section}  -mrodata=@var{readonly-data-section}}
576
577 @emph{TMS320C3x/C4x Options}
578 @gccoptlist{
579 -mcpu=@var{cpu}  -mbig  -msmall  -mregparm  -mmemparm @gol
580 -mfast-fix  -mmpyi  -mbk  -mti  -mdp-isr-reload @gol
581 -mrpts=@var{count}  -mrptb  -mdb  -mloop-unsigned @gol
582 -mparallel-insns  -mparallel-mpy  -mpreserve-float}
583
584 @emph{V850 Options}
585 @gccoptlist{
586 -mlong-calls  -mno-long-calls  -mep  -mno-ep @gol
587 -mprolog-function  -mno-prolog-function  -mspace @gol
588 -mtda=@var{n}  -msda=@var{n}  -mzda=@var{n} @gol
589 -mapp-regs -mno-app-regs @gol
590 -mdisable-callt -mno-disable-callt @gol
591 -mv850e @gol
592 -mv850  -mbig-switch}
593
594 @emph{NS32K Options}
595 @gccoptlist{
596 -m32032  -m32332  -m32532  -m32081  -m32381 @gol
597 -mmult-add  -mnomult-add  -msoft-float  -mrtd  -mnortd @gol
598 -mregparam  -mnoregparam  -msb  -mnosb @gol
599 -mbitfield  -mnobitfield  -mhimem  -mnohimem}
600
601 @emph{AVR Options}
602 @gccoptlist{
603 -mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
604 -mcall-prologues  -mno-tablejump  -mtiny-stack}
605
606 @emph{MCore Options}
607 @gccoptlist{
608 -mhardlit  -mno-hardlit  -mdiv  -mno-div  -mrelax-immediates @gol
609 -mno-relax-immediates  -mwide-bitfields  -mno-wide-bitfields @gol
610 -m4byte-functions  -mno-4byte-functions  -mcallgraph-data @gol
611 -mno-callgraph-data  -mslow-bytes  -mno-slow-bytes  -mno-lsim @gol
612 -mlittle-endian  -mbig-endian  -m210  -m340  -mstack-increment}
613
614 @emph{MMIX Options}
615 @gccoptlist{
616 -mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
617 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
618 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
619 -mno-base-addresses -msingle-exit -mno-single-exit}
620
621 @emph{IA-64 Options}
622 @gccoptlist{
623 -mbig-endian  -mlittle-endian  -mgnu-as  -mgnu-ld  -mno-pic @gol
624 -mvolatile-asm-stop  -mb-step  -mregister-names  -mno-sdata @gol
625 -mconstant-gp  -mauto-pic  -minline-divide-min-latency @gol
626 -minline-divide-max-throughput  -mno-dwarf2-asm @gol
627 -mfixed-range=@var{register-range}}
628
629 @emph{D30V Options}
630 @gccoptlist{
631 -mextmem  -mextmemory  -monchip  -mno-asm-optimize @gol
632 -masm-optimize -mbranch-cost=@var{n} -mcond-exec=@var{n}}
633
634 @emph{S/390 and zSeries Options}
635 @gccoptlist{
636 -mhard-float  -msoft-float  -mbackchain  -mno-backchain @gol
637 -msmall-exec  -mno-small-exec  -mmvcle -mno-mvcle @gol
638 -m64 -m31 -mdebug -mno-debug}
639
640 @emph{CRIS Options}
641 @gccoptlist{
642 -mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
643 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
644 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
645 -mstack-align -mdata-align -mconst-align @gol
646 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
647 -melf -maout -melinux -mlinux -sim -sim2}
648
649 @emph{PDP-11 Options}
650 @gccoptlist{
651 -mfpu  -msoft-float  -mac0  -mno-ac0  -m40  -m45  -m10 @gol
652 -mbcopy  -mbcopy-builtin  -mint32  -mno-int16 @gol
653 -mint16  -mno-int32  -mfloat32  -mno-float64 @gol
654 -mfloat64  -mno-float32  -mabshi  -mno-abshi @gol
655 -mbranch-expensive  -mbranch-cheap @gol
656 -msplit  -mno-split  -munix-asm  -mdec-asm}
657
658 @emph{Xstormy16 Options}
659 @gccoptlist{
660 -msim}
661
662 @emph{Xtensa Options}
663 @gccoptlist{
664 -mbig-endian -mlittle-endian @gol
665 -mdensity -mno-density @gol
666 -mmac16 -mno-mac16 @gol
667 -mmul16 -mno-mul16 @gol
668 -mmul32 -mno-mul32 @gol
669 -mnsa -mno-nsa @gol
670 -mminmax -mno-minmax @gol
671 -msext -mno-sext @gol
672 -mbooleans -mno-booleans @gol
673 -mhard-float -msoft-float @gol
674 -mfused-madd -mno-fused-madd @gol
675 -mserialize-volatile -mno-serialize-volatile @gol
676 -mtext-section-literals -mno-text-section-literals @gol
677 -mtarget-align -mno-target-align @gol
678 -mlongcalls -mno-longcalls}
679
680 @item Code Generation Options
681 @xref{Code Gen Options,,Options for Code Generation Conventions}.
682 @gccoptlist{
683 -fcall-saved-@var{reg}  -fcall-used-@var{reg} @gol
684 -ffixed-@var{reg} -fexceptions @gol
685 -fnon-call-exceptions  -funwind-tables @gol
686 -fasynchronous-unwind-tables @gol
687 -finhibit-size-directive  -finstrument-functions @gol
688 -fno-common  -fno-ident  -fno-gnu-linker @gol
689 -fpcc-struct-return  -fpic  -fPIC @gol
690 -freg-struct-return  -fshared-data  -fshort-enums @gol
691 -fshort-double  -fshort-wchar -fvolatile @gol
692 -fvolatile-global  -fvolatile-static @gol
693 -fverbose-asm  -fpack-struct  -fstack-check @gol
694 -fstack-limit-register=@var{reg}  -fstack-limit-symbol=@var{sym} @gol
695 -fargument-alias  -fargument-noalias @gol
696 -fargument-noalias-global  -fleading-underscore @gol
697 -ftls-model=@var{model}}
698 @end table
699
700 @menu
701 * Overall Options::     Controlling the kind of output:
702                         an executable, object files, assembler files,
703                         or preprocessed source.
704 * C Dialect Options::   Controlling the variant of C language compiled.
705 * C++ Dialect Options:: Variations on C++.
706 * Objective-C Dialect Options:: Variations on Objective-C.
707 * Language Independent Options:: Controlling how diagnostics should be
708                         formatted.
709 * Warning Options::     How picky should the compiler be?
710 * Debugging Options::   Symbol tables, measurements, and debugging dumps.
711 * Optimize Options::    How much optimization?
712 * Preprocessor Options:: Controlling header files and macro definitions.
713                          Also, getting dependency information for Make.
714 * Assembler Options::   Passing options to the assembler.
715 * Link Options::        Specifying libraries and so on.
716 * Directory Options::   Where to find header files and libraries.
717                         Where to find the compiler executable files.
718 * Spec Files::          How to pass switches to sub-processes.
719 * Target Options::      Running a cross-compiler, or an old version of GCC.
720 @end menu
721
722 @node Overall Options
723 @section Options Controlling the Kind of Output
724
725 Compilation can involve up to four stages: preprocessing, compilation
726 proper, assembly and linking, always in that order.  The first three
727 stages apply to an individual source file, and end by producing an
728 object file; linking combines all the object files (those newly
729 compiled, and those specified as input) into an executable file.
730
731 @cindex file name suffix
732 For any given input file, the file name suffix determines what kind of
733 compilation is done:
734
735 @table @gcctabopt
736 @item @var{file}.c
737 C source code which must be preprocessed.
738
739 @item @var{file}.i
740 C source code which should not be preprocessed.
741
742 @item @var{file}.ii
743 C++ source code which should not be preprocessed.
744
745 @item @var{file}.m
746 Objective-C source code.  Note that you must link with the library
747 @file{libobjc.a} to make an Objective-C program work.
748
749 @item @var{file}.mi
750 Objective-C source code which should not be preprocessed.
751
752 @item @var{file}.h
753 C header file (not to be compiled or linked).
754
755 @item @var{file}.cc
756 @itemx @var{file}.cp
757 @itemx @var{file}.cxx
758 @itemx @var{file}.cpp
759 @itemx @var{file}.c++
760 @itemx @var{file}.C
761 C++ source code which must be preprocessed.  Note that in @samp{.cxx},
762 the last two letters must both be literally @samp{x}.  Likewise,
763 @samp{.C} refers to a literal capital C@.
764
765 @item @var{file}.f
766 @itemx @var{file}.for
767 @itemx @var{file}.FOR
768 Fortran source code which should not be preprocessed.
769
770 @item @var{file}.F
771 @itemx @var{file}.fpp
772 @itemx @var{file}.FPP
773 Fortran source code which must be preprocessed (with the traditional
774 preprocessor).
775
776 @item @var{file}.r
777 Fortran source code which must be preprocessed with a RATFOR
778 preprocessor (not included with GCC)@.
779
780 @xref{Overall Options,,Options Controlling the Kind of Output, g77,
781 Using and Porting GNU Fortran}, for more details of the handling of
782 Fortran input files.
783
784 @c FIXME: Descriptions of Java file types.
785 @c @var{file}.java
786 @c @var{file}.class
787 @c @var{file}.zip
788 @c @var{file}.jar
789
790 @item @var{file}.ads
791 Ada source code file which contains a library unit declaration (a
792 declaration of a package, subprogram, or generic, or a generic
793 instantiation), or a library unit renaming declaration (a package,
794 generic, or subprogram renaming declaration).  Such files are also
795 called @dfn{specs}.
796
797 @itemx @var{file}.adb
798 Ada source code file containing a library unit body (a subprogram or
799 package body).  Such files are also called @dfn{bodies}.
800
801 @c GCC also knows about some suffixes for languages not yet included:
802 @c Pascal:
803 @c @var{file}.p
804 @c @var{file}.pas
805
806 @item @var{file}.s
807 Assembler code.
808
809 @item @var{file}.S
810 Assembler code which must be preprocessed.
811
812 @item @var{other}
813 An object file to be fed straight into linking.
814 Any file name with no recognized suffix is treated this way.
815 @end table
816
817 @opindex x
818 You can specify the input language explicitly with the @option{-x} option:
819
820 @table @gcctabopt
821 @item -x @var{language}
822 Specify explicitly the @var{language} for the following input files
823 (rather than letting the compiler choose a default based on the file
824 name suffix).  This option applies to all following input files until
825 the next @option{-x} option.  Possible values for @var{language} are:
826 @example
827 c  c-header  cpp-output
828 c++  c++-cpp-output
829 objective-c  objc-cpp-output
830 assembler  assembler-with-cpp
831 ada
832 f77  f77-cpp-input  ratfor
833 java
834 treelang
835 @end example
836
837 @item -x none
838 Turn off any specification of a language, so that subsequent files are
839 handled according to their file name suffixes (as they are if @option{-x}
840 has not been used at all).
841
842 @item -pass-exit-codes
843 @opindex pass-exit-codes
844 Normally the @command{gcc} program will exit with the code of 1 if any
845 phase of the compiler returns a non-success return code.  If you specify
846 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
847 numerically highest error produced by any phase that returned an error
848 indication.
849 @end table
850
851 If you only want some of the stages of compilation, you can use
852 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
853 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
854 @command{gcc} is to stop.  Note that some combinations (for example,
855 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
856
857 @table @gcctabopt
858 @item -c
859 @opindex c
860 Compile or assemble the source files, but do not link.  The linking
861 stage simply is not done.  The ultimate output is in the form of an
862 object file for each source file.
863
864 By default, the object file name for a source file is made by replacing
865 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
866
867 Unrecognized input files, not requiring compilation or assembly, are
868 ignored.
869
870 @item -S
871 @opindex S
872 Stop after the stage of compilation proper; do not assemble.  The output
873 is in the form of an assembler code file for each non-assembler input
874 file specified.
875
876 By default, the assembler file name for a source file is made by
877 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
878
879 Input files that don't require compilation are ignored.
880
881 @item -E
882 @opindex E
883 Stop after the preprocessing stage; do not run the compiler proper.  The
884 output is in the form of preprocessed source code, which is sent to the
885 standard output.
886
887 Input files which don't require preprocessing are ignored.
888
889 @cindex output file option
890 @item -o @var{file}
891 @opindex o
892 Place output in file @var{file}.  This applies regardless to whatever
893 sort of output is being produced, whether it be an executable file,
894 an object file, an assembler file or preprocessed C code.
895
896 Since only one output file can be specified, it does not make sense to
897 use @option{-o} when compiling more than one input file, unless you are
898 producing an executable file as output.
899
900 If @option{-o} is not specified, the default is to put an executable file
901 in @file{a.out}, the object file for @file{@var{source}.@var{suffix}} in
902 @file{@var{source}.o}, its assembler file in @file{@var{source}.s}, and
903 all preprocessed C source on standard output.
904
905 @item -v
906 @opindex v
907 Print (on standard error output) the commands executed to run the stages
908 of compilation.  Also print the version number of the compiler driver
909 program and of the preprocessor and the compiler proper.
910
911 @item -###
912 @opindex ###
913 Like @option{-v} except the commands are not executed and all command
914 arguments are quoted.  This is useful for shell scripts to capture the
915 driver-generated command lines.
916
917 @item -pipe
918 @opindex pipe
919 Use pipes rather than temporary files for communication between the
920 various stages of compilation.  This fails to work on some systems where
921 the assembler is unable to read from a pipe; but the GNU assembler has
922 no trouble.
923
924 @item --help
925 @opindex help
926 Print (on the standard output) a description of the command line options
927 understood by @command{gcc}.  If the @option{-v} option is also specified
928 then @option{--help} will also be passed on to the various processes
929 invoked by @command{gcc}, so that they can display the command line options
930 they accept.  If the @option{-W} option is also specified then command
931 line options which have no documentation associated with them will also
932 be displayed.
933
934 @item --target-help
935 @opindex target-help
936 Print (on the standard output) a description of target specific command
937 line options for each tool.
938
939 @item --version
940 @opindex version
941 Display the version number and copyrights of the invoked GCC.
942 @end table
943
944 @node Invoking G++
945 @section Compiling C++ Programs
946
947 @cindex suffixes for C++ source
948 @cindex C++ source file suffixes
949 C++ source files conventionally use one of the suffixes @samp{.C},
950 @samp{.cc}, @samp{.cpp}, @samp{.c++}, @samp{.cp}, or @samp{.cxx};
951 preprocessed C++ files use the suffix @samp{.ii}.  GCC recognizes
952 files with these names and compiles them as C++ programs even if you
953 call the compiler the same way as for compiling C programs (usually with
954 the name @command{gcc}).
955
956 @findex g++
957 @findex c++
958 However, C++ programs often require class libraries as well as a
959 compiler that understands the C++ language---and under some
960 circumstances, you might want to compile programs from standard input,
961 or otherwise without a suffix that flags them as C++ programs.
962 @command{g++} is a program that calls GCC with the default language
963 set to C++, and automatically specifies linking against the C++
964 library.  On many systems, @command{g++} is also
965 installed with the name @command{c++}.
966
967 @cindex invoking @command{g++}
968 When you compile C++ programs, you may specify many of the same
969 command-line options that you use for compiling programs in any
970 language; or command-line options meaningful for C and related
971 languages; or options that are meaningful only for C++ programs.
972 @xref{C Dialect Options,,Options Controlling C Dialect}, for
973 explanations of options for languages related to C@.
974 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
975 explanations of options that are meaningful only for C++ programs.
976
977 @node C Dialect Options
978 @section Options Controlling C Dialect
979 @cindex dialect options
980 @cindex language dialect options
981 @cindex options, dialect
982
983 The following options control the dialect of C (or languages derived
984 from C, such as C++ and Objective-C) that the compiler accepts:
985
986 @table @gcctabopt
987 @cindex ANSI support
988 @cindex ISO support
989 @item -ansi
990 @opindex ansi
991 In C mode, support all ISO C90 programs.  In C++ mode,
992 remove GNU extensions that conflict with ISO C++.
993
994 This turns off certain features of GCC that are incompatible with ISO
995 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
996 such as the @code{asm} and @code{typeof} keywords, and
997 predefined macros such as @code{unix} and @code{vax} that identify the
998 type of system you are using.  It also enables the undesirable and
999 rarely used ISO trigraph feature.  For the C compiler,
1000 it disables recognition of C++ style @samp{//} comments as well as
1001 the @code{inline} keyword.
1002
1003 The alternate keywords @code{__asm__}, @code{__extension__},
1004 @code{__inline__} and @code{__typeof__} continue to work despite
1005 @option{-ansi}.  You would not want to use them in an ISO C program, of
1006 course, but it is useful to put them in header files that might be included
1007 in compilations done with @option{-ansi}.  Alternate predefined macros
1008 such as @code{__unix__} and @code{__vax__} are also available, with or
1009 without @option{-ansi}.
1010
1011 The @option{-ansi} option does not cause non-ISO programs to be
1012 rejected gratuitously.  For that, @option{-pedantic} is required in
1013 addition to @option{-ansi}.  @xref{Warning Options}.
1014
1015 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1016 option is used.  Some header files may notice this macro and refrain
1017 from declaring certain functions or defining certain macros that the
1018 ISO standard doesn't call for; this is to avoid interfering with any
1019 programs that might use these names for other things.
1020
1021 Functions which would normally be built in but do not have semantics
1022 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1023 functions with @option{-ansi} is used.  @xref{Other Builtins,,Other
1024 built-in functions provided by GCC}, for details of the functions
1025 affected.
1026
1027 @item -std=
1028 @opindex std
1029 Determine the language standard.  This option is currently only
1030 supported when compiling C or C++.  A value for this option must be
1031 provided; possible values are
1032
1033 @table @samp
1034 @item c89
1035 @itemx iso9899:1990
1036 ISO C90 (same as @option{-ansi}).
1037
1038 @item iso9899:199409
1039 ISO C90 as modified in amendment 1.
1040
1041 @item c99
1042 @itemx c9x
1043 @itemx iso9899:1999
1044 @itemx iso9899:199x
1045 ISO C99.  Note that this standard is not yet fully supported; see
1046 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information.  The
1047 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1048
1049 @item gnu89
1050 Default, ISO C90 plus GNU extensions (including some C99 features).
1051
1052 @item gnu99
1053 @item gnu9x
1054 ISO C99 plus GNU extensions.  When ISO C99 is fully implemented in GCC,
1055 this will become the default.  The name @samp{gnu9x} is deprecated.
1056
1057 @item c++98
1058 The 1998 ISO C++ standard plus amendments.
1059
1060 @item gnu++98
1061 The same as @option{-std=c++98} plus GNU extensions.  This is the
1062 default for C++ code.
1063 @end table
1064
1065 Even when this option is not specified, you can still use some of the
1066 features of newer standards in so far as they do not conflict with
1067 previous C standards.  For example, you may use @code{__restrict__} even
1068 when @option{-std=c99} is not specified.
1069
1070 The @option{-std} options specifying some version of ISO C have the same
1071 effects as @option{-ansi}, except that features that were not in ISO C90
1072 but are in the specified version (for example, @samp{//} comments and
1073 the @code{inline} keyword in ISO C99) are not disabled.
1074
1075 @xref{Standards,,Language Standards Supported by GCC}, for details of
1076 these standard versions.
1077
1078 @item -aux-info @var{filename}
1079 @opindex aux-info
1080 Output to the given filename prototyped declarations for all functions
1081 declared and/or defined in a translation unit, including those in header
1082 files.  This option is silently ignored in any language other than C@.
1083
1084 Besides declarations, the file indicates, in comments, the origin of
1085 each declaration (source file and line), whether the declaration was
1086 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1087 @samp{O} for old, respectively, in the first character after the line
1088 number and the colon), and whether it came from a declaration or a
1089 definition (@samp{C} or @samp{F}, respectively, in the following
1090 character).  In the case of function definitions, a K&R-style list of
1091 arguments followed by their declarations is also provided, inside
1092 comments, after the declaration.
1093
1094 @item -fno-asm
1095 @opindex fno-asm
1096 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1097 keyword, so that code can use these words as identifiers.  You can use
1098 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1099 instead.  @option{-ansi} implies @option{-fno-asm}.
1100
1101 In C++, this switch only affects the @code{typeof} keyword, since
1102 @code{asm} and @code{inline} are standard keywords.  You may want to
1103 use the @option{-fno-gnu-keywords} flag instead, which has the same
1104 effect.  In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1105 switch only affects the @code{asm} and @code{typeof} keywords, since
1106 @code{inline} is a standard keyword in ISO C99.
1107
1108 @item -fno-builtin
1109 @itemx -fno-builtin-@var{function}
1110 @opindex fno-builtin
1111 @cindex built-in functions
1112 Don't recognize built-in functions that do not begin with
1113 @samp{__builtin_} as prefix.  @xref{Other Builtins,,Other built-in
1114 functions provided by GCC}, for details of the functions affected,
1115 including those which are not built-in functions when @option{-ansi} or
1116 @option{-std} options for strict ISO C conformance are used because they
1117 do not have an ISO standard meaning.
1118
1119 GCC normally generates special code to handle certain built-in functions
1120 more efficiently; for instance, calls to @code{alloca} may become single
1121 instructions that adjust the stack directly, and calls to @code{memcpy}
1122 may become inline copy loops.  The resulting code is often both smaller
1123 and faster, but since the function calls no longer appear as such, you
1124 cannot set a breakpoint on those calls, nor can you change the behavior
1125 of the functions by linking with a different library.
1126
1127 With the @option{-fno-builtin-@var{function}} option
1128 only the built-in function @var{function} is
1129 disabled.  @var{function} must not begin with @samp{__builtin_}.  If a
1130 function is named this is not built-in in this version of GCC, this
1131 option is ignored.  There is no corresponding
1132 @option{-fbuiltin-@var{function}} option; if you wish to enable
1133 built-in functions selectively when using @option{-fno-builtin} or
1134 @option{-ffreestanding}, you may define macros such as:
1135
1136 @smallexample
1137 #define abs(n)          __builtin_abs ((n))
1138 #define strcpy(d, s)    __builtin_strcpy ((d), (s))
1139 @end smallexample
1140
1141 @item -fhosted
1142 @opindex fhosted
1143 @cindex hosted environment
1144
1145 Assert that compilation takes place in a hosted environment.  This implies
1146 @option{-fbuiltin}.  A hosted environment is one in which the
1147 entire standard library is available, and in which @code{main} has a return
1148 type of @code{int}.  Examples are nearly everything except a kernel.
1149 This is equivalent to @option{-fno-freestanding}.
1150
1151 @item -ffreestanding
1152 @opindex ffreestanding
1153 @cindex hosted environment
1154
1155 Assert that compilation takes place in a freestanding environment.  This
1156 implies @option{-fno-builtin}.  A freestanding environment
1157 is one in which the standard library may not exist, and program startup may
1158 not necessarily be at @code{main}.  The most obvious example is an OS kernel.
1159 This is equivalent to @option{-fno-hosted}.
1160
1161 @xref{Standards,,Language Standards Supported by GCC}, for details of
1162 freestanding and hosted environments.
1163
1164 @item -fms-extensions
1165 @opindex fms-extensions
1166 Accept some non-standard constructs used in Microsoft header files.
1167
1168 @item -trigraphs
1169 @opindex trigraphs
1170 Support ISO C trigraphs.  The @option{-ansi} option (and @option{-std}
1171 options for strict ISO C conformance) implies @option{-trigraphs}.
1172
1173 @cindex traditional C language
1174 @cindex C language, traditional
1175 @item -traditional
1176 @itemx -traditional-cpp
1177 @opindex traditional-cpp
1178 @opindex traditional
1179 Formerly, these options caused GCC to attempt to emulate a pre-standard
1180 C compiler.  They are now only supported with the @option{-E} switch.
1181 The preprocessor continues to support a pre-standard mode.  See the GNU
1182 CPP manual for details.
1183
1184 @item -fcond-mismatch
1185 @opindex fcond-mismatch
1186 Allow conditional expressions with mismatched types in the second and
1187 third arguments.  The value of such an expression is void.  This option
1188 is not supported for C++.
1189
1190 @item -funsigned-char
1191 @opindex funsigned-char
1192 Let the type @code{char} be unsigned, like @code{unsigned char}.
1193
1194 Each kind of machine has a default for what @code{char} should
1195 be.  It is either like @code{unsigned char} by default or like
1196 @code{signed char} by default.
1197
1198 Ideally, a portable program should always use @code{signed char} or
1199 @code{unsigned char} when it depends on the signedness of an object.
1200 But many programs have been written to use plain @code{char} and
1201 expect it to be signed, or expect it to be unsigned, depending on the
1202 machines they were written for.  This option, and its inverse, let you
1203 make such a program work with the opposite default.
1204
1205 The type @code{char} is always a distinct type from each of
1206 @code{signed char} or @code{unsigned char}, even though its behavior
1207 is always just like one of those two.
1208
1209 @item -fsigned-char
1210 @opindex fsigned-char
1211 Let the type @code{char} be signed, like @code{signed char}.
1212
1213 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1214 the negative form of @option{-funsigned-char}.  Likewise, the option
1215 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1216
1217 @item -fsigned-bitfields
1218 @itemx -funsigned-bitfields
1219 @itemx -fno-signed-bitfields
1220 @itemx -fno-unsigned-bitfields
1221 @opindex fsigned-bitfields
1222 @opindex funsigned-bitfields
1223 @opindex fno-signed-bitfields
1224 @opindex fno-unsigned-bitfields
1225 These options control whether a bit-field is signed or unsigned, when the
1226 declaration does not use either @code{signed} or @code{unsigned}.  By
1227 default, such a bit-field is signed, because this is consistent: the
1228 basic integer types such as @code{int} are signed types.
1229
1230 @item -fwritable-strings
1231 @opindex fwritable-strings
1232 Store string constants in the writable data segment and don't uniquize
1233 them.  This is for compatibility with old programs which assume they can
1234 write into string constants.
1235
1236 Writing into string constants is a very bad idea; ``constants'' should
1237 be constant.
1238 @end table
1239
1240 @node C++ Dialect Options
1241 @section Options Controlling C++ Dialect
1242
1243 @cindex compiler options, C++
1244 @cindex C++ options, command line
1245 @cindex options, C++
1246 This section describes the command-line options that are only meaningful
1247 for C++ programs; but you can also use most of the GNU compiler options
1248 regardless of what language your program is in.  For example, you
1249 might compile a file @code{firstClass.C} like this:
1250
1251 @example
1252 g++ -g -frepo -O -c firstClass.C
1253 @end example
1254
1255 @noindent
1256 In this example, only @option{-frepo} is an option meant
1257 only for C++ programs; you can use the other options with any
1258 language supported by GCC@.
1259
1260 Here is a list of options that are @emph{only} for compiling C++ programs:
1261
1262 @table @gcctabopt
1263
1264 @item -fabi-version=@var{n}
1265 @opindex fabi-version
1266 Use version @var{n} of the C++ ABI.  Version 1 is the version of the C++
1267 ABI that first appeared in G++ 3.2.  Version 0 will always be the
1268 version that conforms most closely to the C++ ABI specification.
1269 Therefore, the ABI obtained using version 0 will change as ABI bugs are
1270 fixed.
1271
1272 The default is version 1.
1273
1274 @item -fno-access-control
1275 @opindex fno-access-control
1276 Turn off all access checking.  This switch is mainly useful for working
1277 around bugs in the access control code.
1278
1279 @item -fcheck-new
1280 @opindex fcheck-new
1281 Check that the pointer returned by @code{operator new} is non-null
1282 before attempting to modify the storage allocated.  The current Working
1283 Paper requires that @code{operator new} never return a null pointer, so
1284 this check is normally unnecessary.
1285
1286 An alternative to using this option is to specify that your
1287 @code{operator new} does not throw any exceptions; if you declare it
1288 @samp{throw()}, G++ will check the return value.  See also @samp{new
1289 (nothrow)}.
1290
1291 @item -fconserve-space
1292 @opindex fconserve-space
1293 Put uninitialized or runtime-initialized global variables into the
1294 common segment, as C does.  This saves space in the executable at the
1295 cost of not diagnosing duplicate definitions.  If you compile with this
1296 flag and your program mysteriously crashes after @code{main()} has
1297 completed, you may have an object that is being destroyed twice because
1298 two definitions were merged.
1299
1300 This option is no longer useful on most targets, now that support has
1301 been added for putting variables into BSS without making them common.
1302
1303 @item -fno-const-strings
1304 @opindex fno-const-strings
1305 Give string constants type @code{char *} instead of type @code{const
1306 char *}.  By default, G++ uses type @code{const char *} as required by
1307 the standard.  Even if you use @option{-fno-const-strings}, you cannot
1308 actually modify the value of a string constant, unless you also use
1309 @option{-fwritable-strings}.
1310
1311 This option might be removed in a future release of G++.  For maximum
1312 portability, you should structure your code so that it works with
1313 string constants that have type @code{const char *}.
1314
1315 @item -fdollars-in-identifiers
1316 @opindex fdollars-in-identifiers
1317 Accept @samp{$} in identifiers.  You can also explicitly prohibit use of
1318 @samp{$} with the option @option{-fno-dollars-in-identifiers}.  (GNU C allows
1319 @samp{$} by default on most target systems, but there are a few exceptions.)
1320 Traditional C allowed the character @samp{$} to form part of
1321 identifiers.  However, ISO C and C++ forbid @samp{$} in identifiers.
1322
1323 @item -fno-elide-constructors
1324 @opindex fno-elide-constructors
1325 The C++ standard allows an implementation to omit creating a temporary
1326 which is only used to initialize another object of the same type.
1327 Specifying this option disables that optimization, and forces G++ to
1328 call the copy constructor in all cases.
1329
1330 @item -fno-enforce-eh-specs
1331 @opindex fno-enforce-eh-specs
1332 Don't check for violation of exception specifications at runtime.  This
1333 option violates the C++ standard, but may be useful for reducing code
1334 size in production builds, much like defining @samp{NDEBUG}.  The compiler
1335 will still optimize based on the exception specifications.
1336
1337 @item -fexternal-templates
1338 @opindex fexternal-templates
1339
1340 Cause @samp{#pragma interface} and @samp{implementation} to apply to
1341 template instantiation; template instances are emitted or not according
1342 to the location of the template definition.  @xref{Template
1343 Instantiation}, for more information.
1344
1345 This option is deprecated.
1346
1347 @item -falt-external-templates
1348 @opindex falt-external-templates
1349 Similar to @option{-fexternal-templates}, but template instances are
1350 emitted or not according to the place where they are first instantiated.
1351 @xref{Template Instantiation}, for more information.
1352
1353 This option is deprecated.
1354
1355 @item -ffor-scope
1356 @itemx -fno-for-scope
1357 @opindex ffor-scope
1358 @opindex fno-for-scope
1359 If @option{-ffor-scope} is specified, the scope of variables declared in
1360 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1361 as specified by the C++ standard.
1362 If @option{-fno-for-scope} is specified, the scope of variables declared in
1363 a @i{for-init-statement} extends to the end of the enclosing scope,
1364 as was the case in old versions of G++, and other (traditional)
1365 implementations of C++.
1366
1367 The default if neither flag is given to follow the standard,
1368 but to allow and give a warning for old-style code that would
1369 otherwise be invalid, or have different behavior.
1370
1371 @item -fno-gnu-keywords
1372 @opindex fno-gnu-keywords
1373 Do not recognize @code{typeof} as a keyword, so that code can use this
1374 word as an identifier.  You can use the keyword @code{__typeof__} instead.
1375 @option{-ansi} implies @option{-fno-gnu-keywords}.
1376
1377 @item -fno-implicit-templates
1378 @opindex fno-implicit-templates
1379 Never emit code for non-inline templates which are instantiated
1380 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1381 @xref{Template Instantiation}, for more information.
1382
1383 @item -fno-implicit-inline-templates
1384 @opindex fno-implicit-inline-templates
1385 Don't emit code for implicit instantiations of inline templates, either.
1386 The default is to handle inlines differently so that compiles with and
1387 without optimization will need the same set of explicit instantiations.
1388
1389 @item -fno-implement-inlines
1390 @opindex fno-implement-inlines
1391 To save space, do not emit out-of-line copies of inline functions
1392 controlled by @samp{#pragma implementation}.  This will cause linker
1393 errors if these functions are not inlined everywhere they are called.
1394
1395 @item -fms-extensions
1396 @opindex fms-extensions
1397 Disable pedantic warnings about constructs used in MFC, such as implicit
1398 int and getting a pointer to member function via non-standard syntax.
1399
1400 @item -fno-nonansi-builtins
1401 @opindex fno-nonansi-builtins
1402 Disable built-in declarations of functions that are not mandated by
1403 ANSI/ISO C@.  These include @code{ffs}, @code{alloca}, @code{_exit},
1404 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1405
1406 @item -fno-operator-names
1407 @opindex fno-operator-names
1408 Do not treat the operator name keywords @code{and}, @code{bitand},
1409 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1410 synonyms as keywords.
1411
1412 @item -fno-optional-diags
1413 @opindex fno-optional-diags
1414 Disable diagnostics that the standard says a compiler does not need to
1415 issue.  Currently, the only such diagnostic issued by G++ is the one for
1416 a name having multiple meanings within a class.
1417
1418 @item -fpermissive
1419 @opindex fpermissive
1420 Downgrade messages about nonconformant code from errors to warnings.  By
1421 default, G++ effectively sets @option{-pedantic-errors} without
1422 @option{-pedantic}; this option reverses that.  This behavior and this
1423 option are superseded by @option{-pedantic}, which works as it does for GNU C@.
1424
1425 @item -frepo
1426 @opindex frepo
1427 Enable automatic template instantiation at link time.  This option also
1428 implies @option{-fno-implicit-templates}.  @xref{Template
1429 Instantiation}, for more information.
1430
1431 @item -fno-rtti
1432 @opindex fno-rtti
1433 Disable generation of information about every class with virtual
1434 functions for use by the C++ runtime type identification features
1435 (@samp{dynamic_cast} and @samp{typeid}).  If you don't use those parts
1436 of the language, you can save some space by using this flag.  Note that
1437 exception handling uses the same information, but it will generate it as
1438 needed.
1439
1440 @item -fstats
1441 @opindex fstats
1442 Emit statistics about front-end processing at the end of the compilation.
1443 This information is generally only useful to the G++ development team.
1444
1445 @item -ftemplate-depth-@var{n}
1446 @opindex ftemplate-depth
1447 Set the maximum instantiation depth for template classes to @var{n}.
1448 A limit on the template instantiation depth is needed to detect
1449 endless recursions during template class instantiation.  ANSI/ISO C++
1450 conforming programs must not rely on a maximum depth greater than 17.
1451
1452 @item -fuse-cxa-atexit
1453 @opindex fuse-cxa-atexit
1454 Register destructors for objects with static storage duration with the
1455 @code{__cxa_atexit} function rather than the @code{atexit} function.
1456 This option is required for fully standards-compliant handling of static
1457 destructors, but will only work if your C library supports
1458 @code{__cxa_atexit}.
1459
1460 @item -fvtable-gc
1461 @opindex fvtable-gc
1462 Emit special relocations for vtables and virtual function references
1463 so that the linker can identify unused virtual functions and zero out
1464 vtable slots that refer to them.  This is most useful with
1465 @option{-ffunction-sections} and @option{-Wl,--gc-sections}, in order to
1466 also discard the functions themselves.
1467
1468 This optimization requires GNU as and GNU ld.  Not all systems support
1469 this option.  @option{-Wl,--gc-sections} is ignored without @option{-static}.
1470
1471 @item -fno-weak
1472 @opindex fno-weak
1473 Do not use weak symbol support, even if it is provided by the linker.
1474 By default, G++ will use weak symbols if they are available.  This
1475 option exists only for testing, and should not be used by end-users;
1476 it will result in inferior code and has no benefits.  This option may
1477 be removed in a future release of G++.
1478
1479 @item -nostdinc++
1480 @opindex nostdinc++
1481 Do not search for header files in the standard directories specific to
1482 C++, but do still search the other standard directories.  (This option
1483 is used when building the C++ library.)
1484 @end table
1485
1486 In addition, these optimization, warning, and code generation options
1487 have meanings only for C++ programs:
1488
1489 @table @gcctabopt
1490 @item -fno-default-inline
1491 @opindex fno-default-inline
1492 Do not assume @samp{inline} for functions defined inside a class scope.
1493 @xref{Optimize Options,,Options That Control Optimization}.  Note that these
1494 functions will have linkage like inline functions; they just won't be
1495 inlined by default.
1496
1497 @item -Wabi @r{(C++ only)}
1498 @opindex Wabi
1499 Warn when G++ generates code that is probably not compatible with the
1500 vendor-neutral C++ ABI.  Although an effort has been made to warn about
1501 all such cases, there are probably some cases that are not warned about, 
1502 even though G++ is generating incompatible code.  There may also be
1503 cases where warnings are emitted even though the code that is generated
1504 will be compatible.
1505
1506 You should rewrite your code to avoid these warnings if you are
1507 concerned about the fact that code generated by G++ may not be binary
1508 compatible with code generated by other compilers.
1509
1510 The known incompatibilites at this point include:
1511
1512 @itemize @bullet
1513
1514 @item
1515 Incorrect handling of tail-padding for bit-fields.  G++ may attempt to
1516 pack data into the same byte as a base class.  For example:
1517
1518 @smallexample
1519 struct A @{ virtual void f(); int f1 : 1; @};
1520 struct B : public A @{ int f2 : 1; @};
1521 @end smallexample
1522
1523 @noindent
1524 In this case, G++ will place @code{B::f2} into the same byte
1525 as@code{A::f1}; other compilers will not.  You can avoid this problem 
1526 by explicitly padding @code{A} so that its size is a multiple of the
1527 byte size on your platform; that will cause G++ and other compilers to
1528 layout @code{B} identically.
1529
1530 @item
1531 Incorrect handling of tail-padding for virtual bases.  G++ does not use
1532 tail padding when laying out virtual bases.  For example:
1533
1534 @smallexample
1535 struct A @{ virtual void f(); char c1; @};
1536 struct B @{ B(); char c2; @};
1537 struct C : public A, public virtual B @{@};
1538 @end smallexample
1539
1540 @noindent
1541 In this case, G++ will not place @code{B} into the tail-padding for
1542 @code{A}; other compilers will.  You can avoid this problem by
1543 explicitly padding @code{A} so that its size is a multiple of its
1544 alignment (ignoring virtual base classes); that will cause G++ and other
1545 compilers to layout @code{C} identically.
1546
1547 @item
1548 Incorrect handling of bit-fields with declared widths greater than that
1549 of their underlying types, when the bit-fields appear in a union.  For
1550 example:
1551
1552 @smallexample
1553 union U @{ int i : 4096; @};
1554 @end smallexample
1555
1556 @noindent
1557 Assuming that an @code{int} does not have 4096 bits, G++ will make the
1558 union too small by the number of bits in an @code{int}.
1559
1560 @item
1561 Empty classes can be placed at incorrect offsets.  For example:
1562  
1563 @smallexample
1564 struct A @{@};
1565
1566 struct B @{
1567   A a;
1568   virtual void f ();
1569 @};
1570
1571 struct C : public B, public A @{@};
1572 @end smallexample
1573
1574 @noindent
1575 G++ will place the @code{A} base class of @code{C} at a non-zero offset;
1576 it should be placed at offset zero.  G++ mistakenly believes that the
1577 @code{A} data member of @code{B} is already at offset zero.
1578
1579 @item
1580 Names of template functions whose types involve @code{typename} or
1581 template template parameters can be mangled incorrectly.
1582
1583 @smallexample
1584 template <typename Q>
1585 void f(typename Q::X) @{@}
1586
1587 template <template <typename> class Q>
1588 void f(typename Q<int>::X) @{@}
1589 @end smallexample
1590
1591 @noindent
1592 Instantions of these templates may be mangled incorrectly.
1593
1594 @end itemize
1595
1596 @item -Wctor-dtor-privacy @r{(C++ only)}
1597 @opindex Wctor-dtor-privacy
1598 Warn when a class seems unusable, because all the constructors or
1599 destructors in a class are private and the class has no friends or
1600 public static member functions.  This warning is enabled by default.
1601
1602 @item -Wnon-virtual-dtor @r{(C++ only)}
1603 @opindex Wnon-virtual-dtor
1604 Warn when a class declares a non-virtual destructor that should probably
1605 be virtual, because it looks like the class will be used polymorphically.
1606 This warning is enabled by @option{-Wall}.
1607
1608 @item -Wreorder @r{(C++ only)}
1609 @opindex Wreorder
1610 @cindex reordering, warning
1611 @cindex warning for reordering of member initializers
1612 Warn when the order of member initializers given in the code does not
1613 match the order in which they must be executed.  For instance:
1614
1615 @smallexample
1616 struct A @{
1617   int i;
1618   int j;
1619   A(): j (0), i (1) @{ @}
1620 @};
1621 @end smallexample
1622
1623 Here the compiler will warn that the member initializers for @samp{i}
1624 and @samp{j} will be rearranged to match the declaration order of the
1625 members.  This warning is enabled by @option{-Wall}.
1626 @end table
1627
1628 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
1629
1630 @table @gcctabopt
1631 @item -Weffc++ @r{(C++ only)}
1632 @opindex Weffc++
1633 Warn about violations of the following style guidelines from Scott Meyers'
1634 @cite{Effective C++} book:
1635
1636 @itemize @bullet
1637 @item
1638 Item 11:  Define a copy constructor and an assignment operator for classes
1639 with dynamically allocated memory.
1640
1641 @item
1642 Item 12:  Prefer initialization to assignment in constructors.
1643
1644 @item
1645 Item 14:  Make destructors virtual in base classes.
1646
1647 @item
1648 Item 15:  Have @code{operator=} return a reference to @code{*this}.
1649
1650 @item
1651 Item 23:  Don't try to return a reference when you must return an object.
1652
1653 @end itemize
1654
1655 and about violations of the following style guidelines from Scott Meyers'
1656 @cite{More Effective C++} book:
1657
1658 @itemize @bullet
1659 @item
1660 Item 6:  Distinguish between prefix and postfix forms of increment and
1661 decrement operators.
1662
1663 @item
1664 Item 7:  Never overload @code{&&}, @code{||}, or @code{,}.
1665
1666 @end itemize
1667
1668 If you use this option, you should be aware that the standard library
1669 headers do not obey all of these guidelines; you can use @samp{grep -v}
1670 to filter out those warnings.
1671
1672 @item -Wno-deprecated @r{(C++ only)}
1673 @opindex Wno-deprecated
1674 Do not warn about usage of deprecated features.  @xref{Deprecated Features}.
1675
1676 @item -Wno-non-template-friend @r{(C++ only)}
1677 @opindex Wno-non-template-friend
1678 Disable warnings when non-templatized friend functions are declared
1679 within a template.  With the advent of explicit template specification
1680 support in G++, if the name of the friend is an unqualified-id (i.e.,
1681 @samp{friend foo(int)}), the C++ language specification demands that the
1682 friend declare or define an ordinary, nontemplate function.  (Section
1683 14.5.3).  Before G++ implemented explicit specification, unqualified-ids
1684 could be interpreted as a particular specialization of a templatized
1685 function.  Because this non-conforming behavior is no longer the default
1686 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
1687 check existing code for potential trouble spots, and is on by default.
1688 This new compiler behavior can be turned off with
1689 @option{-Wno-non-template-friend} which keeps the conformant compiler code
1690 but disables the helpful warning.
1691
1692 @item -Wold-style-cast @r{(C++ only)}
1693 @opindex Wold-style-cast
1694 Warn if an old-style (C-style) cast to a non-void type is used within
1695 a C++ program.  The new-style casts (@samp{static_cast},
1696 @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to
1697 unintended effects, and much easier to grep for.
1698
1699 @item -Woverloaded-virtual @r{(C++ only)}
1700 @opindex Woverloaded-virtual
1701 @cindex overloaded virtual fn, warning
1702 @cindex warning for overloaded virtual fn
1703 Warn when a function declaration hides virtual functions from a
1704 base class.  For example, in:
1705
1706 @smallexample
1707 struct A @{
1708   virtual void f();
1709 @};
1710
1711 struct B: public A @{
1712   void f(int);
1713 @};
1714 @end smallexample
1715
1716 the @code{A} class version of @code{f} is hidden in @code{B}, and code
1717 like this:
1718
1719 @smallexample
1720 B* b;
1721 b->f();
1722 @end smallexample
1723
1724 will fail to compile.
1725
1726 @item -Wno-pmf-conversions @r{(C++ only)}
1727 @opindex Wno-pmf-conversions
1728 Disable the diagnostic for converting a bound pointer to member function
1729 to a plain pointer.
1730
1731 @item -Wsign-promo @r{(C++ only)}
1732 @opindex Wsign-promo
1733 Warn when overload resolution chooses a promotion from unsigned or
1734 enumeral type to a signed type over a conversion to an unsigned type of
1735 the same size.  Previous versions of G++ would try to preserve
1736 unsignedness, but the standard mandates the current behavior.
1737
1738 @item -Wsynth @r{(C++ only)}
1739 @opindex Wsynth
1740 @cindex warning for synthesized methods
1741 @cindex synthesized methods, warning
1742 Warn when G++'s synthesis behavior does not match that of cfront.  For
1743 instance:
1744
1745 @smallexample
1746 struct A @{
1747   operator int ();
1748   A& operator = (int);
1749 @};
1750
1751 main ()
1752 @{
1753   A a,b;
1754   a = b;
1755 @}
1756 @end smallexample
1757
1758 In this example, G++ will synthesize a default @samp{A& operator =
1759 (const A&);}, while cfront will use the user-defined @samp{operator =}.
1760 @end table
1761
1762 @node Objective-C Dialect Options
1763 @section Options Controlling Objective-C Dialect
1764
1765 @cindex compiler options, Objective-C
1766 @cindex Objective-C options, command line
1767 @cindex options, Objective-C
1768 This section describes the command-line options that are only meaningful
1769 for Objective-C programs; but you can also use most of the GNU compiler
1770 options regardless of what language your program is in.  For example,
1771 you might compile a file @code{some_class.m} like this:
1772
1773 @example
1774 gcc -g -fgnu-runtime -O -c some_class.m
1775 @end example
1776
1777 @noindent
1778 In this example, only @option{-fgnu-runtime} is an option meant only for
1779 Objective-C programs; you can use the other options with any language
1780 supported by GCC@.
1781
1782 Here is a list of options that are @emph{only} for compiling Objective-C
1783 programs:
1784
1785 @table @gcctabopt
1786 @item -fconstant-string-class=@var{class-name}
1787 @opindex fconstant-string-class
1788 Use @var{class-name} as the name of the class to instantiate for each
1789 literal string specified with the syntax @code{@@"@dots{}"}.  The default
1790 class name is @code{NXConstantString}.
1791
1792 @item -fgnu-runtime
1793 @opindex fgnu-runtime
1794 Generate object code compatible with the standard GNU Objective-C
1795 runtime.  This is the default for most types of systems.
1796
1797 @item -fnext-runtime
1798 @opindex fnext-runtime
1799 Generate output compatible with the NeXT runtime.  This is the default
1800 for NeXT-based systems, including Darwin and Mac OS X@.  The macro
1801 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
1802 used.
1803
1804 @item -gen-decls
1805 @opindex gen-decls
1806 Dump interface declarations for all classes seen in the source file to a
1807 file named @file{@var{sourcename}.decl}.
1808
1809 @item -Wno-protocol
1810 @opindex Wno-protocol
1811 If a class is declared to implement a protocol, a warning is issued for
1812 every method in the protocol that is not implemented by the class.  The
1813 default behavior is to issue a warning for every method not explicitly
1814 implemented in the class, even if a method implementation is inherited
1815 from the superclass.  If you use the @code{-Wno-protocol} option, then
1816 methods inherited from the superclass are considered to be implemented,
1817 and no warning is issued for them.
1818
1819 @item -Wselector
1820 @opindex Wselector
1821 Warn if multiple methods of different types for the same selector are
1822 found during compilation.  The check is performed on the list of methods
1823 in the final stage of compilation.  Additionally, a check is performed
1824 that for each selector appearing in a @code{@@selector(@dots{})}
1825 expression, a corresponding method with that selector has been found
1826 during compilation.  Because these checks scan the method table only at
1827 the end of compilation, these warnings are not produced if the final
1828 stage of compilation is not reached, for example because an error is
1829 found during compilation, or because the @code{-fsyntax-only} option is
1830 being used.
1831
1832 @item -Wundeclared-selector
1833 @opindex Wundeclared-selector
1834 Warn if a @code{@@selector(@dots{})} expression referring to an
1835 undeclared selector is found.  A selector is considered undeclared if no
1836 method with that name has been declared (explicitly, in an
1837 @code{@@interface} or @code{@@protocol} declaration, or implicitly, in
1838 an @code{@@implementation} section) before the
1839 @code{@@selector(@dots{})} expression.  This option always performs its
1840 checks as soon as a @code{@@selector(@dots{})} expression is found
1841 (while @code{-Wselector} only performs its checks in the final stage of
1842 compilation), and so additionally enforces the coding style convention
1843 that methods and selectors must be declared before being used.
1844
1845 @c not documented because only avail via -Wp
1846 @c @item -print-objc-runtime-info
1847
1848 @end table
1849
1850 @node Language Independent Options
1851 @section Options to Control Diagnostic Messages Formatting
1852 @cindex options to control diagnostics formatting
1853 @cindex diagnostic messages
1854 @cindex message formatting
1855
1856 Traditionally, diagnostic messages have been formatted irrespective of
1857 the output device's aspect (e.g.@: its width, @dots{}).  The options described
1858 below can be used to control the diagnostic messages formatting
1859 algorithm, e.g.@: how many characters per line, how often source location
1860 information should be reported.  Right now, only the C++ front end can
1861 honor these options.  However it is expected, in the near future, that
1862 the remaining front ends would be able to digest them correctly.
1863
1864 @table @gcctabopt
1865 @item -fmessage-length=@var{n}
1866 @opindex fmessage-length
1867 Try to format error messages so that they fit on lines of about @var{n}
1868 characters.  The default is 72 characters for @command{g++} and 0 for the rest of
1869 the front ends supported by GCC@.  If @var{n} is zero, then no
1870 line-wrapping will be done; each error message will appear on a single
1871 line.
1872
1873 @opindex fdiagnostics-show-location
1874 @item -fdiagnostics-show-location=once
1875 Only meaningful in line-wrapping mode.  Instructs the diagnostic messages
1876 reporter to emit @emph{once} source location information; that is, in
1877 case the message is too long to fit on a single physical line and has to
1878 be wrapped, the source location won't be emitted (as prefix) again,
1879 over and over, in subsequent continuation lines.  This is the default
1880 behavior.
1881
1882 @item -fdiagnostics-show-location=every-line
1883 Only meaningful in line-wrapping mode.  Instructs the diagnostic
1884 messages reporter to emit the same source location information (as
1885 prefix) for physical lines that result from the process of breaking
1886 a message which is too long to fit on a single line.
1887
1888 @end table
1889
1890 @node Warning Options
1891 @section Options to Request or Suppress Warnings
1892 @cindex options to control warnings
1893 @cindex warning messages
1894 @cindex messages, warning
1895 @cindex suppressing warnings
1896
1897 Warnings are diagnostic messages that report constructions which
1898 are not inherently erroneous but which are risky or suggest there
1899 may have been an error.
1900
1901 You can request many specific warnings with options beginning @samp{-W},
1902 for example @option{-Wimplicit} to request warnings on implicit
1903 declarations.  Each of these specific warning options also has a
1904 negative form beginning @samp{-Wno-} to turn off warnings;
1905 for example, @option{-Wno-implicit}.  This manual lists only one of the
1906 two forms, whichever is not the default.
1907
1908 The following options control the amount and kinds of warnings produced
1909 by GCC; for further, language-specific options also refer to
1910 @ref{C++ Dialect Options} and @ref{Objective-C Dialect Options}.
1911
1912 @table @gcctabopt
1913 @cindex syntax checking
1914 @item -fsyntax-only
1915 @opindex fsyntax-only
1916 Check the code for syntax errors, but don't do anything beyond that.
1917
1918 @item -pedantic
1919 @opindex pedantic
1920 Issue all the warnings demanded by strict ISO C and ISO C++;
1921 reject all programs that use forbidden extensions, and some other
1922 programs that do not follow ISO C and ISO C++.  For ISO C, follows the
1923 version of the ISO C standard specified by any @option{-std} option used.
1924
1925 Valid ISO C and ISO C++ programs should compile properly with or without
1926 this option (though a rare few will require @option{-ansi} or a
1927 @option{-std} option specifying the required version of ISO C)@.  However,
1928 without this option, certain GNU extensions and traditional C and C++
1929 features are supported as well.  With this option, they are rejected.
1930
1931 @option{-pedantic} does not cause warning messages for use of the
1932 alternate keywords whose names begin and end with @samp{__}.  Pedantic
1933 warnings are also disabled in the expression that follows
1934 @code{__extension__}.  However, only system header files should use
1935 these escape routes; application programs should avoid them.
1936 @xref{Alternate Keywords}.
1937
1938 Some users try to use @option{-pedantic} to check programs for strict ISO
1939 C conformance.  They soon find that it does not do quite what they want:
1940 it finds some non-ISO practices, but not all---only those for which
1941 ISO C @emph{requires} a diagnostic, and some others for which
1942 diagnostics have been added.
1943
1944 A feature to report any failure to conform to ISO C might be useful in
1945 some instances, but would require considerable additional work and would
1946 be quite different from @option{-pedantic}.  We don't have plans to
1947 support such a feature in the near future.
1948
1949 Where the standard specified with @option{-std} represents a GNU
1950 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
1951 corresponding @dfn{base standard}, the version of ISO C on which the GNU
1952 extended dialect is based.  Warnings from @option{-pedantic} are given
1953 where they are required by the base standard.  (It would not make sense
1954 for such warnings to be given only for features not in the specified GNU
1955 C dialect, since by definition the GNU dialects of C include all
1956 features the compiler supports with the given option, and there would be
1957 nothing to warn about.)
1958
1959 @item -pedantic-errors
1960 @opindex pedantic-errors
1961 Like @option{-pedantic}, except that errors are produced rather than
1962 warnings.
1963
1964 @item -w
1965 @opindex w
1966 Inhibit all warning messages.
1967
1968 @item -Wno-import
1969 @opindex Wno-import
1970 Inhibit warning messages about the use of @samp{#import}.
1971
1972 @item -Wchar-subscripts
1973 @opindex Wchar-subscripts
1974 Warn if an array subscript has type @code{char}.  This is a common cause
1975 of error, as programmers often forget that this type is signed on some
1976 machines.
1977
1978 @item -Wcomment
1979 @opindex Wcomment
1980 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
1981 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
1982
1983 @item -Wformat
1984 @opindex Wformat
1985 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
1986 the arguments supplied have types appropriate to the format string
1987 specified, and that the conversions specified in the format string make
1988 sense.  This includes standard functions, and others specified by format
1989 attributes (@pxref{Function Attributes}), in the @code{printf},
1990 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
1991 not in the C standard) families.
1992
1993 The formats are checked against the format features supported by GNU
1994 libc version 2.2.  These include all ISO C90 and C99 features, as well
1995 as features from the Single Unix Specification and some BSD and GNU
1996 extensions.  Other library implementations may not support all these
1997 features; GCC does not support warning about features that go beyond a
1998 particular library's limitations.  However, if @option{-pedantic} is used
1999 with @option{-Wformat}, warnings will be given about format features not
2000 in the selected standard version (but not for @code{strfmon} formats,
2001 since those are not in any version of the C standard).  @xref{C Dialect
2002 Options,,Options Controlling C Dialect}.
2003
2004 Since @option{-Wformat} also checks for null format arguments for
2005 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2006
2007 @option{-Wformat} is included in @option{-Wall}.  For more control over some
2008 aspects of format checking, the options @option{-Wno-format-y2k},
2009 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2010 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2011 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2012
2013 @item -Wno-format-y2k
2014 @opindex Wno-format-y2k
2015 If @option{-Wformat} is specified, do not warn about @code{strftime}
2016 formats which may yield only a two-digit year.
2017
2018 @item -Wno-format-extra-args
2019 @opindex Wno-format-extra-args
2020 If @option{-Wformat} is specified, do not warn about excess arguments to a
2021 @code{printf} or @code{scanf} format function.  The C standard specifies
2022 that such arguments are ignored.
2023
2024 Where the unused arguments lie between used arguments that are
2025 specified with @samp{$} operand number specifications, normally
2026 warnings are still given, since the implementation could not know what
2027 type to pass to @code{va_arg} to skip the unused arguments.  However,
2028 in the case of @code{scanf} formats, this option will suppress the
2029 warning if the unused arguments are all pointers, since the Single
2030 Unix Specification says that such unused arguments are allowed.
2031
2032 @item -Wno-format-zero-length
2033 @opindex Wno-format-zero-length
2034 If @option{-Wformat} is specified, do not warn about zero-length formats.
2035 The C standard specifies that zero-length formats are allowed.
2036
2037 @item -Wformat-nonliteral
2038 @opindex Wformat-nonliteral
2039 If @option{-Wformat} is specified, also warn if the format string is not a
2040 string literal and so cannot be checked, unless the format function
2041 takes its format arguments as a @code{va_list}.
2042
2043 @item -Wformat-security
2044 @opindex Wformat-security
2045 If @option{-Wformat} is specified, also warn about uses of format
2046 functions that represent possible security problems.  At present, this
2047 warns about calls to @code{printf} and @code{scanf} functions where the
2048 format string is not a string literal and there are no format arguments,
2049 as in @code{printf (foo);}.  This may be a security hole if the format
2050 string came from untrusted input and contains @samp{%n}.  (This is
2051 currently a subset of what @option{-Wformat-nonliteral} warns about, but
2052 in future warnings may be added to @option{-Wformat-security} that are not
2053 included in @option{-Wformat-nonliteral}.)
2054
2055 @item -Wformat=2
2056 @opindex Wformat=2
2057 Enable @option{-Wformat} plus format checks not included in
2058 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
2059 -Wformat-nonliteral -Wformat-security}.
2060
2061 @item -Wnonnull
2062 @opindex Wnonnull
2063 Enable warning about passing a null pointer for arguments marked as
2064 requiring a non-null value by the @code{nonnull} function attribute.
2065
2066 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}.  It
2067 can be disabled with the @option{-Wno-nonnull} option.
2068
2069 @item -Wimplicit-int
2070 @opindex Wimplicit-int
2071 Warn when a declaration does not specify a type.
2072
2073 @item -Wimplicit-function-declaration
2074 @itemx -Werror-implicit-function-declaration
2075 @opindex Wimplicit-function-declaration
2076 @opindex Werror-implicit-function-declaration
2077 Give a warning (or error) whenever a function is used before being
2078 declared.
2079
2080 @item -Wimplicit
2081 @opindex Wimplicit
2082 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
2083
2084 @item -Wmain
2085 @opindex Wmain
2086 Warn if the type of @samp{main} is suspicious.  @samp{main} should be a
2087 function with external linkage, returning int, taking either zero
2088 arguments, two, or three arguments of appropriate types.
2089
2090 @item -Wmissing-braces
2091 @opindex Wmissing-braces
2092 Warn if an aggregate or union initializer is not fully bracketed.  In
2093 the following example, the initializer for @samp{a} is not fully
2094 bracketed, but that for @samp{b} is fully bracketed.
2095
2096 @smallexample
2097 int a[2][2] = @{ 0, 1, 2, 3 @};
2098 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
2099 @end smallexample
2100
2101 @item -Wparentheses
2102 @opindex Wparentheses
2103 Warn if parentheses are omitted in certain contexts, such
2104 as when there is an assignment in a context where a truth value
2105 is expected, or when operators are nested whose precedence people
2106 often get confused about.
2107
2108 Also warn about constructions where there may be confusion to which
2109 @code{if} statement an @code{else} branch belongs.  Here is an example of
2110 such a case:
2111
2112 @smallexample
2113 @group
2114 @{
2115   if (a)
2116     if (b)
2117       foo ();
2118   else
2119     bar ();
2120 @}
2121 @end group
2122 @end smallexample
2123
2124 In C, every @code{else} branch belongs to the innermost possible @code{if}
2125 statement, which in this example is @code{if (b)}.  This is often not
2126 what the programmer expected, as illustrated in the above example by
2127 indentation the programmer chose.  When there is the potential for this
2128 confusion, GCC will issue a warning when this flag is specified.
2129 To eliminate the warning, add explicit braces around the innermost
2130 @code{if} statement so there is no way the @code{else} could belong to
2131 the enclosing @code{if}.  The resulting code would look like this:
2132
2133 @smallexample
2134 @group
2135 @{
2136   if (a)
2137     @{
2138       if (b)
2139         foo ();
2140       else
2141         bar ();
2142     @}
2143 @}
2144 @end group
2145 @end smallexample
2146
2147 @item -Wsequence-point
2148 @opindex Wsequence-point
2149 Warn about code that may have undefined semantics because of violations
2150 of sequence point rules in the C standard.
2151
2152 The C standard defines the order in which expressions in a C program are
2153 evaluated in terms of @dfn{sequence points}, which represent a partial
2154 ordering between the execution of parts of the program: those executed
2155 before the sequence point, and those executed after it.  These occur
2156 after the evaluation of a full expression (one which is not part of a
2157 larger expression), after the evaluation of the first operand of a
2158 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
2159 function is called (but after the evaluation of its arguments and the
2160 expression denoting the called function), and in certain other places.
2161 Other than as expressed by the sequence point rules, the order of
2162 evaluation of subexpressions of an expression is not specified.  All
2163 these rules describe only a partial order rather than a total order,
2164 since, for example, if two functions are called within one expression
2165 with no sequence point between them, the order in which the functions
2166 are called is not specified.  However, the standards committee have
2167 ruled that function calls do not overlap.
2168
2169 It is not specified when between sequence points modifications to the
2170 values of objects take effect.  Programs whose behavior depends on this
2171 have undefined behavior; the C standard specifies that ``Between the
2172 previous and next sequence point an object shall have its stored value
2173 modified at most once by the evaluation of an expression.  Furthermore,
2174 the prior value shall be read only to determine the value to be
2175 stored.''.  If a program breaks these rules, the results on any
2176 particular implementation are entirely unpredictable.
2177
2178 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
2179 = b[n++]} and @code{a[i++] = i;}.  Some more complicated cases are not
2180 diagnosed by this option, and it may give an occasional false positive
2181 result, but in general it has been found fairly effective at detecting
2182 this sort of problem in programs.
2183
2184 The present implementation of this option only works for C programs.  A
2185 future implementation may also work for C++ programs.
2186
2187 The C standard is worded confusingly, therefore there is some debate
2188 over the precise meaning of the sequence point rules in subtle cases.
2189 Links to discussions of the problem, including proposed formal
2190 definitions, may be found on our readings page, at
2191 @w{@uref{http://gcc.gnu.org/readings.html}}.
2192
2193 @item -Wreturn-type
2194 @opindex Wreturn-type
2195 Warn whenever a function is defined with a return-type that defaults to
2196 @code{int}.  Also warn about any @code{return} statement with no
2197 return-value in a function whose return-type is not @code{void}.
2198
2199 For C++, a function without return type always produces a diagnostic
2200 message, even when @option{-Wno-return-type} is specified.  The only
2201 exceptions are @samp{main} and functions defined in system headers.
2202
2203 @item -Wswitch
2204 @opindex Wswitch
2205 Warn whenever a @code{switch} statement has an index of enumeral type
2206 and lacks a @code{case} for one or more of the named codes of that
2207 enumeration.  (The presence of a @code{default} label prevents this
2208 warning.)  @code{case} labels outside the enumeration range also
2209 provoke warnings when this option is used.
2210
2211 @item -Wswitch-default
2212 @opindex Wswitch-switch
2213 Warn whenever a @code{switch} statement does not have a @code{default}
2214 case.
2215
2216 @item -Wswitch-enum
2217 @opindex Wswitch-enum
2218 Warn whenever a @code{switch} statement has an index of enumeral type
2219 and lacks a @code{case} for one or more of the named codes of that
2220 enumeration.  @code{case} labels outside the enumeration range also
2221 provoke warnings when this option is used.
2222
2223 @item -Wtrigraphs
2224 @opindex Wtrigraphs
2225 Warn if any trigraphs are encountered that might change the meaning of
2226 the program (trigraphs within comments are not warned about).
2227
2228 @item -Wunused-function
2229 @opindex Wunused-function
2230 Warn whenever a static function is declared but not defined or a
2231 non\-inline static function is unused.
2232
2233 @item -Wunused-label
2234 @opindex Wunused-label
2235 Warn whenever a label is declared but not used.
2236
2237 To suppress this warning use the @samp{unused} attribute
2238 (@pxref{Variable Attributes}).
2239
2240 @item -Wunused-parameter
2241 @opindex Wunused-parameter
2242 Warn whenever a function parameter is unused aside from its declaration.
2243
2244 To suppress this warning use the @samp{unused} attribute
2245 (@pxref{Variable Attributes}).
2246
2247 @item -Wunused-variable
2248 @opindex Wunused-variable
2249 Warn whenever a local variable or non-constant static variable is unused
2250 aside from its declaration
2251
2252 To suppress this warning use the @samp{unused} attribute
2253 (@pxref{Variable Attributes}).
2254
2255 @item -Wunused-value
2256 @opindex Wunused-value
2257 Warn whenever a statement computes a result that is explicitly not used.
2258
2259 To suppress this warning cast the expression to @samp{void}.
2260
2261 @item -Wunused
2262 @opindex Wunused
2263 All the above @option{-Wunused} options combined.
2264
2265 In order to get a warning about an unused function parameter, you must
2266 either specify @samp{-W -Wunused} or separately specify
2267 @option{-Wunused-parameter}.
2268
2269 @item -Wuninitialized
2270 @opindex Wuninitialized
2271 Warn if an automatic variable is used without first being initialized or
2272 if a variable may be clobbered by a @code{setjmp} call.
2273
2274 These warnings are possible only in optimizing compilation,
2275 because they require data flow information that is computed only
2276 when optimizing.  If you don't specify @option{-O}, you simply won't
2277 get these warnings.
2278
2279 These warnings occur only for variables that are candidates for
2280 register allocation.  Therefore, they do not occur for a variable that
2281 is declared @code{volatile}, or whose address is taken, or whose size
2282 is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
2283 structures, unions or arrays, even when they are in registers.
2284
2285 Note that there may be no warning about a variable that is used only
2286 to compute a value that itself is never used, because such
2287 computations may be deleted by data flow analysis before the warnings
2288 are printed.
2289
2290 These warnings are made optional because GCC is not smart
2291 enough to see all the reasons why the code might be correct
2292 despite appearing to have an error.  Here is one example of how
2293 this can happen:
2294
2295 @smallexample
2296 @group
2297 @{
2298   int x;
2299   switch (y)
2300     @{
2301     case 1: x = 1;
2302       break;
2303     case 2: x = 4;
2304       break;
2305     case 3: x = 5;
2306     @}
2307   foo (x);
2308 @}
2309 @end group
2310 @end smallexample
2311
2312 @noindent
2313 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
2314 always initialized, but GCC doesn't know this.  Here is
2315 another common case:
2316
2317 @smallexample
2318 @{
2319   int save_y;
2320   if (change_y) save_y = y, y = new_y;
2321   @dots{}
2322   if (change_y) y = save_y;
2323 @}
2324 @end smallexample
2325
2326 @noindent
2327 This has no bug because @code{save_y} is used only if it is set.
2328
2329 @cindex @code{longjmp} warnings
2330 This option also warns when a non-volatile automatic variable might be
2331 changed by a call to @code{longjmp}.  These warnings as well are possible
2332 only in optimizing compilation.
2333
2334 The compiler sees only the calls to @code{setjmp}.  It cannot know
2335 where @code{longjmp} will be called; in fact, a signal handler could
2336 call it at any point in the code.  As a result, you may get a warning
2337 even when there is in fact no problem because @code{longjmp} cannot
2338 in fact be called at the place which would cause a problem.
2339
2340 Some spurious warnings can be avoided if you declare all the functions
2341 you use that never return as @code{noreturn}.  @xref{Function
2342 Attributes}.
2343
2344 @item -Wunknown-pragmas
2345 @opindex Wunknown-pragmas
2346 @cindex warning for unknown pragmas
2347 @cindex unknown pragmas, warning
2348 @cindex pragmas, warning of unknown
2349 Warn when a #pragma directive is encountered which is not understood by
2350 GCC@.  If this command line option is used, warnings will even be issued
2351 for unknown pragmas in system header files.  This is not the case if
2352 the warnings were only enabled by the @option{-Wall} command line option.
2353
2354 @item -Wstrict-aliasing
2355 @opindex Wstrict-aliasing
2356 This option is only active when @option{-fstrict-aliasing} is active.
2357 It warns about code which might break the strict aliasing rules that the
2358 compiler is using for optimization. The warning does not catch all
2359 cases, but does attempt to catch the more common pitfalls. It is
2360 included in @option{-Wall}.
2361
2362 @item -Wall
2363 @opindex Wall
2364 All of the above @samp{-W} options combined.  This enables all the
2365 warnings about constructions that some users consider questionable, and
2366 that are easy to avoid (or modify to prevent the warning), even in
2367 conjunction with macros.  This also enables some language-specific
2368 warnings described in @ref{C++ Dialect Options} and
2369 @ref{Objective-C Dialect Options}.
2370 @end table
2371
2372 The following @option{-W@dots{}} options are not implied by @option{-Wall}.
2373 Some of them warn about constructions that users generally do not
2374 consider questionable, but which occasionally you might wish to check
2375 for; others warn about constructions that are necessary or hard to avoid
2376 in some cases, and there is no simple way to modify the code to suppress
2377 the warning.
2378
2379 @table @gcctabopt
2380 @item -W
2381 @opindex W
2382 Print extra warning messages for these events:
2383
2384 @itemize @bullet
2385 @item
2386 A function can return either with or without a value.  (Falling
2387 off the end of the function body is considered returning without
2388 a value.)  For example, this function would evoke such a
2389 warning:
2390
2391 @smallexample
2392 @group
2393 foo (a)
2394 @{
2395   if (a > 0)
2396     return a;
2397 @}
2398 @end group
2399 @end smallexample
2400
2401 @item
2402 An expression-statement or the left-hand side of a comma expression
2403 contains no side effects.
2404 To suppress the warning, cast the unused expression to void.
2405 For example, an expression such as @samp{x[i,j]} will cause a warning,
2406 but @samp{x[(void)i,j]} will not.
2407
2408 @item
2409 An unsigned value is compared against zero with @samp{<} or @samp{<=}.
2410
2411 @item
2412 A comparison like @samp{x<=y<=z} appears; this is equivalent to
2413 @samp{(x<=y ? 1 : 0) <= z}, which is a different interpretation from
2414 that of ordinary mathematical notation.
2415
2416 @item
2417 Storage-class specifiers like @code{static} are not the first things in
2418 a declaration.  According to the C Standard, this usage is obsolescent.
2419
2420 @item
2421 The return type of a function has a type qualifier such as @code{const}.
2422 Such a type qualifier has no effect, since the value returned by a
2423 function is not an lvalue.  (But don't warn about the GNU extension of
2424 @code{volatile void} return types.  That extension will be warned about
2425 if @option{-pedantic} is specified.)
2426
2427 @item
2428 If @option{-Wall} or @option{-Wunused} is also specified, warn about unused
2429 arguments.
2430
2431 @item
2432 A comparison between signed and unsigned values could produce an
2433 incorrect result when the signed value is converted to unsigned.
2434 (But don't warn if @option{-Wno-sign-compare} is also specified.)
2435
2436 @item
2437 An aggregate has a partly bracketed initializer.
2438 For example, the following code would evoke such a warning,
2439 because braces are missing around the initializer for @code{x.h}:
2440
2441 @smallexample
2442 struct s @{ int f, g; @};
2443 struct t @{ struct s h; int i; @};
2444 struct t x = @{ 1, 2, 3 @};
2445 @end smallexample
2446
2447 @item
2448 An aggregate has an initializer which does not initialize all members.
2449 For example, the following code would cause such a warning, because
2450 @code{x.h} would be implicitly initialized to zero:
2451
2452 @smallexample
2453 struct s @{ int f, g, h; @};
2454 struct s x = @{ 3, 4 @};
2455 @end smallexample
2456 @end itemize
2457
2458 @item -Wno-div-by-zero
2459 @opindex Wno-div-by-zero
2460 @opindex Wdiv-by-zero
2461 Do not warn about compile-time integer division by zero.  Floating point
2462 division by zero is not warned about, as it can be a legitimate way of
2463 obtaining infinities and NaNs.
2464
2465 @item -Wsystem-headers
2466 @opindex Wsystem-headers
2467 @cindex warnings from system headers
2468 @cindex system headers, warnings from
2469 Print warning messages for constructs found in system header files.
2470 Warnings from system headers are normally suppressed, on the assumption
2471 that they usually do not indicate real problems and would only make the
2472 compiler output harder to read.  Using this command line option tells
2473 GCC to emit warnings from system headers as if they occurred in user
2474 code.  However, note that using @option{-Wall} in conjunction with this
2475 option will @emph{not} warn about unknown pragmas in system
2476 headers---for that, @option{-Wunknown-pragmas} must also be used.
2477
2478 @item -Wfloat-equal
2479 @opindex Wfloat-equal
2480 Warn if floating point values are used in equality comparisons.
2481
2482 The idea behind this is that sometimes it is convenient (for the
2483 programmer) to consider floating-point values as approximations to
2484 infinitely precise real numbers.  If you are doing this, then you need
2485 to compute (by analysing the code, or in some other way) the maximum or
2486 likely maximum error that the computation introduces, and allow for it
2487 when performing comparisons (and when producing output, but that's a
2488 different problem).  In particular, instead of testing for equality, you
2489 would check to see whether the two values have ranges that overlap; and
2490 this is done with the relational operators, so equality comparisons are
2491 probably mistaken.
2492
2493 @item -Wtraditional @r{(C only)}
2494 @opindex Wtraditional
2495 Warn about certain constructs that behave differently in traditional and
2496 ISO C@.  Also warn about ISO C constructs that have no traditional C
2497 equivalent, and/or problematic constructs which should be avoided.
2498
2499 @itemize @bullet
2500 @item
2501 Macro parameters that appear within string literals in the macro body.
2502 In traditional C macro replacement takes place within string literals,
2503 but does not in ISO C@.
2504
2505 @item
2506 In traditional C, some preprocessor directives did not exist.
2507 Traditional preprocessors would only consider a line to be a directive
2508 if the @samp{#} appeared in column 1 on the line.  Therefore
2509 @option{-Wtraditional} warns about directives that traditional C
2510 understands but would ignore because the @samp{#} does not appear as the
2511 first character on the line.  It also suggests you hide directives like
2512 @samp{#pragma} not understood by traditional C by indenting them.  Some
2513 traditional implementations would not recognize @samp{#elif}, so it
2514 suggests avoiding it altogether.
2515
2516 @item
2517 A function-like macro that appears without arguments.
2518
2519 @item
2520 The unary plus operator.
2521
2522 @item
2523 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
2524 constant suffixes.  (Traditional C does support the @samp{L} suffix on integer
2525 constants.)  Note, these suffixes appear in macros defined in the system
2526 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
2527 Use of these macros in user code might normally lead to spurious
2528 warnings, however gcc's integrated preprocessor has enough context to
2529 avoid warning in these cases.
2530
2531 @item
2532 A function declared external in one block and then used after the end of
2533 the block.
2534
2535 @item
2536 A @code{switch} statement has an operand of type @code{long}.
2537
2538 @item
2539 A non-@code{static} function declaration follows a @code{static} one.
2540 This construct is not accepted by some traditional C compilers.
2541
2542 @item
2543 The ISO type of an integer constant has a different width or
2544 signedness from its traditional type.  This warning is only issued if
2545 the base of the constant is ten.  I.e.@: hexadecimal or octal values, which
2546 typically represent bit patterns, are not warned about.
2547
2548 @item
2549 Usage of ISO string concatenation is detected.
2550
2551 @item
2552 Initialization of automatic aggregates.
2553
2554 @item
2555 Identifier conflicts with labels.  Traditional C lacks a separate
2556 namespace for labels.
2557
2558 @item
2559 Initialization of unions.  If the initializer is zero, the warning is
2560 omitted.  This is done under the assumption that the zero initializer in
2561 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
2562 initializer warnings and relies on default initialization to zero in the
2563 traditional C case.
2564
2565 @item
2566 Conversions by prototypes between fixed/floating point values and vice
2567 versa.  The absence of these prototypes when compiling with traditional
2568 C would cause serious problems.  This is a subset of the possible
2569 conversion warnings, for the full set use @option{-Wconversion}.
2570
2571 @item
2572 Use of ISO C style function definitions.  This warning intentionally is
2573 @emph{not} issued for prototype declarations or variadic functions
2574 because these ISO C features will appear in your code when using
2575 libiberty's traditional C compatibility macros, @code{PARAMS} and
2576 @code{VPARAMS}.  This warning is also bypassed for nested functions
2577 because that feature is already a gcc extension and thus not relevant to
2578 traditional C compatibility.
2579 @end itemize
2580
2581 @item -Wundef
2582 @opindex Wundef
2583 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
2584
2585 @item -Wendif-labels
2586 @opindex Wendif-labels
2587 Warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
2588
2589 @item -Wshadow
2590 @opindex Wshadow
2591 Warn whenever a local variable shadows another local variable, parameter or
2592 global variable or whenever a built-in function is shadowed.
2593
2594 @item -Wlarger-than-@var{len}
2595 @opindex Wlarger-than
2596 Warn whenever an object of larger than @var{len} bytes is defined.
2597
2598 @item -Wpointer-arith
2599 @opindex Wpointer-arith
2600 Warn about anything that depends on the ``size of'' a function type or
2601 of @code{void}.  GNU C assigns these types a size of 1, for
2602 convenience in calculations with @code{void *} pointers and pointers
2603 to functions.
2604
2605 @item -Wbad-function-cast @r{(C only)}
2606 @opindex Wbad-function-cast
2607 Warn whenever a function call is cast to a non-matching type.
2608 For example, warn if @code{int malloc()} is cast to @code{anything *}.
2609
2610 @item -Wcast-qual
2611 @opindex Wcast-qual
2612 Warn whenever a pointer is cast so as to remove a type qualifier from
2613 the target type.  For example, warn if a @code{const char *} is cast
2614 to an ordinary @code{char *}.
2615
2616 @item -Wcast-align
2617 @opindex Wcast-align
2618 Warn whenever a pointer is cast such that the required alignment of the
2619 target is increased.  For example, warn if a @code{char *} is cast to
2620 an @code{int *} on machines where integers can only be accessed at
2621 two- or four-byte boundaries.
2622
2623 @item -Wwrite-strings
2624 @opindex Wwrite-strings
2625 When compiling C, give string constants the type @code{const
2626 char[@var{length}]} so that
2627 copying the address of one into a non-@code{const} @code{char *}
2628 pointer will get a warning; when compiling C++, warn about the
2629 deprecated conversion from string constants to @code{char *}.
2630 These warnings will help you find at
2631 compile time code that can try to write into a string constant, but
2632 only if you have been very careful about using @code{const} in
2633 declarations and prototypes.  Otherwise, it will just be a nuisance;
2634 this is why we did not make @option{-Wall} request these warnings.
2635
2636 @item -Wconversion
2637 @opindex Wconversion
2638 Warn if a prototype causes a type conversion that is different from what
2639 would happen to the same argument in the absence of a prototype.  This
2640 includes conversions of fixed point to floating and vice versa, and
2641 conversions changing the width or signedness of a fixed point argument
2642 except when the same as the default promotion.
2643
2644 Also, warn if a negative integer constant expression is implicitly
2645 converted to an unsigned type.  For example, warn about the assignment
2646 @code{x = -1} if @code{x} is unsigned.  But do not warn about explicit
2647 casts like @code{(unsigned) -1}.
2648
2649 @item -Wsign-compare
2650 @opindex Wsign-compare
2651 @cindex warning for comparison of signed and unsigned values
2652 @cindex comparison of signed and unsigned values, warning
2653 @cindex signed and unsigned values, comparison warning
2654 Warn when a comparison between signed and unsigned values could produce
2655 an incorrect result when the signed value is converted to unsigned.
2656 This warning is also enabled by @option{-W}; to get the other warnings
2657 of @option{-W} without this warning, use @samp{-W -Wno-sign-compare}.
2658
2659 @item -Waggregate-return
2660 @opindex Waggregate-return
2661 Warn if any functions that return structures or unions are defined or
2662 called.  (In languages where you can return an array, this also elicits
2663 a warning.)
2664
2665 @item -Wstrict-prototypes @r{(C only)}
2666 @opindex Wstrict-prototypes
2667 Warn if a function is declared or defined without specifying the
2668 argument types.  (An old-style function definition is permitted without
2669 a warning if preceded by a declaration which specifies the argument
2670 types.)
2671
2672 @item -Wmissing-prototypes @r{(C only)}
2673 @opindex Wmissing-prototypes
2674 Warn if a global function is defined without a previous prototype
2675 declaration.  This warning is issued even if the definition itself
2676 provides a prototype.  The aim is to detect global functions that fail
2677 to be declared in header files.
2678
2679 @item -Wmissing-declarations
2680 @opindex Wmissing-declarations
2681 Warn if a global function is defined without a previous declaration.
2682 Do so even if the definition itself provides a prototype.
2683 Use this option to detect global functions that are not declared in
2684 header files.
2685
2686 @item -Wmissing-noreturn
2687 @opindex Wmissing-noreturn
2688 Warn about functions which might be candidates for attribute @code{noreturn}.
2689 Note these are only possible candidates, not absolute ones.  Care should
2690 be taken to manually verify functions actually do not ever return before
2691 adding the @code{noreturn} attribute, otherwise subtle code generation
2692 bugs could be introduced.  You will not get a warning for @code{main} in
2693 hosted C environments.
2694
2695 @item -Wmissing-format-attribute
2696 @opindex Wmissing-format-attribute
2697 @opindex Wformat
2698 If @option{-Wformat} is enabled, also warn about functions which might be
2699 candidates for @code{format} attributes.  Note these are only possible
2700 candidates, not absolute ones.  GCC will guess that @code{format}
2701 attributes might be appropriate for any function that calls a function
2702 like @code{vprintf} or @code{vscanf}, but this might not always be the
2703 case, and some functions for which @code{format} attributes are
2704 appropriate may not be detected.  This option has no effect unless
2705 @option{-Wformat} is enabled (possibly by @option{-Wall}).
2706
2707 @item -Wno-multichar
2708 @opindex Wno-multichar
2709 @opindex Wmultichar
2710 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
2711 Usually they indicate a typo in the user's code, as they have
2712 implementation-defined values, and should not be used in portable code.
2713
2714 @item -Wno-deprecated-declarations
2715 @opindex Wno-deprecated-declarations
2716 Do not warn about uses of functions, variables, and types marked as
2717 deprecated by using the @code{deprecated} attribute.
2718 (@pxref{Function Attributes}, @pxref{Variable Attributes},
2719 @pxref{Type Attributes}.)
2720
2721 @item -Wpacked
2722 @opindex Wpacked
2723 Warn if a structure is given the packed attribute, but the packed
2724 attribute has no effect on the layout or size of the structure.
2725 Such structures may be mis-aligned for little benefit.  For
2726 instance, in this code, the variable @code{f.x} in @code{struct bar}
2727 will be misaligned even though @code{struct bar} does not itself
2728 have the packed attribute:
2729
2730 @smallexample
2731 @group
2732 struct foo @{
2733   int x;
2734   char a, b, c, d;
2735 @} __attribute__((packed));
2736 struct bar @{
2737   char z;
2738   struct foo f;
2739 @};
2740 @end group
2741 @end smallexample
2742
2743 @item -Wpadded
2744 @opindex Wpadded
2745 Warn if padding is included in a structure, either to align an element
2746 of the structure or to align the whole structure.  Sometimes when this
2747 happens it is possible to rearrange the fields of the structure to
2748 reduce the padding and so make the structure smaller.
2749
2750 @item -Wredundant-decls
2751 @opindex Wredundant-decls
2752 Warn if anything is declared more than once in the same scope, even in
2753 cases where multiple declaration is valid and changes nothing.
2754
2755 @item -Wnested-externs @r{(C only)}
2756 @opindex Wnested-externs
2757 Warn if an @code{extern} declaration is encountered within a function.
2758
2759 @item -Wunreachable-code
2760 @opindex Wunreachable-code
2761 Warn if the compiler detects that code will never be executed.
2762
2763 This option is intended to warn when the compiler detects that at
2764 least a whole line of source code will never be executed, because
2765 some condition is never satisfied or because it is after a
2766 procedure that never returns.
2767
2768 It is possible for this option to produce a warning even though there
2769 are circumstances under which part of the affected line can be executed,
2770 so care should be taken when removing apparently-unreachable code.
2771
2772 For instance, when a function is inlined, a warning may mean that the
2773 line is unreachable in only one inlined copy of the function.
2774
2775 This option is not made part of @option{-Wall} because in a debugging
2776 version of a program there is often substantial code which checks
2777 correct functioning of the program and is, hopefully, unreachable
2778 because the program does work.  Another common use of unreachable
2779 code is to provide behavior which is selectable at compile-time.
2780
2781 @item -Winline
2782 @opindex Winline
2783 Warn if a function can not be inlined and it was declared as inline.
2784
2785 @item -Wlong-long
2786 @opindex Wlong-long
2787 @opindex Wno-long-long
2788 Warn if @samp{long long} type is used.  This is default.  To inhibit
2789 the warning messages, use @option{-Wno-long-long}.  Flags
2790 @option{-Wlong-long} and @option{-Wno-long-long} are taken into account
2791 only when @option{-pedantic} flag is used.
2792
2793 @item -Wdisabled-optimization
2794 @opindex Wdisabled-optimization
2795 Warn if a requested optimization pass is disabled.  This warning does
2796 not generally indicate that there is anything wrong with your code; it
2797 merely indicates that GCC's optimizers were unable to handle the code
2798 effectively.  Often, the problem is that your code is too big or too
2799 complex; GCC will refuse to optimize programs when the optimization
2800 itself is likely to take inordinate amounts of time.
2801
2802 @item -Werror
2803 @opindex Werror
2804 Make all warnings into errors.
2805 @end table
2806
2807 @node Debugging Options
2808 @section Options for Debugging Your Program or GCC
2809 @cindex options, debugging
2810 @cindex debugging information options
2811
2812 GCC has various special options that are used for debugging
2813 either your program or GCC:
2814
2815 @table @gcctabopt
2816 @item -g
2817 @opindex g
2818 Produce debugging information in the operating system's native format
2819 (stabs, COFF, XCOFF, or DWARF)@.  GDB can work with this debugging
2820 information.
2821
2822 On most systems that use stabs format, @option{-g} enables use of extra
2823 debugging information that only GDB can use; this extra information
2824 makes debugging work better in GDB but will probably make other debuggers
2825 crash or
2826 refuse to read the program.  If you want to control for certain whether
2827 to generate the extra information, use @option{-gstabs+}, @option{-gstabs},
2828 @option{-gxcoff+}, @option{-gxcoff}, @option{-gdwarf-1+}, @option{-gdwarf-1},
2829 or @option{-gvms} (see below).
2830
2831 Unlike most other C compilers, GCC allows you to use @option{-g} with
2832 @option{-O}.  The shortcuts taken by optimized code may occasionally
2833 produce surprising results: some variables you declared may not exist
2834 at all; flow of control may briefly move where you did not expect it;
2835 some statements may not be executed because they compute constant
2836 results or their values were already at hand; some statements may
2837 execute in different places because they were moved out of loops.
2838
2839 Nevertheless it proves possible to debug optimized output.  This makes
2840 it reasonable to use the optimizer for programs that might have bugs.
2841
2842 The following options are useful when GCC is generated with the
2843 capability for more than one debugging format.
2844
2845 @item -ggdb
2846 @opindex ggdb
2847 Produce debugging information for use by GDB@.  This means to use the
2848 most expressive format available (DWARF 2, stabs, or the native format
2849 if neither of those are supported), including GDB extensions if at all
2850 possible.
2851
2852 @item -gstabs
2853 @opindex gstabs
2854 Produce debugging information in stabs format (if that is supported),
2855 without GDB extensions.  This is the format used by DBX on most BSD
2856 systems.  On MIPS, Alpha and System V Release 4 systems this option
2857 produces stabs debugging output which is not understood by DBX or SDB@.
2858 On System V Release 4 systems this option requires the GNU assembler.
2859
2860 @item -gstabs+
2861 @opindex gstabs+
2862 Produce debugging information in stabs format (if that is supported),
2863 using GNU extensions understood only by the GNU debugger (GDB)@.  The
2864 use of these extensions is likely to make other debuggers crash or
2865 refuse to read the program.
2866
2867 @item -gcoff
2868 @opindex gcoff
2869 Produce debugging information in COFF format (if that is supported).
2870 This is the format used by SDB on most System V systems prior to
2871 System V Release 4.
2872
2873 @item -gxcoff
2874 @opindex gxcoff
2875 Produce debugging information in XCOFF format (if that is supported).
2876 This is the format used by the DBX debugger on IBM RS/6000 systems.
2877
2878 @item -gxcoff+
2879 @opindex gxcoff+
2880 Produce debugging information in XCOFF format (if that is supported),
2881 using GNU extensions understood only by the GNU debugger (GDB)@.  The
2882 use of these extensions is likely to make other debuggers crash or
2883 refuse to read the program, and may cause assemblers other than the GNU
2884 assembler (GAS) to fail with an error.
2885
2886 @item -gdwarf
2887 @opindex gdwarf
2888 Produce debugging information in DWARF version 1 format (if that is
2889 supported).  This is the format used by SDB on most System V Release 4
2890 systems.
2891
2892 This option is deprecated.
2893
2894 @item -gdwarf+
2895 @opindex gdwarf+
2896 Produce debugging information in DWARF version 1 format (if that is
2897 supported), using GNU extensions understood only by the GNU debugger
2898 (GDB)@.  The use of these extensions is likely to make other debuggers
2899 crash or refuse to read the program.
2900
2901 This option is deprecated.
2902
2903 @item -gdwarf-2
2904 @opindex gdwarf-2
2905 Produce debugging information in DWARF version 2 format (if that is
2906 supported).  This is the format used by DBX on IRIX 6.
2907
2908 @item -gvms
2909 @opindex gvms
2910 Produce debugging information in VMS debug format (if that is
2911 supported).  This is the format used by DEBUG on VMS systems.
2912
2913 @item -g@var{level}
2914 @itemx -ggdb@var{level}
2915 @itemx -gstabs@var{level}
2916 @itemx -gcoff@var{level}
2917 @itemx -gxcoff@var{level}
2918 @itemx -gvms@var{level}
2919 Request debugging information and also use @var{level} to specify how
2920 much information.  The default level is 2.
2921
2922 Level 1 produces minimal information, enough for making backtraces in
2923 parts of the program that you don't plan to debug.  This includes
2924 descriptions of functions and external variables, but no information
2925 about local variables and no line numbers.
2926
2927 Level 3 includes extra information, such as all the macro definitions
2928 present in the program.  Some debuggers support macro expansion when
2929 you use @option{-g3}.
2930
2931 Note that in order to avoid confusion between DWARF1 debug level 2,
2932 and DWARF2, neither @option{-gdwarf} nor @option{-gdwarf-2} accept
2933 a concatenated debug level.  Instead use an additional @option{-g@var{level}}
2934 option to change the debug level for DWARF1 or DWARF2.
2935
2936 @item -feliminate-dwarf2-dups
2937 @opindex feliminate-dwarf2-dups
2938 Compress DWARF2 debugging information by eliminating duplicated
2939 information about each symbol.  This option only makes sense when
2940 generating DWARF2 debugging information with @option{-gdwarf-2}.
2941
2942 @cindex @code{prof}
2943 @item -p
2944 @opindex p
2945 Generate extra code to write profile information suitable for the
2946 analysis program @code{prof}.  You must use this option when compiling
2947 the source files you want data about, and you must also use it when
2948 linking.
2949
2950 @cindex @code{gprof}
2951 @item -pg
2952 @opindex pg
2953 Generate extra code to write profile information suitable for the
2954 analysis program @code{gprof}.  You must use this option when compiling
2955 the source files you want data about, and you must also use it when
2956 linking.
2957
2958 @item -Q
2959 @opindex Q
2960 Makes the compiler print out each function name as it is compiled, and
2961 print some statistics about each pass when it finishes.
2962
2963 @item -ftime-report
2964 @opindex ftime-report
2965 Makes the compiler print some statistics about the time consumed by each
2966 pass when it finishes.
2967
2968 @item -fmem-report
2969 @opindex fmem-report
2970 Makes the compiler print some statistics about permanent memory
2971 allocation when it finishes.
2972
2973 @item -fprofile-arcs
2974 @opindex fprofile-arcs
2975 Instrument @dfn{arcs} during compilation to generate coverage data or
2976 for profile-directed block ordering.  During execution the program
2977 records how many times each branch is executed and how many times it is
2978 taken.  When the compiled program exits it saves this data to a file
2979 called @file{@var{auxname}.da} for each source file.  @var{auxname} is
2980 generated from the name of the output file, if explicitly specified and
2981 it is not the final executable, otherwise it is the basename of the
2982 source file. In both cases any suffix is removed (e.g.  @file{foo.da}
2983 for input file @file{dir/foo.c}, or @file{dir/foo.da} for output file
2984 specified as @option{-o dir/foo.o}).
2985
2986 For profile-directed block ordering, compile the program with
2987 @option{-fprofile-arcs} plus optimization and code generation options,
2988 generate the arc profile information by running the program on a
2989 selected workload, and then compile the program again with the same
2990 optimization and code generation options plus
2991 @option{-fbranch-probabilities} (@pxref{Optimize Options,,Options that
2992 Control Optimization}).
2993
2994 The other use of @option{-fprofile-arcs} is for use with @code{gcov},
2995 when it is used with the @option{-ftest-coverage} option.
2996
2997 With @option{-fprofile-arcs}, for each function of your program GCC
2998 creates a program flow graph, then finds a spanning tree for the graph.
2999 Only arcs that are not on the spanning tree have to be instrumented: the
3000 compiler adds code to count the number of times that these arcs are
3001 executed.  When an arc is the only exit or only entrance to a block, the
3002 instrumentation code can be added to the block; otherwise, a new basic
3003 block must be created to hold the instrumentation code.
3004
3005 @need 2000
3006 @item -ftest-coverage
3007 @opindex ftest-coverage
3008 Create data files for the @code{gcov} code-coverage utility
3009 (@pxref{Gcov,, @code{gcov}: a GCC Test Coverage Program}).  See
3010 @option{-fprofile-arcs} option above for a description of @var{auxname}.
3011
3012 @table @gcctabopt
3013 @item @var{auxname}.bb
3014 A mapping from basic blocks to line numbers, which @code{gcov} uses to
3015 associate basic block execution counts with line numbers.
3016
3017 @item @var{auxname}.bbg
3018 A list of all arcs in the program flow graph.  This allows @code{gcov}
3019 to reconstruct the program flow graph, so that it can compute all basic
3020 block and arc execution counts from the information in the
3021 @file{@var{auxname}.da} file.
3022 @end table
3023
3024 Use @option{-ftest-coverage} with @option{-fprofile-arcs}; the latter
3025 option adds instrumentation to the program, which then writes
3026 execution counts to another data file:
3027
3028 @table @gcctabopt
3029 @item @var{auxname}.da
3030 Runtime arc execution counts, used in conjunction with the arc
3031 information in the file @file{@var{auxname}.bbg}.
3032 @end table
3033
3034 Coverage data will map better to the source files if
3035 @option{-ftest-coverage} is used without optimization.
3036
3037 @item -d@var{letters}
3038 @opindex d
3039 Says to make debugging dumps during compilation at times specified by
3040 @var{letters}.  This is used for debugging the compiler.  The file names
3041 for most of the dumps are made by appending a pass number and a word to
3042 the @var{dumpname}. @var{dumpname} is generated from the name of the
3043 output file, if explicitly specified and it is not an executable,
3044 otherwise it is the basename of the source file. In both cases any
3045 suffix is removed (e.g.  @file{foo.00.rtl} or @file{foo.01.sibling}).
3046 Here are the possible letters for use in @var{letters}, and their
3047 meanings:
3048
3049 @table @samp
3050 @item A
3051 @opindex dA
3052 Annotate the assembler output with miscellaneous debugging information.
3053 @item b
3054 @opindex db
3055 Dump after computing branch probabilities, to @file{@var{file}.15.bp}.
3056 @item B
3057 @opindex dB
3058 Dump after block reordering, to @file{@var{file}.30.bbro}.
3059 @item c
3060 @opindex dc
3061 Dump after instruction combination, to the file @file{@var{file}.17.combine}.
3062 @item C
3063 @opindex dC
3064 Dump after the first if conversion, to the file @file{@var{file}.18.ce}.
3065 @item d
3066 @opindex dd
3067 Dump after delayed branch scheduling, to @file{@var{file}.32.dbr}.
3068 @item D
3069 @opindex dD
3070 Dump all macro definitions, at the end of preprocessing, in addition to
3071 normal output.
3072 @item e
3073 @opindex de
3074 Dump after SSA optimizations, to @file{@var{file}.04.ssa} and
3075 @file{@var{file}.07.ussa}.
3076 @item E
3077 @opindex dE
3078 Dump after the second if conversion, to @file{@var{file}.27.ce2}.
3079 @item f
3080 @opindex df
3081 Dump after life analysis, to @file{@var{file}.16.life}.
3082 @item F
3083 @opindex dF
3084 Dump after purging @code{ADDRESSOF} codes, to @file{@var{file}.10.addressof}.
3085 @item g
3086 @opindex dg
3087 Dump after global register allocation, to @file{@var{file}.22.greg}.
3088 @item h
3089 @opindex dh
3090 Dump after finalization of EH handling code, to @file{@var{file}.02.eh}.
3091 @item k
3092 @opindex dk
3093 Dump after reg-to-stack conversion, to @file{@var{file}.29.stack}.
3094 @item o
3095 @opindex do
3096 Dump after post-reload optimizations, to @file{@var{file}.23.postreload}.
3097 @item G
3098 @opindex dG
3099 Dump after GCSE, to @file{@var{file}.11.gcse}.
3100 @item i
3101 @opindex di
3102 Dump after sibling call optimizations, to @file{@var{file}.01.sibling}.
3103 @item j
3104 @opindex dj
3105 Dump after the first jump optimization, to @file{@var{file}.03.jump}.
3106 @item k
3107 @opindex dk
3108 Dump after conversion from registers to stack, to @file{@var{file}.33.stack}.
3109 @item l
3110 @opindex dl
3111 Dump after local register allocation, to @file{@var{file}.21.lreg}.
3112 @item L
3113 @opindex dL
3114 Dump after loop optimization, to @file{@var{file}.12.loop}.
3115 @item M
3116 @opindex dM
3117 Dump after performing the machine dependent reorganisation pass, to
3118 @file{@var{file}.31.mach}.
3119 @item n
3120 @opindex dn
3121 Dump after register renumbering, to @file{@var{file}.26.rnreg}.
3122 @item N
3123 @opindex dN
3124 Dump after the register move pass, to @file{@var{file}.19.regmove}.
3125 @item r
3126 @opindex dr
3127 Dump after RTL generation, to @file{@var{file}.00.rtl}.
3128 @item R
3129 @opindex dR
3130 Dump after the second scheduling pass, to @file{@var{file}.28.sched2}.
3131 @item s
3132 @opindex ds
3133 Dump after CSE (including the jump optimization that sometimes follows
3134 CSE), to @file{@var{file}.09.cse}.
3135 @item S
3136 @opindex dS
3137 Dump after the first scheduling pass, to @file{@var{file}.20.sched}.
3138 @item t
3139 @opindex dt
3140 Dump after the second CSE pass (including the jump optimization that
3141 sometimes follows CSE), to @file{@var{file}.13.cse2}.
3142 @item u
3143 @opindex du
3144 Dump after null pointer ellimination pass ti @file{@var{file}.08.null}.
3145 @item w
3146 @opindex dw
3147 Dump after the second flow pass, to @file{@var{file}.24.flow2}.
3148 @item X
3149 @opindex dX
3150 Dump after SSA dead code elimination, to @file{@var{file}.06.ssadce}.
3151 @item z
3152 @opindex dz
3153 Dump after the peephole pass, to @file{@var{file}.25.peephole2}.
3154 @item a
3155 @opindex da
3156 Produce all the dumps listed above.
3157 @item m
3158 @opindex dm
3159 Print statistics on memory usage, at the end of the run, to
3160 standard error.
3161 @item p
3162 @opindex dp
3163 Annotate the assembler output with a comment indicating which
3164 pattern and alternative was used.  The length of each instruction is
3165 also printed.
3166 @item P
3167 @opindex dP
3168 Dump the RTL in the assembler output as a comment before each instruction.
3169 Also turns on @option{-dp} annotation.
3170 @item v
3171 @opindex dv
3172 For each of the other indicated dump files (except for
3173 @file{@var{file}.00.rtl}), dump a representation of the control flow graph
3174 suitable for viewing with VCG to @file{@var{file}.@var{pass}.vcg}.
3175 @item x
3176 @opindex dx
3177 Just generate RTL for a function instead of compiling it.  Usually used
3178 with @samp{r}.
3179 @item y
3180 @opindex dy
3181 Dump debugging information during parsing, to standard error.
3182 @end table
3183
3184 @item -fdump-unnumbered
3185 @opindex fdump-unnumbered
3186 When doing debugging dumps (see @option{-d} option above), suppress instruction
3187 numbers and line number note output.  This makes it more feasible to
3188 use diff on debugging dumps for compiler invocations with different
3189 options, in particular with and without @option{-g}.
3190
3191 @item -fdump-translation-unit @r{(C and C++ only)}
3192 @itemx -fdump-translation-unit-@var{options} @r{(C and C++ only)}
3193 @opindex fdump-translation-unit
3194 Dump a representation of the tree structure for the entire translation
3195 unit to a file.  The file name is made by appending @file{.tu} to the
3196 source file name.  If the @samp{-@var{options}} form is used, @var{options}
3197 controls the details of the dump as described for the
3198 @option{-fdump-tree} options.
3199
3200 @item -fdump-class-hierarchy @r{(C++ only)}
3201 @itemx -fdump-class-hierarchy-@var{options} @r{(C++ only)}
3202 @opindex fdump-class-hierarchy
3203 Dump a representation of each class's hierarchy and virtual function
3204 table layout to a file.  The file name is made by appending @file{.class}
3205 to the source file name.  If the @samp{-@var{options}} form is used,
3206 @var{options} controls the details of the dump as described for the
3207 @option{-fdump-tree} options.
3208
3209 @item -fdump-tree-@var{switch} @r{(C++ only)}
3210 @itemx -fdump-tree-@var{switch}-@var{options} @r{(C++ only)}
3211 @opindex fdump-tree
3212 Control the dumping at various stages of processing the intermediate
3213 language tree to a file.  The file name is generated by appending a switch
3214 specific suffix to the source file name.  If the @samp{-@var{options}}
3215 form is used, @var{options} is a list of @samp{-} separated options that
3216 control the details of the dump. Not all options are applicable to all
3217 dumps, those which are not meaningful will be ignored. The following
3218 options are available
3219
3220 @table @samp
3221 @item address
3222 Print the address of each node.  Usually this is not meaningful as it
3223 changes according to the environment and source file. Its primary use
3224 is for tying up a dump file with a debug environment.
3225 @item slim
3226 Inhibit dumping of members of a scope or body of a function merely
3227 because that scope has been reached. Only dump such items when they
3228 are directly reachable by some other path.
3229 @item all
3230 Turn on all options.
3231 @end table
3232
3233 The following tree dumps are possible:
3234 @table @samp
3235 @item original
3236 Dump before any tree based optimization, to @file{@var{file}.original}.
3237 @item optimized
3238 Dump after all tree based optimization, to @file{@var{file}.optimized}.
3239 @item inlined
3240 Dump after function inlining, to @file{@var{file}.inlined}.
3241 @end table
3242
3243 @item -fsched-verbose=@var{n}
3244 @opindex fsched-verbose
3245 On targets that use instruction scheduling, this option controls the
3246 amount of debugging output the scheduler prints.  This information is
3247 written to standard error, unless @option{-dS} or @option{-dR} is
3248 specified, in which case it is output to the usual dump
3249 listing file, @file{.sched} or @file{.sched2} respectively.  However
3250 for @var{n} greater than nine, the output is always printed to standard
3251 error.
3252
3253 For @var{n} greater than zero, @option{-fsched-verbose} outputs the
3254 same information as @option{-dRS}.  For @var{n} greater than one, it
3255 also output basic block probabilities, detailed ready list information
3256 and unit/insn info.  For @var{n} greater than two, it includes RTL
3257 at abort point, control-flow and regions info.  And for @var{n} over
3258 four, @option{-fsched-verbose} also includes dependence info.
3259
3260 @item -save-temps
3261 @opindex save-temps
3262 Store the usual ``temporary'' intermediate files permanently; place them
3263 in the current directory and name them based on the source file.  Thus,
3264 compiling @file{foo.c} with @samp{-c -save-temps} would produce files
3265 @file{foo.i} and @file{foo.s}, as well as @file{foo.o}.  This creates a
3266 preprocessed @file{foo.i} output file even though the compiler now
3267 normally uses an integrated preprocessor.
3268
3269 @item -time
3270 @opindex time
3271 Report the CPU time taken by each subprocess in the compilation
3272 sequence.  For C source files, this is the compiler proper and assembler
3273 (plus the linker if linking is done).  The output looks like this:
3274
3275 @smallexample
3276 # cc1 0.12 0.01
3277 # as 0.00 0.01
3278 @end smallexample
3279
3280 The first number on each line is the ``user time,'' that is time spent
3281 executing the program itself.  The second number is ``system time,''
3282 time spent executing operating system routines on behalf of the program.
3283 Both numbers are in seconds.
3284
3285 @item -print-file-name=@var{library}
3286 @opindex print-file-name
3287 Print the full absolute name of the library file @var{library} that
3288 would be used when linking---and don't do anything else.  With this
3289 option, GCC does not compile or link anything; it just prints the
3290 file name.
3291
3292 @item -print-multi-directory
3293 @opindex print-multi-directory
3294 Print the directory name corresponding to the multilib selected by any
3295 other switches present in the command line.  This directory is supposed
3296 to exist in @env{GCC_EXEC_PREFIX}.
3297
3298 @item -print-multi-lib
3299 @opindex print-multi-lib
3300 Print the mapping from multilib directory names to compiler switches
3301 that enable them.  The directory name is separated from the switches by
3302 @samp{;}, and each switch starts with an @samp{@@} instead of the
3303 @samp{-}, without spaces between multiple switches.  This is supposed to
3304 ease shell-processing.
3305
3306 @item -print-prog-name=@var{program}
3307 @opindex print-prog-name
3308 Like @option{-print-file-name}, but searches for a program such as @samp{cpp}.
3309
3310 @item -print-libgcc-file-name
3311 @opindex print-libgcc-file-name
3312 Same as @option{-print-file-name=libgcc.a}.
3313
3314 This is useful when you use @option{-nostdlib} or @option{-nodefaultlibs}
3315 but you do want to link with @file{libgcc.a}.  You can do
3316
3317 @example
3318 gcc -nostdlib @var{files}@dots{} `gcc -print-libgcc-file-name`
3319 @end example
3320
3321 @item -print-search-dirs
3322 @opindex print-search-dirs
3323 Print the name of the configured installation directory and a list of
3324 program and library directories gcc will search---and don't do anything else.
3325
3326 This is useful when gcc prints the error message
3327 @samp{installation problem, cannot exec cpp0: No such file or directory}.
3328 To resolve this you either need to put @file{cpp0} and the other compiler
3329 components where gcc expects to find them, or you can set the environment
3330 variable @env{GCC_EXEC_PREFIX} to the directory where you installed them.
3331 Don't forget the trailing '/'.
3332 @xref{Environment Variables}.
3333
3334 @item -dumpmachine
3335 @opindex dumpmachine
3336 Print the compiler's target machine (for example,
3337 @samp{i686-pc-linux-gnu})---and don't do anything else.
3338
3339 @item -dumpversion
3340 @opindex dumpversion
3341 Print the compiler version (for example, @samp{3.0})---and don't do
3342 anything else.
3343
3344 @item -dumpspecs
3345 @opindex dumpspecs
3346 Print the compiler's built-in specs---and don't do anything else.  (This
3347 is used when GCC itself is being built.)  @xref{Spec Files}.
3348 @end table
3349
3350 @node Optimize Options
3351 @section Options That Control Optimization
3352 @cindex optimize options
3353 @cindex options, optimization
3354
3355 These options control various sorts of optimizations:
3356
3357 @table @gcctabopt
3358 @item -O
3359 @itemx -O1
3360 @opindex O
3361 @opindex O1
3362 Optimize.  Optimizing compilation takes somewhat more time, and a lot
3363 more memory for a large function.
3364
3365 Without @option{-O}, the compiler's goal is to reduce the cost of
3366 compilation and to make debugging produce the expected results.
3367 Statements are independent: if you stop the program with a breakpoint
3368 between statements, you can then assign a new value to any variable or
3369 change the program counter to any other statement in the function and
3370 get exactly the results you would expect from the source code.
3371
3372 With @option{-O}, the compiler tries to reduce code size and execution
3373 time, without performing any optimizations that take a great deal of
3374 compilation time.
3375
3376 @item -O2
3377 @opindex O2
3378 Optimize even more.  GCC performs nearly all supported optimizations
3379 that do not involve a space-speed tradeoff.  The compiler does not
3380 perform loop unrolling or function inlining when you specify @option{-O2}.
3381 As compared to @option{-O}, this option increases both compilation time
3382 and the performance of the generated code.
3383
3384 @option{-O2} turns on all optional optimizations except for loop
3385 unrolling, function inlining, and register renaming.  It also turns on
3386 the @option{-fforce-mem} and @option{-fstrict-aliasing} option on all
3387 machines and frame pointer elimination on machines where doing so does
3388 not interfere with debugging.
3389
3390 Please note the warning under @option{-fgcse} about
3391 invoking @option{-O2} on programs that use computed gotos.
3392
3393 @item -O3
3394 @opindex O3
3395 Optimize yet more.  @option{-O3} turns on all optimizations specified by
3396 @option{-O2} and also turns on the @option{-finline-functions} and
3397 @option{-frename-registers} options.
3398
3399 @item -O0
3400 @opindex O0
3401 Do not optimize.
3402
3403 @item -Os
3404 @opindex Os
3405 Optimize for size.  @option{-Os} enables all @option{-O2} optimizations that
3406 do not typically increase code size.  It also performs further
3407 optimizations designed to reduce code size.
3408
3409 If you use multiple @option{-O} options, with or without level numbers,
3410 the last such option is the one that is effective.
3411 @end table
3412
3413 Options of the form @option{-f@var{flag}} specify machine-independent
3414 flags.  Most flags have both positive and negative forms; the negative
3415 form of @option{-ffoo} would be @option{-fno-foo}.  In the table below,
3416 only one of the forms is listed---the one which is not the default.
3417 You can figure out the other form by either removing @samp{no-} or
3418 adding it.
3419
3420 @table @gcctabopt
3421 @item -ffloat-store
3422 @opindex ffloat-store
3423 Do not store floating point variables in registers, and inhibit other
3424 options that might change whether a floating point value is taken from a
3425 register or memory.
3426
3427 @cindex floating point precision
3428 This option prevents undesirable excess precision on machines such as
3429 the 68000 where the floating registers (of the 68881) keep more
3430 precision than a @code{double} is supposed to have.  Similarly for the
3431 x86 architecture.  For most programs, the excess precision does only
3432 good, but a few programs rely on the precise definition of IEEE floating
3433 point.  Use @option{-ffloat-store} for such programs, after modifying
3434 them to store all pertinent intermediate computations into variables.
3435
3436 @item -fno-default-inline
3437 @opindex fno-default-inline
3438 Do not make member functions inline by default merely because they are
3439 defined inside the class scope (C++ only).  Otherwise, when you specify
3440 @w{@option{-O}}, member functions defined inside class scope are compiled
3441 inline by default; i.e., you don't need to add @samp{inline} in front of
3442 the member function name.
3443
3444 @item -fno-defer-pop
3445 @opindex fno-defer-pop
3446 Always pop the arguments to each function call as soon as that function
3447 returns.  For machines which must pop arguments after a function call,
3448 the compiler normally lets arguments accumulate on the stack for several
3449 function calls and pops them all at once.
3450
3451 @item -fforce-mem
3452 @opindex fforce-mem
3453 Force memory operands to be copied into registers before doing
3454 arithmetic on them.  This produces better code by making all memory
3455 references potential common subexpressions.  When they are not common
3456 subexpressions, instruction combination should eliminate the separate
3457 register-load.  The @option{-O2} option turns on this option.
3458
3459 @item -fforce-addr
3460 @opindex fforce-addr
3461 Force memory address constants to be copied into registers before
3462 doing arithmetic on them.  This may produce better code just as
3463 @option{-fforce-mem} may.
3464
3465 @item -fomit-frame-pointer
3466 @opindex fomit-frame-pointer
3467 Don't keep the frame pointer in a register for functions that
3468 don't need one.  This avoids the instructions to save, set up and
3469 restore frame pointers; it also makes an extra register available
3470 in many functions.  @strong{It also makes debugging impossible on
3471 some machines.}
3472
3473 On some machines, such as the VAX, this flag has no effect, because
3474 the standard calling sequence automatically handles the frame pointer
3475 and nothing is saved by pretending it doesn't exist.  The
3476 machine-description macro @code{FRAME_POINTER_REQUIRED} controls
3477 whether a target machine supports this flag.  @xref{Registers,,Register
3478 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
3479
3480 @item -foptimize-sibling-calls
3481 @opindex foptimize-sibling-calls
3482 Optimize sibling and tail recursive calls.
3483
3484 @item -ftrapv
3485 @opindex ftrapv
3486 This option generates traps for signed overflow on addition, subtraction,
3487 multiplication operations.
3488
3489 @item -fno-inline
3490 @opindex fno-inline
3491 Don't pay attention to the @code{inline} keyword.  Normally this option
3492 is used to keep the compiler from expanding any functions inline.
3493 Note that if you are not optimizing, no functions can be expanded inline.
3494
3495 @item -finline-functions
3496 @opindex finline-functions
3497 Integrate all simple functions into their callers.  The compiler
3498 heuristically decides which functions are simple enough to be worth
3499 integrating in this way.
3500
3501 If all calls to a given function are integrated, and the function is
3502 declared @code{static}, then the function is normally not output as
3503 assembler code in its own right.
3504
3505 @item -finline-limit=@var{n}
3506 @opindex finline-limit
3507 By default, gcc limits the size of functions that can be inlined.  This flag
3508 allows the control of this limit for functions that are explicitly marked as
3509 inline (ie marked with the inline keyword or defined within the class
3510 definition in c++).  @var{n} is the size of functions that can be inlined in
3511 number of pseudo instructions (not counting parameter handling).  The default
3512 value of @var{n} is 600.
3513 Increasing this value can result in more inlined code at
3514 the cost of compilation time and memory consumption.  Decreasing usually makes
3515 the compilation faster and less code will be inlined (which presumably
3516 means slower programs).  This option is particularly useful for programs that
3517 use inlining heavily such as those based on recursive templates with C++.
3518
3519 @emph{Note:} pseudo instruction represents, in this particular context, an
3520 abstract measurement of function's size.  In no way, it represents a count
3521 of assembly instructions and as such its exact meaning might change from one
3522 release to an another.
3523
3524 @item -fkeep-inline-functions
3525 @opindex fkeep-inline-functions
3526 Even if all calls to a given function are integrated, and the function
3527 is declared @code{static}, nevertheless output a separate run-time
3528 callable version of the function.  This switch does not affect
3529 @code{extern inline} functions.
3530
3531 @item -fkeep-static-consts
3532 @opindex fkeep-static-consts
3533 Emit variables declared @code{static const} when optimization isn't turned
3534 on, even if the variables aren't referenced.
3535
3536 GCC enables this option by default.  If you want to force the compiler to
3537 check if the variable was referenced, regardless of whether or not
3538 optimization is turned on, use the @option{-fno-keep-static-consts} option.
3539
3540 @item -fmerge-constants
3541 Attempt to merge identical constants (string constants and floating point
3542 constants) accross compilation units.
3543
3544 This option is default for optimized compilation if assembler and linker
3545 support it.  Use @option{-fno-merge-constants} to inhibit this behavior.
3546
3547 @item -fmerge-all-constants
3548 Attempt to merge identical constants and identical variables.
3549
3550 This option implies @option{-fmerge-constants}.  In addition to
3551 @option{-fmerge-constants} this considers e.g. even constant initialized
3552 arrays or initialized constant variables with integral or floating point
3553 types.  Languages like C or C++ require each non-automatic variable to
3554 have distinct location, so using this option will result in non-conforming
3555 behavior.
3556
3557 @item -fnew-ra
3558 @opindex fnew-ra
3559 Use a graph coloring register allocator.  Currently this option is meant
3560 for testing, so we are interested to hear about miscompilations with
3561 @option{-fnew-ra}.
3562
3563 @item -fno-branch-count-reg
3564 @opindex fno-branch-count-reg
3565 Do not use ``decrement and branch'' instructions on a count register,
3566 but instead generate a sequence of instructions that decrement a
3567 register, compare it against zero, then branch based upon the result.
3568 This option is only meaningful on architectures that support such
3569 instructions, which include x86, PowerPC, IA-64 and S/390.
3570
3571 @item -fno-function-cse
3572 @opindex fno-function-cse
3573 Do not put function addresses in registers; make each instruction that
3574 calls a constant function contain the function's address explicitly.
3575
3576 This option results in less efficient code, but some strange hacks
3577 that alter the assembler output may be confused by the optimizations
3578 performed when this option is not used.
3579
3580 @item -ffast-math
3581 @opindex ffast-math
3582 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
3583 @option{-fno-trapping-math}, @option{-ffinite-math-only} and @*
3584 @option{-fno-signaling-nans}.
3585
3586 This option causes the preprocessor macro @code{__FAST_MATH__} to be defined.
3587
3588 This option should never be turned on by any @option{-O} option since
3589 it can result in incorrect output for programs which depend on
3590 an exact implementation of IEEE or ISO rules/specifications for
3591 math functions.
3592
3593 @item -fno-math-errno
3594 @opindex fno-math-errno
3595 Do not set ERRNO after calling math functions that are executed
3596 with a single instruction, e.g., sqrt.  A program that relies on
3597 IEEE exceptions for math error handling may want to use this flag
3598 for speed while maintaining IEEE arithmetic compatibility.
3599
3600 This option should never be turned on by any @option{-O} option since
3601 it can result in incorrect output for programs which depend on
3602 an exact implementation of IEEE or ISO rules/specifications for
3603 math functions.
3604
3605 The default is @option{-fmath-errno}.
3606
3607 @item -funsafe-math-optimizations
3608 @opindex funsafe-math-optimizations
3609 Allow optimizations for floating-point arithmetic that (a) assume
3610 that arguments and results are valid and (b) may violate IEEE or
3611 ANSI standards.  When used at link-time, it may include libraries
3612 or startup files that change the default FPU control word or other
3613 similar optimizations.
3614
3615 This option should never be turned on by any @option{-O} option since
3616 it can result in incorrect output for programs which depend on
3617 an exact implementation of IEEE or ISO rules/specifications for
3618 math functions.
3619
3620 The default is @option{-fno-unsafe-math-optimizations}.
3621
3622 @item -ffinite-math-only
3623 @opindex ffinite-math-only
3624 Allow optimizations for floating-point arithmetic that assume
3625 that arguments and results are not NaNs or +-Infs.
3626
3627 This option should never be turned on by any @option{-O} option since
3628 it can result in incorrect output for programs which depend on
3629 an exact implementation of IEEE or ISO rules/specifications.
3630
3631 The default is @option{-fno-finite-math-only}.
3632
3633 @item -fno-trapping-math
3634 @opindex fno-trapping-math
3635 Compile code assuming that floating-point operations cannot generate
3636 user-visible traps.  These traps include division by zero, overflow,
3637 underflow, inexact result and invalid operation.  This option implies
3638 @option{-fno-signaling-nans}.  Setting this option may allow faster
3639 code if one relies on ``non-stop'' IEEE arithmetic, for example.
3640
3641 This option should never be turned on by any @option{-O} option since
3642 it can result in incorrect output for programs which depend on
3643 an exact implementation of IEEE or ISO rules/specifications for
3644 math functions.
3645
3646 The default is @option{-ftrapping-math}.
3647
3648 @item -fsignaling-nans
3649 @opindex fsignaling-nans
3650 Compile code assuming that IEEE signaling NaNs may generate user-visible
3651 traps during floating-point operations.  Setting this option disables
3652 optimizations that may change the number of exceptions visible with
3653 signaling NaNs.  This option implies @option{-ftrapping-math}.
3654
3655 This option causes the preprocessor macro @code{__SUPPORT_SNAN__} to
3656 be defined.
3657
3658 The default is @option{-fno-signaling-nans}.
3659
3660 This option is experimental and does not currently guarantee to
3661 disable all GCC optimizations that affect signaling NaN behavior.
3662
3663 @item -fno-zero-initialized-in-bss
3664 @opindex fno-zero-initialized-in-bss
3665 If the target supports a BSS section, GCC by default puts variables that
3666 are initialized to zero into BSS@.  This can save space in the resulting
3667 code.
3668
3669 This option turns off this behavior because some programs explicitly
3670 rely on variables going to the data section.  E.g., so that the
3671 resulting executable can find the beginning of that section and/or make
3672 assumptions based on that.
3673
3674 The default is @option{-fzero-initialized-in-bss}.
3675
3676 @item -fbounds-check
3677 @opindex fbounds-check
3678 For front-ends that support it, generate additional code to check that
3679 indices used to access arrays are within the declared range.  This is
3680 currenly only supported by the Java and Fortran 77 front-ends, where
3681 this option defaults to true and false respectively.
3682
3683 @end table
3684
3685 The following options control specific optimizations.  The @option{-O2}
3686 option turns on all of these optimizations except @option{-funroll-loops}
3687 and @option{-funroll-all-loops}.  On most machines, the @option{-O} option
3688 turns on the @option{-fthread-jumps} and @option{-fdelayed-branch} options,
3689 but specific machines may handle it differently.
3690
3691 You can use the following flags in the rare cases when ``fine-tuning''
3692 of optimizations to be performed is desired.
3693
3694 Not all of the optimizations performed by GCC have @option{-f} options
3695 to control them.
3696
3697 @table @gcctabopt
3698 @item -fstrength-reduce
3699 @opindex fstrength-reduce
3700 Perform the optimizations of loop strength reduction and
3701 elimination of iteration variables.
3702
3703 @item -fthread-jumps
3704 @opindex fthread-jumps
3705 Perform optimizations where we check to see if a jump branches to a
3706 location where another comparison subsumed by the first is found.  If
3707 so, the first branch is redirected to either the destination of the
3708 second branch or a point immediately following it, depending on whether
3709 the condition is known to be true or false.
3710
3711 @item -fcse-follow-jumps
3712 @opindex fcse-follow-jumps
3713 In common subexpression elimination, scan through jump instructions
3714 when the target of the jump is not reached by any other path.  For
3715 example, when CSE encounters an @code{if} statement with an
3716 @code{else} clause, CSE will follow the jump when the condition
3717 tested is false.
3718
3719 @item -fcse-skip-blocks
3720 @opindex fcse-skip-blocks
3721 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
3722 follow jumps which conditionally skip over blocks.  When CSE
3723 encounters a simple @code{if} statement with no else clause,
3724 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
3725 body of the @code{if}.
3726
3727 @item -frerun-cse-after-loop
3728 @opindex frerun-cse-after-loop
3729 Re-run common subexpression elimination after loop optimizations has been
3730 performed.
3731
3732 @item -frerun-loop-opt
3733 @opindex frerun-loop-opt
3734 Run the loop optimizer twice.
3735
3736 @item -fgcse
3737 @opindex fgcse
3738 Perform a global common subexpression elimination pass.
3739 This pass also performs global constant and copy propagation.
3740
3741 @emph{Note:} When compiling a program using computed gotos, a GCC
3742 extension, you may get better runtime performance if you disable
3743 the global common subexpression elmination pass by adding
3744 @option{-fno-gcse} to the command line.
3745
3746 @item -fgcse-lm
3747 @opindex fgcse-lm
3748 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
3749 attempt to move loads which are only killed by stores into themselves.  This
3750 allows a loop containing a load/store sequence to be changed to a load outside
3751 the loop, and a copy/store within the loop.
3752
3753 @item -fgcse-sm
3754 @opindex fgcse-sm
3755 When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
3756 subexpression elimination.  This pass will attempt to move stores out of loops.
3757 When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
3758 can be changed to a load before the loop and a store after the loop.
3759
3760 @item -floop-optimize
3761 @opindex floop-optimize
3762 Perform loop optimizations: move constant expressions out of loops, simplify
3763 exit test conditions and optionally do strength-reduction and loop unrolling as
3764 well.
3765
3766 @item -fcrossjumping
3767 @opindex crossjumping
3768 Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
3769 resulting code may or may not perform better than without cross-jumping.
3770
3771 @item -fif-conversion
3772 @opindex if-conversion
3773 Attempt to transform conditional jumps into branch-less equivalents.  This
3774 include use of conditional moves, min, max, set flags and abs instructions, and
3775 some tricks doable by standard arithmetics.  The use of conditional execution
3776 on chips where it is available is controlled by @code{if-conversion2}.
3777
3778 @item -fif-conversion2
3779 @opindex if-conversion2
3780 Use conditional execution (where available) to transform conditional jumps into
3781 branch-less equivalents.
3782
3783 @item -fdelete-null-pointer-checks
3784 @opindex fdelete-null-pointer-checks
3785 Use global dataflow analysis to identify and eliminate useless checks
3786 for null pointers.  The compiler assumes that dereferencing a null
3787 pointer would have halted the program.  If a pointer is checked after
3788 it has already been dereferenced, it cannot be null.
3789
3790 In some environments, this assumption is not true, and programs can
3791 safely dereference null pointers.  Use
3792 @option{-fno-delete-null-pointer-checks} to disable this optimization
3793 for programs which depend on that behavior.
3794
3795 @item -fexpensive-optimizations
3796 @opindex fexpensive-optimizations
3797 Perform a number of minor optimizations that are relatively expensive.
3798
3799 @item -foptimize-register-move
3800 @itemx -fregmove
3801 @opindex foptimize-register-move
3802 @opindex fregmove
3803 Attempt to reassign register numbers in move instructions and as
3804 operands of other simple instructions in order to maximize the amount of
3805 register tying.  This is especially helpful on machines with two-operand
3806 instructions.  GCC enables this optimization by default with @option{-O2}
3807 or higher.
3808
3809 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
3810 optimization.
3811
3812 @item -fdelayed-branch
3813 @opindex fdelayed-branch
3814 If supported for the target machine, attempt to reorder instructions
3815 to exploit instruction slots available after delayed branch
3816 instructions.
3817
3818 @item -fschedule-insns
3819 @opindex fschedule-insns
3820 If supported for the target machine, attempt to reorder instructions to
3821 eliminate execution stalls due to required data being unavailable.  This
3822 helps machines that have slow floating point or memory load instructions
3823 by allowing other instructions to be issued until the result of the load
3824 or floating point instruction is required.
3825
3826 @item -fschedule-insns2
3827 @opindex fschedule-insns2
3828 Similar to @option{-fschedule-insns}, but requests an additional pass of
3829 instruction scheduling after register allocation has been done.  This is
3830 especially useful on machines with a relatively small number of
3831 registers and where memory load instructions take more than one cycle.
3832
3833 @item -fno-sched-interblock
3834 @opindex fno-sched-interblock
3835 Don't schedule instructions across basic blocks.  This is normally
3836 enabled by default when scheduling before register allocation, i.e.@:
3837 with @option{-fschedule-insns} or at @option{-O2} or higher.
3838
3839 @item -fno-sched-spec
3840 @opindex fno-sched-spec
3841 Don't allow speculative motion of non-load instructions.  This is normally
3842 enabled by default when scheduling before register allocation, i.e.@:
3843 with @option{-fschedule-insns} or at @option{-O2} or higher.
3844
3845 @item -fsched-spec-load
3846 @opindex fsched-spec-load
3847 Allow speculative motion of some load instructions.  This only makes
3848 sense when scheduling before register allocation, i.e.@: with
3849 @option{-fschedule-insns} or at @option{-O2} or higher.
3850
3851 @item -fsched-spec-load-dangerous
3852 @opindex fsched-spec-load-dangerous
3853 Allow speculative motion of more load instructions.  This only makes
3854 sense when scheduling before register allocation, i.e.@: with
3855 @option{-fschedule-insns} or at @option{-O2} or higher.
3856
3857 @item -ffunction-sections
3858 @itemx -fdata-sections
3859 @opindex ffunction-sections
3860 @opindex fdata-sections
3861 Place each function or data item into its own section in the output
3862 file if the target supports arbitrary sections.  The name of the
3863 function or the name of the data item determines the section's name
3864 in the output file.
3865
3866 Use these options on systems where the linker can perform optimizations
3867 to improve locality of reference in the instruction space.  HPPA
3868 processors running HP-UX and SPARC processors running Solaris 2 have
3869 linkers with such optimizations.  Other systems using the ELF object format
3870 as well as AIX may have these optimizations in the future.
3871
3872 Only use these options when there are significant benefits from doing
3873 so.  When you specify these options, the assembler and linker will
3874 create larger object and executable files and will also be slower.
3875 You will not be able to use @code{gprof} on all systems if you
3876 specify this option and you may have problems with debugging if
3877 you specify both this option and @option{-g}.
3878
3879 @item -fcaller-saves
3880 @opindex fcaller-saves
3881 Enable values to be allocated in registers that will be clobbered by
3882 function calls, by emitting extra instructions to save and restore the
3883 registers around such calls.  Such allocation is done only when it
3884 seems to result in better code than would otherwise be produced.
3885
3886 This option is always enabled by default on certain machines, usually
3887 those which have no call-preserved registers to use instead.
3888
3889 For all machines, optimization level 2 and higher enables this flag by
3890 default.
3891
3892 @item -ftracer
3893 @opindex ftracer
3894 Perform tail duplication to enlarge superblock size. This transformation
3895 simplifies the control flow of the function allowing other optimizations to do
3896 better job.
3897
3898 @item -funroll-loops
3899 @opindex funroll-loops
3900 Unroll loops whose number of iterations can be determined at compile
3901 time or upon entry to the loop.  @option{-funroll-loops} implies both
3902 @option{-fstrength-reduce} and @option{-frerun-cse-after-loop}.  This
3903 option makes code larger, and may or may not make it run faster.
3904
3905 @item -funroll-all-loops
3906 @opindex funroll-all-loops
3907 Unroll all loops, even if their number of iterations is uncertain when
3908 the loop is entered.  This usually makes programs run more slowly.
3909 @option{-funroll-all-loops} implies the same options as
3910 @option{-funroll-loops},
3911
3912 @item -fprefetch-loop-arrays
3913 @opindex fprefetch-loop-arrays
3914 If supported by the target machine, generate instructions to prefetch
3915 memory to improve the performance of loops that access large arrays.
3916
3917 @item -fmove-all-movables
3918 @opindex fmove-all-movables
3919 Forces all invariant computations in loops to be moved
3920 outside the loop.
3921
3922 @item -freduce-all-givs
3923 @opindex freduce-all-givs
3924 Forces all general-induction variables in loops to be
3925 strength-reduced.
3926
3927 @emph{Note:} When compiling programs written in Fortran,
3928 @option{-fmove-all-movables} and @option{-freduce-all-givs} are enabled
3929 by default when you use the optimizer.
3930
3931 These options may generate better or worse code; results are highly
3932 dependent on the structure of loops within the source code.
3933
3934 These two options are intended to be removed someday, once
3935 they have helped determine the efficacy of various
3936 approaches to improving loop optimizations.
3937
3938 Please let us (@w{@email{gcc@@gcc.gnu.org}} and @w{@email{fortran@@gnu.org}})
3939 know how use of these options affects
3940 the performance of your production code.
3941 We're very interested in code that runs @emph{slower}
3942 when these options are @emph{enabled}.
3943
3944 @item -fno-peephole
3945 @itemx -fno-peephole2
3946 @opindex fno-peephole
3947 @opindex fno-peephole2
3948 Disable any machine-specific peephole optimizations.  The difference
3949 between @option{-fno-peephole} and @option{-fno-peephole2} is in how they
3950 are implemented in the compiler; some targets use one, some use the
3951 other, a few use both.
3952
3953 @item -fbranch-probabilities
3954 @opindex fbranch-probabilities
3955 After running a program compiled with @option{-fprofile-arcs}
3956 (@pxref{Debugging Options,, Options for Debugging Your Program or
3957 @command{gcc}}), you can compile it a second time using
3958 @option{-fbranch-probabilities}, to improve optimizations based on
3959 the number of times each branch was taken.  When the program
3960 compiled with @option{-fprofile-arcs} exits it saves arc execution
3961 counts to a file called @file{@var{sourcename}.da} for each source
3962 file  The information in this data file is very dependent on the
3963 structure of the generated code, so you must use the same source code
3964 and the same optimization options for both compilations.
3965
3966 With @option{-fbranch-probabilities}, GCC puts a @samp{REG_EXEC_COUNT}
3967 note on the first instruction of each basic block, and a
3968 @samp{REG_BR_PROB} note on each @samp{JUMP_INSN} and @samp{CALL_INSN}.
3969 These can be used to improve optimization.  Currently, they are only
3970 used in one place: in @file{reorg.c}, instead of guessing which path a
3971 branch is mostly to take, the @samp{REG_BR_PROB} values are used to
3972 exactly determine which path is taken more often.
3973
3974 @item -fno-guess-branch-probability
3975 @opindex fno-guess-branch-probability
3976 Do not guess branch probabilities using a randomized model.
3977
3978 Sometimes gcc will opt to use a randomized model to guess branch
3979 probabilities, when none are available from either profiling feedback
3980 (@option{-fprofile-arcs}) or @samp{__builtin_expect}.  This means that
3981 different runs of the compiler on the same program may produce different
3982 object code.
3983
3984 In a hard real-time system, people don't want different runs of the
3985 compiler to produce code that has different behavior; minimizing
3986 non-determinism is of paramount import.  This switch allows users to
3987 reduce non-determinism, possibly at the expense of inferior
3988 optimization.
3989
3990 @item -freorder-blocks
3991 @opindex freorder-blocks
3992 Reorder basic blocks in the compiled function in order to reduce number of
3993 taken branches and improve code locality.
3994
3995 @item -freorder-functions
3996 @opindex freorder-functions
3997 Reorder basic blocks in the compiled function in order to reduce number of
3998 taken branches and improve code locality. This is implemented by using special
3999 subsections @code{text.hot} for most frequently executed functions and
4000 @code{text.unlikely} for unlikely executed functions.  Reordering is done by
4001 the linker so object file format must support named sections and linker must
4002 place them in resonable way.
4003
4004 Also profile feedback must be available in to make this option effective.  See
4005 @option{-fprofile-arcs} for details.
4006
4007 @item -fstrict-aliasing
4008 @opindex fstrict-aliasing
4009 Allows the compiler to assume the strictest aliasing rules applicable to
4010 the language being compiled.  For C (and C++), this activates
4011 optimizations based on the type of expressions.  In particular, an
4012 object of one type is assumed never to reside at the same address as an
4013 object of a different type, unless the types are almost the same.  For
4014 example, an @code{unsigned int} can alias an @code{int}, but not a
4015 @code{void*} or a @code{double}.  A character type may alias any other
4016 type.
4017
4018 Pay special attention to code like this:
4019 @example
4020 union a_union @{
4021   int i;
4022   double d;
4023 @};
4024
4025 int f() @{
4026   a_union t;
4027   t.d = 3.0;
4028   return t.i;
4029 @}
4030 @end example
4031 The practice of reading from a different union member than the one most
4032 recently written to (called ``type-punning'') is common.  Even with
4033 @option{-fstrict-aliasing}, type-punning is allowed, provided the memory
4034 is accessed through the union type.  So, the code above will work as
4035 expected.  However, this code might not:
4036 @example
4037 int f() @{
4038   a_union t;
4039   int* ip;
4040   t.d = 3.0;
4041   ip = &t.i;
4042   return *ip;
4043 @}
4044 @end example
4045
4046 Every language that wishes to perform language-specific alias analysis
4047 should define a function that computes, given an @code{tree}
4048 node, an alias set for the node.  Nodes in different alias sets are not
4049 allowed to alias.  For an example, see the C front-end function
4050 @code{c_get_alias_set}.
4051
4052 For all machines, optimization level 2 and higher enables this flag by
4053 default.
4054
4055 @item -falign-functions
4056 @itemx -falign-functions=@var{n}
4057 @opindex falign-functions
4058 Align the start of functions to the next power-of-two greater than
4059 @var{n}, skipping up to @var{n} bytes.  For instance,
4060 @option{-falign-functions=32} aligns functions to the next 32-byte
4061 boundary, but @option{-falign-functions=24} would align to the next
4062 32-byte boundary only if this can be done by skipping 23 bytes or less.
4063
4064 @option{-fno-align-functions} and @option{-falign-functions=1} are
4065 equivalent and mean that functions will not be aligned.
4066
4067 Some assemblers only support this flag when @var{n} is a power of two;
4068 in that case, it is rounded up.
4069
4070 If @var{n} is not specified, use a machine-dependent default.
4071
4072 @item -falign-labels
4073 @itemx -falign-labels=@var{n}
4074 @opindex falign-labels
4075 Align all branch targets to a power-of-two boundary, skipping up to
4076 @var{n} bytes like @option{-falign-functions}.  This option can easily
4077 make code slower, because it must insert dummy operations for when the
4078 branch target is reached in the usual flow of the code.
4079
4080 If @option{-falign-loops} or @option{-falign-jumps} are applicable and
4081 are greater than this value, then their values are used instead.
4082
4083 If @var{n} is not specified, use a machine-dependent default which is
4084 very likely to be @samp{1}, meaning no alignment.
4085
4086 @item -falign-loops
4087 @itemx -falign-loops=@var{n}
4088 @opindex falign-loops
4089 Align loops to a power-of-two boundary, skipping up to @var{n} bytes
4090 like @option{-falign-functions}.  The hope is that the loop will be
4091 executed many times, which will make up for any execution of the dummy
4092 operations.
4093
4094 If @var{n} is not specified, use a machine-dependent default.
4095
4096 @item -falign-jumps
4097 @itemx -falign-jumps=@var{n}
4098 @opindex falign-jumps
4099 Align branch targets to a power-of-two boundary, for branch targets
4100 where the targets can only be reached by jumping, skipping up to @var{n}
4101 bytes like @option{-falign-functions}.  In this case, no dummy operations
4102 need be executed.
4103
4104 If @var{n} is not specified, use a machine-dependent default.
4105
4106 @item -fssa
4107 @opindex fssa
4108 Perform optimizations in static single assignment form.  Each function's
4109 flow graph is translated into SSA form, optimizations are performed, and
4110 the flow graph is translated back from SSA form.  Users should not
4111 specify this option, since it is not yet ready for production use.
4112
4113 @item -fssa-ccp
4114 @opindex fssa-ccp
4115 Perform Sparse Conditional Constant Propagation in SSA form.  Requires
4116 @option{-fssa}.  Like @option{-fssa}, this is an experimental feature.
4117
4118 @item -fssa-dce
4119 @opindex fssa-dce
4120 Perform aggressive dead-code elimination in SSA form.  Requires @option{-fssa}.
4121 Like @option{-fssa}, this is an experimental feature.
4122
4123 @item -fsingle-precision-constant
4124 @opindex fsingle-precision-constant
4125 Treat floating point constant as single precision constant instead of
4126 implicitly converting it to double precision constant.
4127
4128 @item -frename-registers
4129 @opindex frename-registers
4130 Attempt to avoid false dependencies in scheduled code by making use
4131 of registers left over after register allocation.  This optimization
4132 will most benefit processors with lots of registers.  It can, however,
4133 make debugging impossible, since variables will no longer stay in
4134 a ``home register''.
4135
4136 @item -fno-cprop-registers
4137 @opindex fno-cprop-registers
4138 After register allocation and post-register allocation instruction splitting,
4139 we perform a copy-propagation pass to try to reduce scheduling dependencies
4140 and occasionally eliminate the copy.
4141
4142 @item --param @var{name}=@var{value}
4143 @opindex param
4144 In some places, GCC uses various constants to control the amount of
4145 optimization that is done.  For example, GCC will not inline functions
4146 that contain more that a certain number of instructions.  You can
4147 control some of these constants on the command-line using the
4148 @option{--param} option.
4149
4150 In each case, the @var{value} is an integer.  The allowable choices for
4151 @var{name} are given in the following table:
4152
4153 @table @gcctabopt
4154 @item max-delay-slot-insn-search
4155 The maximum number of instructions to consider when looking for an
4156 instruction to fill a delay slot.  If more than this arbitrary number of
4157 instructions is searched, the time savings from filling the delay slot
4158 will be minimal so stop searching.  Increasing values mean more
4159 aggressive optimization, making the compile time increase with probably
4160 small improvement in executable run time.
4161
4162 @item max-delay-slot-live-search
4163 When trying to fill delay slots, the maximum number of instructions to
4164 consider when searching for a block with valid live register
4165 information.  Increasing this arbitrarily chosen value means more
4166 aggressive optimization, increasing the compile time.  This parameter
4167 should be removed when the delay slot code is rewritten to maintain the
4168 control-flow graph.
4169
4170 @item max-gcse-memory
4171 The approximate maximum amount of memory that will be allocated in
4172 order to perform the global common subexpression elimination
4173 optimization.  If more memory than specified is required, the
4174 optimization will not be done.
4175
4176 @item max-gcse-passes
4177 The maximum number of passes of GCSE to run.
4178
4179 @item max-pending-list-length
4180 The maximum number of pending dependencies scheduling will allow
4181 before flushing the current state and starting over.  Large functions
4182 with few branches or calls can create excessively large lists which
4183 needlessly consume memory and resources.
4184
4185 @item max-inline-insns
4186 If an function contains more than this many instructions, it
4187 will not be inlined.  This option is precisely equivalent to
4188 @option{-finline-limit}.
4189
4190 @item max-unrolled-insns
4191 The maximum number of instructions that a loop should have if that loop
4192 is unrolled, and if the loop is unrolled, it determines how many times
4193 the loop code is unrolled.
4194
4195 @item hot-bb-count-fraction
4196 Select fraction of the maximal count of repetitions of basic block in program
4197 given basic block needs to have to be considered hot.
4198
4199 @item hot-bb-frequency-fraction
4200 Select fraction of the maximal frequency of executions of basic block in
4201 function given basic block needs to have to be considered hot
4202
4203 @item tracer-dynamic-coverage
4204 @itemx tracer-dynamic-coverage-feedback
4205
4206 This value is used to limit superblock formation once given percentage of
4207 executed instructions is covered.  This limits unnecesary code size expansion.
4208
4209 The @option{tracer-dynamic-coverage-feedback} is used only when profile
4210 feedback is available.  The real profiles (as opposed to statically estimated
4211 ones) are much less balanced allowing the threshold to be larger value.
4212
4213 @item tracer-max-code-growth
4214 Stop tail duplication once code growth has reached given percentage.  This is
4215 rather hokey argument, as most of the duplicates will be elliminated later in
4216 cross jumping, so it may be set to much higher values than is the desired code
4217 growth.
4218
4219 @item tracer-min-branch-ratio
4220
4221 Stop reverse growth when the reverse probability of best edge is less than this
4222 threshold (in percent).
4223
4224 @item tracer-min-branch-ratio
4225 @itemx tracer-min-branch-ratio-feedback
4226
4227 Stop forward growth if the best edge do have probability lower than this
4228 threshold.
4229
4230 Similary to @option{tracer-dynamic-coverage} two values are present, one for
4231 compilation for profile feedback and one for compilation without.  The value
4232 for compilation with profile feedback needs to be more conservative (higher) in
4233 order to make tracer effective.
4234
4235 @end table
4236 @end table
4237
4238 @node Preprocessor Options
4239 @section Options Controlling the Preprocessor
4240 @cindex preprocessor options
4241 @cindex options, preprocessor
4242
4243 These options control the C preprocessor, which is run on each C source
4244 file before actual compilation.
4245
4246 If you use the @option{-E} option, nothing is done except preprocessing.
4247 Some of these options make sense only together with @option{-E} because
4248 they cause the preprocessor output to be unsuitable for actual
4249 compilation.
4250
4251 @opindex Wp
4252 You can use @option{-Wp,@var{option}} to bypass the compiler driver
4253 and pass @var{option} directly through to the preprocessor.  If
4254 @var{option} contains commas, it is split into multiple options at the
4255 commas.  However, many options are modified, translated or interpreted
4256 by the compiler driver before being passed to the preprocessor, and
4257 @option{-Wp} forcibly bypasses this phase.  The preprocessor's direct
4258 interface is undocumented and subject to change, so whenever possible
4259 you should avoid using @option{-Wp} and let the driver handle the
4260 options instead.
4261
4262 @include cppopts.texi
4263
4264 @node Assembler Options
4265 @section Passing Options to the Assembler
4266
4267 @c prevent bad page break with this line
4268 You can pass options to the assembler.
4269
4270 @table @gcctabopt
4271 @item -Wa,@var{option}
4272 @opindex Wa
4273 Pass @var{option} as an option to the assembler.  If @var{option}
4274 contains commas, it is split into multiple options at the commas.
4275 @end table
4276
4277 @node Link Options
4278 @section Options for Linking
4279 @cindex link options
4280 @cindex options, linking
4281
4282 These options come into play when the compiler links object files into
4283 an executable output file.  They are meaningless if the compiler is
4284 not doing a link step.
4285
4286 @table @gcctabopt
4287 @cindex file names
4288 @item @var{object-file-name}
4289 A file name that does not end in a special recognized suffix is
4290 considered to name an object file or library.  (Object files are
4291 distinguished from libraries by the linker according to the file
4292 contents.)  If linking is done, these object files are used as input
4293 to the linker.
4294
4295 @item -c
4296 @itemx -S
4297 @itemx -E
4298 @opindex c
4299 @opindex S
4300 @opindex E
4301 If any of these options is used, then the linker is not run, and
4302 object file names should not be used as arguments.  @xref{Overall
4303 Options}.
4304
4305 @cindex Libraries
4306 @item -l@var{library}
4307 @itemx -l @var{library}
4308 @opindex l
4309 Search the library named @var{library} when linking.  (The second
4310 alternative with the library as a separate argument is only for
4311 POSIX compliance and is not recommended.)
4312
4313 It makes a difference where in the command you write this option; the
4314 linker searches and processes libraries and object files in the order they
4315 are specified.  Thus, @samp{foo.o -lz bar.o} searches library @samp{z}
4316 after file @file{foo.o} but before @file{bar.o}.  If @file{bar.o} refers
4317 to functions in @samp{z}, those functions may not be loaded.
4318
4319 The linker searches a standard list of directories for the library,
4320 which is actually a file named @file{lib@var{library}.a}.  The linker
4321 then uses this file as if it had been specified precisely by name.
4322
4323 The directories searched include several standard system directories
4324 plus any that you specify with @option{-L}.
4325
4326 Normally the files found this way are library files---archive files
4327 whose members are object files.  The linker handles an archive file by
4328 scanning through it for members which define symbols that have so far
4329 been referenced but not defined.  But if the file that is found is an
4330 ordinary object file, it is linked in the usual fashion.  The only
4331 difference between using an @option{-l} option and specifying a file name
4332 is that @option{-l} surrounds @var{library} with @samp{lib} and @samp{.a}
4333 and searches several directories.
4334
4335 @item -lobjc
4336 @opindex lobjc
4337 You need this special case of the @option{-l} option in order to
4338 link an Objective-C program.
4339
4340 @item -nostartfiles
4341 @opindex nostartfiles
4342 Do not use the standard system startup files when linking.
4343 The standard system libraries are used normally, unless @option{-nostdlib}
4344 or @option{-nodefaultlibs} is used.
4345
4346 @item -nodefaultlibs
4347 @opindex nodefaultlibs
4348 Do not use the standard system libraries when linking.
4349 Only the libraries you specify will be passed to the linker.
4350 The standard startup files are used normally, unless @option{-nostartfiles}
4351 is used.  The compiler may generate calls to memcmp, memset, and memcpy
4352 for System V (and ISO C) environments or to bcopy and bzero for
4353 BSD environments.  These entries are usually resolved by entries in
4354 libc.  These entry points should be supplied through some other
4355 mechanism when this option is specified.
4356
4357 @item -nostdlib
4358 @opindex nostdlib
4359 Do not use the standard system startup files or libraries when linking.
4360 No startup files and only the libraries you specify will be passed to
4361 the linker.  The compiler may generate calls to memcmp, memset, and memcpy
4362 for System V (and ISO C) environments or to bcopy and bzero for
4363 BSD environments.  These entries are usually resolved by entries in
4364 libc.  These entry points should be supplied through some other
4365 mechanism when this option is specified.
4366
4367 @cindex @option{-lgcc}, use with @option{-nostdlib}
4368 @cindex @option{-nostdlib} and unresolved references
4369 @cindex unresolved references and @option{-nostdlib}
4370 @cindex @option{-lgcc}, use with @option{-nodefaultlibs}
4371 @cindex @option{-nodefaultlibs} and unresolved references
4372 @cindex unresolved references and @option{-nodefaultlibs}
4373 One of the standard libraries bypassed by @option{-nostdlib} and
4374 @option{-nodefaultlibs} is @file{libgcc.a}, a library of internal subroutines
4375 that GCC uses to overcome shortcomings of particular machines, or special
4376 needs for some languages.
4377 (@xref{Interface,,Interfacing to GCC Output,gccint,GNU Compiler
4378 Collection (GCC) Internals},
4379 for more discussion of @file{libgcc.a}.)
4380 In most cases, you need @file{libgcc.a} even when you want to avoid
4381 other standard libraries.  In other words, when you specify @option{-nostdlib}
4382 or @option{-nodefaultlibs} you should usually specify @option{-lgcc} as well.
4383 This ensures that you have no unresolved references to internal GCC
4384 library subroutines.  (For example, @samp{__main}, used to ensure C++
4385 constructors will be called; @pxref{Collect2,,@code{collect2}, gccint,
4386 GNU Compiler Collection (GCC) Internals}.)
4387
4388 @item -s
4389 @opindex s
4390 Remove all symbol table and relocation information from the executable.
4391
4392 @item -static
4393 @opindex static
4394 On systems that support dynamic linking, this prevents linking with the shared
4395 libraries.  On other systems, this option has no effect.
4396
4397 @item -shared
4398 @opindex shared
4399 Produce a shared object which can then be linked with other objects to
4400 form an executable.  Not all systems support this option.  For predictable
4401 results, you must also specify the same set of options that were used to
4402 generate code (@option{-fpic}, @option{-fPIC}, or model suboptions)
4403 when you specify this option.@footnote{On some systems, @samp{gcc -shared}
4404 needs to build supplementary stub code for constructors to work.  On
4405 multi-libbed systems, @samp{gcc -shared} must select the correct support
4406 libraries to link against.  Failing to supply the correct flags may lead
4407 to subtle defects.  Supplying them in cases where they are not necessary
4408 is innocuous.}
4409
4410 @item -shared-libgcc
4411 @itemx -static-libgcc
4412 @opindex shared-libgcc
4413 @opindex static-libgcc
4414 On systems that provide @file{libgcc} as a shared library, these options
4415 force the use of either the shared or static version respectively.
4416 If no shared version of @file{libgcc} was built when the compiler was
4417 configured, these options have no effect.
4418
4419 There are several situations in which an application should use the
4420 shared @file{libgcc} instead of the static version.  The most common
4421 of these is when the application wishes to throw and catch exceptions
4422 across different shared libraries.  In that case, each of the libraries
4423 as well as the application itself should use the shared @file{libgcc}.
4424
4425 Therefore, the G++ and GCJ drivers automatically add
4426 @option{-shared-libgcc} whenever you build a shared library or a main
4427 executable, because C++ and Java programs typically use exceptions, so
4428 this is the right thing to do.
4429
4430 If, instead, you use the GCC driver to create shared libraries, you may
4431 find that they will not always be linked with the shared @file{libgcc}.
4432 If GCC finds, at its configuration time, that you have a GNU linker that
4433 does not support option @option{--eh-frame-hdr}, it will link the shared
4434 version of @file{libgcc} into shared libraries by default.  Otherwise,
4435 it will take advantage of the linker and optimize away the linking with
4436 the shared version of @file{libgcc}, linking with the static version of
4437 libgcc by default.  This allows exceptions to propagate through such
4438 shared libraries, without incurring relocation costs at library load
4439 time.
4440
4441 However, if a library or main executable is supposed to throw or catch
4442 exceptions, you must link it using the G++ or GCJ driver, as appropriate
4443 for the languages used in the program, or using the option
4444 @option{-shared-libgcc}, such that it is linked with the shared
4445 @file{libgcc}.
4446
4447 @item -symbolic
4448 @opindex symbolic
4449 Bind references to global symbols when building a shared object.  Warn
4450 about any unresolved references (unless overridden by the link editor
4451 option @samp{-Xlinker -z -Xlinker defs}).  Only a few systems support
4452 this option.
4453
4454 @item -Xlinker @var{option}
4455 @opindex Xlinker
4456 Pass @var{option} as an option to the linker.  You can use this to
4457 supply system-specific linker options which GCC does not know how to
4458 recognize.
4459
4460 If you want to pass an option that takes an argument, you must use
4461 @option{-Xlinker} twice, once for the option and once for the argument.
4462 For example, to pass @option{-assert definitions}, you must write
4463 @samp{-Xlinker -assert -Xlinker definitions}.  It does not work to write
4464 @option{-Xlinker "-assert definitions"}, because this passes the entire
4465 string as a single argument, which is not what the linker expects.
4466
4467 @item -Wl,@var{option}
4468 @opindex Wl
4469 Pass @var{option} as an option to the linker.  If @var{option} contains
4470 commas, it is split into multiple options at the commas.
4471
4472 @item -u @var{symbol}
4473 @opindex u
4474 Pretend the symbol @var{symbol} is undefined, to force linking of
4475 library modules to define it.  You can use @option{-u} multiple times with
4476 different symbols to force loading of additional library modules.
4477 @end table
4478
4479 @node Directory Options
4480 @section Options for Directory Search
4481 @cindex directory options
4482 @cindex options, directory search
4483 @cindex search path
4484
4485 These options specify directories to search for header files, for
4486 libraries and for parts of the compiler:
4487
4488 @table @gcctabopt
4489 @item -I@var{dir}
4490 @opindex I
4491 Add the directory @var{dir} to the head of the list of directories to be
4492 searched for header files.  This can be used to override a system header
4493 file, substituting your own version, since these directories are
4494 searched before the system header file directories.  However, you should
4495 not use this option to add directories that contain vendor-supplied
4496 system header files (use @option{-isystem} for that).  If you use more than
4497 one @option{-I} option, the directories are scanned in left-to-right
4498 order; the standard system directories come after.
4499
4500 If a standard system include directory, or a directory specified with
4501 @option{-isystem}, is also specified with @option{-I}, the @option{-I}
4502 option will be ignored.  The directory will still be searched but as a
4503 system directory at its normal position in the system include chain.
4504 This is to ensure that GCC's procedure to fix buggy system headers and
4505 the ordering for the include_next directive are not inadvertantly changed.
4506 If you really need to change the search order for system directories,
4507 use the @option{-nostdinc} and/or @option{-isystem} options.
4508
4509 @item -I-
4510 @opindex I-
4511 Any directories you specify with @option{-I} options before the @option{-I-}
4512 option are searched only for the case of @samp{#include "@var{file}"};
4513 they are not searched for @samp{#include <@var{file}>}.
4514
4515 If additional directories are specified with @option{-I} options after
4516 the @option{-I-}, these directories are searched for all @samp{#include}
4517 directives.  (Ordinarily @emph{all} @option{-I} directories are used
4518 this way.)
4519
4520 In addition, the @option{-I-} option inhibits the use of the current
4521 directory (where the current input file came from) as the first search
4522 directory for @samp{#include "@var{file}"}.  There is no way to
4523 override this effect of @option{-I-}.  With @option{-I.} you can specify
4524 searching the directory which was current when the compiler was
4525 invoked.  That is not exactly the same as what the preprocessor does
4526 by default, but it is often satisfactory.
4527
4528 @option{-I-} does not inhibit the use of the standard system directories
4529 for header files.  Thus, @option{-I-} and @option{-nostdinc} are
4530 independent.
4531
4532 @item -L@var{dir}
4533 @opindex L
4534 Add directory @var{dir} to the list of directories to be searched
4535 for @option{-l}.
4536
4537 @item -B@var{prefix}
4538 @opindex B
4539 This option specifies where to find the executables, libraries,
4540 include files, and data files of the compiler itself.
4541
4542 The compiler driver program runs one or more of the subprograms
4543 @file{cpp}, @file{cc1}, @file{as} and @file{ld}.  It tries
4544 @var{prefix} as a prefix for each program it tries to run, both with and
4545 without @samp{@var{machine}/@var{version}/} (@pxref{Target Options}).
4546
4547 For each subprogram to be run, the compiler driver first tries the
4548 @option{-B} prefix, if any.  If that name is not found, or if @option{-B}
4549 was not specified, the driver tries two standard prefixes, which are
4550 @file{/usr/lib/gcc/} and @file{/usr/local/lib/gcc-lib/}.  If neither of
4551 those results in a file name that is found, the unmodified program
4552 name is searched for using the directories specified in your
4553 @env{PATH} environment variable.
4554
4555 The compiler will check to see if the path provided by the @option{-B}
4556 refers to a directory, and if necessary it will add a directory
4557 separator character at the end of the path.
4558
4559 @option{-B} prefixes that effectively specify directory names also apply
4560 to libraries in the linker, because the compiler translates these
4561 options into @option{-L} options for the linker.  They also apply to
4562 includes files in the preprocessor, because the compiler translates these
4563 options into @option{-isystem} options for the preprocessor.  In this case,
4564 the compiler appends @samp{include} to the prefix.
4565
4566 The run-time support file @file{libgcc.a} can also be searched for using
4567 the @option{-B} prefix, if needed.  If it is not found there, the two
4568 standard prefixes above are tried, and that is all.  The file is left
4569 out of the link if it is not found by those means.
4570
4571 Another way to specify a prefix much like the @option{-B} prefix is to use
4572 the environment variable @env{GCC_EXEC_PREFIX}.  @xref{Environment
4573 Variables}.
4574
4575 As a special kludge, if the path provided by @option{-B} is
4576 @file{[dir/]stage@var{N}/}, where @var{N} is a number in the range 0 to
4577 9, then it will be replaced by @file{[dir/]include}.  This is to help
4578 with boot-strapping the compiler.
4579
4580 @item -specs=@var{file}
4581 @opindex specs
4582 Process @var{file} after the compiler reads in the standard @file{specs}
4583 file, in order to override the defaults that the @file{gcc} driver
4584 program uses when determining what switches to pass to @file{cc1},
4585 @file{cc1plus}, @file{as}, @file{ld}, etc.  More than one
4586 @option{-specs=@var{file}} can be specified on the command line, and they
4587 are processed in order, from left to right.
4588 @end table
4589
4590 @c man end
4591
4592 @node Spec Files
4593 @section Specifying subprocesses and the switches to pass to them
4594 @cindex Spec Files
4595 @command{gcc} is a driver program.  It performs its job by invoking a
4596 sequence of other programs to do the work of compiling, assembling and
4597 linking.  GCC interprets its command-line parameters and uses these to
4598 deduce which programs it should invoke, and which command-line options
4599 it ought to place on their command lines.  This behavior is controlled
4600 by @dfn{spec strings}.  In most cases there is one spec string for each
4601 program that GCC can invoke, but a few programs have multiple spec
4602 strings to control their behavior.  The spec strings built into GCC can
4603 be overridden by using the @option{-specs=} command-line switch to specify
4604 a spec file.
4605
4606 @dfn{Spec files} are plaintext files that are used to construct spec
4607 strings.  They consist of a sequence of directives separated by blank
4608 lines.  The type of directive is determined by the first non-whitespace
4609 character on the line and it can be one of the following:
4610
4611 @table @code
4612 @item %@var{command}
4613 Issues a @var{command} to the spec file processor.  The commands that can
4614 appear here are:
4615
4616 @table @code
4617 @item %include <@var{file}>
4618 @cindex %include
4619 Search for @var{file} and insert its text at the current point in the
4620 specs file.
4621
4622 @item %include_noerr <@var{file}>
4623 @cindex %include_noerr
4624 Just like @samp{%include}, but do not generate an error message if the include
4625 file cannot be found.
4626
4627 @item %rename @var{old_name} @var{new_name}
4628 @cindex %rename
4629 Rename the spec string @var{old_name} to @var{new_name}.
4630
4631 @end table
4632
4633 @item *[@var{spec_name}]:
4634 This tells the compiler to create, override or delete the named spec
4635 string.  All lines after this directive up to the next directive or
4636 blank line are considered to be the text for the spec string.  If this
4637 results in an empty string then the spec will be deleted.  (Or, if the
4638 spec did not exist, then nothing will happened.)  Otherwise, if the spec
4639 does not currently exist a new spec will be created.  If the spec does
4640 exist then its contents will be overridden by the text of this
4641 directive, unless the first character of that text is the @samp{+}
4642 character, in which case the text will be appended to the spec.
4643
4644 @item [@var{suffix}]:
4645 Creates a new @samp{[@var{suffix}] spec} pair.  All lines after this directive
4646 and up to the next directive or blank line are considered to make up the
4647 spec string for the indicated suffix.  When the compiler encounters an
4648 input file with the named suffix, it will processes the spec string in
4649 order to work out how to compile that file.  For example:
4650
4651 @smallexample
4652 .ZZ:
4653 z-compile -input %i
4654 @end smallexample
4655
4656 This says that any input file whose name ends in @samp{.ZZ} should be
4657 passed to the program @samp{z-compile}, which should be invoked with the
4658 command-line switch @option{-input} and with the result of performing the
4659 @samp{%i} substitution.  (See below.)
4660
4661 As an alternative to providing a spec string, the text that follows a
4662 suffix directive can be one of the following:
4663
4664 @table @code
4665 @item @@@var{language}
4666 This says that the suffix is an alias for a known @var{language}.  This is
4667 similar to using the @option{-x} command-line switch to GCC to specify a
4668 language explicitly.  For example:
4669
4670 @smallexample
4671 .ZZ:
4672 @@c++
4673 @end smallexample
4674
4675 Says that .ZZ files are, in fact, C++ source files.
4676
4677 @item #@var{name}
4678 This causes an error messages saying:
4679
4680 @smallexample
4681 @var{name} compiler not installed on this system.
4682 @end smallexample
4683 @end table
4684
4685 GCC already has an extensive list of suffixes built into it.
4686 This directive will add an entry to the end of the list of suffixes, but
4687 since the list is searched from the end backwards, it is effectively
4688 possible to override earlier entries using this technique.
4689
4690 @end table
4691
4692 GCC has the following spec strings built into it.  Spec files can
4693 override these strings or create their own.  Note that individual
4694 targets can also add their own spec strings to this list.
4695
4696 @smallexample
4697 asm          Options to pass to the assembler
4698 asm_final    Options to pass to the assembler post-processor
4699 cpp          Options to pass to the C preprocessor
4700 cc1          Options to pass to the C compiler
4701 cc1plus      Options to pass to the C++ compiler
4702 endfile      Object files to include at the end of the link
4703 link         Options to pass to the linker
4704 lib          Libraries to include on the command line to the linker
4705 libgcc       Decides which GCC support library to pass to the linker
4706 linker       Sets the name of the linker
4707 predefines   Defines to be passed to the C preprocessor
4708 signed_char  Defines to pass to CPP to say whether @code{char} is signed
4709              by default
4710 startfile    Object files to include at the start of the link
4711 @end smallexample
4712
4713 Here is a small example of a spec file:
4714
4715 @smallexample
4716 %rename lib                 old_lib
4717
4718 *lib:
4719 --start-group -lgcc -lc -leval1 --end-group %(old_lib)
4720 @end smallexample
4721
4722 This example renames the spec called @samp{lib} to @samp{old_lib} and
4723 then overrides the previous definition of @samp{lib} with a new one.
4724 The new definition adds in some extra command-line options before
4725 including the text of the old definition.
4726
4727 @dfn{Spec strings} are a list of command-line options to be passed to their
4728 corresponding program.  In addition, the spec strings can contain
4729 @samp{%}-prefixed sequences to substitute variable text or to
4730 conditionally insert text into the command line.  Using these constructs
4731 it is possible to generate quite complex command lines.
4732
4733 Here is a table of all defined @samp{%}-sequences for spec
4734 strings.  Note that spaces are not generated automatically around the
4735 results of expanding these sequences.  Therefore you can concatenate them
4736 together or combine them with constant text in a single argument.
4737
4738 @table @code
4739 @item %%
4740 Substitute one @samp{%} into the program name or argument.
4741
4742 @item %i
4743 Substitute the name of the input file being processed.
4744
4745 @item %b
4746 Substitute the basename of the input file being processed.
4747 This is the substring up to (and not including) the last period
4748 and not including the directory.
4749
4750 @item %B
4751 This is the same as @samp{%b}, but include the file suffix (text after
4752 the last period).
4753
4754 @item %d
4755 Marks the argument containing or following the @samp{%d} as a
4756 temporary file name, so that that file will be deleted if GCC exits
4757 successfully.  Unlike @samp{%g}, this contributes no text to the
4758 argument.
4759
4760 @item %g@var{suffix}
4761 Substitute a file name that has suffix @var{suffix} and is chosen
4762 once per compilation, and mark the argument in the same way as
4763 @samp{%d}.  To reduce exposure to denial-of-service attacks, the file
4764 name is now chosen in a way that is hard to predict even when previously
4765 chosen file names are known.  For example, @samp{%g.s @dots{} %g.o @dots{} %g.s}
4766 might turn into @samp{ccUVUUAU.s ccXYAXZ12.o ccUVUUAU.s}.  @var{suffix} matches
4767 the regexp @samp{[.A-Za-z]*} or the special string @samp{%O}, which is
4768 treated exactly as if @samp{%O} had been preprocessed.  Previously, @samp{%g}
4769 was simply substituted with a file name chosen once per compilation,
4770 without regard to any appended suffix (which was therefore treated
4771 just like ordinary text), making such attacks more likely to succeed.
4772
4773 @item %u@var{suffix}
4774 Like @samp{%g}, but generates a new temporary file name even if
4775 @samp{%u@var{suffix}} was already seen.
4776
4777 @item %U@var{suffix}
4778 Substitutes the last file name generated with @samp{%u@var{suffix}}, generating a
4779 new one if there is no such last file name.  In the absence of any
4780 @samp{%u@var{suffix}}, this is just like @samp{%g@var{suffix}}, except they don't share
4781 the same suffix @emph{space}, so @samp{%g.s @dots{} %U.s @dots{} %g.s @dots{} %U.s}
4782 would involve the generation of two distinct file names, one
4783 for each @samp{%g.s} and another for each @samp{%U.s}.  Previously, @samp{%U} was
4784 simply substituted with a file name chosen for the previous @samp{%u},
4785 without regard to any appended suffix.
4786
4787 @item %j@var{SUFFIX}
4788 Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is
4789 writable, and if save-temps is off; otherwise, substitute the name
4790 of a temporary file, just like @samp{%u}.  This temporary file is not
4791 meant for communication between processes, but rather as a junk
4792 disposal mechanism.
4793
4794 @item %.@var{SUFFIX}
4795 Substitutes @var{.SUFFIX} for the suffixes of a matched switch's args
4796 when it is subsequently output with @samp{%*}.  @var{SUFFIX} is
4797 terminated by the next space or %.
4798
4799 @item %w
4800 Marks the argument containing or following the @samp{%w} as the
4801 designated output file of this compilation.  This puts the argument
4802 into the sequence of arguments that @samp{%o} will substitute later.
4803
4804 @item %o
4805 Substitutes the names of all the output files, with spaces
4806 automatically placed around them.  You should write spaces
4807 around the @samp{%o} as well or the results are undefined.
4808 @samp{%o} is for use in the specs for running the linker.
4809 Input files whose names have no recognized suffix are not compiled
4810 at all, but they are included among the output files, so they will
4811 be linked.
4812
4813 @item %O
4814 Substitutes the suffix for object files.  Note that this is
4815 handled specially when it immediately follows @samp{%g, %u, or %U},
4816 because of the need for those to form complete file names.  The
4817 handling is such that @samp{%O} is treated exactly as if it had already
4818 been substituted, except that @samp{%g, %u, and %U} do not currently
4819 support additional @var{suffix} characters following @samp{%O} as they would
4820 following, for example, @samp{.o}.
4821
4822 @item %p
4823 Substitutes the standard macro predefinitions for the
4824 current target machine.  Use this when running @code{cpp}.
4825
4826 @item %P
4827 Like @samp{%p}, but puts @samp{__} before and after the name of each
4828 predefined macro, except for macros that start with @samp{__} or with
4829 @samp{_@var{L}}, where @var{L} is an uppercase letter.  This is for ISO
4830 C@.
4831
4832 @item %I
4833 Substitute a @option{-iprefix} option made from @env{GCC_EXEC_PREFIX}.
4834
4835 @item %s
4836 Current argument is the name of a library or startup file of some sort.
4837 Search for that file in a standard list of directories and substitute
4838 the full name found.
4839
4840 @item %e@var{str}
4841 Print @var{str} as an error message.  @var{str} is terminated by a newline.
4842 Use this when inconsistent options are detected.
4843
4844 @item %|
4845 Output @samp{-} if the input for the current command is coming from a pipe.
4846
4847 @item %(@var{name})
4848 Substitute the contents of spec string @var{name} at this point.
4849
4850 @item %[@var{name}]
4851 Like @samp{%(@dots{})} but put @samp{__} around @option{-D} arguments.
4852
4853 @item %x@{@var{option}@}
4854 Accumulate an option for @samp{%X}.
4855
4856 @item %X
4857 Output the accumulated linker options specified by @option{-Wl} or a @samp{%x}
4858 spec string.
4859
4860 @item %Y
4861 Output the accumulated assembler options specified by @option{-Wa}.
4862
4863 @item %Z
4864 Output the accumulated preprocessor options specified by @option{-Wp}.
4865
4866 @item %v1
4867 Substitute the major version number of GCC@.
4868 (For version 2.9.5, this is 2.)
4869
4870 @item %v2
4871 Substitute the minor version number of GCC@.
4872 (For version 2.9.5, this is 9.)
4873
4874 @item %v3
4875 Substitute the patch level number of GCC@.
4876 (For version 2.9.5, this is 5.)
4877
4878 @item %a
4879 Process the @code{asm} spec.  This is used to compute the
4880 switches to be passed to the assembler.
4881
4882 @item %A
4883 Process the @code{asm_final} spec.  This is a spec string for
4884 passing switches to an assembler post-processor, if such a program is
4885 needed.
4886
4887 @item %l
4888 Process the @code{link} spec.  This is the spec for computing the
4889 command line passed to the linker.  Typically it will make use of the
4890 @samp{%L %G %S %D and %E} sequences.
4891
4892 @item %D
4893 Dump out a @option{-L} option for each directory that GCC believes might
4894 contain startup files.  If the target supports multilibs then the
4895 current multilib directory will be prepended to each of these paths.
4896
4897 @item %M
4898 Output the multilib directory with directory separators replaced with
4899 @samp{_}.  If multilib directories are not set, or the multilib directory is
4900 @file{.} then this option emits nothing.
4901
4902 @item %L
4903 Process the @code{lib} spec.  This is a spec string for deciding which
4904 libraries should be included on the command line to the linker.
4905
4906 @item %G
4907 Process the @code{libgcc} spec.  This is a spec string for deciding
4908 which GCC support library should be included on the command line to the linker.
4909
4910 @item %S
4911 Process the @code{startfile} spec.  This is a spec for deciding which
4912 object files should be the first ones passed to the linker.  Typically
4913 this might be a file named @file{crt0.o}.
4914
4915 @item %E
4916 Process the @code{endfile} spec.  This is a spec string that specifies
4917 the last object files that will be passed to the linker.
4918
4919 @item %C
4920 Process the @code{cpp} spec.  This is used to construct the arguments
4921 to be passed to the C preprocessor.
4922
4923 @item %c
4924 Process the @code{signed_char} spec.  This is intended to be used
4925 to tell cpp whether a char is signed.  It typically has the definition:
4926 @smallexample
4927 %@{funsigned-char:-D__CHAR_UNSIGNED__@}
4928 @end smallexample
4929
4930 @item %1
4931 Process the @code{cc1} spec.  This is used to construct the options to be
4932 passed to the actual C compiler (@samp{cc1}).
4933
4934 @item %2
4935 Process the @code{cc1plus} spec.  This is used to construct the options to be
4936 passed to the actual C++ compiler (@samp{cc1plus}).
4937
4938 @item %*
4939 Substitute the variable part of a matched option.  See below.
4940 Note that each comma in the substituted string is replaced by
4941 a single space.
4942
4943 @item %@{@code{S}@}
4944 Substitutes the @code{-S} switch, if that switch was given to GCC@.
4945 If that switch was not specified, this substitutes nothing.  Note that
4946 the leading dash is omitted when specifying this option, and it is
4947 automatically inserted if the substitution is performed.  Thus the spec
4948 string @samp{%@{foo@}} would match the command-line option @option{-foo}
4949 and would output the command line option @option{-foo}.
4950
4951 @item %W@{@code{S}@}
4952 Like %@{@code{S}@} but mark last argument supplied within as a file to be
4953 deleted on failure.
4954
4955 @item %@{@code{S}*@}
4956 Substitutes all the switches specified to GCC whose names start
4957 with @code{-S}, but which also take an argument.  This is used for
4958 switches like @option{-o}, @option{-D}, @option{-I}, etc.
4959 GCC considers @option{-o foo} as being
4960 one switch whose names starts with @samp{o}.  %@{o*@} would substitute this
4961 text, including the space.  Thus two arguments would be generated.
4962
4963 @item %@{^@code{S}*@}
4964 Like %@{@code{S}*@}, but don't put a blank between a switch and its
4965 argument.  Thus %@{^o*@} would only generate one argument, not two.
4966
4967 @item %@{@code{S}*&@code{T}*@}
4968 Like %@{@code{S}*@}, but preserve order of @code{S} and @code{T} options
4969 (the order of @code{S} and @code{T} in the spec is not significant).
4970 There can be any number of ampersand-separated variables; for each the
4971 wild card is optional.  Useful for CPP as @samp{%@{D*&U*&A*@}}.
4972
4973 @item %@{<@code{S}@}
4974 Remove all occurrences of @code{-S} from the command line.  Note---this
4975 command is position dependent.  @samp{%} commands in the spec string
4976 before this option will see @code{-S}, @samp{%} commands in the spec
4977 string after this option will not.
4978
4979 @item %@{@code{S}*:@code{X}@}
4980 Substitutes @code{X} if one or more switches whose names start with
4981 @code{-S} are specified to GCC@.  Note that the tail part of the
4982 @code{-S} option (i.e.@: the part matched by the @samp{*}) will be substituted
4983 for each occurrence of @samp{%*} within @code{X}.
4984
4985 @item %@{@code{S}:@code{X}@}
4986 Substitutes @code{X}, but only if the @samp{-S} switch was given to GCC@.
4987
4988 @item %@{!@code{S}:@code{X}@}
4989 Substitutes @code{X}, but only if the @samp{-S} switch was @emph{not} given to GCC@.
4990
4991 @item %@{|@code{S}:@code{X}@}
4992 Like %@{@code{S}:@code{X}@}, but if no @code{S} switch, substitute @samp{-}.
4993
4994 @item %@{|!@code{S}:@code{X}@}
4995 Like %@{!@code{S}:@code{X}@}, but if there is an @code{S} switch, substitute @samp{-}.
4996
4997 @item %@{.@code{S}:@code{X}@}
4998 Substitutes @code{X}, but only if processing a file with suffix @code{S}.
4999
5000 @item %@{!.@code{S}:@code{X}@}
5001 Substitutes @code{X}, but only if @emph{not} processing a file with suffix @code{S}.
5002
5003 @item %@{@code{S}|@code{P}:@code{X}@}
5004 Substitutes @code{X} if either @code{-S} or @code{-P} was given to GCC@.  This may be
5005 combined with @samp{!} and @samp{.} sequences as well, although they
5006 have a stronger binding than the @samp{|}.  For example a spec string
5007 like this:
5008
5009 @smallexample
5010 %@{.c:-foo@} %@{!.c:-bar@} %@{.c|d:-baz@} %@{!.c|d:-boggle@}
5011 @end smallexample
5012
5013 will output the following command-line options from the following input
5014 command-line options:
5015
5016 @smallexample
5017 fred.c        -foo -baz
5018 jim.d         -bar -boggle
5019 -d fred.c     -foo -baz -boggle
5020 -d jim.d      -bar -baz -boggle
5021 @end smallexample
5022
5023 @end table
5024
5025 The conditional text @code{X} in a %@{@code{S}:@code{X}@} or
5026 %@{!@code{S}:@code{X}@} construct may contain other nested @samp{%} constructs
5027 or spaces, or even newlines.  They are processed as usual, as described
5028 above.
5029
5030 The @option{-O}, @option{-f}, @option{-m}, and @option{-W}
5031 switches are handled specifically in these
5032 constructs.  If another value of @option{-O} or the negated form of a @option{-f}, @option{-m}, or
5033 @option{-W} switch is found later in the command line, the earlier switch
5034 value is ignored, except with @{@code{S}*@} where @code{S} is just one
5035 letter, which passes all matching options.
5036
5037 The character @samp{|} at the beginning of the predicate text is used to indicate
5038 that a command should be piped to the following command, but only if @option{-pipe}
5039 is specified.
5040
5041 It is built into GCC which switches take arguments and which do not.
5042 (You might think it would be useful to generalize this to allow each
5043 compiler's spec to say which switches take arguments.  But this cannot
5044 be done in a consistent fashion.  GCC cannot even decide which input
5045 files have been specified without knowing which switches take arguments,
5046 and it must know which input files to compile in order to tell which
5047 compilers to run).
5048
5049 GCC also knows implicitly that arguments starting in @option{-l} are to be
5050 treated as compiler output files, and passed to the linker in their
5051 proper position among the other output files.
5052
5053 @c man begin OPTIONS
5054
5055 @node Target Options
5056 @section Specifying Target Machine and Compiler Version
5057 @cindex target options
5058 @cindex cross compiling
5059 @cindex specifying machine version
5060 @cindex specifying compiler version and target machine
5061 @cindex compiler version, specifying
5062 @cindex target machine, specifying
5063
5064 The usual way to run GCC is to run the executable called @file{gcc}, or
5065 @file{<machine>-gcc} when cross-compiling, or
5066 @file{<machine>-gcc-<version>} to run a version other than the one that
5067 was installed last.  Sometimes this is inconvenient, so GCC provides
5068 options that will switch to another cross-compiler or version.
5069
5070 @table @gcctabopt
5071 @item -b @var{machine}
5072 @opindex b
5073 The argument @var{machine} specifies the target machine for compilation.
5074
5075 The value to use for @var{machine} is the same as was specified as the
5076 machine type when configuring GCC as a cross-compiler.  For
5077 example, if a cross-compiler was configured with @samp{configure
5078 i386v}, meaning to compile for an 80386 running System V, then you
5079 would specify @option{-b i386v} to run that cross compiler.
5080
5081 @item -V @var{version}
5082 @opindex V
5083 The argument @var{version} specifies which version of GCC to run.
5084 This is useful when multiple versions are installed.  For example,
5085 @var{version} might be @samp{2.0}, meaning to run GCC version 2.0.
5086 @end table
5087
5088 The @option{-V} and @option{-b} options work by running the
5089 @file{<machine>-gcc-<version>} executable, so there's no real reason to
5090 use them if you can just run that directly.
5091
5092 @node Submodel Options
5093 @section Hardware Models and Configurations
5094 @cindex submodel options
5095 @cindex specifying hardware config
5096 @cindex hardware models and configurations, specifying
5097 @cindex machine dependent options
5098
5099 Earlier we discussed the standard option @option{-b} which chooses among
5100 different installed compilers for completely different target
5101 machines, such as VAX vs.@: 68000 vs.@: 80386.
5102
5103 In addition, each of these target machine types can have its own
5104 special options, starting with @samp{-m}, to choose among various
5105 hardware models or configurations---for example, 68010 vs 68020,
5106 floating coprocessor or none.  A single installed version of the
5107 compiler can compile for any model or configuration, according to the
5108 options specified.
5109
5110 Some configurations of the compiler also support additional special
5111 options, usually for compatibility with other compilers on the same
5112 platform.
5113
5114 These options are defined by the macro @code{TARGET_SWITCHES} in the
5115 machine description.  The default for the options is also defined by
5116 that macro, which enables you to change the defaults.
5117
5118 @menu
5119 * M680x0 Options::
5120 * M68hc1x Options::
5121 * VAX Options::
5122 * SPARC Options::
5123 * Convex Options::
5124 * AMD29K Options::
5125 * ARM Options::
5126 * MN10200 Options::
5127 * MN10300 Options::
5128 * M32R/D Options::
5129 * M88K Options::
5130 * RS/6000 and PowerPC Options::
5131 * RT Options::
5132 * MIPS Options::
5133 * i386 and x86-64 Options::
5134 * HPPA Options::
5135 * Intel 960 Options::
5136 * DEC Alpha Options::
5137 * DEC Alpha/VMS Options::
5138 * Clipper Options::
5139 * H8/300 Options::
5140 * SH Options::
5141 * System V Options::
5142 * TMS320C3x/C4x Options::
5143 * V850 Options::
5144 * ARC Options::
5145 * NS32K Options::
5146 * AVR Options::
5147 * MCore Options::
5148 * IA-64 Options::
5149 * D30V Options::
5150 * S/390 and zSeries Options::
5151 * CRIS Options::
5152 * MMIX Options::
5153 * PDP-11 Options::
5154 * Xstormy16 Options::
5155 * Xtensa Options::
5156 @end menu
5157
5158 @node M680x0 Options
5159 @subsection M680x0 Options
5160 @cindex M680x0 options
5161
5162 These are the @samp{-m} options defined for the 68000 series.  The default
5163 values for these options depends on which style of 68000 was selected when
5164 the compiler was configured; the defaults for the most common choices are
5165 given below.
5166
5167 @table @gcctabopt
5168 @item -m68000
5169 @itemx -mc68000
5170 @opindex m68000
5171 @opindex mc68000
5172 Generate output for a 68000.  This is the default
5173 when the compiler is configured for 68000-based systems.
5174
5175 Use this option for microcontrollers with a 68000 or EC000 core,
5176 including the 68008, 68302, 68306, 68307, 68322, 68328 and 68356.
5177
5178 @item -m68020
5179 @itemx -mc68020
5180 @opindex m68020
5181 @opindex mc68020
5182 Generate output for a 68020.  This is the default
5183 when the compiler is configured for 68020-based systems.
5184
5185 @item -m68881
5186 @opindex m68881
5187 Generate output containing 68881 instructions for floating point.
5188 This is the default for most 68020 systems unless @option{--nfp} was
5189 specified when the compiler was configured.
5190
5191 @item -m68030
5192 @opindex m68030
5193 Generate output for a 68030.  This is the default when the compiler is
5194 configured for 68030-based systems.
5195
5196 @item -m68040
5197 @opindex m68040
5198 Generate output for a 68040.  This is the default when the compiler is
5199 configured for 68040-based systems.
5200
5201 This option inhibits the use of 68881/68882 instructions that have to be
5202 emulated by software on the 68040.  Use this option if your 68040 does not
5203 have code to emulate those instructions.
5204
5205 @item -m68060
5206 @opindex m68060
5207 Generate output for a 68060.  This is the default when the compiler is
5208 configured for 68060-based systems.
5209
5210 This option inhibits the use of 68020 and 68881/68882 instructions that
5211 have to be emulated by software on the 68060.  Use this option if your 68060
5212 does not have code to emulate those instructions.
5213
5214 @item -mcpu32
5215 @opindex mcpu32
5216 Generate output for a CPU32.  This is the default
5217 when the compiler is configured for CPU32-based systems.
5218
5219 Use this option for microcontrollers with a
5220 CPU32 or CPU32+ core, including the 68330, 68331, 68332, 68333, 68334,
5221 68336, 68340, 68341, 68349 and 68360.
5222
5223 @item -m5200
5224 @opindex m5200
5225 Generate output for a 520X ``coldfire'' family cpu.  This is the default
5226 when the compiler is configured for 520X-based systems.
5227
5228 Use this option for microcontroller with a 5200 core, including
5229 the MCF5202, MCF5203, MCF5204 and MCF5202.
5230
5231
5232 @item -m68020-40
5233 @opindex m68020-40
5234 Generate output for a 68040, without using any of the new instructions.
5235 This results in code which can run relatively efficiently on either a
5236 68020/68881 or a 68030 or a 68040.  The generated code does use the
5237 68881 instructions that are emulated on the 68040.
5238
5239 @item -m68020-60
5240 @opindex m68020-60
5241 Generate output for a 68060, without using any of the new instructions.
5242 This results in code which can run relatively efficiently on either a
5243 68020/68881 or a 68030 or a 68040.  The generated code does use the
5244 68881 instructions that are emulated on the 68060.
5245
5246 @item -mfpa
5247 @opindex mfpa
5248 Generate output containing Sun FPA instructions for floating point.
5249
5250 @item -msoft-float
5251 @opindex msoft-float
5252 Generate output containing library calls for floating point.
5253 @strong{Warning:} the requisite libraries are not available for all m68k
5254 targets.  Normally the facilities of the machine's usual C compiler are
5255 used, but this can't be done directly in cross-compilation.  You must
5256 make your own arrangements to provide suitable library functions for
5257 cross-compilation.  The embedded targets @samp{m68k-*-aout} and
5258 @samp{m68k-*-coff} do provide software floating point support.
5259
5260 @item -mshort
5261 @opindex mshort
5262 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5263
5264 @item -mnobitfield
5265 @opindex mnobitfield
5266 Do not use the bit-field instructions.  The @option{-m68000}, @option{-mcpu32}
5267 and @option{-m5200} options imply @w{@option{-mnobitfield}}.
5268
5269 @item -mbitfield
5270 @opindex mbitfield
5271 Do use the bit-field instructions.  The @option{-m68020} option implies
5272 @option{-mbitfield}.  This is the default if you use a configuration
5273 designed for a 68020.
5274
5275 @item -mrtd
5276 @opindex mrtd
5277 Use a different function-calling convention, in which functions
5278 that take a fixed number of arguments return with the @code{rtd}
5279 instruction, which pops their arguments while returning.  This
5280 saves one instruction in the caller since there is no need to pop
5281 the arguments there.
5282
5283 This calling convention is incompatible with the one normally
5284 used on Unix, so you cannot use it if you need to call libraries
5285 compiled with the Unix compiler.
5286
5287 Also, you must provide function prototypes for all functions that
5288 take variable numbers of arguments (including @code{printf});
5289 otherwise incorrect code will be generated for calls to those
5290 functions.
5291
5292 In addition, seriously incorrect code will result if you call a
5293 function with too many arguments.  (Normally, extra arguments are
5294 harmlessly ignored.)
5295
5296 The @code{rtd} instruction is supported by the 68010, 68020, 68030,
5297 68040, 68060 and CPU32 processors, but not by the 68000 or 5200.
5298
5299 @item -malign-int
5300 @itemx -mno-align-int
5301 @opindex malign-int
5302 @opindex mno-align-int
5303 Control whether GCC aligns @code{int}, @code{long}, @code{long long},
5304 @code{float}, @code{double}, and @code{long double} variables on a 32-bit
5305 boundary (@option{-malign-int}) or a 16-bit boundary (@option{-mno-align-int}).
5306 Aligning variables on 32-bit boundaries produces code that runs somewhat
5307 faster on processors with 32-bit busses at the expense of more memory.
5308
5309 @strong{Warning:} if you use the @option{-malign-int} switch, GCC will
5310 align structures containing the above types  differently than
5311 most published application binary interface specifications for the m68k.
5312
5313 @item -mpcrel
5314 @opindex mpcrel
5315 Use the pc-relative addressing mode of the 68000 directly, instead of
5316 using a global offset table.  At present, this option implies @option{-fpic},
5317 allowing at most a 16-bit offset for pc-relative addressing.  @option{-fPIC} is
5318 not presently supported with @option{-mpcrel}, though this could be supported for
5319 68020 and higher processors.
5320
5321 @item -mno-strict-align
5322 @itemx -mstrict-align
5323 @opindex mno-strict-align
5324 @opindex mstrict-align
5325 Do not (do) assume that unaligned memory references will be handled by
5326 the system.
5327
5328 @end table
5329
5330 @node M68hc1x Options
5331 @subsection M68hc1x Options
5332 @cindex M68hc1x options
5333
5334 These are the @samp{-m} options defined for the 68hc11 and 68hc12
5335 microcontrollers.  The default values for these options depends on
5336 which style of microcontroller was selected when the compiler was configured;
5337 the defaults for the most common choices are given below.
5338
5339 @table @gcctabopt
5340 @item -m6811
5341 @itemx -m68hc11
5342 @opindex m6811
5343 @opindex m68hc11
5344 Generate output for a 68HC11.  This is the default
5345 when the compiler is configured for 68HC11-based systems.
5346
5347 @item -m6812
5348 @itemx -m68hc12
5349 @opindex m6812
5350 @opindex m68hc12
5351 Generate output for a 68HC12.  This is the default
5352 when the compiler is configured for 68HC12-based systems.
5353
5354 @item -mauto-incdec
5355 @opindex mauto-incdec
5356 Enable the use of 68HC12 pre and post auto-increment and auto-decrement
5357 addressing modes.
5358
5359 @item -minmax
5360 @itemx -nominmax
5361 @opindex minmax
5362 @opindex mnominmax
5363 Enable the use of 68HC12 min and max instructions.
5364
5365 @item -mlong-calls
5366 @itemx -mno-long-calls
5367 @opindex mlong-calls
5368 @opindex mno-long-calls
5369 Treat all calls as being far away (near).  If calls are assumed to be
5370 far away, the compiler will use the @code{call} instruction to
5371 call a function and the @code{rtc} instruction for returning.
5372
5373 @item -mshort
5374 @opindex mshort
5375 Consider type @code{int} to be 16 bits wide, like @code{short int}.
5376
5377 @item -msoft-reg-count=@var{count}
5378 @opindex msoft-reg-count
5379 Specify the number of pseudo-soft registers which are used for the
5380 code generation.  The maximum number is 32.  Using more pseudo-soft
5381 register may or may not result in better code depending on the program.
5382 The default is 4 for 68HC11 and 2 for 68HC12.
5383
5384 @end table
5385
5386 @node VAX Options
5387 @subsection VAX Options
5388 @cindex VAX options
5389
5390 These @samp{-m} options are defined for the VAX:
5391
5392 @table @gcctabopt
5393 @item -munix
5394 @opindex munix
5395 Do not output certain jump instructions (@code{aobleq} and so on)
5396 that the Unix assembler for the VAX cannot handle across long
5397 ranges.
5398
5399 @item -mgnu
5400 @opindex mgnu
5401 Do output those jump instructions, on the assumption that you
5402 will assemble with the GNU assembler.
5403
5404 @item -mg
5405 @opindex mg
5406 Output code for g-format floating point numbers instead of d-format.
5407 @end table
5408
5409 @node SPARC Options
5410 @subsection SPARC Options
5411 @cindex SPARC options
5412
5413 These @samp{-m} switches are supported on the SPARC:
5414
5415 @table @gcctabopt
5416 @item -mno-app-regs
5417 @itemx -mapp-regs
5418 @opindex mno-app-regs
5419 @opindex mapp-regs
5420 Specify @option{-mapp-regs} to generate output using the global registers
5421 2 through 4, which the SPARC SVR4 ABI reserves for applications.  This
5422 is the default.
5423
5424 To be fully SVR4 ABI compliant at the cost of some performance loss,
5425 specify @option{-mno-app-regs}.  You should compile libraries and system
5426 software with this option.
5427
5428 @item -mfpu
5429 @itemx -mhard-float
5430 @opindex mfpu
5431 @opindex mhard-float
5432 Generate output containing floating point instructions.  This is the
5433 default.
5434
5435 @item -mno-fpu
5436 @itemx -msoft-float
5437 @opindex mno-fpu
5438 @opindex msoft-float
5439 Generate output containing library calls for floating point.
5440 @strong{Warning:} the requisite libraries are not available for all SPARC
5441 targets.  Normally the facilities of the machine's usual C compiler are
5442 used, but this cannot be done directly in cross-compilation.  You must make
5443 your own arrangements to provide suitable library functions for
5444 cross-compilation.  The embedded targets @samp{sparc-*-aout} and
5445 @samp{sparclite-*-*} do provide software floating point support.
5446
5447 @option{-msoft-float} changes the calling convention in the output file;
5448 therefore, it is only useful if you compile @emph{all} of a program with
5449 this option.  In particular, you need to compile @file{libgcc.a}, the
5450 library that comes with GCC, with @option{-msoft-float} in order for
5451 this to work.
5452
5453 @item -mhard-quad-float
5454 @opindex mhard-quad-float
5455 Generate output containing quad-word (long double) floating point
5456 instructions.
5457
5458 @item -msoft-quad-float
5459 @opindex msoft-quad-float
5460 Generate output containing library calls for quad-word (long double)
5461 floating point instructions.  The functions called are those specified
5462 in the SPARC ABI@.  This is the default.
5463
5464 As of this writing, there are no sparc implementations that have hardware
5465 support for the quad-word floating point instructions.  They all invoke
5466 a trap handler for one of these instructions, and then the trap handler
5467 emulates the effect of the instruction.  Because of the trap handler overhead,
5468 this is much slower than calling the ABI library routines.  Thus the
5469 @option{-msoft-quad-float} option is the default.
5470
5471 @item -mno-flat
5472 @itemx -mflat
5473 @opindex mno-flat
5474 @opindex mflat
5475 With @option{-mflat}, the compiler does not generate save/restore instructions
5476 and will use a ``flat'' or single register window calling convention.
5477 This model uses %i7 as the frame pointer and is compatible with the normal
5478 register window model.  Code from either may be intermixed.
5479 The local registers and the input registers (0--5) are still treated as
5480 ``call saved'' registers and will be saved on the stack as necessary.
5481
5482 With @option{-mno-flat} (the default), the compiler emits save/restore
5483 instructions (except for leaf functions) and is the normal mode of operation.
5484
5485 @item -mno-unaligned-doubles
5486 @itemx -munaligned-doubles
5487 @opindex mno-unaligned-doubles
5488 @opindex munaligned-doubles
5489 Assume that doubles have 8 byte alignment.  This is the default.
5490
5491 With @option{-munaligned-doubles}, GCC assumes that doubles have 8 byte
5492 alignment only if they are contained in another type, or if they have an
5493 absolute address.  Otherwise, it assumes they have 4 byte alignment.
5494 Specifying this option avoids some rare compatibility problems with code
5495 generated by other compilers.  It is not the default because it results
5496 in a performance loss, especially for floating point code.
5497
5498 @item -mno-faster-structs
5499 @itemx -mfaster-structs
5500 @opindex mno-faster-structs
5501 @opindex mfaster-structs
5502 With @option{-mfaster-structs}, the compiler assumes that structures
5503 should have 8 byte alignment.  This enables the use of pairs of
5504 @code{ldd} and @code{std} instructions for copies in structure
5505 assignment, in place of twice as many @code{ld} and @code{st} pairs.
5506 However, the use of this changed alignment directly violates the SPARC
5507 ABI@.  Thus, it's intended only for use on targets where the developer
5508 acknowledges that their resulting code will not be directly in line with
5509 the rules of the ABI@.
5510
5511 @item -mv8
5512 @itemx -msparclite
5513 @opindex mv8
5514 @opindex msparclite
5515 These two options select variations on the SPARC architecture.
5516
5517 By default (unless specifically configured for the Fujitsu SPARClite),
5518 GCC generates code for the v7 variant of the SPARC architecture.
5519
5520 @option{-mv8} will give you SPARC v8 code.  The only difference from v7
5521 code is that the compiler emits the integer multiply and integer
5522 divide instructions which exist in SPARC v8 but not in SPARC v7.
5523
5524 @option{-msparclite} will give you SPARClite code.  This adds the integer
5525 multiply, integer divide step and scan (@code{ffs}) instructions which
5526 exist in SPARClite but not in SPARC v7.
5527
5528 These options are deprecated and will be deleted in a future GCC release.
5529 They have been replaced with @option{-mcpu=xxx}.
5530
5531 @item -mcypress
5532 @itemx -msupersparc
5533 @opindex mcypress
5534 @opindex msupersparc
5535 These two options select the processor for which the code is optimized.
5536
5537 With @option{-mcypress} (the default), the compiler optimizes code for the
5538 Cypress CY7C602 chip, as used in the SPARCStation/SPARCServer 3xx series.
5539 This is also appropriate for the older SPARCStation 1, 2, IPX etc.
5540
5541 With @option{-msupersparc} the compiler optimizes code for the SuperSPARC cpu, as
5542 used in the SPARCStation 10, 1000 and 2000 series.  This flag also enables use
5543 of the full SPARC v8 instruction set.
5544
5545 These options are deprecated and will be deleted in a future GCC release.
5546 They have been replaced with @option{-mcpu=xxx}.
5547
5548 @item -mcpu=@var{cpu_type}
5549 @opindex mcpu
5550 Set the instruction set, register set, and instruction scheduling parameters
5551 for machine type @var{cpu_type}.  Supported values for @var{cpu_type} are
5552 @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
5553 @samp{hypersparc}, @samp{sparclite86x}, @samp{f930}, @samp{f934},
5554 @samp{sparclet}, @samp{tsc701}, @samp{v9}, and @samp{ultrasparc}.
5555
5556 Default instruction scheduling parameters are used for values that select
5557 an architecture and not an implementation.  These are @samp{v7}, @samp{v8},
5558 @samp{sparclite}, @samp{sparclet}, @samp{v9}.
5559
5560 Here is a list of each supported architecture and their supported
5561 implementations.
5562
5563 @smallexample
5564     v7:             cypress
5565     v8:             supersparc, hypersparc
5566     sparclite:      f930, f934, sparclite86x
5567     sparclet:       tsc701
5568     v9:             ultrasparc
5569 @end smallexample
5570
5571 @item -mtune=@var{cpu_type}
5572 @opindex mtune
5573 Set the instruction scheduling parameters for machine type
5574 @var{cpu_type}, but do not set the instruction set or register set that the
5575 option @option{-mcpu=@var{cpu_type}} would.
5576
5577 The same values for @option{-mcpu=@var{cpu_type}} can be used for
5578 @option{-mtune=@var{cpu_type}}, but the only useful values are those
5579 that select a particular cpu implementation.  Those are @samp{cypress},
5580 @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
5581 @samp{sparclite86x}, @samp{tsc701}, and @samp{ultrasparc}.
5582
5583 @end table
5584
5585 These @samp{-m} switches are supported in addition to the above
5586 on the SPARCLET processor.
5587
5588 @table @gcctabopt
5589 @item -mlittle-endian
5590 @opindex mlittle-endian
5591 Generate code for a processor running in little-endian mode.
5592
5593 @item -mlive-g0
5594 @opindex mlive-g0
5595 Treat register @code{%g0} as a normal register.
5596 GCC will continue to clobber it as necessary but will not assume
5597 it always reads as 0.
5598
5599 @item -mbroken-saverestore
5600 @opindex mbroken-saverestore
5601 Generate code that does not use non-trivial forms of the @code{save} and
5602 @code{restore} instructions.  Early versions of the SPARCLET processor do
5603 not correctly handle @code{save} and @code{restore} instructions used with
5604 arguments.  They correctly handle them used without arguments.  A @code{save}
5605 instruction used without arguments increments the current window pointer
5606 but does not allocate a new stack frame.  It is assumed that the window
5607 overflow trap handler will properly handle this case as will interrupt
5608 handlers.
5609 @end table
5610
5611 These @samp{-m} switches are supported in addition to the above
5612 on SPARC V9 processors in 64-bit environments.
5613
5614 @table @gcctabopt
5615 @item -mlittle-endian
5616 @opindex mlittle-endian
5617 Generate code for a processor running in little-endian mode.
5618
5619 @item -m32
5620 @itemx -m64
5621 @opindex m32
5622 @opindex m64
5623 Generate code for a 32-bit or 64-bit environment.
5624 The 32-bit environment sets int, long and pointer to 32 bits.
5625 The 64-bit environment sets int to 32 bits and long and pointer
5626 to 64 bits.
5627
5628 @item -mcmodel=medlow
5629 @opindex mcmodel=medlow
5630 Generate code for the Medium/Low code model: the program must be linked
5631 in the low 32 bits of the address space.  Pointers are 64 bits.
5632 Programs can be statically or dynamically linked.
5633
5634 @item -mcmodel=medmid
5635 @opindex mcmodel=medmid
5636 Generate code for the Medium/Middle code model: the program must be linked
5637 in the low 44 bits of the address space, the text segment must be less than
5638 2G bytes, and data segment must be within 2G of the text segment.
5639 Pointers are 64 bits.
5640
5641 @item -mcmodel=medany
5642 @opindex mcmodel=medany
5643 Generate code for the Medium/Anywhere code model: the program may be linked
5644 anywhere in the address space, the text segment must be less than
5645 2G bytes, and data segment must be within 2G of the text segment.
5646 Pointers are 64 bits.
5647
5648 @item -mcmodel=embmedany
5649 @opindex mcmodel=embmedany
5650 Generate code for the Medium/Anywhere code model for embedded systems:
5651 assume a 32-bit text and a 32-bit data segment, both starting anywhere
5652 (determined at link time).  Register %g4 points to the base of the
5653 data segment.  Pointers are still 64 bits.
5654 Programs are statically linked, PIC is not supported.
5655
5656 @item -mstack-bias
5657 @itemx -mno-stack-bias
5658 @opindex mstack-bias
5659 @opindex mno-stack-bias
5660 With @option{-mstack-bias}, GCC assumes that the stack pointer, and
5661 frame pointer if present, are offset by @minus{}2047 which must be added back
5662 when making stack frame references.
5663 Otherwise, assume no such offset is present.
5664 @end table
5665
5666 @node Convex Options
5667 @subsection Convex Options
5668 @cindex Convex options
5669
5670 These @samp{-m} options are defined for Convex:
5671
5672 @table @gcctabopt
5673 @item -mc1
5674 @opindex mc1
5675 Generate output for C1.  The code will run on any Convex machine.
5676 The preprocessor symbol @code{__convex__c1__} is defined.
5677
5678 @item -mc2
5679 @opindex mc2
5680 Generate output for C2.  Uses instructions not available on C1.
5681 Scheduling and other optimizations are chosen for max performance on C2.
5682 The preprocessor symbol @code{__convex_c2__} is defined.
5683
5684 @item -mc32
5685 @opindex mc32
5686 Generate output for C32xx.  Uses instructions not available on C1.
5687 Scheduling and other optimizations are chosen for max performance on C32.
5688 The preprocessor symbol @code{__convex_c32__} is defined.
5689
5690 @item -mc34
5691 @opindex mc34
5692 Generate output for C34xx.  Uses instructions not available on C1.
5693 Scheduling and other optimizations are chosen for max performance on C34.
5694 The preprocessor symbol @code{__convex_c34__} is defined.
5695
5696 @item -mc38
5697 @opindex mc38
5698 Generate output for C38xx.  Uses instructions not available on C1.
5699 Scheduling and other optimizations are chosen for max performance on C38.
5700 The preprocessor symbol @code{__convex_c38__} is defined.
5701
5702 @item -margcount
5703 @opindex margcount
5704 Generate code which puts an argument count in the word preceding each
5705 argument list.  This is compatible with regular CC, and a few programs
5706 may need the argument count word.  GDB and other source-level debuggers
5707 do not need it; this info is in the symbol table.
5708
5709 @item -mnoargcount
5710 @opindex mnoargcount
5711 Omit the argument count word.  This is the default.
5712
5713 @item -mvolatile-cache
5714 @opindex mvolatile-cache
5715 Allow volatile references to be cached.  This is the default.
5716
5717 @item -mvolatile-nocache
5718 @opindex mvolatile-nocache
5719 Volatile references bypass the data cache, going all the way to memory.
5720 This is only needed for multi-processor code that does not use standard
5721 synchronization instructions.  Making non-volatile references to volatile
5722 locations will not necessarily work.
5723
5724 @item -mlong32
5725 @opindex mlong32
5726 Type long is 32 bits, the same as type int.  This is the default.
5727
5728 @item -mlong64
5729 @opindex mlong64
5730 Type long is 64 bits, the same as type long long.  This option is useless,
5731 because no library support exists for it.
5732 @end table
5733
5734 @node AMD29K Options
5735 @subsection AMD29K Options
5736 @cindex AMD29K options
5737
5738 These @samp{-m} options are defined for the AMD Am29000:
5739
5740 @table @gcctabopt
5741 @item -mdw
5742 @opindex mdw
5743 @cindex DW bit (29k)
5744 Generate code that assumes the @code{DW} bit is set, i.e., that byte and
5745 halfword operations are directly supported by the hardware.  This is the
5746 default.
5747
5748 @item -mndw
5749 @opindex mndw
5750 Generate code that assumes the @code{DW} bit is not set.
5751
5752 @item -mbw
5753 @opindex mbw
5754 @cindex byte writes (29k)
5755 Generate code that assumes the system supports byte and halfword write
5756 operations.  This is the default.
5757
5758 @item -mnbw
5759 @opindex mnbw
5760 Generate code that assumes the systems does not support byte and
5761 halfword write operations.  @option{-mnbw} implies @option{-mndw}.
5762
5763 @item -msmall
5764 @opindex msmall
5765 @cindex memory model (29k)
5766 Use a small memory model that assumes that all function addresses are
5767 either within a single 256 KB segment or at an absolute address of less
5768 than 256k.  This allows the @code{call} instruction to be used instead
5769 of a @code{const}, @code{consth}, @code{calli} sequence.
5770
5771 @item -mnormal
5772 @opindex mnormal
5773 Use the normal memory model: Generate @code{call} instructions only when
5774 calling functions in the same file and @code{calli} instructions
5775 otherwise.  This works if each file occupies less than 256 KB but allows
5776 the entire executable to be larger than 256 KB@.  This is the default.
5777
5778 @item -mlarge
5779 @opindex mlarge
5780 Always use @code{calli} instructions.  Specify this option if you expect
5781 a single file to compile into more than 256 KB of code.
5782
5783 @item -m29050
5784 @opindex m29050
5785 @cindex processor selection (29k)
5786 Generate code for the Am29050.
5787
5788 @item -m29000
5789 @opindex m29000
5790 Generate code for the Am29000.  This is the default.
5791
5792 @item -mkernel-registers
5793 @opindex mkernel-registers
5794 @cindex kernel and user registers (29k)
5795 Generate references to registers @code{gr64-gr95} instead of to
5796 registers @code{gr96-gr127}.  This option can be used when compiling
5797 kernel code that wants a set of global registers disjoint from that used
5798 by user-mode code.
5799
5800 Note that when this option is used, register names in @samp{-f} flags
5801 must use the normal, user-mode, names.
5802
5803 @item -muser-registers
5804 @opindex muser-registers
5805 Use the normal set of global registers, @code{gr96-gr127}.  This is the
5806 default.
5807
5808 @item -mstack-check
5809 @itemx -mno-stack-check
5810 @opindex mstack-check
5811 @opindex mno-stack-check
5812 @cindex stack checks (29k)
5813 Insert (or do not insert) a call to @code{__msp_check} after each stack
5814 adjustment.  This is often used for kernel code.
5815
5816 @item -mstorem-bug
5817 @itemx -mno-storem-bug
5818 @opindex mstorem-bug
5819 @opindex mno-storem-bug
5820 @cindex storem bug (29k)
5821 @option{-mstorem-bug} handles 29k processors which cannot handle the
5822 separation of a mtsrim insn and a storem instruction (most 29000 chips
5823 to date, but not the 29050).
5824
5825 @item -mno-reuse-arg-regs
5826 @itemx -mreuse-arg-regs
5827 @opindex mno-reuse-arg-regs
5828 @opindex mreuse-arg-regs
5829 @option{-mno-reuse-arg-regs} tells the compiler to only use incoming argument
5830 registers for copying out arguments.  This helps detect calling a function
5831 with fewer arguments than it was declared with.
5832
5833 @item -mno-impure-text
5834 @itemx -mimpure-text
5835 @opindex mno-impure-text
5836 @opindex mimpure-text
5837 @option{-mimpure-text}, used in addition to @option{-shared}, tells the compiler to
5838 not pass @option{-assert pure-text} to the linker when linking a shared object.
5839
5840 @item -msoft-float
5841 @opindex msoft-float
5842 Generate output containing library calls for floating point.
5843 @strong{Warning:} the requisite libraries are not part of GCC@.
5844 Normally the facilities of the machine's usual C compiler are used, but
5845 this can't be done directly in cross-compilation.  You must make your
5846 own arrangements to provide suitable library functions for
5847 cross-compilation.
5848
5849 @item -mno-multm
5850 @opindex mno-multm
5851 Do not generate multm or multmu instructions.  This is useful for some embedded
5852 systems which do not have trap handlers for these instructions.
5853 @end table
5854
5855 @node ARM Options
5856 @subsection ARM Options
5857 @cindex ARM options
5858
5859 These @samp{-m} options are defined for Advanced RISC Machines (ARM)
5860 architectures:
5861
5862 @table @gcctabopt
5863 @item -mapcs-frame
5864 @opindex mapcs-frame
5865 Generate a stack frame that is compliant with the ARM Procedure Call
5866 Standard for all functions, even if this is not strictly necessary for
5867 correct execution of the code.  Specifying @option{-fomit-frame-pointer}
5868 with this option will cause the stack frames not to be generated for
5869 leaf functions.  The default is @option{-mno-apcs-frame}.
5870
5871 @item -mapcs
5872 @opindex mapcs
5873 This is a synonym for @option{-mapcs-frame}.
5874
5875 @item -mapcs-26
5876 @opindex mapcs-26
5877 Generate code for a processor running with a 26-bit program counter,
5878 and conforming to the function calling standards for the APCS 26-bit
5879 option.  This option replaces the @option{-m2} and @option{-m3} options
5880 of previous releases of the compiler.
5881
5882 @item -mapcs-32
5883 @opindex mapcs-32
5884 Generate code for a processor running with a 32-bit program counter,
5885 and conforming to the function calling standards for the APCS 32-bit
5886 option.  This option replaces the @option{-m6} option of previous releases
5887 of the compiler.
5888
5889 @ignore
5890 @c not currently implemented
5891 @item -mapcs-stack-check
5892 @opindex mapcs-stack-check
5893 Generate code to check the amount of stack space available upon entry to
5894 every function (that actually uses some stack space).  If there is
5895 insufficient space available then either the function
5896 @samp{__rt_stkovf_split_small} or @samp{__rt_stkovf_split_big} will be
5897 called, depending upon the amount of stack space required.  The run time
5898 system is required to provide these functions.  The default is
5899 @option{-mno-apcs-stack-check}, since this produces smaller code.
5900
5901 @c not currently implemented
5902 @item -mapcs-float
5903 @opindex mapcs-float
5904 Pass floating point arguments using the float point registers.  This is
5905 one of the variants of the APCS@.  This option is recommended if the
5906 target hardware has a floating point unit or if a lot of floating point
5907 arithmetic is going to be performed by the code.  The default is
5908 @option{-mno-apcs-float}, since integer only code is slightly increased in
5909 size if @option{-mapcs-float} is used.
5910
5911 @c not currently implemented
5912 @item -mapcs-reentrant
5913 @opindex mapcs-reentrant
5914 Generate reentrant, position independent code.  The default is
5915 @option{-mno-apcs-reentrant}.
5916 @end ignore
5917
5918 @item -mthumb-interwork
5919 @opindex mthumb-interwork
5920 Generate code which supports calling between the ARM and Thumb
5921 instruction sets.  Without this option the two instruction sets cannot
5922 be reliably used inside one program.  The default is
5923 @option{-mno-thumb-interwork}, since slightly larger code is generated
5924 when @option{-mthumb-interwork} is specified.
5925
5926 @item -mno-sched-prolog
5927 @opindex mno-sched-prolog
5928 Prevent the reordering of instructions in the function prolog, or the
5929 merging of those instruction with the instructions in the function's
5930 body.  This means that all functions will start with a recognizable set
5931 of instructions (or in fact one of a choice from a small set of
5932 different function prologues), and this information can be used to
5933 locate the start if functions inside an executable piece of code.  The
5934 default is @option{-msched-prolog}.
5935
5936 @item -mhard-float
5937 @opindex mhard-float
5938 Generate output containing floating point instructions.  This is the
5939 default.
5940
5941 @item -msoft-float
5942 @opindex msoft-float
5943 Generate output containing library calls for floating point.
5944 @strong{Warning:} the requisite libraries are not available for all ARM
5945 targets.  Normally the facilities of the machine's usual C compiler are
5946 used, but this cannot be done directly in cross-compilation.  You must make
5947 your own arrangements to provide suitable library functions for
5948 cross-compilation.
5949
5950 @option{-msoft-float} changes the calling convention in the output file;
5951 therefore, it is only useful if you compile @emph{all} of a program with
5952 this option.  In particular, you need to compile @file{libgcc.a}, the
5953 library that comes with GCC, with @option{-msoft-float} in order for
5954 this to work.
5955
5956 @item -mlittle-endian
5957 @opindex mlittle-endian
5958 Generate code for a processor running in little-endian mode.  This is
5959 the default for all standard configurations.
5960
5961 @item -mbig-endian
5962 @opindex mbig-endian
5963 Generate code for a processor running in big-endian mode; the default is
5964 to compile code for a little-endian processor.
5965
5966 @item -mwords-little-endian
5967 @opindex mwords-little-endian
5968 This option only applies when generating code for big-endian processors.
5969 Generate code for a little-endian word order but a big-endian byte
5970 order.  That is, a byte order of the form @samp{32107654}.  Note: this
5971 option should only be used if you require compatibility with code for
5972 big-endian ARM processors generated by versions of the compiler prior to
5973 2.8.
5974
5975 @item -malignment-traps
5976 @opindex malignment-traps
5977 Generate code that will not trap if the MMU has alignment traps enabled.
5978 On ARM architectures prior to ARMv4, there were no instructions to
5979 access half-word objects stored in memory.  However, when reading from
5980 memory a feature of the ARM architecture allows a word load to be used,
5981 even if the address is unaligned, and the processor core will rotate the
5982 data as it is being loaded.  This option tells the compiler that such
5983 misaligned accesses will cause a MMU trap and that it should instead
5984 synthesize the access as a series of byte accesses.  The compiler can
5985 still use word accesses to load half-word data if it knows that the
5986 address is aligned to a word boundary.
5987
5988 This option is ignored when compiling for ARM architecture 4 or later,
5989 since these processors have instructions to directly access half-word
5990 objects in memory.
5991
5992 @item -mno-alignment-traps
5993 @opindex mno-alignment-traps
5994 Generate code that assumes that the MMU will not trap unaligned
5995 accesses.  This produces better code when the target instruction set
5996 does not have half-word memory operations (i.e.@: implementations prior to
5997 ARMv4).
5998
5999 Note that you cannot use this option to access unaligned word objects,
6000 since the processor will only fetch one 32-bit aligned object from
6001 memory.
6002
6003 The default setting for most targets is @option{-mno-alignment-traps}, since
6004 this produces better code when there are no half-word memory
6005 instructions available.
6006
6007 @item -mshort-load-bytes
6008 @itemx -mno-short-load-words
6009 @opindex mshort-load-bytes
6010 @opindex mno-short-load-words
6011 These are deprecated aliases for @option{-malignment-traps}.
6012
6013 @item -mno-short-load-bytes
6014 @itemx -mshort-load-words
6015 @opindex mno-short-load-bytes
6016 @opindex mshort-load-words
6017 This are deprecated aliases for @option{-mno-alignment-traps}.
6018
6019 @item -mbsd
6020 @opindex mbsd
6021 This option only applies to RISC iX@.  Emulate the native BSD-mode
6022 compiler.  This is the default if @option{-ansi} is not specified.
6023
6024 @item -mxopen
6025 @opindex mxopen
6026 This option only applies to RISC iX@.  Emulate the native X/Open-mode
6027 compiler.
6028
6029 @item -mno-symrename
6030 @opindex mno-symrename
6031 This option only applies to RISC iX@.  Do not run the assembler
6032 post-processor, @samp{symrename}, after code has been assembled.
6033 Normally it is necessary to modify some of the standard symbols in
6034 preparation for linking with the RISC iX C library; this option
6035 suppresses this pass.  The post-processor is never run when the
6036 compiler is built for cross-compilation.
6037
6038 @item -mcpu=@var{name}
6039 @opindex mcpu
6040 This specifies the name of the target ARM processor.  GCC uses this name
6041 to determine what kind of instructions it can emit when generating
6042 assembly code.  Permissible names are: @samp{arm2}, @samp{arm250},
6043 @samp{arm3}, @samp{arm6}, @samp{arm60}, @samp{arm600}, @samp{arm610},
6044 @samp{arm620}, @samp{arm7}, @samp{arm7m}, @samp{arm7d}, @samp{arm7dm},
6045 @samp{arm7di}, @samp{arm7dmi}, @samp{arm70}, @samp{arm700},
6046 @samp{arm700i}, @samp{arm710}, @samp{arm710c}, @samp{arm7100},
6047 @samp{arm7500}, @samp{arm7500fe}, @samp{arm7tdmi}, @samp{arm8},
6048 @samp{strongarm}, @samp{strongarm110}, @samp{strongarm1100},
6049 @samp{arm8}, @samp{arm810}, @samp{arm9}, @samp{arm9e}, @samp{arm920},
6050 @samp{arm920t}, @samp{arm940t}, @samp{arm9tdmi}, @samp{arm10tdmi},
6051 @samp{arm1020t}, @samp{xscale}.
6052
6053 @itemx -mtune=@var{name}
6054 @opindex mtune
6055 This option is very similar to the @option{-mcpu=} option, except that
6056 instead of specifying the actual target processor type, and hence
6057 restricting which instructions can be used, it specifies that GCC should
6058 tune the performance of the code as if the target were of the type
6059 specified in this option, but still choosing the instructions that it
6060 will generate based on the cpu specified by a @option{-mcpu=} option.
6061 For some ARM implementations better performance can be obtained by using
6062 this option.
6063
6064 @item -march=@var{name}
6065 @opindex march
6066 This specifies the name of the target ARM architecture.  GCC uses this
6067 name to determine what kind of instructions it can emit when generating
6068 assembly code.  This option can be used in conjunction with or instead
6069 of the @option{-mcpu=} option.  Permissible names are: @samp{armv2},
6070 @samp{armv2a}, @samp{armv3}, @samp{armv3m}, @samp{armv4}, @samp{armv4t},
6071 @samp{armv5}, @samp{armv5t}, @samp{armv5te}.
6072
6073 @item -mfpe=@var{number}
6074 @itemx -mfp=@var{number}
6075 @opindex mfpe
6076 @opindex mfp
6077 This specifies the version of the floating point emulation available on
6078 the target.  Permissible values are 2 and 3.  @option{-mfp=} is a synonym
6079 for @option{-mfpe=}, for compatibility with older versions of GCC@.
6080
6081 @item -mstructure-size-boundary=@var{n}
6082 @opindex mstructure-size-boundary
6083 The size of all structures and unions will be rounded up to a multiple
6084 of the number of bits set by this option.  Permissible values are 8 and
6085 32.  The default value varies for different toolchains.  For the COFF
6086 targeted toolchain the default value is 8.  Specifying the larger number
6087 can produce faster, more efficient code, but can also increase the size
6088 of the program.  The two values are potentially incompatible.  Code
6089 compiled with one value cannot necessarily expect to work with code or
6090 libraries compiled with the other value, if they exchange information
6091 using structures or unions.
6092
6093 @item -mabort-on-noreturn
6094 @opindex mabort-on-noreturn
6095 Generate a call to the function @code{abort} at the end of a
6096 @code{noreturn} function.  It will be executed if the function tries to
6097 return.
6098
6099 @item -mlong-calls
6100 @itemx -mno-long-calls
6101 @opindex mlong-calls
6102 @opindex mno-long-calls
6103 Tells the compiler to perform function calls by first loading the
6104 address of the function into a register and then performing a subroutine
6105 call on this register.  This switch is needed if the target function
6106 will lie outside of the 64 megabyte addressing range of the offset based
6107 version of subroutine call instruction.
6108
6109 Even if this switch is enabled, not all function calls will be turned
6110 into long calls.  The heuristic is that static functions, functions
6111 which have the @samp{short-call} attribute, functions that are inside
6112 the scope of a @samp{#pragma no_long_calls} directive and functions whose
6113 definitions have already been compiled within the current compilation
6114 unit, will not be turned into long calls.  The exception to this rule is
6115 that weak function definitions, functions with the @samp{long-call}
6116 attribute or the @samp{section} attribute, and functions that are within
6117 the scope of a @samp{#pragma long_calls} directive, will always be
6118 turned into long calls.
6119
6120 This feature is not enabled by default.  Specifying
6121 @option{-mno-long-calls} will restore the default behavior, as will
6122 placing the function calls within the scope of a @samp{#pragma
6123 long_calls_off} directive.  Note these switches have no effect on how
6124 the compiler generates code to handle function calls via function
6125 pointers.
6126
6127 @item -mnop-fun-dllimport
6128 @opindex mnop-fun-dllimport
6129 Disable support for the @code{dllimport} attribute.
6130
6131 @item -msingle-pic-base
6132 @opindex msingle-pic-base
6133 Treat the register used for PIC addressing as read-only, rather than
6134 loading it in the prologue for each function.  The run-time system is
6135 responsible for initializing this register with an appropriate value
6136 before execution begins.
6137
6138 @item -mpic-register=@var{reg}
6139 @opindex mpic-register
6140 Specify the register to be used for PIC addressing.  The default is R10
6141 unless stack-checking is enabled, when R9 is used.
6142
6143 @item -mpoke-function-name
6144 @opindex mpoke-function-name
6145 Write the name of each function into the text section, directly
6146 preceding the function prologue.  The generated code is similar to this:
6147
6148 @smallexample
6149      t0
6150          .ascii "arm_poke_function_name", 0
6151          .align
6152      t1
6153          .word 0xff000000 + (t1 - t0)
6154      arm_poke_function_name
6155          mov     ip, sp
6156          stmfd   sp!, @{fp, ip, lr, pc@}
6157          sub     fp, ip, #4
6158 @end smallexample
6159
6160 When performing a stack backtrace, code can inspect the value of
6161 @code{pc} stored at @code{fp + 0}.  If the trace function then looks at
6162 location @code{pc - 12} and the top 8 bits are set, then we know that
6163 there is a function name embedded immediately preceding this location
6164 and has length @code{((pc[-3]) & 0xff000000)}.
6165
6166 @item -mthumb
6167 @opindex mthumb
6168 Generate code for the 16-bit Thumb instruction set.  The default is to
6169 use the 32-bit ARM instruction set.
6170
6171 @item -mtpcs-frame
6172 @opindex mtpcs-frame
6173 Generate a stack frame that is compliant with the Thumb Procedure Call
6174 Standard for all non-leaf functions.  (A leaf function is one that does
6175 not call any other functions.)  The default is @option{-mno-tpcs-frame}.
6176
6177 @item -mtpcs-leaf-frame
6178 @opindex mtpcs-leaf-frame
6179 Generate a stack frame that is compliant with the Thumb Procedure Call
6180 Standard for all leaf functions.  (A leaf function is one that does
6181 not call any other functions.)  The default is @option{-mno-apcs-leaf-frame}.
6182
6183 @item -mcallee-super-interworking
6184 @opindex mcallee-super-interworking
6185 Gives all externally visible functions in the file being compiled an ARM
6186 instruction set header which switches to Thumb mode before executing the
6187 rest of the function.  This allows these functions to be called from
6188 non-interworking code.
6189
6190 @item -mcaller-super-interworking
6191 @opindex mcaller-super-interworking
6192 Allows calls via function pointers (including virtual functions) to
6193 execute correctly regardless of whether the target code has been
6194 compiled for interworking or not.  There is a small overhead in the cost
6195 of executing a function pointer if this option is enabled.
6196
6197 @end table
6198
6199 @node MN10200 Options
6200 @subsection MN10200 Options
6201 @cindex MN10200 options
6202 These @option{-m} options are defined for Matsushita MN10200 architectures:
6203 @table @gcctabopt
6204
6205 @item -mrelax
6206 @opindex mrelax
6207 Indicate to the linker that it should perform a relaxation optimization pass
6208 to shorten branches, calls and absolute memory addresses.  This option only
6209 has an effect when used on the command line for the final link step.
6210
6211 This option makes symbolic debugging impossible.
6212 @end table
6213
6214 @node MN10300 Options
6215 @subsection MN10300 Options
6216 @cindex MN10300 options
6217 These @option{-m} options are defined for Matsushita MN10300 architectures:
6218
6219 @table @gcctabopt
6220 @item -mmult-bug
6221 @opindex mmult-bug
6222 Generate code to avoid bugs in the multiply instructions for the MN10300
6223 processors.  This is the default.
6224
6225 @item -mno-mult-bug
6226 @opindex mno-mult-bug
6227 Do not generate code to avoid bugs in the multiply instructions for the
6228 MN10300 processors.
6229
6230 @item -mam33
6231 @opindex mam33
6232 Generate code which uses features specific to the AM33 processor.
6233
6234 @item -mno-am33
6235 @opindex mno-am33
6236 Do not generate code which uses features specific to the AM33 processor.  This
6237 is the default.
6238
6239 @item -mno-crt0
6240 @opindex mno-crt0
6241 Do not link in the C run-time initialization object file.
6242
6243 @item -mrelax
6244 @opindex mrelax
6245 Indicate to the linker that it should perform a relaxation optimization pass
6246 to shorten branches, calls and absolute memory addresses.  This option only
6247 has an effect when used on the command line for the final link step.
6248
6249 This option makes symbolic debugging impossible.
6250 @end table
6251
6252
6253 @node M32R/D Options
6254 @subsection M32R/D Options
6255 @cindex M32R/D options
6256
6257 These @option{-m} options are defined for Mitsubishi M32R/D architectures:
6258
6259 @table @gcctabopt
6260 @item -m32rx
6261 @opindex m32rx
6262 Generate code for the M32R/X@.
6263
6264 @item -m32r
6265 @opindex m32r
6266 Generate code for the M32R@.  This is the default.
6267
6268 @item -mcode-model=small
6269 @opindex mcode-model=small
6270 Assume all objects live in the lower 16MB of memory (so that their addresses
6271 can be loaded with the @code{ld24} instruction), and assume all subroutines
6272 are reachable with the @code{bl} instruction.
6273 This is the default.
6274
6275 The addressability of a particular object can be set with the
6276 @code{model} attribute.
6277
6278 @item -mcode-model=medium
6279 @opindex mcode-model=medium
6280 Assume objects may be anywhere in the 32-bit address space (the compiler
6281 will generate @code{seth/add3} instructions to load their addresses), and
6282 assume all subroutines are reachable with the @code{bl} instruction.
6283
6284 @item -mcode-model=large
6285 @opindex mcode-model=large
6286 Assume objects may be anywhere in the 32-bit address space (the compiler
6287 will generate @code{seth/add3} instructions to load their addresses), and
6288 assume subroutines may not be reachable with the @code{bl} instruction
6289 (the compiler will generate the much slower @code{seth/add3/jl}
6290 instruction sequence).
6291
6292 @item -msdata=none
6293 @opindex msdata=none
6294 Disable use of the small data area.  Variables will be put into
6295 one of @samp{.data}, @samp{bss}, or @samp{.rodata} (unless the
6296 @code{section} attribute has been specified).
6297 This is the default.
6298
6299 The small data area consists of sections @samp{.sdata} and @samp{.sbss}.
6300 Objects may be explicitly put in the small data area with the
6301 @code{section} attribute using one of these sections.
6302
6303 @item -msdata=sdata
6304 @opindex msdata=sdata
6305 Put small global and static data in the small data area, but do not
6306 generate special code to reference them.
6307
6308 @item -msdata=use
6309 @opindex msdata=use
6310 Put small global and static data in the small data area, and generate
6311 special instructions to reference them.
6312
6313 @item -G @var{num}
6314 @opindex G
6315 @cindex smaller data references
6316 Put global and static objects less than or equal to @var{num} bytes
6317 into the small data or bss sections instead of the normal data or bss
6318 sections.  The default value of @var{num} is 8.
6319 The @option{-msdata} option must be set to one of @samp{sdata} or @samp{use}
6320 for this option to have any effect.
6321
6322 All modules should be compiled with the same @option{-G @var{num}} value.
6323 Compiling with different values of @var{num} may or may not work; if it
6324 doesn't the linker will give an error message---incorrect code will not be
6325 generated.
6326
6327 @end table
6328
6329 @node M88K Options
6330 @subsection M88K Options
6331 @cindex M88k options
6332
6333 These @samp{-m} options are defined for Motorola 88k architectures:
6334
6335 @table @gcctabopt
6336 @item -m88000
6337 @opindex m88000
6338 Generate code that works well on both the m88100 and the
6339 m88110.
6340
6341 @item -m88100
6342 @opindex m88100
6343 Generate code that works best for the m88100, but that also
6344 runs on the m88110.
6345
6346 @item -m88110
6347 @opindex m88110
6348 Generate code that works best for the m88110, and may not run
6349 on the m88100.
6350
6351 @item -mbig-pic
6352 @opindex mbig-pic
6353 Obsolete option to be removed from the next revision.
6354 Use @option{-fPIC}.
6355
6356 @item -midentify-revision
6357 @opindex midentify-revision
6358 @cindex identifying source, compiler (88k)
6359 Include an @code{ident} directive in the assembler output recording the
6360 source file name, compiler name and version, timestamp, and compilation
6361 flags used.
6362
6363 @item -mno-underscores
6364 @opindex mno-underscores
6365 @cindex underscores, avoiding (88k)
6366 In assembler output, emit symbol names without adding an underscore
6367 character at the beginning of each name.  The default is to use an
6368 underscore as prefix on each name.
6369
6370 @item -mocs-debug-info
6371 @itemx -mno-ocs-debug-info
6372 @opindex mocs-debug-info
6373 @opindex mno-ocs-debug-info
6374 @cindex OCS (88k)
6375 @cindex debugging, 88k OCS
6376 Include (or omit) additional debugging information (about registers used
6377 in each stack frame) as specified in the 88open Object Compatibility
6378 Standard, ``OCS''@.  This extra information allows debugging of code that
6379 has had the frame pointer eliminated.  The default for DG/UX, SVr4, and
6380 Delta 88 SVr3.2 is to include this information; other 88k configurations
6381 omit this information by default.
6382
6383 @item -mocs-frame-position
6384 @opindex mocs-frame-position
6385 @cindex register positions in frame (88k)
6386 When emitting COFF debugging information for automatic variables and
6387 parameters stored on the stack, use the offset from the canonical frame
6388 address, which is the stack pointer (register 31) on entry to the
6389 function.  The DG/UX, SVr4, Delta88 SVr3.2, and BCS configurations use
6390 @option{-mocs-frame-position}; other 88k configurations have the default
6391 @option{-mno-ocs-frame-position}.
6392
6393 @item -mno-ocs-frame-position
6394 @opindex mno-ocs-frame-position
6395 @cindex register positions in frame (88k)
6396 When emitting COFF debugging information for automatic variables and
6397 parameters stored on the stack, use the offset from the frame pointer
6398 register (register 30).  When this option is in effect, the frame
6399 pointer is not eliminated when debugging information is selected by the
6400 -g switch.
6401
6402 @item -moptimize-arg-area
6403 @opindex moptimize-arg-area
6404 @cindex arguments in frame (88k)
6405 Save space by reorganizing the stack frame.  This option generates code
6406 that does not agree with the 88open specifications, but uses less
6407 memory.
6408
6409 @itemx -mno-optimize-arg-area
6410 @opindex mno-optimize-arg-area
6411 Do not reorganize the stack frame to save space.  This is the default.
6412 The generated conforms to the specification, but uses more memory.
6413
6414 @item -mshort-data-@var{num}
6415 @opindex mshort-data
6416 @cindex smaller data references (88k)
6417 @cindex r0-relative references (88k)
6418 Generate smaller data references by making them relative to @code{r0},
6419 which allows loading a value using a single instruction (rather than the
6420 usual two).  You control which data references are affected by
6421 specifying @var{num} with this option.  For example, if you specify
6422 @option{-mshort-data-512}, then the data references affected are those
6423 involving displacements of less than 512 bytes.
6424 @option{-mshort-data-@var{num}} is not effective for @var{num} greater
6425 than 64k.
6426
6427 @item -mserialize-volatile
6428 @opindex mserialize-volatile
6429 @itemx -mno-serialize-volatile
6430 @opindex mno-serialize-volatile
6431 @cindex sequential consistency on 88k
6432 Do, or don't, generate code to guarantee sequential consistency
6433 of volatile memory references.  By default, consistency is
6434 guaranteed.
6435
6436 The order of memory references made by the MC88110 processor does
6437 not always match the order of the instructions requesting those
6438 references.  In particular, a load instruction may execute before
6439 a preceding store instruction.  Such reordering violates
6440 sequential consistency of volatile memory references, when there
6441 are multiple processors.   When consistency must be guaranteed,
6442 GCC generates special instructions, as needed, to force
6443 execution in the proper order.
6444
6445 The MC88100 processor does not reorder memory references and so
6446 always provides sequential consistency.  However, by default, GCC
6447 generates the special instructions to guarantee consistency
6448 even when you use @option{-m88100}, so that the code may be run on an
6449 MC88110 processor.  If you intend to run your code only on the
6450 MC88100 processor, you may use @option{-mno-serialize-volatile}.
6451
6452 The extra code generated to guarantee consistency may affect the
6453 performance of your application.  If you know that you can safely
6454 forgo this guarantee, you may use @option{-mno-serialize-volatile}.
6455
6456 @item -msvr4
6457 @itemx -msvr3
6458 @opindex msvr4
6459 @opindex msvr3
6460 @cindex assembler syntax, 88k
6461 @cindex SVr4
6462 Turn on (@option{-msvr4}) or off (@option{-msvr3}) compiler extensions
6463 related to System V release 4 (SVr4).  This controls the following:
6464
6465 @enumerate
6466 @item
6467 Which variant of the assembler syntax to emit.
6468 @item
6469 @option{-msvr4} makes the C preprocessor recognize @samp{#pragma weak}
6470 that is used on System V release 4.
6471 @item
6472 @option{-msvr4} makes GCC issue additional declaration directives used in
6473 SVr4.
6474 @end enumerate
6475
6476 @option{-msvr4} is the default for the m88k-motorola-sysv4 and
6477 m88k-dg-dgux m88k configurations.  @option{-msvr3} is the default for all
6478 other m88k configurations.
6479
6480 @item -mversion-03.00
6481 @opindex mversion-03.00
6482 This option is obsolete, and is ignored.
6483 @c ??? which asm syntax better for GAS?  option there too?
6484
6485 @item -mno-check-zero-division
6486 @itemx -mcheck-zero-division
6487 @opindex mno-check-zero-division
6488 @opindex mcheck-zero-division
6489 @cindex zero division on 88k
6490 Do, or don't, generate code to guarantee that integer division by
6491 zero will be detected.  By default, detection is guaranteed.
6492
6493 Some models of the MC88100 processor fail to trap upon integer
6494 division by zero under certain conditions.  By default, when
6495 compiling code that might be run on such a processor, GCC
6496 generates code that explicitly checks for zero-valued divisors
6497 and traps with exception number 503 when one is detected.  Use of
6498 @option{-mno-check-zero-division} suppresses such checking for code
6499 generated to run on an MC88100 processor.
6500
6501 GCC assumes that the MC88110 processor correctly detects all instances
6502 of integer division by zero.  When @option{-m88110} is specified, no
6503 explicit checks for zero-valued divisors are generated, and both
6504 @option{-mcheck-zero-division} and @option{-mno-check-zero-division} are
6505 ignored.
6506
6507 @item -muse-div-instruction
6508 @opindex muse-div-instruction
6509 @cindex divide instruction, 88k
6510 Use the div instruction for signed integer division on the
6511 MC88100 processor.  By default, the div instruction is not used.
6512
6513 On the MC88100 processor the signed integer division instruction
6514 div) traps to the operating system on a negative operand.  The
6515 operating system transparently completes the operation, but at a
6516 large cost in execution time.  By default, when compiling code
6517 that might be run on an MC88100 processor, GCC emulates signed
6518 integer division using the unsigned integer division instruction
6519 divu), thereby avoiding the large penalty of a trap to the
6520 operating system.  Such emulation has its own, smaller, execution
6521 cost in both time and space.  To the extent that your code's
6522 important signed integer division operations are performed on two
6523 nonnegative operands, it may be desirable to use the div
6524 instruction directly.
6525
6526 On the MC88110 processor the div instruction (also known as the
6527 divs instruction) processes negative operands without trapping to
6528 the operating system.  When @option{-m88110} is specified,
6529 @option{-muse-div-instruction} is ignored, and the div instruction is used
6530 for signed integer division.
6531
6532 Note that the result of dividing @code{INT_MIN} by @minus{}1 is undefined.  In
6533 particular, the behavior of such a division with and without
6534 @option{-muse-div-instruction} may differ.
6535
6536 @item -mtrap-large-shift
6537 @itemx -mhandle-large-shift
6538 @opindex mtrap-large-shift
6539 @opindex mhandle-large-shift
6540 @cindex bit shift overflow (88k)
6541 @cindex large bit shifts (88k)
6542 Include code to detect bit-shifts of more than 31 bits; respectively,
6543 trap such shifts or emit code to handle them properly.  By default GCC
6544 makes no special provision for large bit shifts.
6545
6546 @item -mwarn-passed-structs
6547 @opindex mwarn-passed-structs
6548 @cindex structure passing (88k)
6549 Warn when a function passes a struct as an argument or result.
6550 Structure-passing conventions have changed during the evolution of the C
6551 language, and are often the source of portability problems.  By default,
6552 GCC issues no such warning.
6553 @end table
6554
6555 @c break page here to avoid unsightly interparagraph stretch.
6556 @c -zw, 2001-8-17
6557 @page
6558
6559 @node RS/6000 and PowerPC Options
6560 @subsection IBM RS/6000 and PowerPC Options
6561 @cindex RS/6000 and PowerPC Options
6562 @cindex IBM RS/6000 and PowerPC Options
6563
6564 These @samp{-m} options are defined for the IBM RS/6000 and PowerPC:
6565 @table @gcctabopt
6566 @item -mpower
6567 @itemx -mno-power
6568 @itemx -mpower2
6569 @itemx -mno-power2
6570 @itemx -mpowerpc
6571 @itemx -mno-powerpc
6572 @itemx -mpowerpc-gpopt
6573 @itemx -mno-powerpc-gpopt
6574 @itemx -mpowerpc-gfxopt
6575 @itemx -mno-powerpc-gfxopt
6576 @itemx -mpowerpc64
6577 @itemx -mno-powerpc64
6578 @opindex mpower
6579 @opindex mno-power
6580 @opindex mpower2
6581 @opindex mno-power2
6582 @opindex mpowerpc
6583 @opindex mno-powerpc
6584 @opindex mpowerpc-gpopt
6585 @opindex mno-powerpc-gpopt
6586 @opindex mpowerpc-gfxopt
6587 @opindex mno-powerpc-gfxopt
6588 @opindex mpowerpc64
6589 @opindex mno-powerpc64
6590 GCC supports two related instruction set architectures for the
6591 RS/6000 and PowerPC@.  The @dfn{POWER} instruction set are those
6592 instructions supported by the @samp{rios} chip set used in the original
6593 RS/6000 systems and the @dfn{PowerPC} instruction set is the
6594 architecture of the Motorola MPC5xx, MPC6xx, MPC8xx microprocessors, and
6595 the IBM 4xx microprocessors.
6596
6597 Neither architecture is a subset of the other.  However there is a
6598 large common subset of instructions supported by both.  An MQ
6599 register is included in processors supporting the POWER architecture.
6600
6601 You use these options to specify which instructions are available on the
6602 processor you are using.  The default value of these options is
6603 determined when configuring GCC@.  Specifying the
6604 @option{-mcpu=@var{cpu_type}} overrides the specification of these
6605 options.  We recommend you use the @option{-mcpu=@var{cpu_type}} option
6606 rather than the options listed above.
6607
6608 The @option{-mpower} option allows GCC to generate instructions that
6609 are found only in the POWER architecture and to use the MQ register.
6610 Specifying @option{-mpower2} implies @option{-power} and also allows GCC
6611 to generate instructions that are present in the POWER2 architecture but
6612 not the original POWER architecture.
6613
6614 The @option{-mpowerpc} option allows GCC to generate instructions that
6615 are found only in the 32-bit subset of the PowerPC architecture.
6616 Specifying @option{-mpowerpc-gpopt} implies @option{-mpowerpc} and also allows
6617 GCC to use the optional PowerPC architecture instructions in the
6618 General Purpose group, including floating-point square root.  Specifying
6619 @option{-mpowerpc-gfxopt} implies @option{-mpowerpc} and also allows GCC to
6620 use the optional PowerPC architecture instructions in the Graphics
6621 group, including floating-point select.
6622
6623 The @option{-mpowerpc64} option allows GCC to generate the additional
6624 64-bit instructions that are found in the full PowerPC64 architecture
6625 and to treat GPRs as 64-bit, doubleword quantities.  GCC defaults to
6626 @option{-mno-powerpc64}.
6627
6628 If you specify both @option{-mno-power} and @option{-mno-powerpc}, GCC
6629 will use only the instructions in the common subset of both
6630 architectures plus some special AIX common-mode calls, and will not use
6631 the MQ register.  Specifying both @option{-mpower} and @option{-mpowerpc}
6632 permits GCC to use any instruction from either architecture and to
6633 allow use of the MQ register; specify this for the Motorola MPC601.
6634
6635 @item -mnew-mnemonics
6636 @itemx -mold-mnemonics
6637 @opindex mnew-mnemonics
6638 @opindex mold-mnemonics
6639 Select which mnemonics to use in the generated assembler code.  With
6640 @option{-mnew-mnemonics}, GCC uses the assembler mnemonics defined for
6641 the PowerPC architecture.  With @option{-mold-mnemonics} it uses the
6642 assembler mnemonics defined for the POWER architecture.  Instructions
6643 defined in only one architecture have only one mnemonic; GCC uses that
6644 mnemonic irrespective of which of these options is specified.
6645
6646 GCC defaults to the mnemonics appropriate for the architecture in
6647 use.  Specifying @option{-mcpu=@var{cpu_type}} sometimes overrides the
6648 value of these option.  Unless you are building a cross-compiler, you
6649 should normally not specify either @option{-mnew-mnemonics} or
6650 @option{-mold-mnemonics}, but should instead accept the default.
6651
6652 @item -mcpu=@var{cpu_type}
6653 @opindex mcpu
6654 Set architecture type, register usage, choice of mnemonics, and
6655 instruction scheduling parameters for machine type @var{cpu_type}.
6656 Supported values for @var{cpu_type} are @samp{rios}, @samp{rios1},
6657 @samp{rsc}, @samp{rios2}, @samp{rs64a}, @samp{601}, @samp{602},
6658 @samp{603}, @samp{603e}, @samp{604}, @samp{604e}, @samp{620},
6659 @samp{630}, @samp{740}, @samp{7400}, @samp{7450}, @samp{750},
6660 @samp{power}, @samp{power2}, @samp{powerpc}, @samp{403}, @samp{505},
6661 @samp{801}, @samp{821}, @samp{823}, and @samp{860} and @samp{common}.
6662
6663 @option{-mcpu=common} selects a completely generic processor.  Code
6664 generated under this option will run on any POWER or PowerPC processor.
6665 GCC will use only the instructions in the common subset of both
6666 architectures, and will not use the MQ register.  GCC assumes a generic
6667 processor model for scheduling purposes.
6668
6669 @option{-mcpu=power}, @option{-mcpu=power2}, @option{-mcpu=powerpc}, and
6670 @option{-mcpu=powerpc64} specify generic POWER, POWER2, pure 32-bit
6671 PowerPC (i.e., not MPC601), and 64-bit PowerPC architecture machine
6672 types, with an appropriate, generic processor model assumed for
6673 scheduling purposes.
6674
6675 The other options specify a specific processor.  Code generated under
6676 those options will run best on that processor, and may not run at all on
6677 others.
6678
6679 The @option{-mcpu} options automatically enable or disable other
6680 @option{-m} options as follows:
6681
6682 @table @samp
6683 @item common
6684 @option{-mno-power}, @option{-mno-powerc}
6685
6686 @item power
6687 @itemx power2
6688 @itemx rios1
6689 @itemx rios2
6690 @itemx rsc
6691 @option{-mpower}, @option{-mno-powerpc}, @option{-mno-new-mnemonics}
6692
6693 @item powerpc
6694 @itemx rs64a
6695 @itemx 602
6696 @itemx 603
6697 @itemx 603e
6698 @itemx 604
6699 @itemx 620
6700 @itemx 630
6701 @itemx 740
6702 @itemx 7400
6703 @itemx 7450
6704 @itemx 750
6705 @itemx 505
6706 @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6707
6708 @item 601
6709 @option{-mpower}, @option{-mpowerpc}, @option{-mnew-mnemonics}
6710
6711 @item 403
6712 @itemx 821
6713 @itemx 860
6714 @option{-mno-power}, @option{-mpowerpc}, @option{-mnew-mnemonics}, @option{-msoft-float}
6715 @end table
6716
6717 @item -mtune=@var{cpu_type}
6718 @opindex mtune
6719 Set the instruction scheduling parameters for machine type
6720 @var{cpu_type}, but do not set the architecture type, register usage, or
6721 choice of mnemonics, as @option{-mcpu=@var{cpu_type}} would.  The same
6722 values for @var{cpu_type} are used for @option{-mtune} as for
6723 @option{-mcpu}.  If both are specified, the code generated will use the
6724 architecture, registers, and mnemonics set by @option{-mcpu}, but the
6725 scheduling parameters set by @option{-mtune}.
6726
6727 @item -maltivec
6728 @itemx -mno-altivec
6729 @opindex maltivec
6730 @opindex mno-altivec
6731 These switches enable or disable the use of built-in functions that
6732 allow access to the AltiVec instruction set.  You may also need to set
6733 @option{-mabi=altivec} to adjust the current ABI with AltiVec ABI
6734 enhancements.
6735
6736 @item -mabi=spe
6737 @opindex mabi=spe
6738 Extend the current ABI with SPE ABI extensions.  This does not change
6739 the default ABI, instead it adds the SPE ABI extensions to the current
6740 ABI@.
6741
6742 @item -mabi=no-spe
6743 @opindex mabi=no-spe
6744 Disable Booke SPE ABI extensions for the current ABI.
6745
6746 @item -misel=@var{yes/no}
6747 @itemx -misel
6748 @opindex misel
6749 This switch enables or disables the generation of ISEL instructions.
6750
6751 @item -mfull-toc
6752 @itemx -mno-fp-in-toc
6753 @itemx -mno-sum-in-toc
6754 @itemx -mminimal-toc
6755 @opindex mfull-toc
6756 @opindex mno-fp-in-toc
6757 @opindex mno-sum-in-toc
6758 @opindex mminimal-toc
6759 Modify generation of the TOC (Table Of Contents), which is created for
6760 every executable file.  The @option{-mfull-toc} option is selected by
6761 default.  In that case, GCC will allocate at least one TOC entry for
6762 each unique non-automatic variable reference in your program.  GCC
6763 will also place floating-point constants in the TOC@.  However, only
6764 16,384 entries are available in the TOC@.
6765
6766 If you receive a linker error message that saying you have overflowed
6767 the available TOC space, you can reduce the amount of TOC space used
6768 with the @option{-mno-fp-in-toc} and @option{-mno-sum-in-toc} options.
6769 @option{-mno-fp-in-toc} prevents GCC from putting floating-point
6770 constants in the TOC and @option{-mno-sum-in-toc} forces GCC to
6771 generate code to calculate the sum of an address and a constant at
6772 run-time instead of putting that sum into the TOC@.  You may specify one
6773 or both of these options.  Each causes GCC to produce very slightly
6774 slower and larger code at the expense of conserving TOC space.
6775
6776 If you still run out of space in the TOC even when you specify both of
6777 these options, specify @option{-mminimal-toc} instead.  This option causes
6778 GCC to make only one TOC entry for every file.  When you specify this
6779 option, GCC will produce code that is slower and larger but which
6780 uses extremely little TOC space.  You may wish to use this option
6781 only on files that contain less frequently executed code.
6782
6783 @item -maix64
6784 @itemx -maix32
6785 @opindex maix64
6786 @opindex maix32
6787 Enable 64-bit AIX ABI and calling convention: 64-bit pointers, 64-bit
6788 @code{long} type, and the infrastructure needed to support them.
6789 Specifying @option{-maix64} implies @option{-mpowerpc64} and
6790 @option{-mpowerpc}, while @option{-maix32} disables the 64-bit ABI and
6791 implies @option{-mno-powerpc64}.  GCC defaults to @option{-maix32}.
6792
6793 @item -mxl-call
6794 @itemx -mno-xl-call
6795 @opindex mxl-call
6796 @opindex mno-xl-call
6797 On AIX, pass floating-point arguments to prototyped functions beyond the
6798 register save area (RSA) on the stack in addition to argument FPRs.  The
6799 AIX calling convention was extended but not initially documented to
6800 handle an obscure K&R C case of calling a function that takes the
6801 address of its arguments with fewer arguments than declared.  AIX XL
6802 compilers access floating point arguments which do not fit in the
6803 RSA from the stack when a subroutine is compiled without
6804 optimization.  Because always storing floating-point arguments on the
6805 stack is inefficient and rarely needed, this option is not enabled by
6806 default and only is necessary when calling subroutines compiled by AIX
6807 XL compilers without optimization.
6808
6809 @item -mpe
6810 @opindex mpe
6811 Support @dfn{IBM RS/6000 SP} @dfn{Parallel Environment} (PE)@.  Link an
6812 application written to use message passing with special startup code to
6813 enable the application to run.  The system must have PE installed in the
6814 standard location (@file{/usr/lpp/ppe.poe/}), or the @file{specs} file
6815 must be overridden with the @option{-specs=} option to specify the
6816 appropriate directory location.  The Parallel Environment does not
6817 support threads, so the @option{-mpe} option and the @option{-pthread}
6818 option are incompatible.
6819
6820 @item -msoft-float
6821 @itemx -mhard-float
6822 @opindex msoft-float
6823 @opindex mhard-float
6824 Generate code that does not use (uses) the floating-point register set.
6825 Software floating point emulation is provided if you use the
6826 @option{-msoft-float} option, and pass the option to GCC when linking.
6827
6828 @item -mmultiple
6829 @itemx -mno-multiple
6830 @opindex mmultiple
6831 @opindex mno-multiple
6832 Generate code that uses (does not use) the load multiple word
6833 instructions and the store multiple word instructions.  These
6834 instructions are generated by default on POWER systems, and not
6835 generated on PowerPC systems.  Do not use @option{-mmultiple} on little
6836 endian PowerPC systems, since those instructions do not work when the
6837 processor is in little endian mode.  The exceptions are PPC740 and
6838 PPC750 which permit the instructions usage in little endian mode.
6839
6840 @item -mstring
6841 @itemx -mno-string
6842 @opindex mstring
6843 @opindex mno-string
6844 Generate code that uses (does not use) the load string instructions
6845 and the store string word instructions to save multiple registers and
6846 do small block moves.  These instructions are generated by default on
6847 POWER systems, and not generated on PowerPC systems.  Do not use
6848 @option{-mstring} on little endian PowerPC systems, since those
6849 instructions do not work when the processor is in little endian mode.
6850 The exceptions are PPC740 and PPC750 which permit the instructions
6851 usage in little endian mode.
6852
6853 @item -mupdate
6854 @itemx -mno-update
6855 @opindex mupdate
6856 @opindex mno-update
6857 Generate code that uses (does not use) the load or store instructions
6858 that update the base register to the address of the calculated memory
6859 location.  These instructions are generated by default.  If you use
6860 @option{-mno-update}, there is a small window between the time that the
6861 stack pointer is updated and the address of the previous frame is
6862 stored, which means code that walks the stack frame across interrupts or
6863 signals may get corrupted data.
6864
6865 @item -mfused-madd
6866 @itemx -mno-fused-madd
6867 @opindex mfused-madd
6868 @opindex mno-fused-madd
6869 Generate code that uses (does not use) the floating point multiply and
6870 accumulate instructions.  These instructions are generated by default if
6871 hardware floating is used.
6872
6873 @item -mno-bit-align
6874 @itemx -mbit-align
6875 @opindex mno-bit-align
6876 @opindex mbit-align
6877 On System V.4 and embedded PowerPC systems do not (do) force structures
6878 and unions that contain bit-fields to be aligned to the base type of the
6879 bit-field.
6880
6881 For example, by default a structure containing nothing but 8
6882 @code{unsigned} bit-fields of length 1 would be aligned to a 4 byte
6883 boundary and have a size of 4 bytes.  By using @option{-mno-bit-align},
6884 the structure would be aligned to a 1 byte boundary and be one byte in
6885 size.
6886
6887 @item -mno-strict-align
6888 @itemx -mstrict-align
6889 @opindex mno-strict-align
6890 @opindex mstrict-align
6891 On System V.4 and embedded PowerPC systems do not (do) assume that
6892 unaligned memory references will be handled by the system.
6893
6894 @item -mrelocatable
6895 @itemx -mno-relocatable
6896 @opindex mrelocatable
6897 @opindex mno-relocatable
6898 On embedded PowerPC systems generate code that allows (does not allow)
6899 the program to be relocated to a different address at runtime.  If you
6900 use @option{-mrelocatable} on any module, all objects linked together must
6901 be compiled with @option{-mrelocatable} or @option{-mrelocatable-lib}.
6902
6903 @item -mrelocatable-lib
6904 @itemx -mno-relocatable-lib
6905 @opindex mrelocatable-lib
6906 @opindex mno-relocatable-lib
6907 On embedded PowerPC systems generate code that allows (does not allow)
6908 the program to be relocated to a different address at runtime.  Modules
6909 compiled with @option{-mrelocatable-lib} can be linked with either modules
6910 compiled without @option{-mrelocatable} and @option{-mrelocatable-lib} or
6911 with modules compiled with the @option{-mrelocatable} options.
6912
6913 @item -mno-toc
6914 @itemx -mtoc
6915 @opindex mno-toc
6916 @opindex mtoc
6917 On System V.4 and embedded PowerPC systems do not (do) assume that
6918 register 2 contains a pointer to a global area pointing to the addresses
6919 used in the program.
6920
6921 @item -mlittle
6922 @itemx -mlittle-endian
6923 @opindex mlittle
6924 @opindex mlittle-endian
6925 On System V.4 and embedded PowerPC systems compile code for the
6926 processor in little endian mode.  The @option{-mlittle-endian} option is
6927 the same as @option{-mlittle}.
6928
6929 @item -mbig
6930 @itemx -mbig-endian
6931 @opindex mbig
6932 @opindex mbig-endian
6933 On System V.4 and embedded PowerPC systems compile code for the
6934 processor in big endian mode.  The @option{-mbig-endian} option is
6935 the same as @option{-mbig}.
6936
6937 @item -mcall-sysv
6938 @opindex mcall-sysv
6939 On System V.4 and embedded PowerPC systems compile code using calling
6940 conventions that adheres to the March 1995 draft of the System V
6941 Application Binary Interface, PowerPC processor supplement.  This is the
6942 default unless you configured GCC using @samp{powerpc-*-eabiaix}.
6943
6944 @item -mcall-sysv-eabi
6945 @opindex mcall-sysv-eabi
6946 Specify both @option{-mcall-sysv} and @option{-meabi} options.
6947
6948 @item -mcall-sysv-noeabi
6949 @opindex mcall-sysv-noeabi
6950 Specify both @option{-mcall-sysv} and @option{-mno-eabi} options.
6951
6952 @item -mcall-aix
6953 @opindex mcall-aix
6954 On System V.4 and embedded PowerPC systems compile code using calling
6955 conventions that are similar to those used on AIX@.  This is the
6956 default if you configured GCC using @samp{powerpc-*-eabiaix}.
6957
6958 @item -mcall-solaris
6959 @opindex mcall-solaris
6960 On System V.4 and embedded PowerPC systems compile code for the Solaris
6961 operating system.
6962
6963 @item -mcall-linux
6964 @opindex mcall-linux
6965 On System V.4 and embedded PowerPC systems compile code for the
6966 Linux-based GNU system.
6967
6968 @item -mcall-gnu
6969 @opindex mcall-gnu
6970 On System V.4 and embedded PowerPC systems compile code for the
6971 Hurd-based GNU system.
6972
6973 @item -mcall-netbsd
6974 @opindex mcall-netbsd
6975 On System V.4 and embedded PowerPC systems compile code for the
6976 NetBSD operating system.
6977
6978 @item -maix-struct-return
6979 @opindex maix-struct-return
6980 Return all structures in memory (as specified by the AIX ABI)@.
6981
6982 @item -msvr4-struct-return
6983 @opindex msvr4-struct-return
6984 Return structures smaller than 8 bytes in registers (as specified by the
6985 SVR4 ABI)@.
6986
6987 @item -mabi=altivec
6988 @opindex mabi=altivec
6989 Extend the current ABI with AltiVec ABI extensions.  This does not
6990 change the default ABI, instead it adds the AltiVec ABI extensions to
6991 the current ABI@.
6992
6993 @item -mabi=no-altivec
6994 @opindex mabi=no-altivec
6995 Disable AltiVec ABI extensions for the current ABI.
6996
6997 @item -mprototype
6998 @itemx -mno-prototype
6999 @opindex mprototype
7000 @opindex mno-prototype
7001 On System V.4 and embedded PowerPC systems assume that all calls to
7002 variable argument functions are properly prototyped.  Otherwise, the
7003 compiler must insert an instruction before every non prototyped call to
7004 set or clear bit 6 of the condition code register (@var{CR}) to
7005 indicate whether floating point values were passed in the floating point
7006 registers in case the function takes a variable arguments.  With
7007 @option{-mprototype}, only calls to prototyped variable argument functions
7008 will set or clear the bit.
7009
7010 @item -msim
7011 @opindex msim
7012 On embedded PowerPC systems, assume that the startup module is called
7013 @file{sim-crt0.o} and that the standard C libraries are @file{libsim.a} and
7014 @file{libc.a}.  This is the default for @samp{powerpc-*-eabisim}.
7015 configurations.
7016
7017 @item -mmvme
7018 @opindex mmvme
7019 On embedded PowerPC systems, assume that the startup module is called
7020 @file{crt0.o} and the standard C libraries are @file{libmvme.a} and
7021 @file{libc.a}.
7022
7023 @item -mads
7024 @opindex mads
7025 On embedded PowerPC systems, assume that the startup module is called
7026 @file{crt0.o} and the standard C libraries are @file{libads.a} and
7027 @file{libc.a}.
7028
7029 @item -myellowknife
7030 @opindex myellowknife
7031 On embedded PowerPC systems, assume that the startup module is called
7032 @file{crt0.o} and the standard C libraries are @file{libyk.a} and
7033 @file{libc.a}.
7034
7035 @item -mvxworks
7036 @opindex mvxworks
7037 On System V.4 and embedded PowerPC systems, specify that you are
7038 compiling for a VxWorks system.
7039
7040 @item -mwindiss
7041 @opindex mwindiss
7042 Specify that you are compiling for the WindISS simulation environment.
7043
7044 @item -memb
7045 @opindex memb
7046 On embedded PowerPC systems, set the @var{PPC_EMB} bit in the ELF flags
7047 header to indicate that @samp{eabi} extended relocations are used.
7048
7049 @item -meabi
7050 @itemx -mno-eabi
7051 @opindex meabi
7052 @opindex mno-eabi
7053 On System V.4 and embedded PowerPC systems do (do not) adhere to the
7054 Embedded Applications Binary Interface (eabi) which is a set of
7055 modifications to the System V.4 specifications.  Selecting @option{-meabi}
7056 means that the stack is aligned to an 8 byte boundary, a function
7057 @code{__eabi} is called to from @code{main} to set up the eabi
7058 environment, and the @option{-msdata} option can use both @code{r2} and
7059 @code{r13} to point to two separate small data areas.  Selecting
7060 @option{-mno-eabi} means that the stack is aligned to a 16 byte boundary,
7061 do not call an initialization function from @code{main}, and the
7062 @option{-msdata} option will only use @code{r13} to point to a single
7063 small data area.  The @option{-meabi} option is on by default if you
7064 configured GCC using one of the @samp{powerpc*-*-eabi*} options.
7065
7066 @item -msdata=eabi
7067 @opindex msdata=eabi
7068 On System V.4 and embedded PowerPC systems, put small initialized
7069 @code{const} global and static data in the @samp{.sdata2} section, which
7070 is pointed to by register @code{r2}.  Put small initialized
7071 non-@code{const} global and static data in the @samp{.sdata} section,
7072 which is pointed to by register @code{r13}.  Put small uninitialized
7073 global and static data in the @samp{.sbss} section, which is adjacent to
7074 the @samp{.sdata} section.  The @option{-msdata=eabi} option is
7075 incompatible with the @option{-mrelocatable} option.  The
7076 @option{-msdata=eabi} option also sets the @option{-memb} option.
7077
7078 @item -msdata=sysv
7079 @opindex msdata=sysv
7080 On System V.4 and embedded PowerPC systems, put small global and static
7081 data in the @samp{.sdata} section, which is pointed to by register
7082 @code{r13}.  Put small uninitialized global and static data in the
7083 @samp{.sbss} section, which is adjacent to the @samp{.sdata} section.
7084 The @option{-msdata=sysv} option is incompatible with the
7085 @option{-mrelocatable} option.
7086
7087 @item -msdata=default
7088 @itemx -msdata
7089 @opindex msdata=default
7090 @opindex msdata
7091 On System V.4 and embedded PowerPC systems, if @option{-meabi} is used,
7092 compile code the same as @option{-msdata=eabi}, otherwise compile code the
7093 same as @option{-msdata=sysv}.
7094
7095 @item -msdata-data
7096 @opindex msdata-data
7097 On System V.4 and embedded PowerPC systems, put small global and static
7098 data in the @samp{.sdata} section.  Put small uninitialized global and
7099 static data in the @samp{.sbss} section.  Do not use register @code{r13}
7100 to address small data however.  This is the default behavior unless
7101 other @option{-msdata} options are used.
7102
7103 @item -msdata=none
7104 @itemx -mno-sdata
7105 @opindex msdata=none
7106 @opindex mno-sdata
7107 On embedded PowerPC systems, put all initialized global and static data
7108 in the @samp{.data} section, and all uninitialized data in the
7109 @samp{.bss} section.
7110
7111 @item -G @var{num}
7112 @opindex G
7113 @cindex smaller data references (PowerPC)
7114 @cindex .sdata/.sdata2 references (PowerPC)
7115 On embedded PowerPC systems, put global and static items less than or
7116 equal to @var{num} bytes into the small data or bss sections instead of
7117 the normal data or bss section.  By default, @var{num} is 8.  The
7118 @option{-G @var{num}} switch is also passed to the linker.
7119 All modules should be compiled with the same @option{-G @var{num}} value.
7120
7121 @item -mregnames
7122 @itemx -mno-regnames
7123 @opindex mregnames
7124 @opindex mno-regnames
7125 On System V.4 and embedded PowerPC systems do (do not) emit register
7126 names in the assembly language output using symbolic forms.
7127
7128 @item -mlongcall
7129 @itemx -mno-longcall
7130 @opindex mlongcall
7131 @opindex mno-longcall
7132 Default to making all function calls via pointers, so that functions
7133 which reside further than 64 megabytes (67,108,864 bytes) from the
7134 current location can be called.  This setting can be overridden by the
7135 @code{shortcall} function attribute, or by @code{#pragma longcall(0)}.
7136
7137 Some linkers are capable of detecting out-of-range calls and generating
7138 glue code on the fly.  On these systems, long calls are unnecessary and
7139 generate slower code.  As of this writing, the AIX linker can do this,
7140 as can the GNU linker for PowerPC/64.  It is planned to add this feature
7141 to the GNU linker for 32-bit PowerPC systems as well.
7142
7143 In the future, we may cause GCC to ignore all longcall specifications
7144 when the linker is known to generate glue.
7145
7146 @item -pthread
7147 @opindex pthread
7148 Adds support for multithreading with the @dfn{pthreads} library.
7149 This option sets flags for both the preprocessor and linker.
7150
7151 @end table
7152
7153 @node RT Options
7154 @subsection IBM RT Options
7155 @cindex RT options
7156 @cindex IBM RT options
7157
7158 These @samp{-m} options are defined for the IBM RT PC:
7159
7160 @table @gcctabopt
7161 @item -min-line-mul
7162 @opindex min-line-mul
7163 Use an in-line code sequence for integer multiplies.  This is the
7164 default.
7165
7166 @item -mcall-lib-mul
7167 @opindex mcall-lib-mul
7168 Call @code{lmul$$} for integer multiples.
7169
7170 @item -mfull-fp-blocks
7171 @opindex mfull-fp-blocks
7172 Generate full-size floating point data blocks, including the minimum
7173 amount of scratch space recommended by IBM@.  This is the default.
7174
7175 @item -mminimum-fp-blocks
7176 @opindex mminimum-fp-blocks
7177 Do not include extra scratch space in floating point data blocks.  This
7178 results in smaller code, but slower execution, since scratch space must
7179 be allocated dynamically.
7180
7181 @cindex @file{stdarg.h} and RT PC
7182 @item -mfp-arg-in-fpregs
7183 @opindex mfp-arg-in-fpregs
7184 Use a calling sequence incompatible with the IBM calling convention in
7185 which floating point arguments are passed in floating point registers.
7186 Note that @code{stdarg.h} will not work with floating point operands
7187 if this option is specified.
7188
7189 @item -mfp-arg-in-gregs
7190 @opindex mfp-arg-in-gregs
7191 Use the normal calling convention for floating point arguments.  This is
7192 the default.
7193
7194 @item -mhc-struct-return
7195 @opindex mhc-struct-return
7196 Return structures of more than one word in memory, rather than in a
7197 register.  This provides compatibility with the MetaWare HighC (hc)
7198 compiler.  Use the option @option{-fpcc-struct-return} for compatibility
7199 with the Portable C Compiler (pcc).
7200
7201 @item -mnohc-struct-return
7202 @opindex mnohc-struct-return
7203 Return some structures of more than one word in registers, when
7204 convenient.  This is the default.  For compatibility with the
7205 IBM-supplied compilers, use the option @option{-fpcc-struct-return} or the
7206 option @option{-mhc-struct-return}.
7207 @end table
7208
7209 @node MIPS Options
7210 @subsection MIPS Options
7211 @cindex MIPS options
7212
7213 These @samp{-m} options are defined for the MIPS family of computers:
7214
7215 @table @gcctabopt
7216
7217 @item -march=@var{arch}
7218 @opindex march
7219 Generate code that will run on @var{arch}, which can be the name of a
7220 generic MIPS ISA, or the name of a particular processor.  The ISA names
7221 are: @samp{mips1}, @samp{mips2}, @samp{mips3}, @samp{mips4}, @samp{mips32}
7222 and @samp{mips64}.  The processor names are: @samp{r2000},
7223 @samp{r3000}, @samp{r3900}, @samp{r4000}, @samp{vr4100}, @samp{vr4300},
7224 @samp{r4400}, @samp{r4600}, @samp{r4650}, @samp{vr5000}, @samp{r6000},
7225 @samp{r8000}, @samp{4kc}, @samp{4kp}, @samp{5kc}, @samp{20kc},
7226 @samp{orion}, and @samp{sb1}.  The special value @samp{from-abi} selects the
7227 most compatible architecture for the selected ABI (that is,
7228 @samp{mips1} for 32-bit ABIs and @samp{mips3} for 64-bit ABIs)@.
7229
7230 In processor names, a final @samp{000} can be abbreviated as @samp{k}
7231 (for example, @samp{-march=r2k}).  Prefixes are optional, and
7232 @samp{vr} may be written @samp{r}.
7233
7234 GCC defines two macros based on the value of this option.  The first
7235 is @samp{_MIPS_ARCH}, which gives the name of target architecture, as
7236 a string.  The second has the form @samp{_MIPS_ARCH_@var{foo}},
7237 where @var{foo} is the capitialized value of @samp{_MIPS_ARCH}@.
7238 For example, @samp{-march=r2000} will set @samp{_MIPS_ARCH}
7239 to @samp{"r2000"} and define the macro @samp{_MIPS_ARCH_R2000}.
7240
7241 Note that the @samp{_MIPS_ARCH} macro uses the processor names given
7242 above.  In other words, it will have the full prefix and will not
7243 abbreviate @samp{000} as @samp{k}.  In the case of @samp{from-abi},
7244 the macro names the resolved architecture (either @samp{"mips1"} or
7245 @samp{"mips3"}).  It names the default architecture when no
7246 @option{-march} option is given.
7247
7248 @item -mtune=@var{arch}
7249 @opindex mtune
7250 Optimize for @var{arch}.  Among other things, this option controls
7251 the way instructions are scheduled, and the perceived cost of arithmetic
7252 operations.  The list of @var{arch} values is the same as for
7253 @option{-march}.
7254
7255 When this option is not used, GCC will optimize for the processor
7256 specified by @option{-march}.  By using @option{-march} and
7257 @option{-mtune} together, it is possible to generate code that will
7258 run on a family of processors, but optimize the code for one
7259 particular member of that family.
7260
7261 @samp{-mtune} defines the macros @samp{_MIPS_TUNE} and
7262 @samp{_MIPS_TUNE_@var{foo}}, which work in the same way as the
7263 @samp{-march} ones described above.
7264
7265 @item -mips1
7266 @opindex mips1
7267 Equivalent to @samp{-march=mips1}.
7268
7269 @item -mips2
7270 @opindex mips2
7271 Equivalent to @samp{-march=mips2}.
7272
7273 @item -mips3
7274 @opindex mips3
7275 Equivalent to @samp{-march=mips3}.
7276
7277 @item -mips4
7278 @opindex mips4
7279 Equivalent to @samp{-march=mips4}.
7280
7281 @item -mips32
7282 @opindex mips32
7283 Equivalent to @samp{-march=mips32}.
7284
7285 @item -mips64
7286 @opindex mips64
7287 Equivalent to @samp{-march=mips64}.
7288
7289 @item -mfused-madd
7290 @itemx -mno-fused-madd
7291 @opindex mfused-madd
7292 @opindex mno-fused-madd
7293 Generate code that uses (does not use) the floating point multiply and
7294 accumulate instructions, when they are available.  These instructions
7295 are generated by default if they are available, but this may be
7296 undesirable if the extra precision causes problems or on certain chips
7297 in the mode where denormals are rounded to zero where denormals
7298 generated by multiply and accumulate instructions cause exceptions
7299 anyway.
7300
7301 @item -mfp32
7302 @opindex mfp32
7303 Assume that floating point registers are 32 bits wide.
7304
7305 @item -mfp64
7306 @opindex mfp64
7307 Assume that floating point registers are 64 bits wide.
7308
7309 @item -mgp32
7310 @opindex mgp32
7311 Assume that general purpose registers are 32 bits wide.
7312
7313 @item -mgp64
7314 @opindex mgp64
7315 Assume that general purpose registers are 64 bits wide.
7316
7317 @item -mint64
7318 @opindex mint64
7319 Force int and long types to be 64 bits wide.  See @option{-mlong32} for an
7320 explanation of the default, and the width of pointers.
7321
7322 @item -mlong64
7323 @opindex mlong64
7324 Force long types to be 64 bits wide.  See @option{-mlong32} for an
7325 explanation of the default, and the width of pointers.
7326
7327 @item -mlong32
7328 @opindex mlong32
7329 Force long, int, and pointer types to be 32 bits wide.
7330
7331 The default size of ints, longs and pointers depends on the ABI@.  All
7332 the supported ABIs use 32-bit ints.  The n64 ABI uses 64-bit longs, as
7333 does the 64-bit Cygnus EABI; the others use 32-bit longs.  Pointers
7334 are the same size as longs, or the same size as integer registers,
7335 whichever is smaller.
7336
7337 @item -mabi=32
7338 @itemx -mabi=o64
7339 @itemx -mabi=n32
7340 @itemx -mabi=64
7341 @itemx -mabi=eabi
7342 @itemx -mabi=meabi
7343 @opindex mabi=32
7344 @opindex mabi=o64
7345 @opindex mabi=n32
7346 @opindex mabi=64
7347 @opindex mabi=eabi
7348 @opindex mabi=meabi
7349 Generate code for the given ABI@.
7350
7351 Note that there are two embedded ABIs: @option{-mabi=eabi}
7352 selects the one defined by Cygnus while @option{-meabi=meabi}
7353 selects the one defined by MIPS@.  Both these ABIs have
7354 32-bit and 64-bit variants.  Normally, GCC will generate
7355 64-bit code when you select a 64-bit architecture, but you
7356 can use @option{-mgp32} to get 32-bit code instead.
7357
7358 @item -mmips-as
7359 @opindex mmips-as
7360 Generate code for the MIPS assembler, and invoke @file{mips-tfile} to
7361 add normal debug information.  This is the default for all
7362 platforms except for the OSF/1 reference platform, using the OSF/rose
7363 object format.  If the either of the @option{-gstabs} or @option{-gstabs+}
7364 switches are used, the @file{mips-tfile} program will encapsulate the
7365 stabs within MIPS ECOFF@.
7366
7367 @item -mgas
7368 @opindex mgas
7369 Generate code for the GNU assembler.  This is the default on the OSF/1
7370 reference platform, using the OSF/rose object format.  Also, this is
7371 the default if the configure option @option{--with-gnu-as} is used.
7372
7373 @item -msplit-addresses
7374 @itemx -mno-split-addresses
7375 @opindex msplit-addresses
7376 @opindex mno-split-addresses
7377 Generate code to load the high and low parts of address constants separately.
7378 This allows GCC to optimize away redundant loads of the high order
7379 bits of addresses.  This optimization requires GNU as and GNU ld.
7380 This optimization is enabled by default for some embedded targets where
7381 GNU as and GNU ld are standard.
7382
7383 @item -mrnames
7384 @itemx -mno-rnames
7385 @opindex mrnames
7386 @opindex mno-rnames
7387 The @option{-mrnames} switch says to output code using the MIPS software
7388 names for the registers, instead of the hardware names (ie, @var{a0}
7389 instead of @var{$4}).  The only known assembler that supports this option
7390 is the Algorithmics assembler.
7391
7392 @item -mgpopt
7393 @itemx -mno-gpopt
7394 @opindex mgpopt
7395 @opindex mno-gpopt
7396 The @option{-mgpopt} switch says to write all of the data declarations
7397 before the instructions in the text section, this allows the MIPS
7398 assembler to generate one word memory references instead of using two
7399 words for short global or static data items.  This is on by default if
7400 optimization is selected.
7401
7402 @item -mstats
7403 @itemx -mno-stats
7404 @opindex mstats
7405 @opindex mno-stats
7406 For each non-inline function processed, the @option{-mstats} switch
7407 causes the compiler to emit one line to the standard error file to
7408 print statistics about the program (number of registers saved, stack
7409 size, etc.).
7410
7411 @item -mmemcpy
7412 @itemx -mno-memcpy
7413 @opindex mmemcpy
7414 @opindex mno-memcpy
7415 The @option{-mmemcpy} switch makes all block moves call the appropriate
7416 string function (@samp{memcpy} or @samp{bcopy}) instead of possibly
7417 generating inline code.
7418
7419 @item -mmips-tfile
7420 @itemx -mno-mips-tfile
7421 @opindex mmips-tfile
7422 @opindex mno-mips-tfile
7423 The @option{-mno-mips-tfile} switch causes the compiler not
7424 postprocess the object file with the @file{mips-tfile} program,
7425 after the MIPS assembler has generated it to add debug support.  If
7426 @file{mips-tfile} is not run, then no local variables will be
7427 available to the debugger.  In addition, @file{stage2} and
7428 @file{stage3} objects will have the temporary file names passed to the
7429 assembler embedded in the object file, which means the objects will
7430 not compare the same.  The @option{-mno-mips-tfile} switch should only
7431 be used when there are bugs in the @file{mips-tfile} program that
7432 prevents compilation.
7433
7434 @item -msoft-float
7435 @opindex msoft-float
7436 Generate output containing library calls for floating point.
7437 @strong{Warning:} the requisite libraries are not part of GCC@.
7438 Normally the facilities of the machine's usual C compiler are used, but
7439 this can't be done directly in cross-compilation.  You must make your
7440 own arrangements to provide suitable library functions for
7441 cross-compilation.
7442
7443 @item -mhard-float
7444 @opindex mhard-float
7445 Generate output containing floating point instructions.  This is the
7446 default if you use the unmodified sources.
7447
7448 @item -mabicalls
7449 @itemx -mno-abicalls
7450 @opindex mabicalls
7451 @opindex mno-abicalls
7452 Emit (or do not emit) the pseudo operations @samp{.abicalls},
7453 @samp{.cpload}, and @samp{.cprestore} that some System V.4 ports use for
7454 position independent code.
7455
7456 @item -mlong-calls
7457 @itemx -mno-long-calls
7458 @opindex mlong-calls
7459 @opindex mno-long-calls
7460 Do all calls with the @samp{JALR} instruction, which requires
7461 loading up a function's address into a register before the call.
7462 You need to use this switch, if you call outside of the current
7463 512 megabyte segment to functions that are not through pointers.
7464
7465 @item -mhalf-pic
7466 @itemx -mno-half-pic
7467 @opindex mhalf-pic
7468 @opindex mno-half-pic
7469 Put pointers to extern references into the data section and load them
7470 up, rather than put the references in the text section.
7471
7472 @item -membedded-pic
7473 @itemx -mno-embedded-pic
7474 @opindex membedded-pic
7475 @opindex mno-embedded-pic
7476 Generate PIC code suitable for some embedded systems.  All calls are
7477 made using PC relative address, and all data is addressed using the $gp
7478 register.  No more than 65536 bytes of global data may be used.  This
7479 requires GNU as and GNU ld which do most of the work.  This currently
7480 only works on targets which use ECOFF; it does not work with ELF@.
7481
7482 @item -membedded-data
7483 @itemx -mno-embedded-data
7484 @opindex membedded-data
7485 @opindex mno-embedded-data
7486 Allocate variables to the read-only data section first if possible, then
7487 next in the small data section if possible, otherwise in data.  This gives
7488 slightly slower code than the default, but reduces the amount of RAM required
7489 when executing, and thus may be preferred for some embedded systems.
7490
7491 @item -muninit-const-in-rodata
7492 @itemx -mno-uninit-const-in-rodata
7493 @opindex muninit-const-in-rodata
7494 @opindex mno-uninit-const-in-rodata
7495 When used together with @option{-membedded-data}, it will always store uninitialized
7496 const variables in the read-only data section.
7497
7498 @item -msingle-float
7499 @itemx -mdouble-float
7500 @opindex msingle-float
7501 @opindex mdouble-float
7502 The @option{-msingle-float} switch tells gcc to assume that the floating
7503 point coprocessor only supports single precision operations, as on the
7504 @samp{r4650} chip.  The @option{-mdouble-float} switch permits gcc to use
7505 double precision operations.  This is the default.
7506
7507 @item -mmad
7508 @itemx -mno-mad
7509 @opindex mmad
7510 @opindex mno-mad
7511 Permit use of the @samp{mad}, @samp{madu} and @samp{mul} instructions,
7512 as on the @samp{r4650} chip.
7513
7514 @item -m4650
7515 @opindex m4650
7516 Turns on @option{-msingle-float}, @option{-mmad}, and, at least for now,
7517 @option{-mcpu=r4650}.
7518
7519 @item -mips16
7520 @itemx -mno-mips16
7521 @opindex mips16
7522 @opindex mno-mips16
7523 Enable 16-bit instructions.
7524
7525 @item -mentry
7526 @opindex mentry
7527 Use the entry and exit pseudo ops.  This option can only be used with
7528 @option{-mips16}.
7529
7530 @item -EL
7531 @opindex EL
7532 Compile code for the processor in little endian mode.
7533 The requisite libraries are assumed to exist.
7534
7535 @item -EB
7536 @opindex EB
7537 Compile code for the processor in big endian mode.
7538 The requisite libraries are assumed to exist.
7539
7540 @item -G @var{num}
7541 @opindex G
7542 @cindex smaller data references (MIPS)
7543 @cindex gp-relative references (MIPS)
7544 Put global and static items less than or equal to @var{num} bytes into
7545 the small data or bss sections instead of the normal data or bss
7546 section.  This allows the assembler to emit one word memory reference
7547 instructions based on the global pointer (@var{gp} or @var{$28}),
7548 instead of the normal two words used.  By default, @var{num} is 8 when
7549 the MIPS assembler is used, and 0 when the GNU assembler is used.  The
7550 @option{-G @var{num}} switch is also passed to the assembler and linker.
7551 All modules should be compiled with the same @option{-G @var{num}}
7552 value.
7553
7554 @item -nocpp
7555 @opindex nocpp
7556 Tell the MIPS assembler to not run its preprocessor over user
7557 assembler files (with a @samp{.s} suffix) when assembling them.
7558
7559 @item -mfix7000
7560 @opindex mfix7000
7561 Pass an option to gas which will cause nops to be inserted if
7562 the read of the destination register of an mfhi or mflo instruction
7563 occurs in the following two instructions.
7564
7565 @item -no-crt0
7566 @opindex no-crt0
7567 Do not include the default crt0.
7568
7569 @item -mflush-func=@var{func}
7570 @itemx -mno-flush-func
7571 @opindex mflush-func
7572 Specifies the function to call to flush the I and D caches, or to not
7573 call any such function.  If called, the function must take the same
7574 arguments as the common @code{_flush_func()}, that is, the address of the
7575 memory range for which the cache is being flushed, the size of the
7576 memory range, and the number 3 (to flush both caches).  The default
7577 depends on the target gcc was configured for, but commonly is either
7578 @samp{_flush_func} or @samp{__cpu_flush}.
7579
7580 @item -mbranch-likely
7581 @itemx -mno-branch-likely
7582 @opindex mbranch-likely
7583 @opindex mno-branch-likely
7584 Enable or disable use of Branch Likely instructions, regardless of the
7585 default for the selected architecture.  By default, Branch Likely
7586 instructions may be generated if they are supported by the selected
7587 architecture.  An exception is for the MIPS32 and MIPS64 architectures
7588 and processors which implement those architectures; for those, Branch
7589 Likely instructions will not be generated by default because the MIPS32
7590 and MIPS64 architectures specifically deprecate their use.
7591 @end table
7592
7593 @node i386 and x86-64 Options
7594 @subsection Intel 386 and AMD x86-64 Options
7595 @cindex i386 Options
7596 @cindex x86-64 Options
7597 @cindex Intel 386 Options
7598 @cindex AMD x86-64 Options
7599
7600 These @samp{-m} options are defined for the i386 and x86-64 family of
7601 computers:
7602
7603 @table @gcctabopt
7604 @item -mcpu=@var{cpu-type}
7605 @opindex mcpu
7606 Tune to @var{cpu-type} everything applicable about the generated code, except
7607 for the ABI and the set of available instructions.  The choices for
7608 @var{cpu-type} are @samp{i386}, @samp{i486}, @samp{i586}, @samp{i686},
7609 @samp{pentium}, @samp{pentium-mmx}, @samp{pentiumpro}, @samp{pentium2},
7610 @samp{pentium3}, @samp{pentium4}, @samp{k6}, @samp{k6-2}, @samp{k6-3},
7611 @samp{athlon}, @samp{athlon-tbird}, @samp{athlon-4}, @samp{athlon-xp},
7612 @samp{athlon-mp}, @samp{winchip-c6}, @samp{winchip2} and @samp{c3}.
7613
7614 While picking a specific @var{cpu-type} will schedule things appropriately
7615 for that particular chip, the compiler will not generate any code that
7616 does not run on the i386 without the @option{-march=@var{cpu-type}} option
7617 being used.  @samp{i586} is equivalent to @samp{pentium} and @samp{i686}
7618 is equivalent to @samp{pentiumpro}.  @samp{k6} and @samp{athlon} are the
7619 AMD chips as opposed to the Intel ones.
7620
7621 @item -march=@var{cpu-type}
7622 @opindex march
7623 Generate instructions for the machine type @var{cpu-type}.  The choices
7624 for @var{cpu-type} are the same as for @option{-mcpu}.  Moreover,
7625 specifying @option{-march=@var{cpu-type}} implies @option{-mcpu=@var{cpu-type}}.
7626
7627 @item -m386
7628 @itemx -m486
7629 @itemx -mpentium
7630 @itemx -mpentiumpro
7631 @opindex m386
7632 @opindex m486
7633 @opindex mpentium
7634 @opindex mpentiumpro
7635 These options are synonyms for @option{-mcpu=i386}, @option{-mcpu=i486},
7636 @option{-mcpu=pentium}, and @option{-mcpu=pentiumpro} respectively.
7637 These synonyms are deprecated.
7638
7639 @item -mfpmath=@var{unit}
7640 @opindex march
7641 generate floating point arithmetics for selected unit @var{unit}.  the choices
7642 for @var{unit} are:
7643
7644 @table @samp
7645 @item 387
7646 Use the standard 387 floating point coprocessor present majority of chips and
7647 emulated otherwise.  Code compiled with this option will run almost everywhere.
7648 The temporary results are computed in 80bit precesion instead of precision
7649 specified by the type resulting in slightly different results compared to most
7650 of other chips. See @option{-ffloat-store} for more detailed description.
7651
7652 This is the default choice for i386 compiler.
7653
7654 @item sse
7655 Use scalar floating point instructions present in the SSE instruction set.
7656 This instruction set is supported by Pentium3 and newer chips, in the AMD line
7657 by Athlon-4, Athlon-xp and Athlon-mp chips.  The earlier version of SSE
7658 instruction set supports only single precision arithmetics, thus the double and
7659 extended precision arithmetics is still done using 387.  Later version, present
7660 only in Pentium4 and the future AMD x86-64 chips supports double precision
7661 arithmetics too.
7662
7663 For i387 you need to use @option{-march=@var{cpu-type}}, @option{-msse} or
7664 @option{-msse2} switches to enable SSE extensions and make this option
7665 effective.  For x86-64 compiler, these extensions are enabled by default.
7666
7667 The resulting code should be considerably faster in majority of cases and avoid
7668 the numerical instability problems of 387 code, but may break some existing
7669 code that expects temporaries to be 80bit.
7670
7671 This is the default choice for x86-64 compiler.
7672
7673 @item sse,387
7674 Attempt to utilize both instruction sets at once.  This effectivly double the
7675 amount of available registers and on chips with separate execution units for
7676 387 and SSE the execution resources too.  Use this option with care, as it is
7677 still experimental, because gcc register allocator does not model separate
7678 functional units well resulting in instable performance.
7679 @end table
7680
7681 @item -masm=@var{dialect}
7682 @opindex masm=@var{dialect}
7683 Output asm instructions using selected @var{dialect}. Supported choices are
7684 @samp{intel} or @samp{att} (the default one).
7685
7686 @item -mieee-fp
7687 @itemx -mno-ieee-fp
7688 @opindex mieee-fp
7689 @opindex mno-ieee-fp
7690 Control whether or not the compiler uses IEEE floating point
7691 comparisons.  These handle correctly the case where the result of a
7692 comparison is unordered.
7693
7694 @item -msoft-float
7695 @opindex msoft-float
7696 Generate output containing library calls for floating point.
7697 @strong{Warning:} the requisite libraries are not part of GCC@.
7698 Normally the facilities of the machine's usual C compiler are used, but
7699 this can't be done directly in cross-compilation.  You must make your
7700 own arrangements to provide suitable library functions for
7701 cross-compilation.
7702
7703 On machines where a function returns floating point results in the 80387
7704 register stack, some floating point opcodes may be emitted even if
7705 @option{-msoft-float} is used.
7706
7707 @item -mno-fp-ret-in-387
7708 @opindex mno-fp-ret-in-387
7709 Do not use the FPU registers for return values of functions.
7710
7711 The usual calling convention has functions return values of types
7712 @code{float} and @code{double} in an FPU register, even if there
7713 is no FPU@.  The idea is that the operating system should emulate
7714 an FPU@.
7715
7716 The option @option{-mno-fp-ret-in-387} causes such values to be returned
7717 in ordinary CPU registers instead.
7718
7719 @item -mno-fancy-math-387
7720 @opindex mno-fancy-math-387
7721 Some 387 emulators do not support the @code{sin}, @code{cos} and
7722 @code{sqrt} instructions for the 387.  Specify this option to avoid
7723 generating those instructions.  This option is the default on FreeBSD,
7724 OpenBSD and NetBSD@.  This option is overridden when @option{-march}
7725 indicates that the target cpu will always have an FPU and so the
7726 instruction will not need emulation.  As of revision 2.6.1, these
7727 instructions are not generated unless you also use the
7728 @option{-funsafe-math-optimizations} switch.
7729
7730 @item -malign-double
7731 @itemx -mno-align-double
7732 @opindex malign-double
7733 @opindex mno-align-double
7734 Control whether GCC aligns @code{double}, @code{long double}, and
7735 @code{long long} variables on a two word boundary or a one word
7736 boundary.  Aligning @code{double} variables on a two word boundary will
7737 produce code that runs somewhat faster on a @samp{Pentium} at the
7738 expense of more memory.
7739
7740 @strong{Warning:} if you use the @samp{-malign-double} switch,
7741 structures containing the above types will be aligned differently than
7742 the published application binary interface specifications for the 386.
7743
7744 @item -m128bit-long-double
7745 @opindex m128bit-long-double
7746 Control the size of @code{long double} type. i386 application binary interface
7747 specify the size to be 12 bytes, while modern architectures (Pentium and newer)
7748 prefer @code{long double} aligned to 8 or 16 byte boundary.  This is
7749 impossible to reach with 12 byte long doubles in the array accesses.
7750
7751 @strong{Warning:} if you use the @option{-m128bit-long-double} switch, the
7752 structures and arrays containing @code{long double} will change their size as
7753 well as function calling convention for function taking @code{long double}
7754 will be modified.
7755
7756 @item -m96bit-long-double
7757 @opindex m96bit-long-double
7758 Set the size of @code{long double} to 96 bits as required by the i386
7759 application binary interface.  This is the default.
7760
7761 @item -msvr3-shlib
7762 @itemx -mno-svr3-shlib
7763 @opindex msvr3-shlib
7764 @opindex mno-svr3-shlib
7765 Control whether GCC places uninitialized local variables into the
7766 @code{bss} or @code{data} segments.  @option{-msvr3-shlib} places them
7767 into @code{bss}.  These options are meaningful only on System V Release 3.
7768
7769 @item -mrtd
7770 @opindex mrtd
7771 Use a different function-calling convention, in which functions that
7772 take a fixed number of arguments return with the @code{ret} @var{num}
7773 instruction, which pops their arguments while returning.  This saves one
7774 instruction in the caller since there is no need to pop the arguments
7775 there.
7776
7777 You can specify that an individual function is called with this calling
7778 sequence with the function attribute @samp{stdcall}.  You can also
7779 override the @option{-mrtd} option by using the function attribute
7780 @samp{cdecl}.  @xref{Function Attributes}.
7781
7782 @strong{Warning:} this calling convention is incompatible with the one
7783 normally used on Unix, so you cannot use it if you need to call
7784 libraries compiled with the Unix compiler.
7785
7786 Also, you must provide function prototypes for all functions that
7787 take variable numbers of arguments (including @code{printf});
7788 otherwise incorrect code will be generated for calls to those
7789 functions.
7790
7791 In addition, seriously incorrect code will result if you call a
7792 function with too many arguments.  (Normally, extra arguments are
7793 harmlessly ignored.)
7794
7795 @item -mregparm=@var{num}
7796 @opindex mregparm
7797 Control how many registers are used to pass integer arguments.  By
7798 default, no registers are used to pass arguments, and at most 3
7799 registers can be used.  You can control this behavior for a specific
7800 function by using the function attribute @samp{regparm}.
7801 @xref{Function Attributes}.
7802
7803 @strong{Warning:} if you use this switch, and
7804 @var{num} is nonzero, then you must build all modules with the same
7805 value, including any libraries.  This includes the system libraries and
7806 startup modules.
7807
7808 @item -mpreferred-stack-boundary=@var{num}
7809 @opindex mpreferred-stack-boundary
7810 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
7811 byte boundary.  If @option{-mpreferred-stack-boundary} is not specified,
7812 the default is 4 (16 bytes or 128 bits), except when optimizing for code
7813 size (@option{-Os}), in which case the default is the minimum correct
7814 alignment (4 bytes for x86, and 8 bytes for x86-64).
7815
7816 On Pentium and PentiumPro, @code{double} and @code{long double} values
7817 should be aligned to an 8 byte boundary (see @option{-malign-double}) or
7818 suffer significant run time performance penalties.  On Pentium III, the
7819 Streaming SIMD Extension (SSE) data type @code{__m128} suffers similar
7820 penalties if it is not 16 byte aligned.
7821
7822 To ensure proper alignment of this values on the stack, the stack boundary
7823 must be as aligned as that required by any value stored on the stack.
7824 Further, every function must be generated such that it keeps the stack
7825 aligned.  Thus calling a function compiled with a higher preferred
7826 stack boundary from a function compiled with a lower preferred stack
7827 boundary will most likely misalign the stack.  It is recommended that
7828 libraries that use callbacks always use the default setting.
7829
7830 This extra alignment does consume extra stack space, and generally
7831 increases code size.  Code that is sensitive to stack space usage, such
7832 as embedded systems and operating system kernels, may want to reduce the
7833 preferred alignment to @option{-mpreferred-stack-boundary=2}.
7834
7835 @item -mmmx
7836 @itemx -mno-mmx
7837 @item -msse
7838 @itemx -mno-sse
7839 @item -msse2
7840 @itemx -mno-sse2
7841 @item -m3dnow
7842 @itemx -mno-3dnow
7843 @opindex mmmx
7844 @opindex mno-mmx
7845 @opindex msse
7846 @opindex mno-sse
7847 @opindex m3dnow
7848 @opindex mno-3dnow
7849 These switches enable or disable the use of built-in functions that allow
7850 direct access to the MMX, SSE and 3Dnow extensions of the instruction set.
7851
7852 @xref{X86 Built-in Functions}, for details of the functions enabled
7853 and disabled by these switches.
7854
7855 To have SSE/SSE2 instructions generated automatically from floating-point
7856 code, see @option{-mfpmath=sse}.
7857
7858 @item -mpush-args
7859 @itemx -mno-push-args
7860 @opindex mpush-args
7861 @opindex mno-push-args
7862 Use PUSH operations to store outgoing parameters.  This method is shorter
7863 and usually equally fast as method using SUB/MOV operations and is enabled
7864 by default.  In some cases disabling it may improve performance because of
7865 improved scheduling and reduced dependencies.
7866
7867 @item -maccumulate-outgoing-args
7868 @opindex maccumulate-outgoing-args
7869 If enabled, the maximum amount of space required for outgoing arguments will be
7870 computed in the function prologue.  This is faster on most modern CPUs
7871 because of reduced dependencies, improved scheduling and reduced stack usage
7872 when preferred stack boundary is not equal to 2.  The drawback is a notable
7873 increase in code size.  This switch implies @option{-mno-push-args}.
7874
7875 @item -mthreads
7876 @opindex mthreads
7877 Support thread-safe exception handling on @samp{Mingw32}.  Code that relies
7878 on thread-safe exception handling must compile and link all code with the
7879 @option{-mthreads} option.  When compiling, @option{-mthreads} defines
7880 @option{-D_MT}; when linking, it links in a special thread helper library
7881 @option{-lmingwthrd} which cleans up per thread exception handling data.
7882
7883 @item -mno-align-stringops
7884 @opindex mno-align-stringops
7885 Do not align destination of inlined string operations.  This switch reduces
7886 code size and improves performance in case the destination is already aligned,
7887 but gcc don't know about it.
7888
7889 @item -minline-all-stringops
7890 @opindex minline-all-stringops
7891 By default GCC inlines string operations only when destination is known to be
7892 aligned at least to 4 byte boundary.  This enables more inlining, increase code
7893 size, but may improve performance of code that depends on fast memcpy, strlen
7894 and memset for short lengths.
7895
7896 @item -momit-leaf-frame-pointer
7897 @opindex momit-leaf-frame-pointer
7898 Don't keep the frame pointer in a register for leaf functions.  This
7899 avoids the instructions to save, set up and restore frame pointers and
7900 makes an extra register available in leaf functions.  The option
7901 @option{-fomit-frame-pointer} removes the frame pointer for all functions
7902 which might make debugging harder.
7903 @end table
7904
7905 These @samp{-m} switches are supported in addition to the above
7906 on AMD x86-64 processors in 64-bit environments.
7907
7908 @table @gcctabopt
7909 @item -m32
7910 @itemx -m64
7911 @opindex m32
7912 @opindex m64
7913 Generate code for a 32-bit or 64-bit environment.
7914 The 32-bit environment sets int, long and pointer to 32 bits and
7915 generates code that runs on any i386 system.
7916 The 64-bit environment sets int to 32 bits and long and pointer
7917 to 64 bits and generates code for AMD's x86-64 architecture.
7918
7919 @item -mno-red-zone
7920 @opindex no-red-zone
7921 Do not use a so called red zone for x86-64 code.  The red zone is mandated
7922 by the x86-64 ABI, it is a 128-byte area beyond the location of the
7923 stack pointer that will not be modified by signal or interrupt handlers
7924 and therefore can be used for temporary data without adjusting the stack
7925 pointer.  The flag @option{-mno-red-zone} disables this red zone.
7926
7927 @item -mcmodel=small
7928 @opindex mcmodel=small
7929 Generate code for the small code model: the program and its symbols must
7930 be linked in the lower 2 GB of the address space.  Pointers are 64 bits.
7931 Programs can be statically or dynamically linked.  This is the default
7932 code model.
7933
7934 @item -mcmodel=kernel
7935 @opindex mcmodel=kernel
7936 Generate code for the kernel code model.  The kernel runs in the
7937 negative 2 GB of the address space.
7938 This model has to be used for Linux kernel code.
7939
7940 @item -mcmodel=medium
7941 @opindex mcmodel=medium
7942 Generate code for the medium model: The program is linked in the lower 2
7943 GB of the address space but symbols can be located anywhere in the
7944 address space.  Programs can be statically or dynamically linked, but
7945 building of shared libraries are not supported with the medium model.
7946
7947 @item -mcmodel=large
7948 @opindex mcmodel=large
7949 Generate code for the large model: This model makes no assumptions
7950 about addresses and sizes of sections.  Currently GCC does not implement
7951 this model.
7952 @end table
7953
7954 @node HPPA Options
7955 @subsection HPPA Options
7956 @cindex HPPA Options
7957
7958 These @samp{-m} options are defined for the HPPA family of computers:
7959
7960 @table @gcctabopt
7961 @item -march=@var{architecture-type}
7962 @opindex march
7963 Generate code for the specified architecture.  The choices for
7964 @var{architecture-type} are @samp{1.0} for PA 1.0, @samp{1.1} for PA
7965 1.1, and @samp{2.0} for PA 2.0 processors.  Refer to
7966 @file{/usr/lib/sched.models} on an HP-UX system to determine the proper
7967 architecture option for your machine.  Code compiled for lower numbered
7968 architectures will run on higher numbered architectures, but not the
7969 other way around.
7970
7971 PA 2.0 support currently requires gas snapshot 19990413 or later.  The
7972 next release of binutils (current is 2.9.1) will probably contain PA 2.0
7973 support.
7974
7975 @item -mpa-risc-1-0
7976 @itemx -mpa-risc-1-1
7977 @itemx -mpa-risc-2-0
7978 @opindex mpa-risc-1-0
7979 @opindex mpa-risc-1-1
7980 @opindex mpa-risc-2-0
7981 Synonyms for @option{-march=1.0}, @option{-march=1.1}, and @option{-march=2.0} respectively.
7982
7983 @item -mbig-switch
7984 @opindex mbig-switch
7985 Generate code suitable for big switch tables.  Use this option only if
7986 the assembler/linker complain about out of range branches within a switch
7987 table.
7988
7989 @item -mjump-in-delay
7990 @opindex mjump-in-delay
7991 Fill delay slots of function calls with unconditional jump instructions
7992 by modifying the return pointer for the function call to be the target
7993 of the conditional jump.
7994
7995 @item -mdisable-fpregs
7996 @opindex mdisable-fpregs
7997 Prevent floating point registers from being used in any manner.  This is
7998 necessary for compiling kernels which perform lazy context switching of
7999 floating point registers.  If you use this option and attempt to perform
8000 floating point operations, the compiler will abort.
8001
8002 @item -mdisable-indexing
8003 @opindex mdisable-indexing
8004 Prevent the compiler from using indexing address modes.  This avoids some
8005 rather obscure problems when compiling MIG generated code under MACH@.
8006
8007 @item -mno-space-regs
8008 @opindex mno-space-regs
8009 Generate code that assumes the target has no space registers.  This allows
8010 GCC to generate faster indirect calls and use unscaled index address modes.
8011
8012 Such code is suitable for level 0 PA systems and kernels.
8013
8014 @item -mfast-indirect-calls
8015 @opindex mfast-indirect-calls
8016 Generate code that assumes calls never cross space boundaries.  This
8017 allows GCC to emit code which performs faster indirect calls.
8018
8019 This option will not work in the presence of shared libraries or nested
8020 functions.
8021
8022 @item -mlong-load-store
8023 @opindex mlong-load-store
8024 Generate 3-instruction load and store sequences as sometimes required by
8025 the HP-UX 10 linker.  This is equivalent to the @samp{+k} option to
8026 the HP compilers.
8027
8028 @item -mportable-runtime
8029 @opindex mportable-runtime
8030 Use the portable calling conventions proposed by HP for ELF systems.
8031
8032 @item -mgas
8033 @opindex mgas
8034 Enable the use of assembler directives only GAS understands.
8035
8036 @item -mschedule=@var{cpu-type}
8037 @opindex mschedule
8038 Schedule code according to the constraints for the machine type
8039 @var{cpu-type}.  The choices for @var{cpu-type} are @samp{700}
8040 @samp{7100}, @samp{7100LC}, @samp{7200}, @samp{7300} and @samp{8000}.  Refer
8041 to @file{/usr/lib/sched.models} on an HP-UX system to determine the
8042 proper scheduling option for your machine.  The default scheduling is
8043 @samp{8000}.
8044
8045 @item -mlinker-opt
8046 @opindex mlinker-opt
8047 Enable the optimization pass in the HP-UX linker.  Note this makes symbolic
8048 debugging impossible.  It also triggers a bug in the HP-UX 8 and HP-UX 9
8049 linkers in which they give bogus error messages when linking some programs.
8050
8051 @item -msoft-float
8052 @opindex msoft-float
8053 Generate output containing library calls for floating point.
8054 @strong{Warning:} the requisite libraries are not available for all HPPA
8055 targets.  Normally the facilities of the machine's usual C compiler are
8056 used, but this cannot be done directly in cross-compilation.  You must make
8057 your own arrangements to provide suitable library functions for
8058 cross-compilation.  The embedded target @samp{hppa1.1-*-pro}
8059 does provide software floating point support.
8060
8061 @option{-msoft-float} changes the calling convention in the output file;
8062 therefore, it is only useful if you compile @emph{all} of a program with
8063 this option.  In particular, you need to compile @file{libgcc.a}, the
8064 library that comes with GCC, with @option{-msoft-float} in order for
8065 this to work.
8066
8067 @item -msio
8068 @opindex msio
8069 Generate the predefine, @code{_SIO}, for server IO.  The default is
8070 @option{-mwsio}.  This generates the predefines, @code{__hp9000s700},
8071 @code{__hp9000s700__} and @code{_WSIO}, for workstation IO.  These
8072 options are available under HP-UX and HI-UX.
8073
8074 @item -mgnu-ld
8075 @opindex gnu-ld
8076 Use GNU ld specific options.  This passes @option{-shared} to ld when
8077 building a shared library.  It is the default when GCC is configured,
8078 explicitly or implicitly, with the GNU linker.  This option does not
8079 have any affect on which ld is called, it only changes what parameters
8080 are passed to that ld.  The ld that is called is determined by the
8081 @option{--with-ld} configure option, gcc's program search path, and
8082 finally by the user's @env{PATH}.  The linker used by GCC can be printed
8083 using @samp{which `gcc -print-prog-name=ld`}.
8084
8085 @item -mhp-ld
8086 @opindex hp-ld
8087 Use HP ld specific options.  This passes @option{-b} to ld when building
8088 a shared library and passes @option{+Accept TypeMismatch} to ld on all
8089 links.  It is the default when GCC is configured, explicitly or
8090 implicitly, with the HP linker.  This option does not have any affect on
8091 which ld is called, it only changes what parameters are passed to that
8092 ld.  The ld that is called is determined by the @option{--with-ld}
8093 configure option, gcc's program search path, and finally by the user's
8094 @env{PATH}.  The linker used by GCC can be printed using @samp{which
8095 `gcc -print-prog-name=ld`}.
8096
8097 @item -mlong-calls
8098 @opindex mno-long-calls
8099 Generate code that uses long call sequences.  This ensures that a call
8100 is always able to reach linker generated stubs.  The default is to generate
8101 long calls only when the distance from the call site to the beginning
8102 of the function or translation unit, as the case may be, exceeds a
8103 predefined limit set by the branch type being used.  The limits for
8104 normal calls are 7,600,000 and 240,000 bytes, respectively for the
8105 PA 2.0 and PA 1.X architectures.  Sibcalls are always limited at
8106 240,000 bytes.
8107
8108 Distances are measured from the beginning of functions when using the
8109 @option{-ffunction-sections} option, or when using the @option{-mgas}
8110 and @option{-mno-portable-runtime} options together under HP-UX with
8111 the SOM linker.
8112
8113 It is normally not desirable to use this option as it will degrade
8114 performance.  However, it may be useful in large applications,
8115 particularly when partial linking is used to build the application.
8116
8117 The types of long calls used depends on the capabilities of the
8118 assembler and linker, and the type of code being generated.  The
8119 impact on systems that support long absolute calls, and long pic
8120 symbol-difference or pc-relative calls should be relatively small.
8121 However, an indirect call is used on 32-bit ELF systems in pic code
8122 and it is quite long.
8123
8124 @end table
8125
8126 @node Intel 960 Options
8127 @subsection Intel 960 Options
8128
8129 These @samp{-m} options are defined for the Intel 960 implementations:
8130
8131 @table @gcctabopt
8132 @item -m@var{cpu-type}
8133 @opindex mka
8134 @opindex mkb
8135 @opindex mmc
8136 @opindex mca
8137 @opindex mcf
8138 @opindex msa
8139 @opindex msb
8140 Assume the defaults for the machine type @var{cpu-type} for some of
8141 the other options, including instruction scheduling, floating point
8142 support, and addressing modes.  The choices for @var{cpu-type} are
8143 @samp{ka}, @samp{kb}, @samp{mc}, @samp{ca}, @samp{cf},
8144 @samp{sa}, and @samp{sb}.
8145 The default is
8146 @samp{kb}.
8147
8148 @item -mnumerics
8149 @itemx -msoft-float
8150 @opindex mnumerics
8151 @opindex msoft-float
8152 The @option{-mnumerics} option indicates that the processor does support
8153 floating-point instructions.  The @option{-msoft-float} option indicates
8154 that floating-point support should not be assumed.
8155
8156 @item -mleaf-procedures
8157 @itemx -mno-leaf-procedures
8158 @opindex mleaf-procedures
8159 @opindex mno-leaf-procedures
8160 Do (or do not) attempt to alter leaf procedures to be callable with the
8161 @code{bal} instruction as well as @code{call}.  This will result in more
8162 efficient code for explicit calls when the @code{bal} instruction can be
8163 substituted by the assembler or linker, but less efficient code in other
8164 cases, such as calls via function pointers, or using a linker that doesn't
8165 support this optimization.
8166
8167 @item -mtail-call
8168 @itemx -mno-tail-call
8169 @opindex mtail-call
8170 @opindex mno-tail-call
8171 Do (or do not) make additional attempts (beyond those of the
8172 machine-independent portions of the compiler) to optimize tail-recursive
8173 calls into branches.  You may not want to do this because the detection of
8174 cases where this is not valid is not totally complete.  The default is
8175 @option{-mno-tail-call}.
8176
8177 @item -mcomplex-addr
8178 @itemx -mno-complex-addr
8179 @opindex mcomplex-addr
8180 @opindex mno-complex-addr
8181 Assume (or do not assume) that the use of a complex addressing mode is a
8182 win on this implementation of the i960.  Complex addressing modes may not
8183 be worthwhile on the K-series, but they definitely are on the C-series.
8184 The default is currently @option{-mcomplex-addr} for all processors except
8185 the CB and CC@.
8186
8187 @item -mcode-align
8188 @itemx -mno-code-align
8189 @opindex mcode-align
8190 @opindex mno-code-align
8191 Align code to 8-byte boundaries for faster fetching (or don't bother).
8192 Currently turned on by default for C-series implementations only.
8193
8194 @ignore
8195 @item -mclean-linkage
8196 @itemx -mno-clean-linkage
8197 @opindex mclean-linkage
8198 @opindex mno-clean-linkage
8199 These options are not fully implemented.
8200 @end ignore
8201
8202 @item -mic-compat
8203 @itemx -mic2.0-compat
8204 @itemx -mic3.0-compat
8205 @opindex mic-compat
8206 @opindex mic2.0-compat
8207 @opindex mic3.0-compat
8208 Enable compatibility with iC960 v2.0 or v3.0.
8209
8210 @item -masm-compat
8211 @itemx -mintel-asm
8212 @opindex masm-compat
8213 @opindex mintel-asm
8214 Enable compatibility with the iC960 assembler.
8215
8216 @item -mstrict-align
8217 @itemx -mno-strict-align
8218 @opindex mstrict-align
8219 @opindex mno-strict-align
8220 Do not permit (do permit) unaligned accesses.
8221
8222 @item -mold-align
8223 @opindex mold-align
8224 Enable structure-alignment compatibility with Intel's gcc release version
8225 1.3 (based on gcc 1.37).  This option implies @option{-mstrict-align}.
8226
8227 @item -mlong-double-64
8228 @opindex mlong-double-64
8229 Implement type @samp{long double} as 64-bit floating point numbers.
8230 Without the option @samp{long double} is implemented by 80-bit
8231 floating point numbers.  The only reason we have it because there is
8232 no 128-bit @samp{long double} support in @samp{fp-bit.c} yet.  So it
8233 is only useful for people using soft-float targets.  Otherwise, we
8234 should recommend against use of it.
8235
8236 @end table
8237
8238 @node DEC Alpha Options
8239 @subsection DEC Alpha Options
8240
8241 These @samp{-m} options are defined for the DEC Alpha implementations:
8242
8243 @table @gcctabopt
8244 @item -mno-soft-float
8245 @itemx -msoft-float
8246 @opindex mno-soft-float
8247 @opindex msoft-float
8248 Use (do not use) the hardware floating-point instructions for
8249 floating-point operations.  When @option{-msoft-float} is specified,
8250 functions in @file{libgcc.a} will be used to perform floating-point
8251 operations.  Unless they are replaced by routines that emulate the
8252 floating-point operations, or compiled in such a way as to call such
8253 emulations routines, these routines will issue floating-point
8254 operations.   If you are compiling for an Alpha without floating-point
8255 operations, you must ensure that the library is built so as not to call
8256 them.
8257
8258 Note that Alpha implementations without floating-point operations are
8259 required to have floating-point registers.
8260
8261 @item -mfp-reg
8262 @itemx -mno-fp-regs
8263 @opindex mfp-reg
8264 @opindex mno-fp-regs
8265 Generate code that uses (does not use) the floating-point register set.
8266 @option{-mno-fp-regs} implies @option{-msoft-float}.  If the floating-point
8267 register set is not used, floating point operands are passed in integer
8268 registers as if they were integers and floating-point results are passed
8269 in @code{$0} instead of @code{$f0}.  This is a non-standard calling sequence,
8270 so any function with a floating-point argument or return value called by code
8271 compiled with @option{-mno-fp-regs} must also be compiled with that
8272 option.
8273
8274 A typical use of this option is building a kernel that does not use,
8275 and hence need not save and restore, any floating-point registers.
8276
8277 @item -mieee
8278 @opindex mieee
8279 The Alpha architecture implements floating-point hardware optimized for
8280 maximum performance.  It is mostly compliant with the IEEE floating
8281 point standard.  However, for full compliance, software assistance is
8282 required.  This option generates code fully IEEE compliant code
8283 @emph{except} that the @var{inexact-flag} is not maintained (see below).
8284 If this option is turned on, the preprocessor macro @code{_IEEE_FP} is
8285 defined during compilation.  The resulting code is less efficient but is
8286 able to correctly support denormalized numbers and exceptional IEEE
8287 values such as not-a-number and plus/minus infinity.  Other Alpha
8288 compilers call this option @option{-ieee_with_no_inexact}.
8289
8290 @item -mieee-with-inexact
8291 @opindex mieee-with-inexact
8292 This is like @option{-mieee} except the generated code also maintains
8293 the IEEE @var{inexact-flag}.  Turning on this option causes the
8294 generated code to implement fully-compliant IEEE math.  In addition to
8295 @code{_IEEE_FP}, @code{_IEEE_FP_EXACT} is defined as a preprocessor
8296 macro.  On some Alpha implementations the resulting code may execute
8297 significantly slower than the code generated by default.  Since there is
8298 very little code that depends on the @var{inexact-flag}, you should
8299 normally not specify this option.  Other Alpha compilers call this
8300 option @option{-ieee_with_inexact}.
8301
8302 @item -mfp-trap-mode=@var{trap-mode}
8303 @opindex mfp-trap-mode
8304 This option controls what floating-point related traps are enabled.
8305 Other Alpha compilers call this option @option{-fptm @var{trap-mode}}.
8306 The trap mode can be set to one of four values:
8307
8308 @table @samp
8309 @item n
8310 This is the default (normal) setting.  The only traps that are enabled
8311 are the ones that cannot be disabled in software (e.g., division by zero
8312 trap).
8313
8314 @item u
8315 In addition to the traps enabled by @samp{n}, underflow traps are enabled
8316 as well.
8317
8318 @item su
8319 Like @samp{su}, but the instructions are marked to be safe for software
8320 completion (see Alpha architecture manual for details).
8321
8322 @item sui
8323 Like @samp{su}, but inexact traps are enabled as well.
8324 @end table
8325
8326 @item -mfp-rounding-mode=@var{rounding-mode}
8327 @opindex mfp-rounding-mode
8328 Selects the IEEE rounding mode.  Other Alpha compilers call this option
8329 @option{-fprm @var{rounding-mode}}.  The @var{rounding-mode} can be one
8330 of:
8331
8332 @table @samp
8333 @item n
8334 Normal IEEE rounding mode.  Floating point numbers are rounded towards
8335 the nearest machine number or towards the even machine number in case
8336 of a tie.
8337
8338 @item m
8339 Round towards minus infinity.
8340
8341 @item c
8342 Chopped rounding mode.  Floating point numbers are rounded towards zero.
8343
8344 @item d
8345 Dynamic rounding mode.  A field in the floating point control register
8346 (@var{fpcr}, see Alpha architecture reference manual) controls the
8347 rounding mode in effect.  The C library initializes this register for
8348 rounding towards plus infinity.  Thus, unless your program modifies the
8349 @var{fpcr}, @samp{d} corresponds to round towards plus infinity.
8350 @end table
8351
8352 @item -mtrap-precision=@var{trap-precision}
8353 @opindex mtrap-precision
8354 In the Alpha architecture, floating point traps are imprecise.  This
8355 means without software assistance it is impossible to recover from a
8356 floating trap and program execution normally needs to be terminated.
8357 GCC can generate code that can assist operating system trap handlers
8358 in determining the exact location that caused a floating point trap.
8359 Depending on the requirements of an application, different levels of
8360 precisions can be selected:
8361
8362 @table @samp
8363 @item p
8364 Program precision.  This option is the default and means a trap handler
8365 can only identify which program caused a floating point exception.
8366
8367 @item f
8368 Function precision.  The trap handler can determine the function that
8369 caused a floating point exception.
8370
8371 @item i
8372 Instruction precision.  The trap handler can determine the exact
8373 instruction that caused a floating point exception.
8374 @end table
8375
8376 Other Alpha compilers provide the equivalent options called
8377 @option{-scope_safe} and @option{-resumption_safe}.
8378
8379 @item -mieee-conformant
8380 @opindex mieee-conformant
8381 This option marks the generated code as IEEE conformant.  You must not
8382 use this option unless you also specify @option{-mtrap-precision=i} and either
8383 @option{-mfp-trap-mode=su} or @option{-mfp-trap-mode=sui}.  Its only effect
8384 is to emit the line @samp{.eflag 48} in the function prologue of the
8385 generated assembly file.  Under DEC Unix, this has the effect that
8386 IEEE-conformant math library routines will be linked in.
8387
8388 @item -mbuild-constants
8389 @opindex mbuild-constants
8390 Normally GCC examines a 32- or 64-bit integer constant to
8391 see if it can construct it from smaller constants in two or three
8392 instructions.  If it cannot, it will output the constant as a literal and
8393 generate code to load it from the data segment at runtime.
8394
8395 Use this option to require GCC to construct @emph{all} integer constants
8396 using code, even if it takes more instructions (the maximum is six).
8397
8398 You would typically use this option to build a shared library dynamic
8399 loader.  Itself a shared library, it must relocate itself in memory
8400 before it can find the variables and constants in its own data segment.
8401
8402 @item -malpha-as
8403 @itemx -mgas
8404 @opindex malpha-as
8405 @opindex mgas
8406 Select whether to generate code to be assembled by the vendor-supplied
8407 assembler (@option{-malpha-as}) or by the GNU assembler @option{-mgas}.
8408
8409 @item -mbwx
8410 @itemx -mno-bwx
8411 @itemx -mcix
8412 @itemx -mno-cix
8413 @itemx -mfix
8414 @itemx -mno-fix
8415 @itemx -mmax
8416 @itemx -mno-max
8417 @opindex mbwx
8418 @opindex mno-bwx
8419 @opindex mcix
8420 @opindex mno-cix
8421 @opindex mfix
8422 @opindex mno-fix
8423 @opindex mmax
8424 @opindex mno-max
8425 Indicate whether GCC should generate code to use the optional BWX,
8426 CIX, FIX and MAX instruction sets.  The default is to use the instruction
8427 sets supported by the CPU type specified via @option{-mcpu=} option or that
8428 of the CPU on which GCC was built if none was specified.
8429
8430 @item -mfloat-vax
8431 @itemx -mfloat-ieee
8432 @opindex mfloat-vax
8433 @opindex mfloat-ieee
8434 Generate code that uses (does not use) VAX F and G floating point
8435 arithmetic instead of IEEE single and double precision.
8436
8437 @item -mexplicit-relocs
8438 @itemx -mno-explicit-relocs
8439 @opindex mexplicit-relocs
8440 @opindex mno-explicit-relocs
8441 Older Alpha assemblers provided no way to generate symbol relocations
8442 except via assembler macros.  Use of these macros does not allow
8443 optimial instruction scheduling.  GNU binutils as of version 2.12
8444 supports a new syntax that allows the compiler to explicitly mark
8445 which relocations should apply to which instructions.  This option
8446 is mostly useful for debugging, as GCC detects the capabilities of
8447 the assembler when it is built and sets the default accordingly.
8448
8449 @item -msmall-data
8450 @itemx -mlarge-data
8451 @opindex msmall-data
8452 @opindex mlarge-data
8453 When @option{-mexplicit-relocs} is in effect, static data is
8454 accessed via @dfn{gp-relative} relocations.  When @option{-msmall-data}
8455 is used, objects 8 bytes long or smaller are placed in a @dfn{small data area}
8456 (the @code{.sdata} and @code{.sbss} sections) and are accessed via
8457 16-bit relocations off of the @code{$gp} register.  This limits the
8458 size of the small data area to 64KB, but allows the variables to be
8459 directly accessed via a single instruction.
8460
8461 The default is @option{-mlarge-data}.  With this option the data area
8462 is limited to just below 2GB.  Programs that require more than 2GB of
8463 data must use @code{malloc} or @code{mmap} to allocate the data in the
8464 heap instead of in the program's data segment.
8465
8466 When generating code for shared libraries, @option{-fpic} implies
8467 @option{-msmall-data} and @option{-fPIC} implies @option{-mlarge-data}.
8468
8469 @item -mcpu=@var{cpu_type}
8470 @opindex mcpu
8471 Set the instruction set and instruction scheduling parameters for
8472 machine type @var{cpu_type}.  You can specify either the @samp{EV}
8473 style name or the corresponding chip number.  GCC supports scheduling
8474 parameters for the EV4, EV5 and EV6 family of processors and will
8475 choose the default values for the instruction set from the processor
8476 you specify.  If you do not specify a processor type, GCC will default
8477 to the processor on which the compiler was built.
8478
8479 Supported values for @var{cpu_type} are
8480
8481 @table @samp
8482 @item ev4
8483 @item ev45
8484 @itemx 21064
8485 Schedules as an EV4 and has no instruction set extensions.
8486
8487 @item ev5
8488 @itemx 21164
8489 Schedules as an EV5 and has no instruction set extensions.
8490
8491 @item ev56
8492 @itemx 21164a
8493 Schedules as an EV5 and supports the BWX extension.
8494
8495 @item pca56
8496 @itemx 21164pc
8497 @itemx 21164PC
8498 Schedules as an EV5 and supports the BWX and MAX extensions.
8499
8500 @item ev6
8501 @itemx 21264
8502 Schedules as an EV6 and supports the BWX, FIX, and MAX extensions.
8503
8504 @item ev67
8505 @item 21264a
8506 Schedules as an EV6 and supports the BWX, CIX, FIX, and MAX extensions.
8507 @end table
8508
8509 @item -mtune=@var{cpu_type}
8510 @opindex mtune
8511 Set only the instruction scheduling parameters for machine type
8512 @var{cpu_type}.  The instruction set is not changed.
8513
8514 @item -mmemory-latency=@var{time}
8515 @opindex mmemory-latency
8516 Sets the latency the scheduler should assume for typical memory
8517 references as seen by the application.  This number is highly
8518 dependent on the memory access patterns used by the application
8519 and the size of the external cache on the machine.
8520
8521 Valid options for @var{time} are
8522
8523 @table @samp
8524 @item @var{number}
8525 A decimal number representing clock cycles.
8526
8527 @item L1
8528 @itemx L2
8529 @itemx L3
8530 @itemx main
8531 The compiler contains estimates of the number of clock cycles for
8532 ``typical'' EV4 & EV5 hardware for the Level 1, 2 & 3 caches
8533 (also called Dcache, Scache, and Bcache), as well as to main memory.
8534 Note that L3 is only valid for EV5.
8535
8536 @end table
8537 @end table
8538
8539 @node DEC Alpha/VMS Options
8540 @subsection DEC Alpha/VMS Options
8541
8542 These @samp{-m} options are defined for the DEC Alpha/VMS implementations:
8543
8544 @table @gcctabopt
8545 @item -mvms-return-codes
8546 @opindex mvms-return-codes
8547 Return VMS condition codes from main.  The default is to return POSIX
8548 style condition (e.g.@ error) codes.
8549 @end table
8550
8551 @node Clipper Options
8552 @subsection Clipper Options
8553
8554 These @samp{-m} options are defined for the Clipper implementations:
8555
8556 @table @gcctabopt
8557 @item -mc300
8558 @opindex mc300
8559 Produce code for a C300 Clipper processor.  This is the default.
8560
8561 @item -mc400
8562 @opindex mc400
8563 Produce code for a C400 Clipper processor, i.e.@: use floating point
8564 registers f8--f15.
8565 @end table
8566
8567 @node H8/300 Options
8568 @subsection H8/300 Options
8569
8570 These @samp{-m} options are defined for the H8/300 implementations:
8571
8572 @table @gcctabopt
8573 @item -mrelax
8574 @opindex mrelax
8575 Shorten some address references at link time, when possible; uses the
8576 linker option @option{-relax}.  @xref{H8/300,, @code{ld} and the H8/300,
8577 ld.info, Using ld}, for a fuller description.
8578
8579 @item -mh
8580 @opindex mh
8581 Generate code for the H8/300H@.
8582
8583 @item -ms
8584 @opindex ms
8585 Generate code for the H8S@.
8586
8587 @item -ms2600
8588 @opindex ms2600
8589 Generate code for the H8S/2600.  This switch must be used with @option{-ms}.
8590
8591 @item -mint32
8592 @opindex mint32
8593 Make @code{int} data 32 bits by default.
8594
8595 @item -malign-300
8596 @opindex malign-300
8597 On the H8/300H and H8S, use the same alignment rules as for the H8/300.
8598 The default for the H8/300H and H8S is to align longs and floats on 4
8599 byte boundaries.
8600 @option{-malign-300} causes them to be aligned on 2 byte boundaries.
8601 This option has no effect on the H8/300.
8602 @end table
8603
8604 @node SH Options
8605 @subsection SH Options
8606
8607 These @samp{-m} options are defined for the SH implementations:
8608
8609 @table @gcctabopt
8610 @item -m1
8611 @opindex m1
8612 Generate code for the SH1.
8613
8614 @item -m2
8615 @opindex m2
8616 Generate code for the SH2.
8617
8618 @item -m3
8619 @opindex m3
8620 Generate code for the SH3.
8621
8622 @item -m3e
8623 @opindex m3e
8624 Generate code for the SH3e.
8625
8626 @item -m4-nofpu
8627 @opindex m4-nofpu
8628 Generate code for the SH4 without a floating-point unit.
8629
8630 @item -m4-single-only
8631 @opindex m4-single-only
8632 Generate code for the SH4 with a floating-point unit that only
8633 supports single-precision arithmetic.
8634
8635 @item -m4-single
8636 @opindex m4-single
8637 Generate code for the SH4 assuming the floating-point unit is in
8638 single-precision mode by default.
8639
8640 @item -m4
8641 @opindex m4
8642 Generate code for the SH4.
8643
8644 @item -mb
8645 @opindex mb
8646 Compile code for the processor in big endian mode.
8647
8648 @item -ml
8649 @opindex ml
8650 Compile code for the processor in little endian mode.
8651
8652 @item -mdalign
8653 @opindex mdalign
8654 Align doubles at 64-bit boundaries.  Note that this changes the calling
8655 conventions, and thus some functions from the standard C library will
8656 not work unless you recompile it first with @option{-mdalign}.
8657
8658 @item -mrelax
8659 @opindex mrelax
8660 Shorten some address references at link time, when possible; uses the
8661 linker option @option{-relax}.
8662
8663 @item -mbigtable
8664 @opindex mbigtable
8665 Use 32-bit offsets in @code{switch} tables.  The default is to use
8666 16-bit offsets.
8667
8668 @item -mfmovd
8669 @opindex mfmovd
8670 Enable the use of the instruction @code{fmovd}.
8671
8672 @item -mhitachi
8673 @opindex mhitachi
8674 Comply with the calling conventions defined by Hitachi.
8675
8676 @item -mnomacsave
8677 @opindex mnomacsave
8678 Mark the @code{MAC} register as call-clobbered, even if
8679 @option{-mhitachi} is given.
8680
8681 @item -mieee
8682 @opindex mieee
8683 Increase IEEE-compliance of floating-point code.
8684
8685 @item -misize
8686 @opindex misize
8687 Dump instruction size and location in the assembly code.
8688
8689 @item -mpadstruct
8690 @opindex mpadstruct
8691 This option is deprecated.  It pads structures to multiple of 4 bytes,
8692 which is incompatible with the SH ABI@.
8693
8694 @item -mspace
8695 @opindex mspace
8696 Optimize for space instead of speed.  Implied by @option{-Os}.
8697
8698 @item -mprefergot
8699 @opindex mprefergot
8700 When generating position-independent code, emit function calls using
8701 the Global Offset Table instead of the Procedure Linkage Table.
8702
8703 @item -musermode
8704 @opindex musermode
8705 Generate a library function call to invalidate instruction cache
8706 entries, after fixing up a trampoline.  This library function call
8707 doesn't assume it can write to the whole memory address space.  This
8708 is the default when the target is @code{sh-*-linux*}.
8709 @end table
8710
8711 @node System V Options
8712 @subsection Options for System V
8713
8714 These additional options are available on System V Release 4 for
8715 compatibility with other compilers on those systems:
8716
8717 @table @gcctabopt
8718 @item -G
8719 @opindex G
8720 Create a shared object.
8721 It is recommended that @option{-symbolic} or @option{-shared} be used instead.
8722
8723 @item -Qy
8724 @opindex Qy
8725 Identify the versions of each tool used by the compiler, in a
8726 @code{.ident} assembler directive in the output.
8727
8728 @item -Qn
8729 @opindex Qn
8730 Refrain from adding @code{.ident} directives to the output file (this is
8731 the default).
8732
8733 @item -YP,@var{dirs}
8734 @opindex YP
8735 Search the directories @var{dirs}, and no others, for libraries
8736 specified with @option{-l}.
8737
8738 @item -Ym,@var{dir}
8739 @opindex Ym
8740 Look in the directory @var{dir} to find the M4 preprocessor.
8741 The assembler uses this option.
8742 @c This is supposed to go with a -Yd for predefined M4 macro files, but
8743 @c the generic assembler that comes with Solaris takes just -Ym.
8744 @end table
8745
8746 @node TMS320C3x/C4x Options
8747 @subsection TMS320C3x/C4x Options
8748 @cindex TMS320C3x/C4x Options
8749
8750 These @samp{-m} options are defined for TMS320C3x/C4x implementations:
8751
8752 @table @gcctabopt
8753
8754 @item -mcpu=@var{cpu_type}
8755 @opindex mcpu
8756 Set the instruction set, register set, and instruction scheduling
8757 parameters for machine type @var{cpu_type}.  Supported values for
8758 @var{cpu_type} are @samp{c30}, @samp{c31}, @samp{c32}, @samp{c40}, and
8759 @samp{c44}.  The default is @samp{c40} to generate code for the
8760 TMS320C40.
8761
8762 @item -mbig-memory
8763 @item -mbig
8764 @itemx -msmall-memory
8765 @itemx -msmall
8766 @opindex mbig-memory
8767 @opindex mbig
8768 @opindex msmall-memory
8769 @opindex msmall
8770 Generates code for the big or small memory model.  The small memory
8771 model assumed that all data fits into one 64K word page.  At run-time
8772 the data page (DP) register must be set to point to the 64K page
8773 containing the .bss and .data program sections.  The big memory model is
8774 the default and requires reloading of the DP register for every direct
8775 memory access.
8776
8777 @item -mbk
8778 @itemx -mno-bk
8779 @opindex mbk
8780 @opindex mno-bk
8781 Allow (disallow) allocation of general integer operands into the block
8782 count register BK@.
8783
8784 @item -mdb
8785 @itemx -mno-db
8786 @opindex mdb
8787 @opindex mno-db
8788 Enable (disable) generation of code using decrement and branch,
8789 DBcond(D), instructions.  This is enabled by default for the C4x.  To be
8790 on the safe side, this is disabled for the C3x, since the maximum
8791 iteration count on the C3x is @math{2^{23} + 1} (but who iterates loops more than
8792 @math{2^{23}} times on the C3x?).  Note that GCC will try to reverse a loop so
8793 that it can utilize the decrement and branch instruction, but will give
8794 up if there is more than one memory reference in the loop.  Thus a loop
8795 where the loop counter is decremented can generate slightly more
8796 efficient code, in cases where the RPTB instruction cannot be utilized.
8797
8798 @item -mdp-isr-reload
8799 @itemx -mparanoid
8800 @opindex mdp-isr-reload
8801 @opindex mparanoid
8802 Force the DP register to be saved on entry to an interrupt service
8803 routine (ISR), reloaded to point to the data section, and restored on
8804 exit from the ISR@.  This should not be required unless someone has
8805 violated the small memory model by modifying the DP register, say within
8806 an object library.
8807
8808 @item -mmpyi
8809 @itemx -mno-mpyi
8810 @opindex mmpyi
8811 @opindex mno-mpyi
8812 For the C3x use the 24-bit MPYI instruction for integer multiplies
8813 instead of a library call to guarantee 32-bit results.  Note that if one
8814 of the operands is a constant, then the multiplication will be performed
8815 using shifts and adds.  If the @option{-mmpyi} option is not specified for the C3x,
8816 then squaring operations are performed inline instead of a library call.
8817
8818 @item -mfast-fix
8819 @itemx -mno-fast-fix
8820 @opindex mfast-fix
8821 @opindex mno-fast-fix
8822 The C3x/C4x FIX instruction to convert a floating point value to an
8823 integer value chooses the nearest integer less than or equal to the
8824 floating point value rather than to the nearest integer.  Thus if the
8825 floating point number is negative, the result will be incorrectly
8826 truncated an additional code is necessary to detect and correct this
8827 case.  This option can be used to disable generation of the additional
8828 code required to correct the result.
8829
8830 @item -mrptb
8831 @itemx -mno-rptb
8832 @opindex mrptb
8833 @opindex mno-rptb
8834 Enable (disable) generation of repeat block sequences using the RPTB
8835 instruction for zero overhead looping.  The RPTB construct is only used
8836 for innermost loops that do not call functions or jump across the loop
8837 boundaries.  There is no advantage having nested RPTB loops due to the
8838 overhead required to save and restore the RC, RS, and RE registers.
8839 This is enabled by default with @option{-O2}.
8840
8841 @item -mrpts=@var{count}
8842 @itemx -mno-rpts
8843 @opindex mrpts
8844 @opindex mno-rpts
8845 Enable (disable) the use of the single instruction repeat instruction
8846 RPTS@.  If a repeat block contains a single instruction, and the loop
8847 count can be guaranteed to be less than the value @var{count}, GCC will
8848 emit a RPTS instruction instead of a RPTB@.  If no value is specified,
8849 then a RPTS will be emitted even if the loop count cannot be determined
8850 at compile time.  Note that the repeated instruction following RPTS does
8851 not have to be reloaded from memory each iteration, thus freeing up the
8852 CPU buses for operands.  However, since interrupts are blocked by this
8853 instruction, it is disabled by default.
8854
8855 @item -mloop-unsigned
8856 @itemx -mno-loop-unsigned
8857 @opindex mloop-unsigned
8858 @opindex mno-loop-unsigned
8859 The maximum iteration count when using RPTS and RPTB (and DB on the C40)
8860 is @math{2^{31} + 1} since these instructions test if the iteration count is
8861 negative to terminate the loop.  If the iteration count is unsigned
8862 there is a possibility than the @math{2^{31} + 1} maximum iteration count may be
8863 exceeded.  This switch allows an unsigned iteration count.
8864
8865 @item -mti
8866 @opindex mti
8867 Try to emit an assembler syntax that the TI assembler (asm30) is happy
8868 with.  This also enforces compatibility with the API employed by the TI
8869 C3x C compiler.  For example, long doubles are passed as structures
8870 rather than in floating point registers.
8871
8872 @item -mregparm
8873 @itemx -mmemparm
8874 @opindex mregparm
8875 @opindex mmemparm
8876 Generate code that uses registers (stack) for passing arguments to functions.
8877 By default, arguments are passed in registers where possible rather
8878 than by pushing arguments on to the stack.
8879
8880 @item -mparallel-insns
8881 @itemx -mno-parallel-insns
8882 @opindex mparallel-insns
8883 @opindex mno-parallel-insns
8884 Allow the generation of parallel instructions.  This is enabled by
8885 default with @option{-O2}.
8886
8887 @item -mparallel-mpy
8888 @itemx -mno-parallel-mpy
8889 @opindex mparallel-mpy
8890 @opindex mno-parallel-mpy
8891 Allow the generation of MPY||ADD and MPY||SUB parallel instructions,
8892 provided @option{-mparallel-insns} is also specified.  These instructions have
8893 tight register constraints which can pessimize the code generation
8894 of large functions.
8895
8896 @end table
8897
8898 @node V850 Options
8899 @subsection V850 Options
8900 @cindex V850 Options
8901
8902 These @samp{-m} options are defined for V850 implementations:
8903
8904 @table @gcctabopt
8905 @item -mlong-calls
8906 @itemx -mno-long-calls
8907 @opindex mlong-calls
8908 @opindex mno-long-calls
8909 Treat all calls as being far away (near).  If calls are assumed to be
8910 far away, the compiler will always load the functions address up into a
8911 register, and call indirect through the pointer.
8912
8913 @item -mno-ep
8914 @itemx -mep
8915 @opindex mno-ep
8916 @opindex mep
8917 Do not optimize (do optimize) basic blocks that use the same index
8918 pointer 4 or more times to copy pointer into the @code{ep} register, and
8919 use the shorter @code{sld} and @code{sst} instructions.  The @option{-mep}
8920 option is on by default if you optimize.
8921
8922 @item -mno-prolog-function
8923 @itemx -mprolog-function
8924 @opindex mno-prolog-function
8925 @opindex mprolog-function
8926 Do not use (do use) external functions to save and restore registers at
8927 the prolog and epilog of a function.  The external functions are slower,
8928 but use less code space if more than one function saves the same number
8929 of registers.  The @option{-mprolog-function} option is on by default if
8930 you optimize.
8931
8932 @item -mspace
8933 @opindex mspace
8934 Try to make the code as small as possible.  At present, this just turns
8935 on the @option{-mep} and @option{-mprolog-function} options.
8936
8937 @item -mtda=@var{n}
8938 @opindex mtda
8939 Put static or global variables whose size is @var{n} bytes or less into
8940 the tiny data area that register @code{ep} points to.  The tiny data
8941 area can hold up to 256 bytes in total (128 bytes for byte references).
8942
8943 @item -msda=@var{n}
8944 @opindex msda
8945 Put static or global variables whose size is @var{n} bytes or less into
8946 the small data area that register @code{gp} points to.  The small data
8947 area can hold up to 64 kilobytes.
8948
8949 @item -mzda=@var{n}
8950 @opindex mzda
8951 Put static or global variables whose size is @var{n} bytes or less into
8952 the first 32 kilobytes of memory.
8953
8954 @item -mv850
8955 @opindex mv850
8956 Specify that the target processor is the V850.
8957
8958 @item -mbig-switch
8959 @opindex mbig-switch
8960 Generate code suitable for big switch tables.  Use this option only if
8961 the assembler/linker complain about out of range branches within a switch
8962 table.
8963
8964 @item -mapp-regs
8965 @opindex -mapp-regs
8966 This option will cause r2 and r5 to be used in the code generated by
8967 the compiler.  This setting is the default.
8968
8969 @item -mno-app-regs
8970 @opindex -mno-app-regs
8971 This option will cause r2 and r5 to be treated as fixed registers.
8972   
8973 @item -mv850e
8974 @opindex -mv850e
8975 Specify that the target processor is the V850E.  The preprocessor
8976 constant @samp{__v850e__} will be defined if this option is used.
8977
8978 If neither @option{-mv850} nor @option{-mv850e} are defined
8979 then a default target processor will be chosen and the relevant
8980 @samp{__v850*__} preprocessor constant will be defined.
8981
8982 The preprocessor constants @samp{__v850} and @samp{__v851__} are always
8983 defined, regardless of which processor variant is the target.
8984
8985 @item -mdisable-callt
8986 @opindex -mdisable-callt
8987 This option will suppress generation of the CALLT instruction for the
8988 v850e flavors of the v850 architecture.  The default is
8989 @option{-mno-disable-callt} which allows the CALLT instruction to be used.
8990
8991 @end table
8992
8993 @node ARC Options
8994 @subsection ARC Options
8995 @cindex ARC Options
8996
8997 These options are defined for ARC implementations:
8998
8999 @table @gcctabopt
9000 @item -EL
9001 @opindex EL
9002 Compile code for little endian mode.  This is the default.
9003
9004 @item -EB
9005 @opindex EB
9006 Compile code for big endian mode.
9007
9008 @item -mmangle-cpu
9009 @opindex mmangle-cpu
9010 Prepend the name of the cpu to all public symbol names.
9011 In multiple-processor systems, there are many ARC variants with different
9012 instruction and register set characteristics.  This flag prevents code
9013 compiled for one cpu to be linked with code compiled for another.
9014 No facility exists for handling variants that are ``almost identical''.
9015 This is an all or nothing option.
9016
9017 @item -mcpu=@var{cpu}
9018 @opindex mcpu
9019 Compile code for ARC variant @var{cpu}.
9020 Which variants are supported depend on the configuration.
9021 All variants support @option{-mcpu=base}, this is the default.
9022
9023 @item -mtext=@var{text-section}
9024 @itemx -mdata=@var{data-section}
9025 @itemx -mrodata=@var{readonly-data-section}
9026 @opindex mtext
9027 @opindex mdata
9028 @opindex mrodata
9029 Put functions, data, and readonly data in @var{text-section},
9030 @var{data-section}, and @var{readonly-data-section} respectively
9031 by default.  This can be overridden with the @code{section} attribute.
9032 @xref{Variable Attributes}.
9033
9034 @end table
9035
9036 @node NS32K Options
9037 @subsection NS32K Options
9038 @cindex NS32K options
9039
9040 These are the @samp{-m} options defined for the 32000 series.  The default
9041 values for these options depends on which style of 32000 was selected when
9042 the compiler was configured; the defaults for the most common choices are
9043 given below.
9044
9045 @table @gcctabopt
9046 @item -m32032
9047 @itemx -m32032
9048 @opindex m32032
9049 @opindex m32032
9050 Generate output for a 32032.  This is the default
9051 when the compiler is configured for 32032 and 32016 based systems.
9052
9053 @item -m32332
9054 @itemx -m32332
9055 @opindex m32332
9056 @opindex m32332
9057 Generate output for a 32332.  This is the default
9058 when the compiler is configured for 32332-based systems.
9059
9060 @item -m32532
9061 @itemx -m32532
9062 @opindex m32532
9063 @opindex m32532
9064 Generate output for a 32532.  This is the default
9065 when the compiler is configured for 32532-based systems.
9066
9067 @item -m32081
9068 @opindex m32081
9069 Generate output containing 32081 instructions for floating point.
9070 This is the default for all systems.
9071
9072 @item -m32381
9073 @opindex m32381
9074 Generate output containing 32381 instructions for floating point.  This
9075 also implies @option{-m32081}.  The 32381 is only compatible with the 32332
9076 and 32532 cpus.  This is the default for the pc532-netbsd configuration.
9077
9078 @item -mmulti-add
9079 @opindex mmulti-add
9080 Try and generate multiply-add floating point instructions @code{polyF}
9081 and @code{dotF}.  This option is only available if the @option{-m32381}
9082 option is in effect.  Using these instructions requires changes to
9083 register allocation which generally has a negative impact on
9084 performance.  This option should only be enabled when compiling code
9085 particularly likely to make heavy use of multiply-add instructions.
9086
9087 @item -mnomulti-add
9088 @opindex mnomulti-add
9089 Do not try and generate multiply-add floating point instructions
9090 @code{polyF} and @code{dotF}.  This is the default on all platforms.
9091
9092 @item -msoft-float
9093 @opindex msoft-float
9094 Generate output containing library calls for floating point.
9095 @strong{Warning:} the requisite libraries may not be available.
9096
9097 @item -mieee-compare
9098 @itemx -mno-ieee-compare
9099 @opindex mieee-compare
9100 @opindex mno-ieee-compare
9101 Control whether or not the compiler uses IEEE floating point
9102 comparisons.  These handle correctly the case where the result of a
9103 comparison is unordered.
9104 @strong{Warning:} the requisite kernel support may not be available.
9105
9106 @item -mnobitfield
9107 @opindex mnobitfield
9108 Do not use the bit-field instructions.  On some machines it is faster to
9109 use shifting and masking operations.  This is the default for the pc532.
9110
9111 @item -mbitfield
9112 @opindex mbitfield
9113 Do use the bit-field instructions.  This is the default for all platforms
9114 except the pc532.
9115
9116 @item -mrtd
9117 @opindex mrtd
9118 Use a different function-calling convention, in which functions
9119 that take a fixed number of arguments return pop their
9120 arguments on return with the @code{ret} instruction.
9121
9122 This calling convention is incompatible with the one normally
9123 used on Unix, so you cannot use it if you need to call libraries
9124 compiled with the Unix compiler.
9125
9126 Also, you must provide function prototypes for all functions that
9127 take variable numbers of arguments (including @code{printf});
9128 otherwise incorrect code will be generated for calls to those
9129 functions.
9130
9131 In addition, seriously incorrect code will result if you call a
9132 function with too many arguments.  (Normally, extra arguments are
9133 harmlessly ignored.)
9134
9135 This option takes its name from the 680x0 @code{rtd} instruction.
9136
9137
9138 @item -mregparam
9139 @opindex mregparam
9140 Use a different function-calling convention where the first two arguments
9141 are passed in registers.
9142
9143 This calling convention is incompatible with the one normally
9144 used on Unix, so you cannot use it if you need to call libraries
9145 compiled with the Unix compiler.
9146
9147 @item -mnoregparam
9148 @opindex mnoregparam
9149 Do not pass any arguments in registers.  This is the default for all
9150 targets.
9151
9152 @item -msb
9153 @opindex msb
9154 It is OK to use the sb as an index register which is always loaded with
9155 zero.  This is the default for the pc532-netbsd target.
9156
9157 @item -mnosb
9158 @opindex mnosb
9159 The sb register is not available for use or has not been initialized to
9160 zero by the run time system.  This is the default for all targets except
9161 the pc532-netbsd.  It is also implied whenever @option{-mhimem} or
9162 @option{-fpic} is set.
9163
9164 @item -mhimem
9165 @opindex mhimem
9166 Many ns32000 series addressing modes use displacements of up to 512MB@.
9167 If an address is above 512MB then displacements from zero can not be used.
9168 This option causes code to be generated which can be loaded above 512MB@.
9169 This may be useful for operating systems or ROM code.
9170
9171 @item -mnohimem
9172 @opindex mnohimem
9173 Assume code will be loaded in the first 512MB of virtual address space.
9174 This is the default for all platforms.
9175
9176
9177 @end table
9178
9179 @node AVR Options
9180 @subsection AVR Options
9181 @cindex AVR Options
9182
9183 These options are defined for AVR implementations:
9184
9185 @table @gcctabopt
9186 @item -mmcu=@var{mcu}
9187 @opindex mmcu
9188 Specify ATMEL AVR instruction set or MCU type.
9189
9190 Instruction set avr1 is for the minimal AVR core, not supported by the C
9191 compiler, only for assembler programs (MCU types: at90s1200, attiny10,
9192 attiny11, attiny12, attiny15, attiny28).
9193
9194 Instruction set avr2 (default) is for the classic AVR core with up to
9195 8K program memory space (MCU types: at90s2313, at90s2323, attiny22,
9196 at90s2333, at90s2343, at90s4414, at90s4433, at90s4434, at90s8515,
9197 at90c8534, at90s8535).
9198
9199 Instruction set avr3 is for the classic AVR core with up to 128K program
9200 memory space (MCU types: atmega103, atmega603, at43usb320, at76c711).
9201
9202 Instruction set avr4 is for the enhanced AVR core with up to 8K program
9203 memory space (MCU types: atmega8, atmega83, atmega85).
9204
9205 Instruction set avr5 is for the enhanced AVR core with up to 128K program
9206 memory space (MCU types: atmega16, atmega161, atmega163, atmega32, atmega323,
9207 atmega64, atmega128, at43usb355, at94k).
9208
9209 @item -msize
9210 @opindex msize
9211 Output instruction sizes to the asm file.
9212
9213 @item -minit-stack=@var{N}
9214 @opindex minit-stack
9215 Specify the initial stack address, which may be a symbol or numeric value,
9216 @samp{__stack} is the default.
9217
9218 @item -mno-interrupts
9219 @opindex mno-interrupts
9220 Generated code is not compatible with hardware interrupts.
9221 Code size will be smaller.
9222
9223 @item -mcall-prologues
9224 @opindex mcall-prologues
9225 Functions prologues/epilogues expanded as call to appropriate
9226 subroutines.  Code size will be smaller.
9227
9228 @item -mno-tablejump
9229 @opindex mno-tablejump
9230 Do not generate tablejump insns which sometimes increase code size.
9231
9232 @item -mtiny-stack
9233 @opindex mtiny-stack
9234 Change only the low 8 bits of the stack pointer.
9235 @end table
9236
9237 @node MCore Options
9238 @subsection MCore Options
9239 @cindex MCore options
9240
9241 These are the @samp{-m} options defined for the Motorola M*Core
9242 processors.
9243
9244 @table @gcctabopt
9245
9246 @item -mhardlit
9247 @itemx -mhardlit
9248 @itemx -mno-hardlit
9249 @opindex mhardlit
9250 @opindex mhardlit
9251 @opindex mno-hardlit
9252 Inline constants into the code stream if it can be done in two
9253 instructions or less.
9254
9255 @item -mdiv
9256 @itemx -mdiv
9257 @itemx -mno-div
9258 @opindex mdiv
9259 @opindex mdiv
9260 @opindex mno-div
9261 Use the divide instruction.  (Enabled by default).
9262
9263 @item -mrelax-immediate
9264 @itemx -mrelax-immediate
9265 @itemx -mno-relax-immediate
9266 @opindex mrelax-immediate
9267 @opindex mrelax-immediate
9268 @opindex mno-relax-immediate
9269 Allow arbitrary sized immediates in bit operations.
9270
9271 @item -mwide-bitfields
9272 @itemx -mwide-bitfields
9273 @itemx -mno-wide-bitfields
9274 @opindex mwide-bitfields
9275 @opindex mwide-bitfields
9276 @opindex mno-wide-bitfields
9277 Always treat bit-fields as int-sized.
9278
9279 @item -m4byte-functions
9280 @itemx -m4byte-functions
9281 @itemx -mno-4byte-functions
9282 @opindex m4byte-functions
9283 @opindex m4byte-functions
9284 @opindex mno-4byte-functions
9285 Force all functions to be aligned to a four byte boundary.
9286
9287 @item -mcallgraph-data
9288 @itemx -mcallgraph-data
9289 @itemx -mno-callgraph-data
9290 @opindex mcallgraph-data
9291 @opindex mcallgraph-data
9292 @opindex mno-callgraph-data
9293 Emit callgraph information.
9294
9295 @item -mslow-bytes
9296 @itemx -mslow-bytes
9297 @itemx -mno-slow-bytes
9298 @opindex mslow-bytes
9299 @opindex mslow-bytes
9300 @opindex mno-slow-bytes
9301 Prefer word access when reading byte quantities.
9302
9303 @item -mlittle-endian
9304 @itemx -mlittle-endian
9305 @itemx -mbig-endian
9306 @opindex mlittle-endian
9307 @opindex mlittle-endian
9308 @opindex mbig-endian
9309 Generate code for a little endian target.
9310
9311 @item -m210
9312 @itemx -m210
9313 @itemx -m340
9314 @opindex m210
9315 @opindex m210
9316 @opindex m340
9317 Generate code for the 210 processor.
9318 @end table
9319
9320 @node IA-64 Options
9321 @subsection IA-64 Options
9322 @cindex IA-64 Options
9323
9324 These are the @samp{-m} options defined for the Intel IA-64 architecture.
9325
9326 @table @gcctabopt
9327 @item -mbig-endian
9328 @opindex mbig-endian
9329 Generate code for a big endian target.  This is the default for HP-UX@.
9330
9331 @item -mlittle-endian
9332 @opindex mlittle-endian
9333 Generate code for a little endian target.  This is the default for AIX5
9334 and Linux.
9335
9336 @item -mgnu-as
9337 @itemx -mno-gnu-as
9338 @opindex mgnu-as
9339 @opindex mno-gnu-as
9340 Generate (or don't) code for the GNU assembler.  This is the default.
9341 @c Also, this is the default if the configure option @option{--with-gnu-as}
9342 @c is used.
9343
9344 @item -mgnu-ld
9345 @itemx -mno-gnu-ld
9346 @opindex mgnu-ld
9347 @opindex mno-gnu-ld
9348 Generate (or don't) code for the GNU linker.  This is the default.
9349 @c Also, this is the default if the configure option @option{--with-gnu-ld}
9350 @c is used.
9351
9352 @item -mno-pic
9353 @opindex mno-pic
9354 Generate code that does not use a global pointer register.  The result
9355 is not position independent code, and violates the IA-64 ABI@.
9356
9357 @item -mvolatile-asm-stop
9358 @itemx -mno-volatile-asm-stop
9359 @opindex mvolatile-asm-stop
9360 @opindex mno-volatile-asm-stop
9361 Generate (or don't) a stop bit immediately before and after volatile asm
9362 statements.
9363
9364 @item -mb-step
9365 @opindex mb-step
9366 Generate code that works around Itanium B step errata.
9367
9368 @item -mregister-names
9369 @itemx -mno-register-names
9370 @opindex mregister-names
9371 @opindex mno-register-names
9372 Generate (or don't) @samp{in}, @samp{loc}, and @samp{out} register names for
9373 the stacked registers.  This may make assembler output more readable.
9374
9375 @item -mno-sdata
9376 @itemx -msdata
9377 @opindex mno-sdata
9378 @opindex msdata
9379 Disable (or enable) optimizations that use the small data section.  This may
9380 be useful for working around optimizer bugs.
9381
9382 @item -mconstant-gp
9383 @opindex mconstant-gp
9384 Generate code that uses a single constant global pointer value.  This is
9385 useful when compiling kernel code.
9386
9387 @item -mauto-pic
9388 @opindex mauto-pic
9389 Generate code that is self-relocatable.  This implies @option{-mconstant-gp}.
9390 This is useful when compiling firmware code.
9391
9392 @item -minline-divide-min-latency
9393 @opindex minline-divide-min-latency
9394 Generate code for inline divides using the minimum latency algorithm.
9395
9396 @item -minline-divide-max-throughput
9397 @opindex minline-divide-max-throughput
9398 Generate code for inline divides using the maximum throughput algorithm.
9399
9400 @item -mno-dwarf2-asm
9401 @itemx -mdwarf2-asm
9402 @opindex mno-dwarf2-asm
9403 @opindex mdwarf2-asm
9404 Don't (or do) generate assembler code for the DWARF2 line number debugging
9405 info.  This may be useful when not using the GNU assembler.
9406
9407 @item -mfixed-range=@var{register-range}
9408 @opindex mfixed-range
9409 Generate code treating the given register range as fixed registers.
9410 A fixed register is one that the register allocator can not use.  This is
9411 useful when compiling kernel code.  A register range is specified as
9412 two registers separated by a dash.  Multiple register ranges can be
9413 specified separated by a comma.
9414 @end table
9415
9416 @node D30V Options
9417 @subsection D30V Options
9418 @cindex D30V Options
9419
9420 These @samp{-m} options are defined for D30V implementations:
9421
9422 @table @gcctabopt
9423 @item -mextmem
9424 @opindex mextmem
9425 Link the @samp{.text}, @samp{.data}, @samp{.bss}, @samp{.strings},
9426 @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections into external
9427 memory, which starts at location @code{0x80000000}.
9428
9429 @item -mextmemory
9430 @opindex mextmemory
9431 Same as the @option{-mextmem} switch.
9432
9433 @item -monchip
9434 @opindex monchip
9435 Link the @samp{.text} section into onchip text memory, which starts at
9436 location @code{0x0}.  Also link @samp{.data}, @samp{.bss},
9437 @samp{.strings}, @samp{.rodata}, @samp{.rodata1}, @samp{.data1} sections
9438 into onchip data memory, which starts at location @code{0x20000000}.
9439
9440 @item -mno-asm-optimize
9441 @itemx -masm-optimize
9442 @opindex mno-asm-optimize
9443 @opindex masm-optimize
9444 Disable (enable) passing @option{-O} to the assembler when optimizing.
9445 The assembler uses the @option{-O} option to automatically parallelize
9446 adjacent short instructions where possible.
9447
9448 @item -mbranch-cost=@var{n}
9449 @opindex mbranch-cost
9450 Increase the internal costs of branches to @var{n}.  Higher costs means
9451 that the compiler will issue more instructions to avoid doing a branch.
9452 The default is 2.
9453
9454 @item -mcond-exec=@var{n}
9455 @opindex mcond-exec
9456 Specify the maximum number of conditionally executed instructions that
9457 replace a branch.  The default is 4.
9458 @end table
9459
9460 @node S/390 and zSeries Options
9461 @subsection S/390 and zSeries Options
9462 @cindex S/390 and zSeries Options
9463
9464 These are the @samp{-m} options defined for the S/390 and zSeries architecture.
9465
9466 @table @gcctabopt
9467 @item -mhard-float
9468 @itemx -msoft-float
9469 @opindex mhard-float
9470 @opindex msoft-float
9471 Use (do not use) the hardware floating-point instructions and registers
9472 for floating-point operations.  When @option{-msoft-float} is specified,
9473 functions in @file{libgcc.a} will be used to perform floating-point
9474 operations.  When @option{-mhard-float} is specified, the compiler
9475 generates IEEE floating-point instructions.  This is the default.
9476
9477 @item -mbackchain
9478 @itemx -mno-backchain
9479 @opindex mbackchain
9480 @opindex mno-backchain
9481 Generate (or do not generate) code which maintains an explicit
9482 backchain within the stack frame that points to the caller's frame.
9483 This is currently needed to allow debugging.  The default is to
9484 generate the backchain.
9485
9486 @item -msmall-exec
9487 @itemx -mno-small-exec
9488 @opindex msmall-exec
9489 @opindex mno-small-exec
9490 Generate (or do not generate) code using the @code{bras} instruction
9491 to do subroutine calls.
9492 This only works reliably if the total executable size does not
9493 exceed 64k.  The default is to use the @code{basr} instruction instead,
9494 which does not have this limitation.
9495
9496 @item -m64
9497 @itemx -m31
9498 @opindex m64
9499 @opindex m31
9500 When @option{-m31} is specified, generate code compliant to the
9501 Linux for S/390 ABI@.  When @option{-m64} is specified, generate
9502 code compliant to the Linux for zSeries ABI@.  This allows GCC in
9503 particular to generate 64-bit instructions.  For the @samp{s390}
9504 targets, the default is @option{-m31}, while the @samp{s390x}
9505 targets default to @option{-m64}.
9506
9507 @item -mmvcle
9508 @itemx -mno-mvcle
9509 @opindex mmvcle
9510 @opindex mno-mvcle
9511 Generate (or do not generate) code using the @code{mvcle} instruction
9512 to perform block moves.  When @option{-mno-mvcle} is specifed,
9513 use a @code{mvc} loop instead.  This is the default.
9514
9515 @item -mdebug
9516 @itemx -mno-debug
9517 @opindex mdebug
9518 @opindex mno-debug
9519 Print (or do not print) additional debug information when compiling.
9520 The default is to not print debug information.
9521
9522 @end table
9523
9524 @node CRIS Options
9525 @subsection CRIS Options
9526 @cindex CRIS Options
9527
9528 These options are defined specifically for the CRIS ports.
9529
9530 @table @gcctabopt
9531 @item -march=@var{architecture-type}
9532 @itemx -mcpu=@var{architecture-type}
9533 @opindex march
9534 @opindex mcpu
9535 Generate code for the specified architecture.  The choices for
9536 @var{architecture-type} are @samp{v3}, @samp{v8} and @samp{v10} for
9537 respectively ETRAX@w{ }4, ETRAX@w{ }100, and ETRAX@w{ }100@w{ }LX.
9538 Default is @samp{v0} except for cris-axis-linux-gnu, where the default is
9539 @samp{v10}.
9540
9541 @item -mtune=@var{architecture-type}
9542 @opindex mtune
9543 Tune to @var{architecture-type} everything applicable about the generated
9544 code, except for the ABI and the set of available instructions.  The
9545 choices for @var{architecture-type} are the same as for
9546 @option{-march=@var{architecture-type}}.
9547
9548 @item -mmax-stack-frame=@var{n}
9549 @opindex mmax-stack-frame
9550 Warn when the stack frame of a function exceeds @var{n} bytes.
9551
9552 @item -melinux-stacksize=@var{n}
9553 @opindex melinux-stacksize
9554 Only available with the @samp{cris-axis-aout} target.  Arranges for
9555 indications in the program to the kernel loader that the stack of the
9556 program should be set to @var{n} bytes.
9557
9558 @item -metrax4
9559 @itemx -metrax100
9560 @opindex metrax4
9561 @opindex metrax100
9562 The options @option{-metrax4} and @option{-metrax100} are synonyms for
9563 @option{-march=v3} and @option{-march=v8} respectively.
9564
9565 @item -mpdebug
9566 @opindex mpdebug
9567 Enable CRIS-specific verbose debug-related information in the assembly
9568 code.  This option also has the effect to turn off the @samp{#NO_APP}
9569 formatted-code indicator to the assembler at the beginning of the
9570 assembly file.
9571
9572 @item -mcc-init
9573 @opindex mcc-init
9574 Do not use condition-code results from previous instruction; always emit
9575 compare and test instructions before use of condition codes.
9576
9577 @item -mno-side-effects
9578 @opindex mno-side-effects
9579 Do not emit instructions with side-effects in addressing modes other than
9580 post-increment.
9581
9582 @item -mstack-align
9583 @itemx -mno-stack-align
9584 @itemx -mdata-align
9585 @itemx -mno-data-align
9586 @itemx -mconst-align
9587 @itemx -mno-const-align
9588 @opindex mstack-align
9589 @opindex mno-stack-align
9590 @opindex mdata-align
9591 @opindex mno-data-align
9592 @opindex mconst-align
9593 @opindex mno-const-align
9594 These options (no-options) arranges (eliminate arrangements) for the
9595 stack-frame, individual data and constants to be aligned for the maximum
9596 single data access size for the chosen CPU model.  The default is to
9597 arrange for 32-bit alignment.  ABI details such as structure layout are
9598 not affected by these options.
9599
9600 @item -m32-bit
9601 @itemx -m16-bit
9602 @itemx -m8-bit
9603 @opindex m32-bit
9604 @opindex m16-bit
9605 @opindex m8-bit
9606 Similar to the stack- data- and const-align options above, these options
9607 arrange for stack-frame, writable data and constants to all be 32-bit,
9608 16-bit or 8-bit aligned.  The default is 32-bit alignment.
9609
9610 @item -mno-prologue-epilogue
9611 @itemx -mprologue-epilogue
9612 @opindex mno-prologue-epilogue
9613 @opindex mprologue-epilogue
9614 With @option{-mno-prologue-epilogue}, the normal function prologue and
9615 epilogue that sets up the stack-frame are omitted and no return
9616 instructions or return sequences are generated in the code.  Use this
9617 option only together with visual inspection of the compiled code: no
9618 warnings or errors are generated when call-saved registers must be saved,
9619 or storage for local variable needs to be allocated.
9620
9621 @item -mno-gotplt
9622 @itemx -mgotplt
9623 @opindex mno-gotplt
9624 @opindex mgotplt
9625 With @option{-fpic} and @option{-fPIC}, don't generate (do generate)
9626 instruction sequences that load addresses for functions from the PLT part
9627 of the GOT rather than (traditional on other architectures) calls to the
9628 PLT.  The default is @option{-mgotplt}.
9629
9630 @item -maout
9631 @opindex maout
9632 Legacy no-op option only recognized with the cris-axis-aout target.
9633
9634 @item -melf
9635 @opindex melf
9636 Legacy no-op option only recognized with the cris-axis-elf and
9637 cris-axis-linux-gnu targets.
9638
9639 @item -melinux
9640 @opindex melinux
9641 Only recognized with the cris-axis-aout target, where it selects a
9642 GNU/linux-like multilib, include files and instruction set for
9643 @option{-march=v8}.
9644
9645 @item -mlinux
9646 @opindex mlinux
9647 Legacy no-op option only recognized with the cris-axis-linux-gnu target.
9648
9649 @item -sim
9650 @opindex sim
9651 This option, recognized for the cris-axis-aout and cris-axis-elf arranges
9652 to link with input-output functions from a simulator library.  Code,
9653 initialized data and zero-initialized data are allocated consecutively.
9654
9655 @item -sim2
9656 @opindex sim2
9657 Like @option{-sim}, but pass linker options to locate initialized data at
9658 0x40000000 and zero-initialized data at 0x80000000.
9659 @end table
9660
9661 @node MMIX Options
9662 @subsection MMIX Options
9663 @cindex MMIX Options
9664
9665 These options are defined for the MMIX:
9666
9667 @table @gcctabopt
9668 @item -mlibfuncs
9669 @itemx -mno-libfuncs
9670 @opindex mlibfuncs
9671 @opindex mno-libfuncs
9672 Specify that intrinsic library functions are being compiled, passing all
9673 values in registers, no matter the size.
9674
9675 @item -mepsilon
9676 @itemx -mno-epsilon
9677 @opindex mepsilon
9678 @opindex mno-epsilon
9679 Generate floating-point comparison instructions that compare with respect
9680 to the @code{rE} epsilon register.
9681
9682 @item -mabi=mmixware
9683 @itemx -mabi=gnu
9684 @opindex mabi-mmixware
9685 @opindex mabi=gnu
9686 Generate code that passes function parameters and return values that (in
9687 the called function) are seen as registers @code{$0} and up, as opposed to
9688 the GNU ABI which uses global registers @code{$231} and up.
9689
9690 @item -mzero-extend
9691 @itemx -mno-zero-extend
9692 @opindex mzero-extend
9693 @opindex mno-zero-extend
9694 When reading data from memory in sizes shorter than 64 bits, use (do not
9695 use) zero-extending load instructions by default, rather than
9696 sign-extending ones.
9697
9698 @item -mknuthdiv
9699 @itemx -mno-knuthdiv
9700 @opindex mknuthdiv
9701 @opindex mno-knuthdiv
9702 Make the result of a division yielding a remainder have the same sign as
9703 the divisor.  With the default, @option{-mno-knuthdiv}, the sign of the
9704 remainder follows the sign of the dividend.  Both methods are
9705 arithmetically valid, the latter being almost exclusively used.
9706
9707 @item -mtoplevel-symbols
9708 @itemx -mno-toplevel-symbols
9709 @opindex mtoplevel-symbols
9710 @opindex mno-toplevel-symbols
9711 Prepend (do not prepend) a @samp{:} to all global symbols, so the assembly
9712 code can be used with the @code{PREFIX} assembly directive.
9713
9714 @item -melf
9715 @opindex melf
9716 Generate an executable in the ELF format, rather than the default
9717 @samp{mmo} format used by the @command{mmix} simulator.
9718
9719 @item -mbranch-predict
9720 @itemx -mno-branch-predict
9721 @opindex mbranch-predict
9722 @opindex mno-branch-predict
9723 Use (do not use) the probable-branch instructions, when static branch
9724 prediction indicates a probable branch.
9725
9726 @item -mbase-addresses
9727 @itemx -mno-base-addresses
9728 @opindex mbase-addresses
9729 @opindex mno-base-addresses
9730 Generate (do not generate) code that uses @emph{base addresses}.  Using a
9731 base address automatically generates a request (handled by the assembler
9732 and the linker) for a constant to be set up in a global register.  The
9733 register is used for one or more base address requests within the range 0
9734 to 255 from the value held in the register.  The generally leads to short
9735 and fast code, but the number of different data items that can be
9736 addressed is limited.  This means that a program that uses lots of static
9737 data may require @option{-mno-base-addresses}.
9738
9739 @item -msingle-exit
9740 @itemx -mno-single-exit
9741 @opindex msingle-exit
9742 @opindex mno-single-exit
9743 Force (do not force) generated code to have a single exit point in each
9744 function.
9745 @end table
9746
9747 @node PDP-11 Options
9748 @subsection PDP-11 Options
9749 @cindex PDP-11 Options
9750
9751 These options are defined for the PDP-11:
9752
9753 @table @gcctabopt
9754 @item -mfpu
9755 @opindex mfpu
9756 Use hardware FPP floating point.  This is the default.  (FIS floating
9757 point on the PDP-11/40 is not supported.)
9758
9759 @item -msoft-float
9760 @opindex msoft-float
9761 Do not use hardware floating point.
9762
9763 @item -mac0
9764 @opindex mac0
9765 Return floating-point results in ac0 (fr0 in Unix assembler syntax).
9766
9767 @item -mno-ac0
9768 @opindex mno-ac0
9769 Return floating-point results in memory.  This is the default.
9770
9771 @item -m40
9772 @opindex m40
9773 Generate code for a PDP-11/40.
9774
9775 @item -m45
9776 @opindex m45
9777 Generate code for a PDP-11/45.  This is the default.
9778
9779 @item -m10
9780 @opindex m10
9781 Generate code for a PDP-11/10.
9782
9783 @item -mbcopy-builtin
9784 @opindex bcopy-builtin
9785 Use inline @code{movstrhi} patterns for copying memory.  This is the
9786 default.
9787
9788 @item -mbcopy
9789 @opindex mbcopy
9790 Do not use inline @code{movstrhi} patterns for copying memory.
9791
9792 @item -mint16
9793 @itemx -mno-int32
9794 @opindex mint16
9795 @opindex mno-int32
9796 Use 16-bit @code{int}.  This is the default.
9797
9798 @item -mint32
9799 @itemx -mno-int16
9800 @opindex mint32
9801 @opindex mno-int16
9802 Use 32-bit @code{int}.
9803
9804 @item -mfloat64
9805 @itemx -mno-float32
9806 @opindex mfloat64
9807 @opindex mno-float32
9808 Use 64-bit @code{float}.  This is the default.
9809
9810 @item -mfloat32
9811 @item -mno-float64
9812 @opindex mfloat32
9813 @opindex mno-float64
9814 Use 32-bit @code{float}.
9815
9816 @item -mabshi
9817 @opindex mabshi
9818 Use @code{abshi2} pattern.  This is the default.
9819
9820 @item -mno-abshi
9821 @opindex mno-abshi
9822 Do not use @code{abshi2} pattern.
9823
9824 @item -mbranch-expensive
9825 @opindex mbranch-expensive
9826 Pretend that branches are expensive.  This is for experimenting with
9827 code generation only.
9828
9829 @item -mbranch-cheap
9830 @opindex mbranch-cheap
9831 Do not pretend that branches are expensive.  This is the default.
9832
9833 @item -msplit
9834 @opindex msplit
9835 Generate code for a system with split I&D.
9836
9837 @item -mno-split
9838 @opindex mno-split
9839 Generate code for a system without split I&D.  This is the default.
9840
9841 @item -munix-asm
9842 @opindex munix-asm
9843 Use Unix assembler syntax.  This is the default when configured for
9844 @samp{pdp11-*-bsd}.
9845
9846 @item -mdec-asm
9847 @opindex mdec-asm
9848 Use DEC assembler syntax.  This is the default when configured for any
9849 PDP-11 target other than @samp{pdp11-*-bsd}.
9850 @end table
9851
9852 @node Xstormy16 Options
9853 @subsection Xstormy16 Options
9854 @cindex Xstormy16 Options
9855
9856 These options are defined for Xstormy16:
9857
9858 @table @gcctabopt
9859 @item -msim
9860 @opindex msim
9861 Choose startup files and linker script suitable for the simulator.
9862 @end table
9863
9864 @node Xtensa Options
9865 @subsection Xtensa Options
9866 @cindex Xtensa Options
9867
9868 The Xtensa architecture is designed to support many different
9869 configurations.  The compiler's default options can be set to match a
9870 particular Xtensa configuration by copying a configuration file into the
9871 GCC sources when building GCC@.  The options below may be used to
9872 override the default options.
9873
9874 @table @gcctabopt
9875 @item -mbig-endian
9876 @itemx -mlittle-endian
9877 @opindex mbig-endian
9878 @opindex mlittle-endian
9879 Specify big-endian or little-endian byte ordering for the target Xtensa
9880 processor.
9881
9882 @item -mdensity
9883 @itemx -mno-density
9884 @opindex mdensity
9885 @opindex mno-density
9886 Enable or disable use of the optional Xtensa code density instructions.
9887
9888 @item -mmac16
9889 @itemx -mno-mac16
9890 @opindex mmac16
9891 @opindex mno-mac16
9892 Enable or disable use of the Xtensa MAC16 option.  When enabled, GCC
9893 will generate MAC16 instructions from standard C code, with the
9894 limitation that it will use neither the MR register file nor any
9895 instruction that operates on the MR registers.  When this option is
9896 disabled, GCC will translate 16-bit multiply/accumulate operations to a
9897 combination of core instructions and library calls, depending on whether
9898 any other multiplier options are enabled.
9899
9900 @item -mmul16
9901 @itemx -mno-mul16
9902 @opindex mmul16
9903 @opindex mno-mul16
9904 Enable or disable use of the 16-bit integer multiplier option.  When
9905 enabled, the compiler will generate 16-bit multiply instructions for
9906 multiplications of 16 bits or smaller in standard C code.  When this
9907 option is disabled, the compiler will either use 32-bit multiply or
9908 MAC16 instructions if they are available or generate library calls to
9909 perform the multiply operations using shifts and adds.
9910
9911 @item -mmul32
9912 @itemx -mno-mul32
9913 @opindex mmul32
9914 @opindex mno-mul32
9915 Enable or disable use of the 32-bit integer multiplier option.  When
9916 enabled, the compiler will generate 32-bit multiply instructions for
9917 multiplications of 32 bits or smaller in standard C code.  When this
9918 option is disabled, the compiler will generate library calls to perform
9919 the multiply operations using either shifts and adds or 16-bit multiply
9920 instructions if they are available.
9921
9922 @item -mnsa
9923 @itemx -mno-nsa
9924 @opindex mnsa
9925 @opindex mno-nsa
9926 Enable or disable use of the optional normalization shift amount
9927 (@code{NSA}) instructions to implement the built-in @code{ffs} function.
9928
9929 @item -mminmax
9930 @itemx -mno-minmax
9931 @opindex mminmax
9932 @opindex mno-minmax
9933 Enable or disable use of the optional minimum and maximum value
9934 instructions.
9935
9936 @item -msext
9937 @itemx -mno-sext
9938 @opindex msext
9939 @opindex mno-sext
9940 Enable or disable use of the optional sign extend (@code{SEXT})
9941 instruction.
9942
9943 @item -mbooleans
9944 @itemx -mno-booleans
9945 @opindex mbooleans
9946 @opindex mno-booleans
9947 Enable or disable support for the boolean register file used by Xtensa
9948 coprocessors.  This is not typically useful by itself but may be
9949 required for other options that make use of the boolean registers (e.g.,
9950 the floating-point option).
9951
9952 @item -mhard-float
9953 @itemx -msoft-float
9954 @opindex mhard-float
9955 @opindex msoft-float
9956 Enable or disable use of the floating-point option.  When enabled, GCC
9957 generates floating-point instructions for 32-bit @code{float}
9958 operations.  When this option is disabled, GCC generates library calls
9959 to emulate 32-bit floating-point operations using integer instructions.
9960 Regardless of this option, 64-bit @code{double} operations are always
9961 emulated with calls to library functions.
9962
9963 @item -mfused-madd
9964 @itemx -mno-fused-madd
9965 @opindex mfused-madd
9966 @opindex mno-fused-madd
9967 Enable or disable use of fused multiply/add and multiply/subtract
9968 instructions in the floating-point option.  This has no effect if the
9969 floating-point option is not also enabled.  Disabling fused multiply/add
9970 and multiply/subtract instructions forces the compiler to use separate
9971 instructions for the multiply and add/subtract operations.  This may be
9972 desirable in some cases where strict IEEE 754-compliant results are
9973 required: the fused multiply add/subtract instructions do not round the
9974 intermediate result, thereby producing results with @emph{more} bits of
9975 precision than specified by the IEEE standard.  Disabling fused multiply
9976 add/subtract instructions also ensures that the program output is not
9977 sensitive to the compiler's ability to combine multiply and add/subtract
9978 operations.
9979
9980 @item -mserialize-volatile
9981 @itemx -mno-serialize-volatile
9982 @opindex mserialize-volatile
9983 @opindex mno-serialize-volatile
9984 When this option is enabled, GCC inserts @code{MEMW} instructions before
9985 @code{volatile} memory references to guarantee sequential consistency.
9986 The default is @option{-mserialize-volatile}.  Use
9987 @option{-mno-serialize-volatile} to omit the @code{MEMW} instructions.
9988
9989 @item -mtext-section-literals
9990 @itemx -mno-text-section-literals
9991 @opindex mtext-section-literals
9992 @opindex mno-text-section-literals
9993 Control the treatment of literal pools.  The default is
9994 @option{-mno-text-section-literals}, which places literals in a separate
9995 section in the output file.  This allows the literal pool to be placed
9996 in a data RAM/ROM, and it also allows the linker to combine literal
9997 pools from separate object files to remove redundant literals and
9998 improve code size.  With @option{-mtext-section-literals}, the literals
9999 are interspersed in the text section in order to keep them as close as
10000 possible to their references.  This may be necessary for large assembly
10001 files.
10002
10003 @item -mtarget-align
10004 @itemx -mno-target-align
10005 @opindex mtarget-align
10006 @opindex mno-target-align
10007 When this option is enabled, GCC instructs the assembler to
10008 automatically align instructions to reduce branch penalties at the
10009 expense of some code density.  The assembler attempts to widen density
10010 instructions to align branch targets and the instructions following call
10011 instructions.  If there are not enough preceding safe density
10012 instructions to align a target, no widening will be performed.  The
10013 default is @option{-mtarget-align}.  These options do not affect the
10014 treatment of auto-aligned instructions like @code{LOOP}, which the
10015 assembler will always align, either by widening density instructions or
10016 by inserting no-op instructions.
10017
10018 @item -mlongcalls
10019 @itemx -mno-longcalls
10020 @opindex mlongcalls
10021 @opindex mno-longcalls
10022 When this option is enabled, GCC instructs the assembler to translate
10023 direct calls to indirect calls unless it can determine that the target
10024 of a direct call is in the range allowed by the call instruction.  This
10025 translation typically occurs for calls to functions in other source
10026 files.  Specifically, the assembler translates a direct @code{CALL}
10027 instruction into an @code{L32R} followed by a @code{CALLX} instruction.
10028 The default is @option{-mno-longcalls}.  This option should be used in
10029 programs where the call target can potentially be out of range.  This
10030 option is implemented in the assembler, not the compiler, so the
10031 assembly code generated by GCC will still show direct call
10032 instructions---look at the disassembled object code to see the actual
10033 instructions.  Note that the assembler will use an indirect call for
10034 every cross-file call, not just those that really will be out of range.
10035 @end table
10036
10037 @node Code Gen Options
10038 @section Options for Code Generation Conventions
10039 @cindex code generation conventions
10040 @cindex options, code generation
10041 @cindex run-time options
10042
10043 These machine-independent options control the interface conventions
10044 used in code generation.
10045
10046 Most of them have both positive and negative forms; the negative form
10047 of @option{-ffoo} would be @option{-fno-foo}.  In the table below, only
10048 one of the forms is listed---the one which is not the default.  You
10049 can figure out the other form by either removing @samp{no-} or adding
10050 it.
10051
10052 @table @gcctabopt
10053 @item -fexceptions
10054 @opindex fexceptions
10055 Enable exception handling.  Generates extra code needed to propagate
10056 exceptions.  For some targets, this implies GCC will generate frame
10057 unwind information for all functions, which can produce significant data
10058 size overhead, although it does not affect execution.  If you do not
10059 specify this option, GCC will enable it by default for languages like
10060 C++ which normally require exception handling, and disable it for
10061 languages like C that do not normally require it.  However, you may need
10062 to enable this option when compiling C code that needs to interoperate
10063 properly with exception handlers written in C++.  You may also wish to
10064 disable this option if you are compiling older C++ programs that don't
10065 use exception handling.
10066
10067 @item -fnon-call-exceptions
10068 @opindex fnon-call-exceptions
10069 Generate code that allows trapping instructions to throw exceptions.
10070 Note that this requires platform-specific runtime support that does
10071 not exist everywhere.  Moreover, it only allows @emph{trapping}
10072 instructions to throw exceptions, i.e.@: memory references or floating
10073 point instructions.  It does not allow exceptions to be thrown from
10074 arbitrary signal handlers such as @code{SIGALRM}.
10075
10076 @item -funwind-tables
10077 @opindex funwind-tables
10078 Similar to @option{-fexceptions}, except that it will just generate any needed
10079 static data, but will not affect the generated code in any other way.
10080 You will normally not enable this option; instead, a language processor
10081 that needs this handling would enable it on your behalf.
10082
10083 @item -fasynchronous-unwind-tables
10084 @opindex funwind-tables
10085 Generate unwind table in dwarf2 format, if supported by target machine.  The
10086 table is exact at each instruction boundary, so it can be used for stack
10087 unwinding from asynchronous events (such as debugger or garbage collector).
10088
10089 @item -fpcc-struct-return
10090 @opindex fpcc-struct-return
10091 Return ``short'' @code{struct} and @code{union} values in memory like
10092 longer ones, rather than in registers.  This convention is less
10093 efficient, but it has the advantage of allowing intercallability between
10094 GCC-compiled files and files compiled with other compilers, particularly
10095 the Portable C Compiler (pcc).
10096
10097 The precise convention for returning structures in memory depends
10098 on the target configuration macros.
10099
10100 Short structures and unions are those whose size and alignment match
10101 that of some integer type.
10102
10103 @strong{Warning:} code compiled with the @option{-fpcc-struct-return}
10104 switch is not binary compatible with code compiled with the
10105 @option{-freg-struct-return} switch.
10106 Use it to conform to a non-default application binary interface.
10107
10108 @item -freg-struct-return
10109 @opindex freg-struct-return
10110 Return @code{struct} and @code{union} values in registers when possible.
10111 This is more efficient for small structures than
10112 @option{-fpcc-struct-return}.
10113
10114 If you specify neither @option{-fpcc-struct-return} nor
10115 @option{-freg-struct-return}, GCC defaults to whichever convention is
10116 standard for the target.  If there is no standard convention, GCC
10117 defaults to @option{-fpcc-struct-return}, except on targets where GCC is
10118 the principal compiler.  In those cases, we can choose the standard, and
10119 we chose the more efficient register return alternative.
10120
10121 @strong{Warning:} code compiled with the @option{-freg-struct-return}
10122 switch is not binary compatible with code compiled with the
10123 @option{-fpcc-struct-return} switch.
10124 Use it to conform to a non-default application binary interface.
10125
10126 @item -fshort-enums
10127 @opindex fshort-enums
10128 Allocate to an @code{enum} type only as many bytes as it needs for the
10129 declared range of possible values.  Specifically, the @code{enum} type
10130 will be equivalent to the smallest integer type which has enough room.
10131
10132 @strong{Warning:} the @option{-fshort-enums} switch causes GCC to generate
10133 code that is not binary compatible with code generated without that switch.
10134 Use it to conform to a non-default application binary interface.
10135
10136 @item -fshort-double
10137 @opindex fshort-double
10138 Use the same size for @code{double} as for @code{float}.
10139
10140 @strong{Warning:} the @option{-fshort-double} switch causes GCC to generate
10141 code that is not binary compatible with code generated without that switch.
10142 Use it to conform to a non-default application binary interface.
10143
10144 @item -fshort-wchar
10145 @opindex fshort-wchar
10146 Override the underlying type for @samp{wchar_t} to be @samp{short
10147 unsigned int} instead of the default for the target.  This option is
10148 useful for building programs to run under WINE@.
10149
10150 @strong{Warning:} the @option{-fshort-wchar} switch causes GCC to generate
10151 code that is not binary compatible with code generated without that switch.
10152 Use it to conform to a non-default application binary interface.
10153
10154 @item -fshared-data
10155 @opindex fshared-data
10156 Requests that the data and non-@code{const} variables of this
10157 compilation be shared data rather than private data.  The distinction
10158 makes sense only on certain operating systems, where shared data is
10159 shared between processes running the same program, while private data
10160 exists in one copy per process.
10161
10162 @item -fno-common
10163 @opindex fno-common
10164 In C, allocate even uninitialized global variables in the data section of the
10165 object file, rather than generating them as common blocks.  This has the
10166 effect that if the same variable is declared (without @code{extern}) in
10167 two different compilations, you will get an error when you link them.
10168 The only reason this might be useful is if you wish to verify that the
10169 program will work on other systems which always work this way.
10170
10171 @item -fno-ident
10172 @opindex fno-ident
10173 Ignore the @samp{#ident} directive.
10174
10175 @item -fno-gnu-linker
10176 @opindex fno-gnu-linker
10177 Do not output global initializations (such as C++ constructors and
10178 destructors) in the form used by the GNU linker (on systems where the GNU
10179 linker is the standard method of handling them).  Use this option when
10180 you want to use a non-GNU linker, which also requires using the
10181 @command{collect2} program to make sure the system linker includes
10182 constructors and destructors.  (@command{collect2} is included in the GCC
10183 distribution.)  For systems which @emph{must} use @command{collect2}, the
10184 compiler driver @command{gcc} is configured to do this automatically.
10185
10186 @item -finhibit-size-directive
10187 @opindex finhibit-size-directive
10188 Don't output a @code{.size} assembler directive, or anything else that
10189 would cause trouble if the function is split in the middle, and the
10190 two halves are placed at locations far apart in memory.  This option is
10191 used when compiling @file{crtstuff.c}; you should not need to use it
10192 for anything else.
10193
10194 @item -fverbose-asm
10195 @opindex fverbose-asm
10196 Put extra commentary information in the generated assembly code to
10197 make it more readable.  This option is generally only of use to those
10198 who actually need to read the generated assembly code (perhaps while
10199 debugging the compiler itself).
10200
10201 @option{-fno-verbose-asm}, the default, causes the
10202 extra information to be omitted and is useful when comparing two assembler
10203 files.
10204
10205 @item -fvolatile
10206 @opindex fvolatile
10207 Consider all memory references through pointers to be volatile.
10208
10209 @item -fvolatile-global
10210 @opindex fvolatile-global
10211 Consider all memory references to extern and global data items to
10212 be volatile.  GCC does not consider static data items to be volatile
10213 because of this switch.
10214
10215 @item -fvolatile-static
10216 @opindex fvolatile-static
10217 Consider all memory references to static data to be volatile.
10218
10219 @item -fpic
10220 @opindex fpic
10221 @cindex global offset table
10222 @cindex PIC
10223 Generate position-independent code (PIC) suitable for use in a shared
10224 library, if supported for the target machine.  Such code accesses all
10225 constant addresses through a global offset table (GOT)@.  The dynamic
10226 loader resolves the GOT entries when the program starts (the dynamic
10227 loader is not part of GCC; it is part of the operating system).  If
10228 the GOT size for the linked executable exceeds a machine-specific
10229 maximum size, you get an error message from the linker indicating that
10230 @option{-fpic} does not work; in that case, recompile with @option{-fPIC}
10231 instead.  (These maximums are 16k on the m88k, 8k on the SPARC, and 32k
10232 on the m68k and RS/6000.  The 386 has no such limit.)
10233
10234 Position-independent code requires special support, and therefore works
10235 only on certain machines.  For the 386, GCC supports PIC for System V
10236 but not for the Sun 386i.  Code generated for the IBM RS/6000 is always
10237 position-independent.
10238
10239 @item -fPIC
10240 @opindex fPIC
10241 If supported for the target machine, emit position-independent code,
10242 suitable for dynamic linking and avoiding any limit on the size of the
10243 global offset table.  This option makes a difference on the m68k, m88k,
10244 and the SPARC.
10245
10246 Position-independent code requires special support, and therefore works
10247 only on certain machines.
10248
10249 @item -ffixed-@var{reg}
10250 @opindex ffixed
10251 Treat the register named @var{reg} as a fixed register; generated code
10252 should never refer to it (except perhaps as a stack pointer, frame
10253 pointer or in some other fixed role).
10254
10255 @var{reg} must be the name of a register.  The register names accepted
10256 are machine-specific and are defined in the @code{REGISTER_NAMES}
10257 macro in the machine description macro file.
10258
10259 This flag does not have a negative form, because it specifies a
10260 three-way choice.
10261
10262 @item -fcall-used-@var{reg}
10263 @opindex fcall-used
10264 Treat the register named @var{reg} as an allocable register that is
10265 clobbered by function calls.  It may be allocated for temporaries or
10266 variables that do not live across a call.  Functions compiled this way
10267 will not save and restore the register @var{reg}.
10268
10269 It is an error to used this flag with the frame pointer or stack pointer.
10270 Use of this flag for other registers that have fixed pervasive roles in
10271 the machine's execution model will produce disastrous results.
10272
10273 This flag does not have a negative form, because it specifies a
10274 three-way choice.
10275
10276 @item -fcall-saved-@var{reg}
10277 @opindex fcall-saved
10278 Treat the register named @var{reg} as an allocable register saved by
10279 functions.  It may be allocated even for temporaries or variables that
10280 live across a call.  Functions compiled this way will save and restore
10281 the register @var{reg} if they use it.
10282
10283 It is an error to used this flag with the frame pointer or stack pointer.
10284 Use of this flag for other registers that have fixed pervasive roles in
10285 the machine's execution model will produce disastrous results.
10286
10287 A different sort of disaster will result from the use of this flag for
10288 a register in which function values may be returned.
10289
10290 This flag does not have a negative form, because it specifies a
10291 three-way choice.
10292
10293 @item -fpack-struct
10294 @opindex fpack-struct
10295 Pack all structure members together without holes.
10296
10297 @strong{Warning:} the @option{-fpack-struct} switch causes GCC to generate
10298 code that is not binary compatible with code generated without that switch.
10299 Additionally, it makes the code suboptimial.
10300 Use it to conform to a non-default application binary interface.
10301
10302 @item -finstrument-functions
10303 @opindex finstrument-functions
10304 Generate instrumentation calls for entry and exit to functions.  Just
10305 after function entry and just before function exit, the following
10306 profiling functions will be called with the address of the current
10307 function and its call site.  (On some platforms,
10308 @code{__builtin_return_address} does not work beyond the current
10309 function, so the call site information may not be available to the
10310 profiling functions otherwise.)
10311
10312 @example
10313 void __cyg_profile_func_enter (void *this_fn,
10314                                void *call_site);
10315 void __cyg_profile_func_exit  (void *this_fn,
10316                                void *call_site);
10317 @end example
10318
10319 The first argument is the address of the start of the current function,
10320 which may be looked up exactly in the symbol table.
10321
10322 This instrumentation is also done for functions expanded inline in other
10323 functions.  The profiling calls will indicate where, conceptually, the
10324 inline function is entered and exited.  This means that addressable
10325 versions of such functions must be available.  If all your uses of a
10326 function are expanded inline, this may mean an additional expansion of
10327 code size.  If you use @samp{extern inline} in your C code, an
10328 addressable version of such functions must be provided.  (This is
10329 normally the case anyways, but if you get lucky and the optimizer always
10330 expands the functions inline, you might have gotten away without
10331 providing static copies.)
10332
10333 A function may be given the attribute @code{no_instrument_function}, in
10334 which case this instrumentation will not be done.  This can be used, for
10335 example, for the profiling functions listed above, high-priority
10336 interrupt routines, and any functions from which the profiling functions
10337 cannot safely be called (perhaps signal handlers, if the profiling
10338 routines generate output or allocate memory).
10339
10340 @item -fstack-check
10341 @opindex fstack-check
10342 Generate code to verify that you do not go beyond the boundary of the
10343 stack.  You should specify this flag if you are running in an
10344 environment with multiple threads, but only rarely need to specify it in
10345 a single-threaded environment since stack overflow is automatically
10346 detected on nearly all systems if there is only one stack.
10347
10348 Note that this switch does not actually cause checking to be done; the
10349 operating system must do that.  The switch causes generation of code
10350 to ensure that the operating system sees the stack being extended.
10351
10352 @item -fstack-limit-register=@var{reg}
10353 @itemx -fstack-limit-symbol=@var{sym}
10354 @itemx -fno-stack-limit
10355 @opindex fstack-limit-register
10356 @opindex fstack-limit-symbol
10357 @opindex fno-stack-limit
10358 Generate code to ensure that the stack does not grow beyond a certain value,
10359 either the value of a register or the address of a symbol.  If the stack
10360 would grow beyond the value, a signal is raised.  For most targets,
10361 the signal is raised before the stack overruns the boundary, so
10362 it is possible to catch the signal without taking special precautions.
10363
10364 For instance, if the stack starts at absolute address @samp{0x80000000}
10365 and grows downwards, you can use the flags
10366 @option{-fstack-limit-symbol=__stack_limit} and
10367 @option{-Wl,--defsym,__stack_limit=0x7ffe0000} to enforce a stack limit
10368 of 128KB@.  Note that this may only work with the GNU linker.
10369
10370 @cindex aliasing of parameters
10371 @cindex parameters, aliased
10372 @item -fargument-alias
10373 @itemx -fargument-noalias
10374 @itemx -fargument-noalias-global
10375 @opindex fargument-alias
10376 @opindex fargument-noalias
10377 @opindex fargument-noalias-global
10378 Specify the possible relationships among parameters and between
10379 parameters and global data.
10380
10381 @option{-fargument-alias} specifies that arguments (parameters) may
10382 alias each other and may alias global storage.@*
10383 @option{-fargument-noalias} specifies that arguments do not alias
10384 each other, but may alias global storage.@*
10385 @option{-fargument-noalias-global} specifies that arguments do not
10386 alias each other and do not alias global storage.
10387
10388 Each language will automatically use whatever option is required by
10389 the language standard.  You should not need to use these options yourself.
10390
10391 @item -fleading-underscore
10392 @opindex fleading-underscore
10393 This option and its counterpart, @option{-fno-leading-underscore}, forcibly
10394 change the way C symbols are represented in the object file.  One use
10395 is to help link with legacy assembly code.
10396
10397 @strong{Warning:} the @option{-fleading-underscore} switch causes GCC to
10398 generate code that is not binary compatible with code generated without that
10399 switch.  Use it to conform to a non-default application binary interface.
10400 Not all targets provide complete support for this switch.
10401
10402 @item -ftls-model=@var{model}
10403 Alter the thread-local storage model to be used (@pxref{Thread-Local}).
10404 The @var{model} argument should be one of @code{global-dynamic},
10405 @code{local-dynamic}, @code{initial-exec} or @code{local-exec}.
10406
10407 The default without @option{-fpic} is @code{initial-exec}; with
10408 @option{-fpic} the default is @code{global-dynamic}.
10409 @end table
10410
10411 @c man end
10412
10413 @node Environment Variables
10414 @section Environment Variables Affecting GCC
10415 @cindex environment variables
10416
10417 @c man begin ENVIRONMENT
10418
10419 This section describes several environment variables that affect how GCC
10420 operates.  Some of them work by specifying directories or prefixes to use
10421 when searching for various kinds of files.  Some are used to specify other
10422 aspects of the compilation environment.
10423
10424 Note that you can also specify places to search using options such as
10425 @option{-B}, @option{-I} and @option{-L} (@pxref{Directory Options}).  These
10426 take precedence over places specified using environment variables, which
10427 in turn take precedence over those specified by the configuration of GCC@.
10428 @xref{Driver,, Controlling the Compilation Driver @file{gcc}, gccint,
10429 GNU Compiler Collection (GCC) Internals}.
10430
10431 @table @env
10432 @item LANG
10433 @itemx LC_CTYPE
10434 @c @itemx LC_COLLATE
10435 @itemx LC_MESSAGES
10436 @c @itemx LC_MONETARY
10437 @c @itemx LC_NUMERIC
10438 @c @itemx LC_TIME
10439 @itemx LC_ALL
10440 @findex LANG
10441 @findex LC_CTYPE
10442 @c @findex LC_COLLATE
10443 @findex LC_MESSAGES
10444 @c @findex LC_MONETARY
10445 @c @findex LC_NUMERIC
10446 @c @findex LC_TIME
10447 @findex LC_ALL
10448 @cindex locale
10449 These environment variables control the way that GCC uses
10450 localization information that allow GCC to work with different
10451 national conventions.  GCC inspects the locale categories
10452 @env{LC_CTYPE} and @env{LC_MESSAGES} if it has been configured to do
10453 so.  These locale categories can be set to any value supported by your
10454 installation.  A typical value is @samp{en_UK} for English in the United
10455 Kingdom.
10456
10457 The @env{LC_CTYPE} environment variable specifies character
10458 classification.  GCC uses it to determine the character boundaries in
10459 a string; this is needed for some multibyte encodings that contain quote
10460 and escape characters that would otherwise be interpreted as a string
10461 end or escape.
10462
10463 The @env{LC_MESSAGES} environment variable specifies the language to
10464 use in diagnostic messages.
10465
10466 If the @env{LC_ALL} environment variable is set, it overrides the value
10467 of @env{LC_CTYPE} and @env{LC_MESSAGES}; otherwise, @env{LC_CTYPE}
10468 and @env{LC_MESSAGES} default to the value of the @env{LANG}
10469 environment variable.  If none of these variables are set, GCC
10470 defaults to traditional C English behavior.
10471
10472 @item TMPDIR
10473 @findex TMPDIR
10474 If @env{TMPDIR} is set, it specifies the directory to use for temporary
10475 files.  GCC uses temporary files to hold the output of one stage of
10476 compilation which is to be used as input to the next stage: for example,
10477 the output of the preprocessor, which is the input to the compiler
10478 proper.
10479
10480 @item GCC_EXEC_PREFIX
10481 @findex GCC_EXEC_PREFIX
10482 If @env{GCC_EXEC_PREFIX} is set, it specifies a prefix to use in the
10483 names of the subprograms executed by the compiler.  No slash is added
10484 when this prefix is combined with the name of a subprogram, but you can
10485 specify a prefix that ends with a slash if you wish.
10486
10487 If @env{GCC_EXEC_PREFIX} is not set, GCC will attempt to figure out
10488 an appropriate prefix to use based on the pathname it was invoked with.
10489
10490 If GCC cannot find the subprogram using the specified prefix, it
10491 tries looking in the usual places for the subprogram.
10492
10493 The default value of @env{GCC_EXEC_PREFIX} is
10494 @file{@var{prefix}/lib/gcc-lib/} where @var{prefix} is the value
10495 of @code{prefix} when you ran the @file{configure} script.
10496
10497 Other prefixes specified with @option{-B} take precedence over this prefix.
10498
10499 This prefix is also used for finding files such as @file{crt0.o} that are
10500 used for linking.
10501
10502 In addition, the prefix is used in an unusual way in finding the
10503 directories to search for header files.  For each of the standard
10504 directories whose name normally begins with @samp{/usr/local/lib/gcc-lib}
10505 (more precisely, with the value of @env{GCC_INCLUDE_DIR}), GCC tries
10506 replacing that beginning with the specified prefix to produce an
10507 alternate directory name.  Thus, with @option{-Bfoo/}, GCC will search
10508 @file{foo/bar} where it would normally search @file{/usr/local/lib/bar}.
10509 These alternate directories are searched first; the standard directories
10510 come next.
10511
10512 @item COMPILER_PATH
10513 @findex COMPILER_PATH
10514 The value of @env{COMPILER_PATH} is a colon-separated list of
10515 directories, much like @env{PATH}.  GCC tries the directories thus
10516 specified when searching for subprograms, if it can't find the
10517 subprograms using @env{GCC_EXEC_PREFIX}.
10518
10519 @item LIBRARY_PATH
10520 @findex LIBRARY_PATH
10521 The value of @env{LIBRARY_PATH} is a colon-separated list of
10522 directories, much like @env{PATH}.  When configured as a native compiler,
10523 GCC tries the directories thus specified when searching for special
10524 linker files, if it can't find them using @env{GCC_EXEC_PREFIX}.  Linking
10525 using GCC also uses these directories when searching for ordinary
10526 libraries for the @option{-l} option (but directories specified with
10527 @option{-L} come first).
10528
10529 @item LANG
10530 @findex LANG
10531 @cindex locale definition
10532 This variable is used to pass locale information to the compiler.  One way in
10533 which this information is used is to determine the character set to be used
10534 when character literals, string literals and comments are parsed in C and C++.
10535 When the compiler is configured to allow multibyte characters,
10536 the following values for @env{LANG} are recognized:
10537
10538 @table @samp
10539 @item C-JIS
10540 Recognize JIS characters.
10541 @item C-SJIS
10542 Recognize SJIS characters.
10543 @item C-EUCJP
10544 Recognize EUCJP characters.
10545 @end table
10546
10547 If @env{LANG} is not defined, or if it has some other value, then the
10548 compiler will use mblen and mbtowc as defined by the default locale to
10549 recognize and translate multibyte characters.
10550 @end table
10551
10552 @noindent
10553 Some additional environments variables affect the behavior of the
10554 preprocessor.
10555
10556 @include cppenv.texi
10557
10558 @c man end
10559
10560 @node Running Protoize
10561 @section Running Protoize
10562
10563 The program @code{protoize} is an optional part of GCC@.  You can use
10564 it to add prototypes to a program, thus converting the program to ISO
10565 C in one respect.  The companion program @code{unprotoize} does the
10566 reverse: it removes argument types from any prototypes that are found.
10567
10568 When you run these programs, you must specify a set of source files as
10569 command line arguments.  The conversion programs start out by compiling
10570 these files to see what functions they define.  The information gathered
10571 about a file @var{foo} is saved in a file named @file{@var{foo}.X}.
10572
10573 After scanning comes actual conversion.  The specified files are all
10574 eligible to be converted; any files they include (whether sources or
10575 just headers) are eligible as well.
10576
10577 But not all the eligible files are converted.  By default,
10578 @code{protoize} and @code{unprotoize} convert only source and header
10579 files in the current directory.  You can specify additional directories
10580 whose files should be converted with the @option{-d @var{directory}}
10581 option.  You can also specify particular files to exclude with the
10582 @option{-x @var{file}} option.  A file is converted if it is eligible, its
10583 directory name matches one of the specified directory names, and its
10584 name within the directory has not been excluded.
10585
10586 Basic conversion with @code{protoize} consists of rewriting most
10587 function definitions and function declarations to specify the types of
10588 the arguments.  The only ones not rewritten are those for varargs
10589 functions.
10590
10591 @code{protoize} optionally inserts prototype declarations at the
10592 beginning of the source file, to make them available for any calls that
10593 precede the function's definition.  Or it can insert prototype
10594 declarations with block scope in the blocks where undeclared functions
10595 are called.
10596
10597 Basic conversion with @code{unprotoize} consists of rewriting most
10598 function declarations to remove any argument types, and rewriting
10599 function definitions to the old-style pre-ISO form.
10600
10601 Both conversion programs print a warning for any function declaration or
10602 definition that they can't convert.  You can suppress these warnings
10603 with @option{-q}.
10604
10605 The output from @code{protoize} or @code{unprotoize} replaces the
10606 original source file.  The original file is renamed to a name ending
10607 with @samp{.save} (for DOS, the saved filename ends in @samp{.sav}
10608 without the original @samp{.c} suffix).  If the @samp{.save} (@samp{.sav}
10609 for DOS) file already exists, then the source file is simply discarded.
10610
10611 @code{protoize} and @code{unprotoize} both depend on GCC itself to
10612 scan the program and collect information about the functions it uses.
10613 So neither of these programs will work until GCC is installed.
10614
10615 Here is a table of the options you can use with @code{protoize} and
10616 @code{unprotoize}.  Each option works with both programs unless
10617 otherwise stated.
10618
10619 @table @code
10620 @item -B @var{directory}
10621 Look for the file @file{SYSCALLS.c.X} in @var{directory}, instead of the
10622 usual directory (normally @file{/usr/local/lib}).  This file contains
10623 prototype information about standard system functions.  This option
10624 applies only to @code{protoize}.
10625
10626 @item -c @var{compilation-options}
10627 Use  @var{compilation-options} as the options when running @code{gcc} to
10628 produce the @samp{.X} files.  The special option @option{-aux-info} is
10629 always passed in addition, to tell @code{gcc} to write a @samp{.X} file.
10630
10631 Note that the compilation options must be given as a single argument to
10632 @code{protoize} or @code{unprotoize}.  If you want to specify several
10633 @code{gcc} options, you must quote the entire set of compilation options
10634 to make them a single word in the shell.
10635
10636 There are certain @code{gcc} arguments that you cannot use, because they
10637 would produce the wrong kind of output.  These include @option{-g},
10638 @option{-O}, @option{-c}, @option{-S}, and @option{-o} If you include these in
10639 the @var{compilation-options}, they are ignored.
10640
10641 @item -C
10642 Rename files to end in @samp{.C} (@samp{.cc} for DOS-based file
10643 systems) instead of @samp{.c}.  This is convenient if you are converting
10644 a C program to C++.  This option applies only to @code{protoize}.
10645
10646 @item -g
10647 Add explicit global declarations.  This means inserting explicit
10648 declarations at the beginning of each source file for each function
10649 that is called in the file and was not declared.  These declarations
10650 precede the first function definition that contains a call to an
10651 undeclared function.  This option applies only to @code{protoize}.
10652
10653 @item -i @var{string}
10654 Indent old-style parameter declarations with the string @var{string}.
10655 This option applies only to @code{protoize}.
10656
10657 @code{unprotoize} converts prototyped function definitions to old-style
10658 function definitions, where the arguments are declared between the
10659 argument list and the initial @samp{@{}.  By default, @code{unprotoize}
10660 uses five spaces as the indentation.  If you want to indent with just
10661 one space instead, use @option{-i " "}.
10662
10663 @item -k
10664 Keep the @samp{.X} files.  Normally, they are deleted after conversion
10665 is finished.
10666
10667 @item -l
10668 Add explicit local declarations.  @code{protoize} with @option{-l} inserts
10669 a prototype declaration for each function in each block which calls the
10670 function without any declaration.  This option applies only to
10671 @code{protoize}.
10672
10673 @item -n
10674 Make no real changes.  This mode just prints information about the conversions
10675 that would have been done without @option{-n}.
10676
10677 @item -N
10678 Make no @samp{.save} files.  The original files are simply deleted.
10679 Use this option with caution.
10680
10681 @item -p @var{program}
10682 Use the program @var{program} as the compiler.  Normally, the name
10683 @file{gcc} is used.
10684
10685 @item -q
10686 Work quietly.  Most warnings are suppressed.
10687
10688 @item -v
10689 Print the version number, just like @option{-v} for @code{gcc}.
10690 @end table
10691
10692 If you need special compiler options to compile one of your program's
10693 source files, then you should generate that file's @samp{.X} file
10694 specially, by running @code{gcc} on that source file with the
10695 appropriate options and the option @option{-aux-info}.  Then run
10696 @code{protoize} on the entire set of files.  @code{protoize} will use
10697 the existing @samp{.X} file because it is newer than the source file.
10698 For example:
10699
10700 @example
10701 gcc -Dfoo=bar file1.c -aux-info file1.X
10702 protoize *.c
10703 @end example
10704
10705 @noindent
10706 You need to include the special files along with the rest in the
10707 @code{protoize} command, even though their @samp{.X} files already
10708 exist, because otherwise they won't get converted.
10709
10710 @xref{Protoize Caveats}, for more information on how to use
10711 @code{protoize} successfully.